]> git.openstreetmap.org Git - rails.git/blob - vendor/assets/iD/iD.js
Update to iD v2.26.1
[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 name in all)
13       __defProp(target, name, { get: all[name], 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(
24     // If the importer is in node compatibility mode or this is not an ESM
25     // file that has been converted to a CommonJS file using a Babel-
26     // compatible transform (i.e. "__esModule" has not been set), then set
27     // "default" to the CommonJS "module.exports" for node compatibility.
28     isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29     mod
30   ));
31
32   // node_modules/diacritics/index.js
33   var require_diacritics = __commonJS({
34     "node_modules/diacritics/index.js"(exports2) {
35       exports2.remove = removeDiacritics2;
36       var replacementList = [
37         {
38           base: " ",
39           chars: "\xA0"
40         },
41         {
42           base: "0",
43           chars: "\u07C0"
44         },
45         {
46           base: "A",
47           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"
48         },
49         {
50           base: "AA",
51           chars: "\uA732"
52         },
53         {
54           base: "AE",
55           chars: "\xC6\u01FC\u01E2"
56         },
57         {
58           base: "AO",
59           chars: "\uA734"
60         },
61         {
62           base: "AU",
63           chars: "\uA736"
64         },
65         {
66           base: "AV",
67           chars: "\uA738\uA73A"
68         },
69         {
70           base: "AY",
71           chars: "\uA73C"
72         },
73         {
74           base: "B",
75           chars: "\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0181"
76         },
77         {
78           base: "C",
79           chars: "\u24B8\uFF23\uA73E\u1E08\u0106C\u0108\u010A\u010C\xC7\u0187\u023B"
80         },
81         {
82           base: "D",
83           chars: "\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018A\u0189\u1D05\uA779"
84         },
85         {
86           base: "Dh",
87           chars: "\xD0"
88         },
89         {
90           base: "DZ",
91           chars: "\u01F1\u01C4"
92         },
93         {
94           base: "Dz",
95           chars: "\u01F2\u01C5"
96         },
97         {
98           base: "E",
99           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"
100         },
101         {
102           base: "F",
103           chars: "\uA77C\u24BB\uFF26\u1E1E\u0191\uA77B"
104         },
105         {
106           base: "G",
107           chars: "\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E\u0262"
108         },
109         {
110           base: "H",
111           chars: "\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"
112         },
113         {
114           base: "I",
115           chars: "\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"
116         },
117         {
118           base: "J",
119           chars: "\u24BF\uFF2A\u0134\u0248\u0237"
120         },
121         {
122           base: "K",
123           chars: "\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"
124         },
125         {
126           base: "L",
127           chars: "\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"
128         },
129         {
130           base: "LJ",
131           chars: "\u01C7"
132         },
133         {
134           base: "Lj",
135           chars: "\u01C8"
136         },
137         {
138           base: "M",
139           chars: "\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C\u03FB"
140         },
141         {
142           base: "N",
143           chars: "\uA7A4\u0220\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u019D\uA790\u1D0E"
144         },
145         {
146           base: "NJ",
147           chars: "\u01CA"
148         },
149         {
150           base: "Nj",
151           chars: "\u01CB"
152         },
153         {
154           base: "O",
155           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"
156         },
157         {
158           base: "OE",
159           chars: "\u0152"
160         },
161         {
162           base: "OI",
163           chars: "\u01A2"
164         },
165         {
166           base: "OO",
167           chars: "\uA74E"
168         },
169         {
170           base: "OU",
171           chars: "\u0222"
172         },
173         {
174           base: "P",
175           chars: "\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"
176         },
177         {
178           base: "Q",
179           chars: "\u24C6\uFF31\uA756\uA758\u024A"
180         },
181         {
182           base: "R",
183           chars: "\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"
184         },
185         {
186           base: "S",
187           chars: "\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"
188         },
189         {
190           base: "T",
191           chars: "\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"
192         },
193         {
194           base: "Th",
195           chars: "\xDE"
196         },
197         {
198           base: "TZ",
199           chars: "\uA728"
200         },
201         {
202           base: "U",
203           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"
204         },
205         {
206           base: "V",
207           chars: "\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"
208         },
209         {
210           base: "VY",
211           chars: "\uA760"
212         },
213         {
214           base: "W",
215           chars: "\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"
216         },
217         {
218           base: "X",
219           chars: "\u24CD\uFF38\u1E8A\u1E8C"
220         },
221         {
222           base: "Y",
223           chars: "\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"
224         },
225         {
226           base: "Z",
227           chars: "\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"
228         },
229         {
230           base: "a",
231           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"
232         },
233         {
234           base: "aa",
235           chars: "\uA733"
236         },
237         {
238           base: "ae",
239           chars: "\xE6\u01FD\u01E3"
240         },
241         {
242           base: "ao",
243           chars: "\uA735"
244         },
245         {
246           base: "au",
247           chars: "\uA737"
248         },
249         {
250           base: "av",
251           chars: "\uA739\uA73B"
252         },
253         {
254           base: "ay",
255           chars: "\uA73D"
256         },
257         {
258           base: "b",
259           chars: "\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253\u0182"
260         },
261         {
262           base: "c",
263           chars: "\uFF43\u24D2\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"
264         },
265         {
266           base: "d",
267           chars: "\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\u018B\u13E7\u0501\uA7AA"
268         },
269         {
270           base: "dh",
271           chars: "\xF0"
272         },
273         {
274           base: "dz",
275           chars: "\u01F3\u01C6"
276         },
277         {
278           base: "e",
279           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"
280         },
281         {
282           base: "f",
283           chars: "\u24D5\uFF46\u1E1F\u0192"
284         },
285         {
286           base: "ff",
287           chars: "\uFB00"
288         },
289         {
290           base: "fi",
291           chars: "\uFB01"
292         },
293         {
294           base: "fl",
295           chars: "\uFB02"
296         },
297         {
298           base: "ffi",
299           chars: "\uFB03"
300         },
301         {
302           base: "ffl",
303           chars: "\uFB04"
304         },
305         {
306           base: "g",
307           chars: "\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\uA77F\u1D79"
308         },
309         {
310           base: "h",
311           chars: "\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"
312         },
313         {
314           base: "hv",
315           chars: "\u0195"
316         },
317         {
318           base: "i",
319           chars: "\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"
320         },
321         {
322           base: "j",
323           chars: "\u24D9\uFF4A\u0135\u01F0\u0249"
324         },
325         {
326           base: "k",
327           chars: "\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"
328         },
329         {
330           base: "l",
331           chars: "\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747\u026D"
332         },
333         {
334           base: "lj",
335           chars: "\u01C9"
336         },
337         {
338           base: "m",
339           chars: "\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"
340         },
341         {
342           base: "n",
343           chars: "\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5\u043B\u0509"
344         },
345         {
346           base: "nj",
347           chars: "\u01CC"
348         },
349         {
350           base: "o",
351           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"
352         },
353         {
354           base: "oe",
355           chars: "\u0153"
356         },
357         {
358           base: "oi",
359           chars: "\u01A3"
360         },
361         {
362           base: "oo",
363           chars: "\uA74F"
364         },
365         {
366           base: "ou",
367           chars: "\u0223"
368         },
369         {
370           base: "p",
371           chars: "\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755\u03C1"
372         },
373         {
374           base: "q",
375           chars: "\u24E0\uFF51\u024B\uA757\uA759"
376         },
377         {
378           base: "r",
379           chars: "\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"
380         },
381         {
382           base: "s",
383           chars: "\u24E2\uFF53\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B\u0282"
384         },
385         {
386           base: "ss",
387           chars: "\xDF"
388         },
389         {
390           base: "t",
391           chars: "\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"
392         },
393         {
394           base: "th",
395           chars: "\xFE"
396         },
397         {
398           base: "tz",
399           chars: "\uA729"
400         },
401         {
402           base: "u",
403           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"
404         },
405         {
406           base: "v",
407           chars: "\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"
408         },
409         {
410           base: "vy",
411           chars: "\uA761"
412         },
413         {
414           base: "w",
415           chars: "\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"
416         },
417         {
418           base: "x",
419           chars: "\u24E7\uFF58\u1E8B\u1E8D"
420         },
421         {
422           base: "y",
423           chars: "\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"
424         },
425         {
426           base: "z",
427           chars: "\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"
428         }
429       ];
430       var diacriticsMap = {};
431       for (i2 = 0; i2 < replacementList.length; i2 += 1) {
432         chars = replacementList[i2].chars;
433         for (j2 = 0; j2 < chars.length; j2 += 1) {
434           diacriticsMap[chars[j2]] = replacementList[i2].base;
435         }
436       }
437       var chars;
438       var j2;
439       var i2;
440       function removeDiacritics2(str2) {
441         return str2.replace(/[^\u0000-\u007e]/g, function(c) {
442           return diacriticsMap[c] || c;
443         });
444       }
445       exports2.replacementList = replacementList;
446       exports2.diacriticsMap = diacriticsMap;
447     }
448   });
449
450   // node_modules/alif-toolkit/lib/isArabic.js
451   var require_isArabic = __commonJS({
452     "node_modules/alif-toolkit/lib/isArabic.js"(exports2) {
453       "use strict";
454       Object.defineProperty(exports2, "__esModule", { value: true });
455       var arabicBlocks = [
456         [1536, 1791],
457         [1872, 1919],
458         [2208, 2303],
459         [64336, 65023],
460         [65136, 65279],
461         [69216, 69247],
462         [126064, 126143],
463         [126464, 126719]
464         // Mathematical Alphabetic symbols https://www.unicode.org/charts/PDF/U1EE00.pdf
465       ];
466       function isArabic(char) {
467         if (char.length > 1) {
468           throw new Error("isArabic works on only one-character strings");
469         }
470         let code = char.charCodeAt(0);
471         for (let i2 = 0; i2 < arabicBlocks.length; i2++) {
472           let block2 = arabicBlocks[i2];
473           if (code >= block2[0] && code <= block2[1]) {
474             return true;
475           }
476         }
477         return false;
478       }
479       exports2.isArabic = isArabic;
480       function isMath(char) {
481         if (char.length > 2) {
482           throw new Error("isMath works on only one-character strings");
483         }
484         let code = char.charCodeAt(0);
485         return code >= 1632 && code <= 1644 || code >= 1776 && code <= 1785;
486       }
487       exports2.isMath = isMath;
488     }
489   });
490
491   // node_modules/alif-toolkit/lib/unicode-arabic.js
492   var require_unicode_arabic = __commonJS({
493     "node_modules/alif-toolkit/lib/unicode-arabic.js"(exports2) {
494       "use strict";
495       Object.defineProperty(exports2, "__esModule", { value: true });
496       var arabicReference = {
497         "alef": {
498           "normal": [
499             "\u0627"
500           ],
501           "madda_above": {
502             "normal": [
503               "\u0627\u0653",
504               "\u0622"
505             ],
506             "isolated": "\uFE81",
507             "final": "\uFE82"
508           },
509           "hamza_above": {
510             "normal": [
511               "\u0627\u0654",
512               "\u0623"
513             ],
514             "isolated": "\uFE83",
515             "final": "\uFE84"
516           },
517           "hamza_below": {
518             "normal": [
519               "\u0627\u0655",
520               "\u0625"
521             ],
522             "isolated": "\uFE87",
523             "final": "\uFE88"
524           },
525           "wasla": {
526             "normal": "\u0671",
527             "isolated": "\uFB50",
528             "final": "\uFB51"
529           },
530           "wavy_hamza_above": [
531             "\u0672"
532           ],
533           "wavy_hamza_below": [
534             "\u0627\u065F",
535             "\u0673"
536           ],
537           "high_hamza": [
538             "\u0675",
539             "\u0627\u0674"
540           ],
541           "indic_two_above": [
542             "\u0773"
543           ],
544           "indic_three_above": [
545             "\u0774"
546           ],
547           "fathatan": {
548             "normal": [
549               "\u0627\u064B"
550             ],
551             "final": "\uFD3C",
552             "isolated": "\uFD3D"
553           },
554           "isolated": "\uFE8D",
555           "final": "\uFE8E"
556         },
557         "beh": {
558           "normal": [
559             "\u0628"
560           ],
561           "dotless": [
562             "\u066E"
563           ],
564           "three_dots_horizontally_below": [
565             "\u0750"
566           ],
567           "dot_below_three_dots_above": [
568             "\u0751"
569           ],
570           "three_dots_pointing_upwards_below": [
571             "\u0752"
572           ],
573           "three_dots_pointing_upwards_below_two_dots_above": [
574             "\u0753"
575           ],
576           "two_dots_below_dot_above": [
577             "\u0754"
578           ],
579           "inverted_small_v_below": [
580             "\u0755"
581           ],
582           "small_v": [
583             "\u0756"
584           ],
585           "small_v_below": [
586             "\u08A0"
587           ],
588           "hamza_above": [
589             "\u08A1"
590           ],
591           "small_meem_above": [
592             "\u08B6"
593           ],
594           "isolated": "\uFE8F",
595           "final": "\uFE90",
596           "initial": "\uFE91",
597           "medial": "\uFE92"
598         },
599         "teh marbuta": {
600           "normal": [
601             "\u0629"
602           ],
603           "isolated": "\uFE93",
604           "final": "\uFE94"
605         },
606         "teh": {
607           "normal": [
608             "\u062A"
609           ],
610           "ring": [
611             "\u067C"
612           ],
613           "three_dots_above_downwards": [
614             "\u067D"
615           ],
616           "small_teh_above": [
617             "\u08B8"
618           ],
619           "isolated": "\uFE95",
620           "final": "\uFE96",
621           "initial": "\uFE97",
622           "medial": "\uFE98"
623         },
624         "theh": {
625           "normal": [
626             "\u062B"
627           ],
628           "isolated": "\uFE99",
629           "final": "\uFE9A",
630           "initial": "\uFE9B",
631           "medial": "\uFE9C"
632         },
633         "jeem": {
634           "normal": [
635             "\u062C"
636           ],
637           "two_dots_above": [
638             "\u08A2"
639           ],
640           "isolated": "\uFE9D",
641           "final": "\uFE9E",
642           "initial": "\uFE9F",
643           "medial": "\uFEA0"
644         },
645         "hah": {
646           "normal": [
647             "\u062D"
648           ],
649           "hamza_above": [
650             "\u0681"
651           ],
652           "two_dots_vertical_above": [
653             "\u0682"
654           ],
655           "three_dots_above": [
656             "\u0685"
657           ],
658           "two_dots_above": [
659             "\u0757"
660           ],
661           "three_dots_pointing_upwards_below": [
662             "\u0758"
663           ],
664           "small_tah_below": [
665             "\u076E"
666           ],
667           "small_tah_two_dots": [
668             "\u076F"
669           ],
670           "small_tah_above": [
671             "\u0772"
672           ],
673           "indic_four_below": [
674             "\u077C"
675           ],
676           "isolated": "\uFEA1",
677           "final": "\uFEA2",
678           "initial": "\uFEA3",
679           "medial": "\uFEA4"
680         },
681         "khah": {
682           "normal": [
683             "\u062E"
684           ],
685           "isolated": "\uFEA5",
686           "final": "\uFEA6",
687           "initial": "\uFEA7",
688           "medial": "\uFEA8"
689         },
690         "dal": {
691           "normal": [
692             "\u062F"
693           ],
694           "ring": [
695             "\u0689"
696           ],
697           "dot_below": [
698             "\u068A"
699           ],
700           "dot_below_small_tah": [
701             "\u068B"
702           ],
703           "three_dots_above_downwards": [
704             "\u068F"
705           ],
706           "four_dots_above": [
707             "\u0690"
708           ],
709           "inverted_v": [
710             "\u06EE"
711           ],
712           "two_dots_vertically_below_small_tah": [
713             "\u0759"
714           ],
715           "inverted_small_v_below": [
716             "\u075A"
717           ],
718           "three_dots_below": [
719             "\u08AE"
720           ],
721           "isolated": "\uFEA9",
722           "final": "\uFEAA"
723         },
724         "thal": {
725           "normal": [
726             "\u0630"
727           ],
728           "isolated": "\uFEAB",
729           "final": "\uFEAC"
730         },
731         "reh": {
732           "normal": [
733             "\u0631"
734           ],
735           "small_v": [
736             "\u0692"
737           ],
738           "ring": [
739             "\u0693"
740           ],
741           "dot_below": [
742             "\u0694"
743           ],
744           "small_v_below": [
745             "\u0695"
746           ],
747           "dot_below_dot_above": [
748             "\u0696"
749           ],
750           "two_dots_above": [
751             "\u0697"
752           ],
753           "four_dots_above": [
754             "\u0699"
755           ],
756           "inverted_v": [
757             "\u06EF"
758           ],
759           "stroke": [
760             "\u075B"
761           ],
762           "two_dots_vertically_above": [
763             "\u076B"
764           ],
765           "hamza_above": [
766             "\u076C"
767           ],
768           "small_tah_two_dots": [
769             "\u0771"
770           ],
771           "loop": [
772             "\u08AA"
773           ],
774           "small_noon_above": [
775             "\u08B9"
776           ],
777           "isolated": "\uFEAD",
778           "final": "\uFEAE"
779         },
780         "zain": {
781           "normal": [
782             "\u0632"
783           ],
784           "inverted_v_above": [
785             "\u08B2"
786           ],
787           "isolated": "\uFEAF",
788           "final": "\uFEB0"
789         },
790         "seen": {
791           "normal": [
792             "\u0633"
793           ],
794           "dot_below_dot_above": [
795             "\u069A"
796           ],
797           "three_dots_below": [
798             "\u069B"
799           ],
800           "three_dots_below_three_dots_above": [
801             "\u069C"
802           ],
803           "four_dots_above": [
804             "\u075C"
805           ],
806           "two_dots_vertically_above": [
807             "\u076D"
808           ],
809           "small_tah_two_dots": [
810             "\u0770"
811           ],
812           "indic_four_above": [
813             "\u077D"
814           ],
815           "inverted_v": [
816             "\u077E"
817           ],
818           "isolated": "\uFEB1",
819           "final": "\uFEB2",
820           "initial": "\uFEB3",
821           "medial": "\uFEB4"
822         },
823         "sheen": {
824           "normal": [
825             "\u0634"
826           ],
827           "dot_below": [
828             "\u06FA"
829           ],
830           "isolated": "\uFEB5",
831           "final": "\uFEB6",
832           "initial": "\uFEB7",
833           "medial": "\uFEB8"
834         },
835         "sad": {
836           "normal": [
837             "\u0635"
838           ],
839           "two_dots_below": [
840             "\u069D"
841           ],
842           "three_dots_above": [
843             "\u069E"
844           ],
845           "three_dots_below": [
846             "\u08AF"
847           ],
848           "isolated": "\uFEB9",
849           "final": "\uFEBA",
850           "initial": "\uFEBB",
851           "medial": "\uFEBC"
852         },
853         "dad": {
854           "normal": [
855             "\u0636"
856           ],
857           "dot_below": [
858             "\u06FB"
859           ],
860           "isolated": "\uFEBD",
861           "final": "\uFEBE",
862           "initial": "\uFEBF",
863           "medial": "\uFEC0"
864         },
865         "tah": {
866           "normal": [
867             "\u0637"
868           ],
869           "three_dots_above": [
870             "\u069F"
871           ],
872           "two_dots_above": [
873             "\u08A3"
874           ],
875           "isolated": "\uFEC1",
876           "final": "\uFEC2",
877           "initial": "\uFEC3",
878           "medial": "\uFEC4"
879         },
880         "zah": {
881           "normal": [
882             "\u0638"
883           ],
884           "isolated": "\uFEC5",
885           "final": "\uFEC6",
886           "initial": "\uFEC7",
887           "medial": "\uFEC8"
888         },
889         "ain": {
890           "normal": [
891             "\u0639"
892           ],
893           "three_dots_above": [
894             "\u06A0"
895           ],
896           "two_dots_above": [
897             "\u075D"
898           ],
899           "three_dots_pointing_downwards_above": [
900             "\u075E"
901           ],
902           "two_dots_vertically_above": [
903             "\u075F"
904           ],
905           "three_dots_below": [
906             "\u08B3"
907           ],
908           "isolated": "\uFEC9",
909           "final": "\uFECA",
910           "initial": "\uFECB",
911           "medial": "\uFECC"
912         },
913         "ghain": {
914           "normal": [
915             "\u063A"
916           ],
917           "dot_below": [
918             "\u06FC"
919           ],
920           "isolated": "\uFECD",
921           "final": "\uFECE",
922           "initial": "\uFECF",
923           "medial": "\uFED0"
924         },
925         "feh": {
926           "normal": [
927             "\u0641"
928           ],
929           "dotless": [
930             "\u06A1"
931           ],
932           "dot_moved_below": [
933             "\u06A2"
934           ],
935           "dot_below": [
936             "\u06A3"
937           ],
938           "three_dots_below": [
939             "\u06A5"
940           ],
941           "two_dots_below": [
942             "\u0760"
943           ],
944           "three_dots_pointing_upwards_below": [
945             "\u0761"
946           ],
947           "dot_below_three_dots_above": [
948             "\u08A4"
949           ],
950           "isolated": "\uFED1",
951           "final": "\uFED2",
952           "initial": "\uFED3",
953           "medial": "\uFED4"
954         },
955         "qaf": {
956           "normal": [
957             "\u0642"
958           ],
959           "dotless": [
960             "\u066F"
961           ],
962           "dot_above": [
963             "\u06A7"
964           ],
965           "three_dots_above": [
966             "\u06A8"
967           ],
968           "dot_below": [
969             "\u08A5"
970           ],
971           "isolated": "\uFED5",
972           "final": "\uFED6",
973           "initial": "\uFED7",
974           "medial": "\uFED8"
975         },
976         "kaf": {
977           "normal": [
978             "\u0643"
979           ],
980           "swash": [
981             "\u06AA"
982           ],
983           "ring": [
984             "\u06AB"
985           ],
986           "dot_above": [
987             "\u06AC"
988           ],
989           "three_dots_below": [
990             "\u06AE"
991           ],
992           "two_dots_above": [
993             "\u077F"
994           ],
995           "dot_below": [
996             "\u08B4"
997           ],
998           "isolated": "\uFED9",
999           "final": "\uFEDA",
1000           "initial": "\uFEDB",
1001           "medial": "\uFEDC"
1002         },
1003         "lam": {
1004           "normal": [
1005             "\u0644"
1006           ],
1007           "small_v": [
1008             "\u06B5"
1009           ],
1010           "dot_above": [
1011             "\u06B6"
1012           ],
1013           "three_dots_above": [
1014             "\u06B7"
1015           ],
1016           "three_dots_below": [
1017             "\u06B8"
1018           ],
1019           "bar": [
1020             "\u076A"
1021           ],
1022           "double_bar": [
1023             "\u08A6"
1024           ],
1025           "isolated": "\uFEDD",
1026           "final": "\uFEDE",
1027           "initial": "\uFEDF",
1028           "medial": "\uFEE0"
1029         },
1030         "meem": {
1031           "normal": [
1032             "\u0645"
1033           ],
1034           "dot_above": [
1035             "\u0765"
1036           ],
1037           "dot_below": [
1038             "\u0766"
1039           ],
1040           "three_dots_above": [
1041             "\u08A7"
1042           ],
1043           "isolated": "\uFEE1",
1044           "final": "\uFEE2",
1045           "initial": "\uFEE3",
1046           "medial": "\uFEE4"
1047         },
1048         "noon": {
1049           "normal": [
1050             "\u0646"
1051           ],
1052           "dot_below": [
1053             "\u06B9"
1054           ],
1055           "ring": [
1056             "\u06BC"
1057           ],
1058           "three_dots_above": [
1059             "\u06BD"
1060           ],
1061           "two_dots_below": [
1062             "\u0767"
1063           ],
1064           "small_tah": [
1065             "\u0768"
1066           ],
1067           "small_v": [
1068             "\u0769"
1069           ],
1070           "isolated": "\uFEE5",
1071           "final": "\uFEE6",
1072           "initial": "\uFEE7",
1073           "medial": "\uFEE8"
1074         },
1075         "heh": {
1076           "normal": [
1077             "\u0647"
1078           ],
1079           "isolated": "\uFEE9",
1080           "final": "\uFEEA",
1081           "initial": "\uFEEB",
1082           "medial": "\uFEEC"
1083         },
1084         "waw": {
1085           "normal": [
1086             "\u0648"
1087           ],
1088           "hamza_above": {
1089             "normal": [
1090               "\u0624",
1091               "\u0648\u0654"
1092             ],
1093             "isolated": "\uFE85",
1094             "final": "\uFE86"
1095           },
1096           "high_hamza": [
1097             "\u0676",
1098             "\u0648\u0674"
1099           ],
1100           "ring": [
1101             "\u06C4"
1102           ],
1103           "two_dots_above": [
1104             "\u06CA"
1105           ],
1106           "dot_above": [
1107             "\u06CF"
1108           ],
1109           "indic_two_above": [
1110             "\u0778"
1111           ],
1112           "indic_three_above": [
1113             "\u0779"
1114           ],
1115           "dot_within": [
1116             "\u08AB"
1117           ],
1118           "isolated": "\uFEED",
1119           "final": "\uFEEE"
1120         },
1121         "alef_maksura": {
1122           "normal": [
1123             "\u0649"
1124           ],
1125           "hamza_above": [
1126             "\u0626",
1127             "\u064A\u0654"
1128           ],
1129           "initial": "\uFBE8",
1130           "medial": "\uFBE9",
1131           "isolated": "\uFEEF",
1132           "final": "\uFEF0"
1133         },
1134         "yeh": {
1135           "normal": [
1136             "\u064A"
1137           ],
1138           "hamza_above": {
1139             "normal": [
1140               "\u0626",
1141               "\u0649\u0654"
1142             ],
1143             "isolated": "\uFE89",
1144             "final": "\uFE8A",
1145             "initial": "\uFE8B",
1146             "medial": "\uFE8C"
1147           },
1148           "two_dots_below_hamza_above": [
1149             "\u08A8"
1150           ],
1151           "high_hamza": [
1152             "\u0678",
1153             "\u064A\u0674"
1154           ],
1155           "tail": [
1156             "\u06CD"
1157           ],
1158           "small_v": [
1159             "\u06CE"
1160           ],
1161           "three_dots_below": [
1162             "\u06D1"
1163           ],
1164           "two_dots_below_dot_above": [
1165             "\u08A9"
1166           ],
1167           "two_dots_below_small_noon_above": [
1168             "\u08BA"
1169           ],
1170           "isolated": "\uFEF1",
1171           "final": "\uFEF2",
1172           "initial": "\uFEF3",
1173           "medial": "\uFEF4"
1174         },
1175         "tteh": {
1176           "normal": [
1177             "\u0679"
1178           ],
1179           "isolated": "\uFB66",
1180           "final": "\uFB67",
1181           "initial": "\uFB68",
1182           "medial": "\uFB69"
1183         },
1184         "tteheh": {
1185           "normal": [
1186             "\u067A"
1187           ],
1188           "isolated": "\uFB5E",
1189           "final": "\uFB5F",
1190           "initial": "\uFB60",
1191           "medial": "\uFB61"
1192         },
1193         "beeh": {
1194           "normal": [
1195             "\u067B"
1196           ],
1197           "isolated": "\uFB52",
1198           "final": "\uFB53",
1199           "initial": "\uFB54",
1200           "medial": "\uFB55"
1201         },
1202         "peh": {
1203           "normal": [
1204             "\u067E"
1205           ],
1206           "small_meem_above": [
1207             "\u08B7"
1208           ],
1209           "isolated": "\uFB56",
1210           "final": "\uFB57",
1211           "initial": "\uFB58",
1212           "medial": "\uFB59"
1213         },
1214         "teheh": {
1215           "normal": [
1216             "\u067F"
1217           ],
1218           "isolated": "\uFB62",
1219           "final": "\uFB63",
1220           "initial": "\uFB64",
1221           "medial": "\uFB65"
1222         },
1223         "beheh": {
1224           "normal": [
1225             "\u0680"
1226           ],
1227           "isolated": "\uFB5A",
1228           "final": "\uFB5B",
1229           "initial": "\uFB5C",
1230           "medial": "\uFB5D"
1231         },
1232         "nyeh": {
1233           "normal": [
1234             "\u0683"
1235           ],
1236           "isolated": "\uFB76",
1237           "final": "\uFB77",
1238           "initial": "\uFB78",
1239           "medial": "\uFB79"
1240         },
1241         "dyeh": {
1242           "normal": [
1243             "\u0684"
1244           ],
1245           "isolated": "\uFB72",
1246           "final": "\uFB73",
1247           "initial": "\uFB74",
1248           "medial": "\uFB75"
1249         },
1250         "tcheh": {
1251           "normal": [
1252             "\u0686"
1253           ],
1254           "dot_above": [
1255             "\u06BF"
1256           ],
1257           "isolated": "\uFB7A",
1258           "final": "\uFB7B",
1259           "initial": "\uFB7C",
1260           "medial": "\uFB7D"
1261         },
1262         "tcheheh": {
1263           "normal": [
1264             "\u0687"
1265           ],
1266           "isolated": "\uFB7E",
1267           "final": "\uFB7F",
1268           "initial": "\uFB80",
1269           "medial": "\uFB81"
1270         },
1271         "ddal": {
1272           "normal": [
1273             "\u0688"
1274           ],
1275           "isolated": "\uFB88",
1276           "final": "\uFB89"
1277         },
1278         "dahal": {
1279           "normal": [
1280             "\u068C"
1281           ],
1282           "isolated": "\uFB84",
1283           "final": "\uFB85"
1284         },
1285         "ddahal": {
1286           "normal": [
1287             "\u068D"
1288           ],
1289           "isolated": "\uFB82",
1290           "final": "\uFB83"
1291         },
1292         "dul": {
1293           "normal": [
1294             "\u068F",
1295             "\u068E"
1296           ],
1297           "isolated": "\uFB86",
1298           "final": "\uFB87"
1299         },
1300         "rreh": {
1301           "normal": [
1302             "\u0691"
1303           ],
1304           "isolated": "\uFB8C",
1305           "final": "\uFB8D"
1306         },
1307         "jeh": {
1308           "normal": [
1309             "\u0698"
1310           ],
1311           "isolated": "\uFB8A",
1312           "final": "\uFB8B"
1313         },
1314         "veh": {
1315           "normal": [
1316             "\u06A4"
1317           ],
1318           "isolated": "\uFB6A",
1319           "final": "\uFB6B",
1320           "initial": "\uFB6C",
1321           "medial": "\uFB6D"
1322         },
1323         "peheh": {
1324           "normal": [
1325             "\u06A6"
1326           ],
1327           "isolated": "\uFB6E",
1328           "final": "\uFB6F",
1329           "initial": "\uFB70",
1330           "medial": "\uFB71"
1331         },
1332         "keheh": {
1333           "normal": [
1334             "\u06A9"
1335           ],
1336           "dot_above": [
1337             "\u0762"
1338           ],
1339           "three_dots_above": [
1340             "\u0763"
1341           ],
1342           "three_dots_pointing_upwards_below": [
1343             "\u0764"
1344           ],
1345           "isolated": "\uFB8E",
1346           "final": "\uFB8F",
1347           "initial": "\uFB90",
1348           "medial": "\uFB91"
1349         },
1350         "ng": {
1351           "normal": [
1352             "\u06AD"
1353           ],
1354           "isolated": "\uFBD3",
1355           "final": "\uFBD4",
1356           "initial": "\uFBD5",
1357           "medial": "\uFBD6"
1358         },
1359         "gaf": {
1360           "normal": [
1361             "\u06AF"
1362           ],
1363           "ring": [
1364             "\u06B0"
1365           ],
1366           "two_dots_below": [
1367             "\u06B2"
1368           ],
1369           "three_dots_above": [
1370             "\u06B4"
1371           ],
1372           "inverted_stroke": [
1373             "\u08B0"
1374           ],
1375           "isolated": "\uFB92",
1376           "final": "\uFB93",
1377           "initial": "\uFB94",
1378           "medial": "\uFB95"
1379         },
1380         "ngoeh": {
1381           "normal": [
1382             "\u06B1"
1383           ],
1384           "isolated": "\uFB9A",
1385           "final": "\uFB9B",
1386           "initial": "\uFB9C",
1387           "medial": "\uFB9D"
1388         },
1389         "gueh": {
1390           "normal": [
1391             "\u06B3"
1392           ],
1393           "isolated": "\uFB96",
1394           "final": "\uFB97",
1395           "initial": "\uFB98",
1396           "medial": "\uFB99"
1397         },
1398         "noon ghunna": {
1399           "normal": [
1400             "\u06BA"
1401           ],
1402           "isolated": "\uFB9E",
1403           "final": "\uFB9F"
1404         },
1405         "rnoon": {
1406           "normal": [
1407             "\u06BB"
1408           ],
1409           "isolated": "\uFBA0",
1410           "final": "\uFBA1",
1411           "initial": "\uFBA2",
1412           "medial": "\uFBA3"
1413         },
1414         "heh doachashmee": {
1415           "normal": [
1416             "\u06BE"
1417           ],
1418           "isolated": "\uFBAA",
1419           "final": "\uFBAB",
1420           "initial": "\uFBAC",
1421           "medial": "\uFBAD"
1422         },
1423         "heh goal": {
1424           "normal": [
1425             "\u06C1"
1426           ],
1427           "hamza_above": [
1428             "\u06C1\u0654",
1429             "\u06C2"
1430           ],
1431           "isolated": "\uFBA6",
1432           "final": "\uFBA7",
1433           "initial": "\uFBA8",
1434           "medial": "\uFBA9"
1435         },
1436         "teh marbuta goal": {
1437           "normal": [
1438             "\u06C3"
1439           ]
1440         },
1441         "kirghiz oe": {
1442           "normal": [
1443             "\u06C5"
1444           ],
1445           "isolated": "\uFBE0",
1446           "final": "\uFBE1"
1447         },
1448         "oe": {
1449           "normal": [
1450             "\u06C6"
1451           ],
1452           "isolated": "\uFBD9",
1453           "final": "\uFBDA"
1454         },
1455         "u": {
1456           "normal": [
1457             "\u06C7"
1458           ],
1459           "hamza_above": {
1460             "normal": [
1461               "\u0677",
1462               "\u06C7\u0674"
1463             ],
1464             "isolated": "\uFBDD"
1465           },
1466           "isolated": "\uFBD7",
1467           "final": "\uFBD8"
1468         },
1469         "yu": {
1470           "normal": [
1471             "\u06C8"
1472           ],
1473           "isolated": "\uFBDB",
1474           "final": "\uFBDC"
1475         },
1476         "kirghiz yu": {
1477           "normal": [
1478             "\u06C9"
1479           ],
1480           "isolated": "\uFBE2",
1481           "final": "\uFBE3"
1482         },
1483         "ve": {
1484           "normal": [
1485             "\u06CB"
1486           ],
1487           "isolated": "\uFBDE",
1488           "final": "\uFBDF"
1489         },
1490         "farsi yeh": {
1491           "normal": [
1492             "\u06CC"
1493           ],
1494           "indic_two_above": [
1495             "\u0775"
1496           ],
1497           "indic_three_above": [
1498             "\u0776"
1499           ],
1500           "indic_four_above": [
1501             "\u0777"
1502           ],
1503           "isolated": "\uFBFC",
1504           "final": "\uFBFD",
1505           "initial": "\uFBFE",
1506           "medial": "\uFBFF"
1507         },
1508         "e": {
1509           "normal": [
1510             "\u06D0"
1511           ],
1512           "isolated": "\uFBE4",
1513           "final": "\uFBE5",
1514           "initial": "\uFBE6",
1515           "medial": "\uFBE7"
1516         },
1517         "yeh barree": {
1518           "normal": [
1519             "\u06D2"
1520           ],
1521           "hamza_above": {
1522             "normal": [
1523               "\u06D2\u0654",
1524               "\u06D3"
1525             ],
1526             "isolated": "\uFBB0",
1527             "final": "\uFBB1"
1528           },
1529           "indic_two_above": [
1530             "\u077A"
1531           ],
1532           "indic_three_above": [
1533             "\u077B"
1534           ],
1535           "isolated": "\uFBAE",
1536           "final": "\uFBAF"
1537         },
1538         "ae": {
1539           "normal": [
1540             "\u06D5"
1541           ],
1542           "isolated": "\u06D5",
1543           "final": "\uFEEA",
1544           "yeh_above": {
1545             "normal": [
1546               "\u06C0",
1547               "\u06D5\u0654"
1548             ],
1549             "isolated": "\uFBA4",
1550             "final": "\uFBA5"
1551           }
1552         },
1553         "rohingya yeh": {
1554           "normal": [
1555             "\u08AC"
1556           ]
1557         },
1558         "low alef": {
1559           "normal": [
1560             "\u08AD"
1561           ]
1562         },
1563         "straight waw": {
1564           "normal": [
1565             "\u08B1"
1566           ]
1567         },
1568         "african feh": {
1569           "normal": [
1570             "\u08BB"
1571           ]
1572         },
1573         "african qaf": {
1574           "normal": [
1575             "\u08BC"
1576           ]
1577         },
1578         "african noon": {
1579           "normal": [
1580             "\u08BD"
1581           ]
1582         }
1583       };
1584       exports2.default = arabicReference;
1585     }
1586   });
1587
1588   // node_modules/alif-toolkit/lib/unicode-ligatures.js
1589   var require_unicode_ligatures = __commonJS({
1590     "node_modules/alif-toolkit/lib/unicode-ligatures.js"(exports2) {
1591       "use strict";
1592       Object.defineProperty(exports2, "__esModule", { value: true });
1593       var ligatureReference = {
1594         "\u0626\u0627": {
1595           "isolated": "\uFBEA",
1596           "final": "\uFBEB"
1597         },
1598         "\u0626\u06D5": {
1599           "isolated": "\uFBEC",
1600           "final": "\uFBED"
1601         },
1602         "\u0626\u0648": {
1603           "isolated": "\uFBEE",
1604           "final": "\uFBEF"
1605         },
1606         "\u0626\u06C7": {
1607           "isolated": "\uFBF0",
1608           "final": "\uFBF1"
1609         },
1610         "\u0626\u06C6": {
1611           "isolated": "\uFBF2",
1612           "final": "\uFBF3"
1613         },
1614         "\u0626\u06C8": {
1615           "isolated": "\uFBF4",
1616           "final": "\uFBF5"
1617         },
1618         "\u0626\u06D0": {
1619           "isolated": "\uFBF6",
1620           "final": "\uFBF7",
1621           "initial": "\uFBF8"
1622         },
1623         "\u0626\u0649": {
1624           "uighur_kirghiz": {
1625             "isolated": "\uFBF9",
1626             "final": "\uFBFA",
1627             "initial": "\uFBFB"
1628           },
1629           "isolated": "\uFC03",
1630           "final": "\uFC68"
1631         },
1632         "\u0626\u062C": {
1633           "isolated": "\uFC00",
1634           "initial": "\uFC97"
1635         },
1636         "\u0626\u062D": {
1637           "isolated": "\uFC01",
1638           "initial": "\uFC98"
1639         },
1640         "\u0626\u0645": {
1641           "isolated": "\uFC02",
1642           "final": "\uFC66",
1643           "initial": "\uFC9A",
1644           "medial": "\uFCDF"
1645         },
1646         "\u0626\u064A": {
1647           "isolated": "\uFC04",
1648           "final": "\uFC69"
1649         },
1650         "\u0628\u062C": {
1651           "isolated": "\uFC05",
1652           "initial": "\uFC9C"
1653         },
1654         "\u0628\u062D": {
1655           "isolated": "\uFC06",
1656           "initial": "\uFC9D"
1657         },
1658         "\u0628\u062E": {
1659           "isolated": "\uFC07",
1660           "initial": "\uFC9E"
1661         },
1662         "\u0628\u0645": {
1663           "isolated": "\uFC08",
1664           "final": "\uFC6C",
1665           "initial": "\uFC9F",
1666           "medial": "\uFCE1"
1667         },
1668         "\u0628\u0649": {
1669           "isolated": "\uFC09",
1670           "final": "\uFC6E"
1671         },
1672         "\u0628\u064A": {
1673           "isolated": "\uFC0A",
1674           "final": "\uFC6F"
1675         },
1676         "\u062A\u062C": {
1677           "isolated": "\uFC0B",
1678           "initial": "\uFCA1"
1679         },
1680         "\u062A\u062D": {
1681           "isolated": "\uFC0C",
1682           "initial": "\uFCA2"
1683         },
1684         "\u062A\u062E": {
1685           "isolated": "\uFC0D",
1686           "initial": "\uFCA3"
1687         },
1688         "\u062A\u0645": {
1689           "isolated": "\uFC0E",
1690           "final": "\uFC72",
1691           "initial": "\uFCA4",
1692           "medial": "\uFCE3"
1693         },
1694         "\u062A\u0649": {
1695           "isolated": "\uFC0F",
1696           "final": "\uFC74"
1697         },
1698         "\u062A\u064A": {
1699           "isolated": "\uFC10",
1700           "final": "\uFC75"
1701         },
1702         "\u062B\u062C": {
1703           "isolated": "\uFC11"
1704         },
1705         "\u062B\u0645": {
1706           "isolated": "\uFC12",
1707           "final": "\uFC78",
1708           "initial": "\uFCA6",
1709           "medial": "\uFCE5"
1710         },
1711         "\u062B\u0649": {
1712           "isolated": "\uFC13",
1713           "final": "\uFC7A"
1714         },
1715         "\u062B\u0648": {
1716           "isolated": "\uFC14"
1717         },
1718         "\u062C\u062D": {
1719           "isolated": "\uFC15",
1720           "initial": "\uFCA7"
1721         },
1722         "\u062C\u0645": {
1723           "isolated": "\uFC16",
1724           "initial": "\uFCA8"
1725         },
1726         "\u062D\u062C": {
1727           "isolated": "\uFC17",
1728           "initial": "\uFCA9"
1729         },
1730         "\u062D\u0645": {
1731           "isolated": "\uFC18",
1732           "initial": "\uFCAA"
1733         },
1734         "\u062E\u062C": {
1735           "isolated": "\uFC19",
1736           "initial": "\uFCAB"
1737         },
1738         "\u062E\u062D": {
1739           "isolated": "\uFC1A"
1740         },
1741         "\u062E\u0645": {
1742           "isolated": "\uFC1B",
1743           "initial": "\uFCAC"
1744         },
1745         "\u0633\u062C": {
1746           "isolated": "\uFC1C",
1747           "initial": "\uFCAD",
1748           "medial": "\uFD34"
1749         },
1750         "\u0633\u062D": {
1751           "isolated": "\uFC1D",
1752           "initial": "\uFCAE",
1753           "medial": "\uFD35"
1754         },
1755         "\u0633\u062E": {
1756           "isolated": "\uFC1E",
1757           "initial": "\uFCAF",
1758           "medial": "\uFD36"
1759         },
1760         "\u0633\u0645": {
1761           "isolated": "\uFC1F",
1762           "initial": "\uFCB0",
1763           "medial": "\uFCE7"
1764         },
1765         "\u0635\u062D": {
1766           "isolated": "\uFC20",
1767           "initial": "\uFCB1"
1768         },
1769         "\u0635\u0645": {
1770           "isolated": "\uFC21",
1771           "initial": "\uFCB3"
1772         },
1773         "\u0636\u062C": {
1774           "isolated": "\uFC22",
1775           "initial": "\uFCB4"
1776         },
1777         "\u0636\u062D": {
1778           "isolated": "\uFC23",
1779           "initial": "\uFCB5"
1780         },
1781         "\u0636\u062E": {
1782           "isolated": "\uFC24",
1783           "initial": "\uFCB6"
1784         },
1785         "\u0636\u0645": {
1786           "isolated": "\uFC25",
1787           "initial": "\uFCB7"
1788         },
1789         "\u0637\u062D": {
1790           "isolated": "\uFC26",
1791           "initial": "\uFCB8"
1792         },
1793         "\u0637\u0645": {
1794           "isolated": "\uFC27",
1795           "initial": "\uFD33",
1796           "medial": "\uFD3A"
1797         },
1798         "\u0638\u0645": {
1799           "isolated": "\uFC28",
1800           "initial": "\uFCB9",
1801           "medial": "\uFD3B"
1802         },
1803         "\u0639\u062C": {
1804           "isolated": "\uFC29",
1805           "initial": "\uFCBA"
1806         },
1807         "\u0639\u0645": {
1808           "isolated": "\uFC2A",
1809           "initial": "\uFCBB"
1810         },
1811         "\u063A\u062C": {
1812           "isolated": "\uFC2B",
1813           "initial": "\uFCBC"
1814         },
1815         "\u063A\u0645": {
1816           "isolated": "\uFC2C",
1817           "initial": "\uFCBD"
1818         },
1819         "\u0641\u062C": {
1820           "isolated": "\uFC2D",
1821           "initial": "\uFCBE"
1822         },
1823         "\u0641\u062D": {
1824           "isolated": "\uFC2E",
1825           "initial": "\uFCBF"
1826         },
1827         "\u0641\u062E": {
1828           "isolated": "\uFC2F",
1829           "initial": "\uFCC0"
1830         },
1831         "\u0641\u0645": {
1832           "isolated": "\uFC30",
1833           "initial": "\uFCC1"
1834         },
1835         "\u0641\u0649": {
1836           "isolated": "\uFC31",
1837           "final": "\uFC7C"
1838         },
1839         "\u0641\u064A": {
1840           "isolated": "\uFC32",
1841           "final": "\uFC7D"
1842         },
1843         "\u0642\u062D": {
1844           "isolated": "\uFC33",
1845           "initial": "\uFCC2"
1846         },
1847         "\u0642\u0645": {
1848           "isolated": "\uFC34",
1849           "initial": "\uFCC3"
1850         },
1851         "\u0642\u0649": {
1852           "isolated": "\uFC35",
1853           "final": "\uFC7E"
1854         },
1855         "\u0642\u064A": {
1856           "isolated": "\uFC36",
1857           "final": "\uFC7F"
1858         },
1859         "\u0643\u0627": {
1860           "isolated": "\uFC37",
1861           "final": "\uFC80"
1862         },
1863         "\u0643\u062C": {
1864           "isolated": "\uFC38",
1865           "initial": "\uFCC4"
1866         },
1867         "\u0643\u062D": {
1868           "isolated": "\uFC39",
1869           "initial": "\uFCC5"
1870         },
1871         "\u0643\u062E": {
1872           "isolated": "\uFC3A",
1873           "initial": "\uFCC6"
1874         },
1875         "\u0643\u0644": {
1876           "isolated": "\uFC3B",
1877           "final": "\uFC81",
1878           "initial": "\uFCC7",
1879           "medial": "\uFCEB"
1880         },
1881         "\u0643\u0645": {
1882           "isolated": "\uFC3C",
1883           "final": "\uFC82",
1884           "initial": "\uFCC8",
1885           "medial": "\uFCEC"
1886         },
1887         "\u0643\u0649": {
1888           "isolated": "\uFC3D",
1889           "final": "\uFC83"
1890         },
1891         "\u0643\u064A": {
1892           "isolated": "\uFC3E",
1893           "final": "\uFC84"
1894         },
1895         "\u0644\u062C": {
1896           "isolated": "\uFC3F",
1897           "initial": "\uFCC9"
1898         },
1899         "\u0644\u062D": {
1900           "isolated": "\uFC40",
1901           "initial": "\uFCCA"
1902         },
1903         "\u0644\u062E": {
1904           "isolated": "\uFC41",
1905           "initial": "\uFCCB"
1906         },
1907         "\u0644\u0645": {
1908           "isolated": "\uFC42",
1909           "final": "\uFC85",
1910           "initial": "\uFCCC",
1911           "medial": "\uFCED"
1912         },
1913         "\u0644\u0649": {
1914           "isolated": "\uFC43",
1915           "final": "\uFC86"
1916         },
1917         "\u0644\u064A": {
1918           "isolated": "\uFC44",
1919           "final": "\uFC87"
1920         },
1921         "\u0645\u062C": {
1922           "isolated": "\uFC45",
1923           "initial": "\uFCCE"
1924         },
1925         "\u0645\u062D": {
1926           "isolated": "\uFC46",
1927           "initial": "\uFCCF"
1928         },
1929         "\u0645\u062E": {
1930           "isolated": "\uFC47",
1931           "initial": "\uFCD0"
1932         },
1933         "\u0645\u0645": {
1934           "isolated": "\uFC48",
1935           "final": "\uFC89",
1936           "initial": "\uFCD1"
1937         },
1938         "\u0645\u0649": {
1939           "isolated": "\uFC49"
1940         },
1941         "\u0645\u064A": {
1942           "isolated": "\uFC4A"
1943         },
1944         "\u0646\u062C": {
1945           "isolated": "\uFC4B",
1946           "initial": "\uFCD2"
1947         },
1948         "\u0646\u062D": {
1949           "isolated": "\uFC4C",
1950           "initial": "\uFCD3"
1951         },
1952         "\u0646\u062E": {
1953           "isolated": "\uFC4D",
1954           "initial": "\uFCD4"
1955         },
1956         "\u0646\u0645": {
1957           "isolated": "\uFC4E",
1958           "final": "\uFC8C",
1959           "initial": "\uFCD5",
1960           "medial": "\uFCEE"
1961         },
1962         "\u0646\u0649": {
1963           "isolated": "\uFC4F",
1964           "final": "\uFC8E"
1965         },
1966         "\u0646\u064A": {
1967           "isolated": "\uFC50",
1968           "final": "\uFC8F"
1969         },
1970         "\u0647\u062C": {
1971           "isolated": "\uFC51",
1972           "initial": "\uFCD7"
1973         },
1974         "\u0647\u0645": {
1975           "isolated": "\uFC52",
1976           "initial": "\uFCD8"
1977         },
1978         "\u0647\u0649": {
1979           "isolated": "\uFC53"
1980         },
1981         "\u0647\u064A": {
1982           "isolated": "\uFC54"
1983         },
1984         "\u064A\u062C": {
1985           "isolated": "\uFC55",
1986           "initial": "\uFCDA"
1987         },
1988         "\u064A\u062D": {
1989           "isolated": "\uFC56",
1990           "initial": "\uFCDB"
1991         },
1992         "\u064A\u062E": {
1993           "isolated": "\uFC57",
1994           "initial": "\uFCDC"
1995         },
1996         "\u064A\u0645": {
1997           "isolated": "\uFC58",
1998           "final": "\uFC93",
1999           "initial": "\uFCDD",
2000           "medial": "\uFCF0"
2001         },
2002         "\u064A\u0649": {
2003           "isolated": "\uFC59",
2004           "final": "\uFC95"
2005         },
2006         "\u064A\u064A": {
2007           "isolated": "\uFC5A",
2008           "final": "\uFC96"
2009         },
2010         "\u0630\u0670": {
2011           "isolated": "\uFC5B"
2012         },
2013         "\u0631\u0670": {
2014           "isolated": "\uFC5C"
2015         },
2016         "\u0649\u0670": {
2017           "isolated": "\uFC5D",
2018           "final": "\uFC90"
2019         },
2020         "\u064C\u0651": {
2021           "isolated": "\uFC5E"
2022         },
2023         "\u064D\u0651": {
2024           "isolated": "\uFC5F"
2025         },
2026         "\u064E\u0651": {
2027           "isolated": "\uFC60"
2028         },
2029         "\u064F\u0651": {
2030           "isolated": "\uFC61"
2031         },
2032         "\u0650\u0651": {
2033           "isolated": "\uFC62"
2034         },
2035         "\u0651\u0670": {
2036           "isolated": "\uFC63"
2037         },
2038         "\u0626\u0631": {
2039           "final": "\uFC64"
2040         },
2041         "\u0626\u0632": {
2042           "final": "\uFC65"
2043         },
2044         "\u0626\u0646": {
2045           "final": "\uFC67"
2046         },
2047         "\u0628\u0631": {
2048           "final": "\uFC6A"
2049         },
2050         "\u0628\u0632": {
2051           "final": "\uFC6B"
2052         },
2053         "\u0628\u0646": {
2054           "final": "\uFC6D"
2055         },
2056         "\u062A\u0631": {
2057           "final": "\uFC70"
2058         },
2059         "\u062A\u0632": {
2060           "final": "\uFC71"
2061         },
2062         "\u062A\u0646": {
2063           "final": "\uFC73"
2064         },
2065         "\u062B\u0631": {
2066           "final": "\uFC76"
2067         },
2068         "\u062B\u0632": {
2069           "final": "\uFC77"
2070         },
2071         "\u062B\u0646": {
2072           "final": "\uFC79"
2073         },
2074         "\u062B\u064A": {
2075           "final": "\uFC7B"
2076         },
2077         "\u0645\u0627": {
2078           "final": "\uFC88"
2079         },
2080         "\u0646\u0631": {
2081           "final": "\uFC8A"
2082         },
2083         "\u0646\u0632": {
2084           "final": "\uFC8B"
2085         },
2086         "\u0646\u0646": {
2087           "final": "\uFC8D"
2088         },
2089         "\u064A\u0631": {
2090           "final": "\uFC91"
2091         },
2092         "\u064A\u0632": {
2093           "final": "\uFC92"
2094         },
2095         "\u064A\u0646": {
2096           "final": "\uFC94"
2097         },
2098         "\u0626\u062E": {
2099           "initial": "\uFC99"
2100         },
2101         "\u0626\u0647": {
2102           "initial": "\uFC9B",
2103           "medial": "\uFCE0"
2104         },
2105         "\u0628\u0647": {
2106           "initial": "\uFCA0",
2107           "medial": "\uFCE2"
2108         },
2109         "\u062A\u0647": {
2110           "initial": "\uFCA5",
2111           "medial": "\uFCE4"
2112         },
2113         "\u0635\u062E": {
2114           "initial": "\uFCB2"
2115         },
2116         "\u0644\u0647": {
2117           "initial": "\uFCCD"
2118         },
2119         "\u0646\u0647": {
2120           "initial": "\uFCD6",
2121           "medial": "\uFCEF"
2122         },
2123         "\u0647\u0670": {
2124           "initial": "\uFCD9"
2125         },
2126         "\u064A\u0647": {
2127           "initial": "\uFCDE",
2128           "medial": "\uFCF1"
2129         },
2130         "\u062B\u0647": {
2131           "medial": "\uFCE6"
2132         },
2133         "\u0633\u0647": {
2134           "medial": "\uFCE8",
2135           "initial": "\uFD31"
2136         },
2137         "\u0634\u0645": {
2138           "medial": "\uFCE9",
2139           "isolated": "\uFD0C",
2140           "final": "\uFD28",
2141           "initial": "\uFD30"
2142         },
2143         "\u0634\u0647": {
2144           "medial": "\uFCEA",
2145           "initial": "\uFD32"
2146         },
2147         "\u0640\u064E\u0651": {
2148           "medial": "\uFCF2"
2149         },
2150         "\u0640\u064F\u0651": {
2151           "medial": "\uFCF3"
2152         },
2153         "\u0640\u0650\u0651": {
2154           "medial": "\uFCF4"
2155         },
2156         "\u0637\u0649": {
2157           "isolated": "\uFCF5",
2158           "final": "\uFD11"
2159         },
2160         "\u0637\u064A": {
2161           "isolated": "\uFCF6",
2162           "final": "\uFD12"
2163         },
2164         "\u0639\u0649": {
2165           "isolated": "\uFCF7",
2166           "final": "\uFD13"
2167         },
2168         "\u0639\u064A": {
2169           "isolated": "\uFCF8",
2170           "final": "\uFD14"
2171         },
2172         "\u063A\u0649": {
2173           "isolated": "\uFCF9",
2174           "final": "\uFD15"
2175         },
2176         "\u063A\u064A": {
2177           "isolated": "\uFCFA",
2178           "final": "\uFD16"
2179         },
2180         "\u0633\u0649": {
2181           "isolated": "\uFCFB"
2182         },
2183         "\u0633\u064A": {
2184           "isolated": "\uFCFC",
2185           "final": "\uFD18"
2186         },
2187         "\u0634\u0649": {
2188           "isolated": "\uFCFD",
2189           "final": "\uFD19"
2190         },
2191         "\u0634\u064A": {
2192           "isolated": "\uFCFE",
2193           "final": "\uFD1A"
2194         },
2195         "\u062D\u0649": {
2196           "isolated": "\uFCFF",
2197           "final": "\uFD1B"
2198         },
2199         "\u062D\u064A": {
2200           "isolated": "\uFD00",
2201           "final": "\uFD1C"
2202         },
2203         "\u062C\u0649": {
2204           "isolated": "\uFD01",
2205           "final": "\uFD1D"
2206         },
2207         "\u062C\u064A": {
2208           "isolated": "\uFD02",
2209           "final": "\uFD1E"
2210         },
2211         "\u062E\u0649": {
2212           "isolated": "\uFD03",
2213           "final": "\uFD1F"
2214         },
2215         "\u062E\u064A": {
2216           "isolated": "\uFD04",
2217           "final": "\uFD20"
2218         },
2219         "\u0635\u0649": {
2220           "isolated": "\uFD05",
2221           "final": "\uFD21"
2222         },
2223         "\u0635\u064A": {
2224           "isolated": "\uFD06",
2225           "final": "\uFD22"
2226         },
2227         "\u0636\u0649": {
2228           "isolated": "\uFD07",
2229           "final": "\uFD23"
2230         },
2231         "\u0636\u064A": {
2232           "isolated": "\uFD08",
2233           "final": "\uFD24"
2234         },
2235         "\u0634\u062C": {
2236           "isolated": "\uFD09",
2237           "final": "\uFD25",
2238           "initial": "\uFD2D",
2239           "medial": "\uFD37"
2240         },
2241         "\u0634\u062D": {
2242           "isolated": "\uFD0A",
2243           "final": "\uFD26",
2244           "initial": "\uFD2E",
2245           "medial": "\uFD38"
2246         },
2247         "\u0634\u062E": {
2248           "isolated": "\uFD0B",
2249           "final": "\uFD27",
2250           "initial": "\uFD2F",
2251           "medial": "\uFD39"
2252         },
2253         "\u0634\u0631": {
2254           "isolated": "\uFD0D",
2255           "final": "\uFD29"
2256         },
2257         "\u0633\u0631": {
2258           "isolated": "\uFD0E",
2259           "final": "\uFD2A"
2260         },
2261         "\u0635\u0631": {
2262           "isolated": "\uFD0F",
2263           "final": "\uFD2B"
2264         },
2265         "\u0636\u0631": {
2266           "isolated": "\uFD10",
2267           "final": "\uFD2C"
2268         },
2269         "\u0633\u0639": {
2270           "final": "\uFD17"
2271         },
2272         "\u062A\u062C\u0645": {
2273           "initial": "\uFD50"
2274         },
2275         "\u062A\u062D\u062C": {
2276           "final": "\uFD51",
2277           "initial": "\uFD52"
2278         },
2279         "\u062A\u062D\u0645": {
2280           "initial": "\uFD53"
2281         },
2282         "\u062A\u062E\u0645": {
2283           "initial": "\uFD54"
2284         },
2285         "\u062A\u0645\u062C": {
2286           "initial": "\uFD55"
2287         },
2288         "\u062A\u0645\u062D": {
2289           "initial": "\uFD56"
2290         },
2291         "\u062A\u0645\u062E": {
2292           "initial": "\uFD57"
2293         },
2294         "\u062C\u0645\u062D": {
2295           "final": "\uFD58",
2296           "initial": "\uFD59"
2297         },
2298         "\u062D\u0645\u064A": {
2299           "final": "\uFD5A"
2300         },
2301         "\u062D\u0645\u0649": {
2302           "final": "\uFD5B"
2303         },
2304         "\u0633\u062D\u062C": {
2305           "initial": "\uFD5C"
2306         },
2307         "\u0633\u062C\u062D": {
2308           "initial": "\uFD5D"
2309         },
2310         "\u0633\u062C\u0649": {
2311           "final": "\uFD5E"
2312         },
2313         "\u0633\u0645\u062D": {
2314           "final": "\uFD5F",
2315           "initial": "\uFD60"
2316         },
2317         "\u0633\u0645\u062C": {
2318           "initial": "\uFD61"
2319         },
2320         "\u0633\u0645\u0645": {
2321           "final": "\uFD62",
2322           "initial": "\uFD63"
2323         },
2324         "\u0635\u062D\u062D": {
2325           "final": "\uFD64",
2326           "initial": "\uFD65"
2327         },
2328         "\u0635\u0645\u0645": {
2329           "final": "\uFD66",
2330           "initial": "\uFDC5"
2331         },
2332         "\u0634\u062D\u0645": {
2333           "final": "\uFD67",
2334           "initial": "\uFD68"
2335         },
2336         "\u0634\u062C\u064A": {
2337           "final": "\uFD69"
2338         },
2339         "\u0634\u0645\u062E": {
2340           "final": "\uFD6A",
2341           "initial": "\uFD6B"
2342         },
2343         "\u0634\u0645\u0645": {
2344           "final": "\uFD6C",
2345           "initial": "\uFD6D"
2346         },
2347         "\u0636\u062D\u0649": {
2348           "final": "\uFD6E"
2349         },
2350         "\u0636\u062E\u0645": {
2351           "final": "\uFD6F",
2352           "initial": "\uFD70"
2353         },
2354         "\u0636\u0645\u062D": {
2355           "final": "\uFD71"
2356         },
2357         "\u0637\u0645\u062D": {
2358           "initial": "\uFD72"
2359         },
2360         "\u0637\u0645\u0645": {
2361           "initial": "\uFD73"
2362         },
2363         "\u0637\u0645\u064A": {
2364           "final": "\uFD74"
2365         },
2366         "\u0639\u062C\u0645": {
2367           "final": "\uFD75",
2368           "initial": "\uFDC4"
2369         },
2370         "\u0639\u0645\u0645": {
2371           "final": "\uFD76",
2372           "initial": "\uFD77"
2373         },
2374         "\u0639\u0645\u0649": {
2375           "final": "\uFD78"
2376         },
2377         "\u063A\u0645\u0645": {
2378           "final": "\uFD79"
2379         },
2380         "\u063A\u0645\u064A": {
2381           "final": "\uFD7A"
2382         },
2383         "\u063A\u0645\u0649": {
2384           "final": "\uFD7B"
2385         },
2386         "\u0641\u062E\u0645": {
2387           "final": "\uFD7C",
2388           "initial": "\uFD7D"
2389         },
2390         "\u0642\u0645\u062D": {
2391           "final": "\uFD7E",
2392           "initial": "\uFDB4"
2393         },
2394         "\u0642\u0645\u0645": {
2395           "final": "\uFD7F"
2396         },
2397         "\u0644\u062D\u0645": {
2398           "final": "\uFD80",
2399           "initial": "\uFDB5"
2400         },
2401         "\u0644\u062D\u064A": {
2402           "final": "\uFD81"
2403         },
2404         "\u0644\u062D\u0649": {
2405           "final": "\uFD82"
2406         },
2407         "\u0644\u062C\u062C": {
2408           "initial": "\uFD83",
2409           "final": "\uFD84"
2410         },
2411         "\u0644\u062E\u0645": {
2412           "final": "\uFD85",
2413           "initial": "\uFD86"
2414         },
2415         "\u0644\u0645\u062D": {
2416           "final": "\uFD87",
2417           "initial": "\uFD88"
2418         },
2419         "\u0645\u062D\u062C": {
2420           "initial": "\uFD89"
2421         },
2422         "\u0645\u062D\u0645": {
2423           "initial": "\uFD8A"
2424         },
2425         "\u0645\u062D\u064A": {
2426           "final": "\uFD8B"
2427         },
2428         "\u0645\u062C\u062D": {
2429           "initial": "\uFD8C"
2430         },
2431         "\u0645\u062C\u0645": {
2432           "initial": "\uFD8D"
2433         },
2434         "\u0645\u062E\u062C": {
2435           "initial": "\uFD8E"
2436         },
2437         "\u0645\u062E\u0645": {
2438           "initial": "\uFD8F"
2439         },
2440         "\u0645\u062C\u062E": {
2441           "initial": "\uFD92"
2442         },
2443         "\u0647\u0645\u062C": {
2444           "initial": "\uFD93"
2445         },
2446         "\u0647\u0645\u0645": {
2447           "initial": "\uFD94"
2448         },
2449         "\u0646\u062D\u0645": {
2450           "initial": "\uFD95"
2451         },
2452         "\u0646\u062D\u0649": {
2453           "final": "\uFD96"
2454         },
2455         "\u0646\u062C\u0645": {
2456           "final": "\uFD97",
2457           "initial": "\uFD98"
2458         },
2459         "\u0646\u062C\u0649": {
2460           "final": "\uFD99"
2461         },
2462         "\u0646\u0645\u064A": {
2463           "final": "\uFD9A"
2464         },
2465         "\u0646\u0645\u0649": {
2466           "final": "\uFD9B"
2467         },
2468         "\u064A\u0645\u0645": {
2469           "final": "\uFD9C",
2470           "initial": "\uFD9D"
2471         },
2472         "\u0628\u062E\u064A": {
2473           "final": "\uFD9E"
2474         },
2475         "\u062A\u062C\u064A": {
2476           "final": "\uFD9F"
2477         },
2478         "\u062A\u062C\u0649": {
2479           "final": "\uFDA0"
2480         },
2481         "\u062A\u062E\u064A": {
2482           "final": "\uFDA1"
2483         },
2484         "\u062A\u062E\u0649": {
2485           "final": "\uFDA2"
2486         },
2487         "\u062A\u0645\u064A": {
2488           "final": "\uFDA3"
2489         },
2490         "\u062A\u0645\u0649": {
2491           "final": "\uFDA4"
2492         },
2493         "\u062C\u0645\u064A": {
2494           "final": "\uFDA5"
2495         },
2496         "\u062C\u062D\u0649": {
2497           "final": "\uFDA6"
2498         },
2499         "\u062C\u0645\u0649": {
2500           "final": "\uFDA7"
2501         },
2502         "\u0633\u062E\u0649": {
2503           "final": "\uFDA8"
2504         },
2505         "\u0635\u062D\u064A": {
2506           "final": "\uFDA9"
2507         },
2508         "\u0634\u062D\u064A": {
2509           "final": "\uFDAA"
2510         },
2511         "\u0636\u062D\u064A": {
2512           "final": "\uFDAB"
2513         },
2514         "\u0644\u062C\u064A": {
2515           "final": "\uFDAC"
2516         },
2517         "\u0644\u0645\u064A": {
2518           "final": "\uFDAD"
2519         },
2520         "\u064A\u062D\u064A": {
2521           "final": "\uFDAE"
2522         },
2523         "\u064A\u062C\u064A": {
2524           "final": "\uFDAF"
2525         },
2526         "\u064A\u0645\u064A": {
2527           "final": "\uFDB0"
2528         },
2529         "\u0645\u0645\u064A": {
2530           "final": "\uFDB1"
2531         },
2532         "\u0642\u0645\u064A": {
2533           "final": "\uFDB2"
2534         },
2535         "\u0646\u062D\u064A": {
2536           "final": "\uFDB3"
2537         },
2538         "\u0639\u0645\u064A": {
2539           "final": "\uFDB6"
2540         },
2541         "\u0643\u0645\u064A": {
2542           "final": "\uFDB7"
2543         },
2544         "\u0646\u062C\u062D": {
2545           "initial": "\uFDB8",
2546           "final": "\uFDBD"
2547         },
2548         "\u0645\u062E\u064A": {
2549           "final": "\uFDB9"
2550         },
2551         "\u0644\u062C\u0645": {
2552           "initial": "\uFDBA",
2553           "final": "\uFDBC"
2554         },
2555         "\u0643\u0645\u0645": {
2556           "final": "\uFDBB",
2557           "initial": "\uFDC3"
2558         },
2559         "\u062C\u062D\u064A": {
2560           "final": "\uFDBE"
2561         },
2562         "\u062D\u062C\u064A": {
2563           "final": "\uFDBF"
2564         },
2565         "\u0645\u062C\u064A": {
2566           "final": "\uFDC0"
2567         },
2568         "\u0641\u0645\u064A": {
2569           "final": "\uFDC1"
2570         },
2571         "\u0628\u062D\u064A": {
2572           "final": "\uFDC2"
2573         },
2574         "\u0633\u062E\u064A": {
2575           "final": "\uFDC6"
2576         },
2577         "\u0646\u062C\u064A": {
2578           "final": "\uFDC7"
2579         },
2580         "\u0644\u0622": {
2581           "isolated": "\uFEF5",
2582           "final": "\uFEF6"
2583         },
2584         "\u0644\u0623": {
2585           "isolated": "\uFEF7",
2586           "final": "\uFEF8"
2587         },
2588         "\u0644\u0625": {
2589           "isolated": "\uFEF9",
2590           "final": "\uFEFA"
2591         },
2592         "\u0644\u0627": {
2593           "isolated": "\uFEFB",
2594           "final": "\uFEFC"
2595         },
2596         "words": {
2597           "\u0635\u0644\u06D2": "\uFDF0",
2598           "\u0642\u0644\u06D2": "\uFDF1",
2599           "\u0627\u0644\u0644\u0647": "\uFDF2",
2600           "\u0627\u0643\u0628\u0631": "\uFDF3",
2601           "\u0645\u062D\u0645\u062F": "\uFDF4",
2602           "\u0635\u0644\u0639\u0645": "\uFDF5",
2603           "\u0631\u0633\u0648\u0644": "\uFDF6",
2604           "\u0639\u0644\u064A\u0647": "\uFDF7",
2605           "\u0648\u0633\u0644\u0645": "\uFDF8",
2606           "\u0635\u0644\u0649": "\uFDF9",
2607           "\u0635\u0644\u0649\u0627\u0644\u0644\u0647\u0639\u0644\u064A\u0647\u0648\u0633\u0644\u0645": "\uFDFA",
2608           "\u062C\u0644\u062C\u0644\u0627\u0644\u0647": "\uFDFB",
2609           "\u0631\u06CC\u0627\u0644": "\uFDFC"
2610         }
2611       };
2612       exports2.default = ligatureReference;
2613     }
2614   });
2615
2616   // node_modules/alif-toolkit/lib/reference.js
2617   var require_reference = __commonJS({
2618     "node_modules/alif-toolkit/lib/reference.js"(exports2) {
2619       "use strict";
2620       Object.defineProperty(exports2, "__esModule", { value: true });
2621       var unicode_arabic_1 = require_unicode_arabic();
2622       var unicode_ligatures_1 = require_unicode_ligatures();
2623       var letterList = Object.keys(unicode_arabic_1.default);
2624       exports2.letterList = letterList;
2625       var ligatureList = Object.keys(unicode_ligatures_1.default);
2626       exports2.ligatureList = ligatureList;
2627       var ligatureWordList = Object.keys(unicode_ligatures_1.default.words);
2628       exports2.ligatureWordList = ligatureWordList;
2629       var lams = "\u0644\u06B5\u06B6\u06B7\u06B8";
2630       exports2.lams = lams;
2631       var alefs = "\u0627\u0622\u0623\u0625\u0671\u0672\u0673\u0675\u0773\u0774";
2632       exports2.alefs = alefs;
2633       var tashkeel = "\u0605\u0640\u0670\u0674\u06DF\u06E7\u06E8";
2634       exports2.tashkeel = tashkeel;
2635       function addToTashkeel(start2, finish) {
2636         for (var i2 = start2; i2 <= finish; i2++) {
2637           exports2.tashkeel = tashkeel += String.fromCharCode(i2);
2638         }
2639       }
2640       addToTashkeel(1552, 1562);
2641       addToTashkeel(1611, 1631);
2642       addToTashkeel(1750, 1756);
2643       addToTashkeel(1760, 1764);
2644       addToTashkeel(1770, 1773);
2645       addToTashkeel(2259, 2273);
2646       addToTashkeel(2275, 2303);
2647       addToTashkeel(65136, 65151);
2648       var lineBreakers = "\u0627\u0629\u0648\u06C0\u06CF\u06FD\u06FE\u076B\u076C\u0771\u0773\u0774\u0778\u0779\u08E2\u08B1\u08B2\u08B9";
2649       exports2.lineBreakers = lineBreakers;
2650       function addToLineBreakers(start2, finish) {
2651         for (var i2 = start2; i2 <= finish; i2++) {
2652           exports2.lineBreakers = lineBreakers += String.fromCharCode(i2);
2653         }
2654       }
2655       addToLineBreakers(1536, 1567);
2656       addToLineBreakers(1569, 1573);
2657       addToLineBreakers(1583, 1586);
2658       addToLineBreakers(1632, 1645);
2659       addToLineBreakers(1649, 1655);
2660       addToLineBreakers(1672, 1689);
2661       addToLineBreakers(1731, 1739);
2662       addToLineBreakers(1746, 1785);
2663       addToLineBreakers(1881, 1883);
2664       addToLineBreakers(2218, 2222);
2665       addToLineBreakers(64336, 65021);
2666       addToLineBreakers(65152, 65276);
2667       addToLineBreakers(69216, 69247);
2668       addToLineBreakers(126064, 126143);
2669       addToLineBreakers(126464, 126719);
2670     }
2671   });
2672
2673   // node_modules/alif-toolkit/lib/GlyphSplitter.js
2674   var require_GlyphSplitter = __commonJS({
2675     "node_modules/alif-toolkit/lib/GlyphSplitter.js"(exports2) {
2676       "use strict";
2677       Object.defineProperty(exports2, "__esModule", { value: true });
2678       var isArabic_1 = require_isArabic();
2679       var reference_1 = require_reference();
2680       function GlyphSplitter(word) {
2681         let letters = [];
2682         let lastLetter = "";
2683         word.split("").forEach((letter) => {
2684           if (isArabic_1.isArabic(letter)) {
2685             if (reference_1.tashkeel.indexOf(letter) > -1) {
2686               letters[letters.length - 1] += letter;
2687             } 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)) {
2688               letters[letters.length - 1] += letter;
2689             } else {
2690               letters.push(letter);
2691             }
2692           } else {
2693             letters.push(letter);
2694           }
2695           if (reference_1.tashkeel.indexOf(letter) === -1) {
2696             lastLetter = letter;
2697           }
2698         });
2699         return letters;
2700       }
2701       exports2.GlyphSplitter = GlyphSplitter;
2702     }
2703   });
2704
2705   // node_modules/alif-toolkit/lib/BaselineSplitter.js
2706   var require_BaselineSplitter = __commonJS({
2707     "node_modules/alif-toolkit/lib/BaselineSplitter.js"(exports2) {
2708       "use strict";
2709       Object.defineProperty(exports2, "__esModule", { value: true });
2710       var isArabic_1 = require_isArabic();
2711       var reference_1 = require_reference();
2712       function BaselineSplitter(word) {
2713         let letters = [];
2714         let lastLetter = "";
2715         word.split("").forEach((letter) => {
2716           if (isArabic_1.isArabic(letter) && isArabic_1.isArabic(lastLetter)) {
2717             if (lastLetter.length && reference_1.tashkeel.indexOf(letter) > -1) {
2718               letters[letters.length - 1] += letter;
2719             } else if (reference_1.lineBreakers.indexOf(lastLetter) > -1) {
2720               letters.push(letter);
2721             } else {
2722               letters[letters.length - 1] += letter;
2723             }
2724           } else {
2725             letters.push(letter);
2726           }
2727           if (reference_1.tashkeel.indexOf(letter) === -1) {
2728             lastLetter = letter;
2729           }
2730         });
2731         return letters;
2732       }
2733       exports2.BaselineSplitter = BaselineSplitter;
2734     }
2735   });
2736
2737   // node_modules/alif-toolkit/lib/Normalization.js
2738   var require_Normalization = __commonJS({
2739     "node_modules/alif-toolkit/lib/Normalization.js"(exports2) {
2740       "use strict";
2741       Object.defineProperty(exports2, "__esModule", { value: true });
2742       var unicode_arabic_1 = require_unicode_arabic();
2743       var unicode_ligatures_1 = require_unicode_ligatures();
2744       var isArabic_1 = require_isArabic();
2745       var reference_1 = require_reference();
2746       function Normal(word, breakPresentationForm) {
2747         if (typeof breakPresentationForm === "undefined") {
2748           breakPresentationForm = true;
2749         }
2750         let returnable = "";
2751         word.split("").forEach((letter) => {
2752           if (!isArabic_1.isArabic(letter)) {
2753             returnable += letter;
2754             return;
2755           }
2756           for (let w = 0; w < reference_1.letterList.length; w++) {
2757             let letterForms = unicode_arabic_1.default[reference_1.letterList[w]];
2758             let versions = Object.keys(letterForms);
2759             for (let v = 0; v < versions.length; v++) {
2760               let localVersion = letterForms[versions[v]];
2761               if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2762                 let embeddedForms = Object.keys(localVersion);
2763                 for (let ef = 0; ef < embeddedForms.length; ef++) {
2764                   let form = localVersion[embeddedForms[ef]];
2765                   if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2766                     if (form === letter) {
2767                       if (breakPresentationForm && localVersion["normal"] && ["isolated", "initial", "medial", "final"].indexOf(embeddedForms[ef]) > -1) {
2768                         if (typeof localVersion["normal"] === "object") {
2769                           returnable += localVersion["normal"][0];
2770                         } else {
2771                           returnable += localVersion["normal"];
2772                         }
2773                         return;
2774                       }
2775                       returnable += letter;
2776                       return;
2777                     } else if (typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2778                       returnable += form[0];
2779                       return;
2780                     }
2781                   }
2782                 }
2783               } else if (localVersion === letter) {
2784                 if (breakPresentationForm && letterForms["normal"] && ["isolated", "initial", "medial", "final"].indexOf(versions[v]) > -1) {
2785                   if (typeof letterForms["normal"] === "object") {
2786                     returnable += letterForms["normal"][0];
2787                   } else {
2788                     returnable += letterForms["normal"];
2789                   }
2790                   return;
2791                 }
2792                 returnable += letter;
2793                 return;
2794               } else if (typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2795                 returnable += localVersion[0];
2796                 return;
2797               }
2798             }
2799           }
2800           for (let v2 = 0; v2 < reference_1.ligatureList.length; v2++) {
2801             let normalForm = reference_1.ligatureList[v2];
2802             if (normalForm !== "words") {
2803               let ligForms = Object.keys(unicode_ligatures_1.default[normalForm]);
2804               for (let f2 = 0; f2 < ligForms.length; f2++) {
2805                 if (unicode_ligatures_1.default[normalForm][ligForms[f2]] === letter) {
2806                   returnable += normalForm;
2807                   return;
2808                 }
2809               }
2810             }
2811           }
2812           for (let v3 = 0; v3 < reference_1.ligatureWordList.length; v3++) {
2813             let normalForm = reference_1.ligatureWordList[v3];
2814             if (unicode_ligatures_1.default.words[normalForm] === letter) {
2815               returnable += normalForm;
2816               return;
2817             }
2818           }
2819           returnable += letter;
2820         });
2821         return returnable;
2822       }
2823       exports2.Normal = Normal;
2824     }
2825   });
2826
2827   // node_modules/alif-toolkit/lib/CharShaper.js
2828   var require_CharShaper = __commonJS({
2829     "node_modules/alif-toolkit/lib/CharShaper.js"(exports2) {
2830       "use strict";
2831       Object.defineProperty(exports2, "__esModule", { value: true });
2832       var unicode_arabic_1 = require_unicode_arabic();
2833       var isArabic_1 = require_isArabic();
2834       var reference_1 = require_reference();
2835       function CharShaper(letter, form) {
2836         if (!isArabic_1.isArabic(letter)) {
2837           throw new Error("Not Arabic");
2838         }
2839         if (letter === "\u0621") {
2840           return "\u0621";
2841         }
2842         for (let w = 0; w < reference_1.letterList.length; w++) {
2843           let letterForms = unicode_arabic_1.default[reference_1.letterList[w]];
2844           let versions = Object.keys(letterForms);
2845           for (let v = 0; v < versions.length; v++) {
2846             let localVersion = letterForms[versions[v]];
2847             if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2848               if (versions.indexOf(form) > -1) {
2849                 return letterForms[form];
2850               }
2851             } else if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2852               let embeddedVersions = Object.keys(localVersion);
2853               for (let ev = 0; ev < embeddedVersions.length; ev++) {
2854                 if (localVersion[embeddedVersions[ev]] === letter || typeof localVersion[embeddedVersions[ev]] === "object" && localVersion[embeddedVersions[ev]].indexOf && localVersion[embeddedVersions[ev]].indexOf(letter) > -1) {
2855                   if (embeddedVersions.indexOf(form) > -1) {
2856                     return localVersion[form];
2857                   }
2858                 }
2859               }
2860             }
2861           }
2862         }
2863       }
2864       exports2.CharShaper = CharShaper;
2865     }
2866   });
2867
2868   // node_modules/alif-toolkit/lib/WordShaper.js
2869   var require_WordShaper = __commonJS({
2870     "node_modules/alif-toolkit/lib/WordShaper.js"(exports2) {
2871       "use strict";
2872       Object.defineProperty(exports2, "__esModule", { value: true });
2873       var isArabic_1 = require_isArabic();
2874       var reference_1 = require_reference();
2875       var CharShaper_1 = require_CharShaper();
2876       var unicode_ligatures_1 = require_unicode_ligatures();
2877       function WordShaper2(word) {
2878         let state = "initial";
2879         let output = "";
2880         for (let w = 0; w < word.length; w++) {
2881           let nextLetter = " ";
2882           for (let nxw = w + 1; nxw < word.length; nxw++) {
2883             if (!isArabic_1.isArabic(word[nxw])) {
2884               break;
2885             }
2886             if (reference_1.tashkeel.indexOf(word[nxw]) === -1) {
2887               nextLetter = word[nxw];
2888               break;
2889             }
2890           }
2891           if (!isArabic_1.isArabic(word[w]) || isArabic_1.isMath(word[w])) {
2892             output += word[w];
2893             state = "initial";
2894           } else if (reference_1.tashkeel.indexOf(word[w]) > -1) {
2895             output += word[w];
2896           } else if (nextLetter === " " || reference_1.lineBreakers.indexOf(word[w]) > -1) {
2897             output += CharShaper_1.CharShaper(word[w], state === "initial" ? "isolated" : "final");
2898             state = "initial";
2899           } else if (reference_1.lams.indexOf(word[w]) > -1 && reference_1.alefs.indexOf(nextLetter) > -1) {
2900             output += unicode_ligatures_1.default[word[w] + nextLetter][state === "initial" ? "isolated" : "final"];
2901             while (word[w] !== nextLetter) {
2902               w++;
2903             }
2904             state = "initial";
2905           } else {
2906             output += CharShaper_1.CharShaper(word[w], state);
2907             state = "medial";
2908           }
2909         }
2910         return output;
2911       }
2912       exports2.WordShaper = WordShaper2;
2913     }
2914   });
2915
2916   // node_modules/alif-toolkit/lib/ParentLetter.js
2917   var require_ParentLetter = __commonJS({
2918     "node_modules/alif-toolkit/lib/ParentLetter.js"(exports2) {
2919       "use strict";
2920       Object.defineProperty(exports2, "__esModule", { value: true });
2921       var unicode_arabic_1 = require_unicode_arabic();
2922       var isArabic_1 = require_isArabic();
2923       var reference_1 = require_reference();
2924       function ParentLetter(letter) {
2925         if (!isArabic_1.isArabic(letter)) {
2926           throw new Error("Not an Arabic letter");
2927         }
2928         for (let w = 0; w < reference_1.letterList.length; w++) {
2929           let letterForms = unicode_arabic_1.default[reference_1.letterList[w]];
2930           let versions = Object.keys(letterForms);
2931           for (let v = 0; v < versions.length; v++) {
2932             let localVersion = letterForms[versions[v]];
2933             if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2934               let embeddedForms = Object.keys(localVersion);
2935               for (let ef = 0; ef < embeddedForms.length; ef++) {
2936                 let form = localVersion[embeddedForms[ef]];
2937                 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2938                   return localVersion;
2939                 }
2940               }
2941             } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2942               return letterForms;
2943             }
2944           }
2945           return null;
2946         }
2947       }
2948       exports2.ParentLetter = ParentLetter;
2949       function GrandparentLetter(letter) {
2950         if (!isArabic_1.isArabic(letter)) {
2951           throw new Error("Not an Arabic letter");
2952         }
2953         for (let w = 0; w < reference_1.letterList.length; w++) {
2954           let letterForms = unicode_arabic_1.default[reference_1.letterList[w]];
2955           let versions = Object.keys(letterForms);
2956           for (let v = 0; v < versions.length; v++) {
2957             let localVersion = letterForms[versions[v]];
2958             if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2959               let embeddedForms = Object.keys(localVersion);
2960               for (let ef = 0; ef < embeddedForms.length; ef++) {
2961                 let form = localVersion[embeddedForms[ef]];
2962                 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2963                   return letterForms;
2964                 }
2965               }
2966             } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2967               return letterForms;
2968             }
2969           }
2970           return null;
2971         }
2972       }
2973       exports2.GrandparentLetter = GrandparentLetter;
2974     }
2975   });
2976
2977   // node_modules/alif-toolkit/lib/index.js
2978   var require_lib = __commonJS({
2979     "node_modules/alif-toolkit/lib/index.js"(exports2) {
2980       "use strict";
2981       Object.defineProperty(exports2, "__esModule", { value: true });
2982       var isArabic_1 = require_isArabic();
2983       exports2.isArabic = isArabic_1.isArabic;
2984       var GlyphSplitter_1 = require_GlyphSplitter();
2985       exports2.GlyphSplitter = GlyphSplitter_1.GlyphSplitter;
2986       var BaselineSplitter_1 = require_BaselineSplitter();
2987       exports2.BaselineSplitter = BaselineSplitter_1.BaselineSplitter;
2988       var Normalization_1 = require_Normalization();
2989       exports2.Normal = Normalization_1.Normal;
2990       var CharShaper_1 = require_CharShaper();
2991       exports2.CharShaper = CharShaper_1.CharShaper;
2992       var WordShaper_1 = require_WordShaper();
2993       exports2.WordShaper = WordShaper_1.WordShaper;
2994       var ParentLetter_1 = require_ParentLetter();
2995       exports2.ParentLetter = ParentLetter_1.ParentLetter;
2996       exports2.GrandparentLetter = ParentLetter_1.GrandparentLetter;
2997     }
2998   });
2999
3000   // node_modules/vparse/index.js
3001   var require_vparse = __commonJS({
3002     "node_modules/vparse/index.js"(exports2, module2) {
3003       (function(window2) {
3004         "use strict";
3005         function parseVersion3(v) {
3006           var m = v.replace(/[^0-9.]/g, "").match(/[0-9]*\.|[0-9]+/g) || [];
3007           v = {
3008             major: +m[0] || 0,
3009             minor: +m[1] || 0,
3010             patch: +m[2] || 0,
3011             build: +m[3] || 0
3012           };
3013           v.isEmpty = !v.major && !v.minor && !v.patch && !v.build;
3014           v.parsed = [v.major, v.minor, v.patch, v.build];
3015           v.text = v.parsed.join(".");
3016           v.compare = compare;
3017           return v;
3018         }
3019         function compare(v) {
3020           if (typeof v === "string") {
3021             v = parseVersion3(v);
3022           }
3023           for (var i2 = 0; i2 < 4; i2++) {
3024             if (this.parsed[i2] !== v.parsed[i2]) {
3025               return this.parsed[i2] > v.parsed[i2] ? 1 : -1;
3026             }
3027           }
3028           return 0;
3029         }
3030         if (typeof module2 === "object" && module2 && typeof module2.exports === "object") {
3031           module2.exports = parseVersion3;
3032         } else {
3033           window2.parseVersion = parseVersion3;
3034         }
3035       })(exports2);
3036     }
3037   });
3038
3039   // node_modules/which-polygon/node_modules/quickselect/quickselect.js
3040   var require_quickselect = __commonJS({
3041     "node_modules/which-polygon/node_modules/quickselect/quickselect.js"(exports2, module2) {
3042       (function(global3, factory) {
3043         typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global3.quickselect = factory();
3044       })(exports2, function() {
3045         "use strict";
3046         function quickselect2(arr, k, left, right, compare) {
3047           quickselectStep(arr, k, left || 0, right || arr.length - 1, compare || defaultCompare);
3048         }
3049         function quickselectStep(arr, k, left, right, compare) {
3050           while (right > left) {
3051             if (right - left > 600) {
3052               var n2 = right - left + 1;
3053               var m = k - left + 1;
3054               var z = Math.log(n2);
3055               var s = 0.5 * Math.exp(2 * z / 3);
3056               var sd = 0.5 * Math.sqrt(z * s * (n2 - s) / n2) * (m - n2 / 2 < 0 ? -1 : 1);
3057               var newLeft = Math.max(left, Math.floor(k - m * s / n2 + sd));
3058               var newRight = Math.min(right, Math.floor(k + (n2 - m) * s / n2 + sd));
3059               quickselectStep(arr, k, newLeft, newRight, compare);
3060             }
3061             var t = arr[k];
3062             var i2 = left;
3063             var j2 = right;
3064             swap2(arr, left, k);
3065             if (compare(arr[right], t) > 0)
3066               swap2(arr, left, right);
3067             while (i2 < j2) {
3068               swap2(arr, i2, j2);
3069               i2++;
3070               j2--;
3071               while (compare(arr[i2], t) < 0)
3072                 i2++;
3073               while (compare(arr[j2], t) > 0)
3074                 j2--;
3075             }
3076             if (compare(arr[left], t) === 0)
3077               swap2(arr, left, j2);
3078             else {
3079               j2++;
3080               swap2(arr, j2, right);
3081             }
3082             if (j2 <= k)
3083               left = j2 + 1;
3084             if (k <= j2)
3085               right = j2 - 1;
3086           }
3087         }
3088         function swap2(arr, i2, j2) {
3089           var tmp = arr[i2];
3090           arr[i2] = arr[j2];
3091           arr[j2] = tmp;
3092         }
3093         function defaultCompare(a, b) {
3094           return a < b ? -1 : a > b ? 1 : 0;
3095         }
3096         return quickselect2;
3097       });
3098     }
3099   });
3100
3101   // node_modules/which-polygon/node_modules/rbush/index.js
3102   var require_rbush = __commonJS({
3103     "node_modules/which-polygon/node_modules/rbush/index.js"(exports2, module2) {
3104       "use strict";
3105       module2.exports = rbush;
3106       module2.exports.default = rbush;
3107       var quickselect2 = require_quickselect();
3108       function rbush(maxEntries, format2) {
3109         if (!(this instanceof rbush))
3110           return new rbush(maxEntries, format2);
3111         this._maxEntries = Math.max(4, maxEntries || 9);
3112         this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
3113         if (format2) {
3114           this._initFormat(format2);
3115         }
3116         this.clear();
3117       }
3118       rbush.prototype = {
3119         all: function() {
3120           return this._all(this.data, []);
3121         },
3122         search: function(bbox2) {
3123           var node = this.data, result = [], toBBox = this.toBBox;
3124           if (!intersects(bbox2, node))
3125             return result;
3126           var nodesToSearch = [], i2, len, child, childBBox;
3127           while (node) {
3128             for (i2 = 0, len = node.children.length; i2 < len; i2++) {
3129               child = node.children[i2];
3130               childBBox = node.leaf ? toBBox(child) : child;
3131               if (intersects(bbox2, childBBox)) {
3132                 if (node.leaf)
3133                   result.push(child);
3134                 else if (contains(bbox2, childBBox))
3135                   this._all(child, result);
3136                 else
3137                   nodesToSearch.push(child);
3138               }
3139             }
3140             node = nodesToSearch.pop();
3141           }
3142           return result;
3143         },
3144         collides: function(bbox2) {
3145           var node = this.data, toBBox = this.toBBox;
3146           if (!intersects(bbox2, node))
3147             return false;
3148           var nodesToSearch = [], i2, len, child, childBBox;
3149           while (node) {
3150             for (i2 = 0, len = node.children.length; i2 < len; i2++) {
3151               child = node.children[i2];
3152               childBBox = node.leaf ? toBBox(child) : child;
3153               if (intersects(bbox2, childBBox)) {
3154                 if (node.leaf || contains(bbox2, childBBox))
3155                   return true;
3156                 nodesToSearch.push(child);
3157               }
3158             }
3159             node = nodesToSearch.pop();
3160           }
3161           return false;
3162         },
3163         load: function(data) {
3164           if (!(data && data.length))
3165             return this;
3166           if (data.length < this._minEntries) {
3167             for (var i2 = 0, len = data.length; i2 < len; i2++) {
3168               this.insert(data[i2]);
3169             }
3170             return this;
3171           }
3172           var node = this._build(data.slice(), 0, data.length - 1, 0);
3173           if (!this.data.children.length) {
3174             this.data = node;
3175           } else if (this.data.height === node.height) {
3176             this._splitRoot(this.data, node);
3177           } else {
3178             if (this.data.height < node.height) {
3179               var tmpNode = this.data;
3180               this.data = node;
3181               node = tmpNode;
3182             }
3183             this._insert(node, this.data.height - node.height - 1, true);
3184           }
3185           return this;
3186         },
3187         insert: function(item) {
3188           if (item)
3189             this._insert(item, this.data.height - 1);
3190           return this;
3191         },
3192         clear: function() {
3193           this.data = createNode([]);
3194           return this;
3195         },
3196         remove: function(item, equalsFn) {
3197           if (!item)
3198             return this;
3199           var node = this.data, bbox2 = this.toBBox(item), path = [], indexes = [], i2, parent, index, goingUp;
3200           while (node || path.length) {
3201             if (!node) {
3202               node = path.pop();
3203               parent = path[path.length - 1];
3204               i2 = indexes.pop();
3205               goingUp = true;
3206             }
3207             if (node.leaf) {
3208               index = findItem(item, node.children, equalsFn);
3209               if (index !== -1) {
3210                 node.children.splice(index, 1);
3211                 path.push(node);
3212                 this._condense(path);
3213                 return this;
3214               }
3215             }
3216             if (!goingUp && !node.leaf && contains(node, bbox2)) {
3217               path.push(node);
3218               indexes.push(i2);
3219               i2 = 0;
3220               parent = node;
3221               node = node.children[0];
3222             } else if (parent) {
3223               i2++;
3224               node = parent.children[i2];
3225               goingUp = false;
3226             } else
3227               node = null;
3228           }
3229           return this;
3230         },
3231         toBBox: function(item) {
3232           return item;
3233         },
3234         compareMinX: compareNodeMinX,
3235         compareMinY: compareNodeMinY,
3236         toJSON: function() {
3237           return this.data;
3238         },
3239         fromJSON: function(data) {
3240           this.data = data;
3241           return this;
3242         },
3243         _all: function(node, result) {
3244           var nodesToSearch = [];
3245           while (node) {
3246             if (node.leaf)
3247               result.push.apply(result, node.children);
3248             else
3249               nodesToSearch.push.apply(nodesToSearch, node.children);
3250             node = nodesToSearch.pop();
3251           }
3252           return result;
3253         },
3254         _build: function(items, left, right, height) {
3255           var N = right - left + 1, M = this._maxEntries, node;
3256           if (N <= M) {
3257             node = createNode(items.slice(left, right + 1));
3258             calcBBox(node, this.toBBox);
3259             return node;
3260           }
3261           if (!height) {
3262             height = Math.ceil(Math.log(N) / Math.log(M));
3263             M = Math.ceil(N / Math.pow(M, height - 1));
3264           }
3265           node = createNode([]);
3266           node.leaf = false;
3267           node.height = height;
3268           var N2 = Math.ceil(N / M), N1 = N2 * Math.ceil(Math.sqrt(M)), i2, j2, right2, right3;
3269           multiSelect(items, left, right, N1, this.compareMinX);
3270           for (i2 = left; i2 <= right; i2 += N1) {
3271             right2 = Math.min(i2 + N1 - 1, right);
3272             multiSelect(items, i2, right2, N2, this.compareMinY);
3273             for (j2 = i2; j2 <= right2; j2 += N2) {
3274               right3 = Math.min(j2 + N2 - 1, right2);
3275               node.children.push(this._build(items, j2, right3, height - 1));
3276             }
3277           }
3278           calcBBox(node, this.toBBox);
3279           return node;
3280         },
3281         _chooseSubtree: function(bbox2, node, level, path) {
3282           var i2, len, child, targetNode, area, enlargement, minArea, minEnlargement;
3283           while (true) {
3284             path.push(node);
3285             if (node.leaf || path.length - 1 === level)
3286               break;
3287             minArea = minEnlargement = Infinity;
3288             for (i2 = 0, len = node.children.length; i2 < len; i2++) {
3289               child = node.children[i2];
3290               area = bboxArea(child);
3291               enlargement = enlargedArea(bbox2, child) - area;
3292               if (enlargement < minEnlargement) {
3293                 minEnlargement = enlargement;
3294                 minArea = area < minArea ? area : minArea;
3295                 targetNode = child;
3296               } else if (enlargement === minEnlargement) {
3297                 if (area < minArea) {
3298                   minArea = area;
3299                   targetNode = child;
3300                 }
3301               }
3302             }
3303             node = targetNode || node.children[0];
3304           }
3305           return node;
3306         },
3307         _insert: function(item, level, isNode) {
3308           var toBBox = this.toBBox, bbox2 = isNode ? item : toBBox(item), insertPath = [];
3309           var node = this._chooseSubtree(bbox2, this.data, level, insertPath);
3310           node.children.push(item);
3311           extend2(node, bbox2);
3312           while (level >= 0) {
3313             if (insertPath[level].children.length > this._maxEntries) {
3314               this._split(insertPath, level);
3315               level--;
3316             } else
3317               break;
3318           }
3319           this._adjustParentBBoxes(bbox2, insertPath, level);
3320         },
3321         // split overflowed node into two
3322         _split: function(insertPath, level) {
3323           var node = insertPath[level], M = node.children.length, m = this._minEntries;
3324           this._chooseSplitAxis(node, m, M);
3325           var splitIndex = this._chooseSplitIndex(node, m, M);
3326           var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
3327           newNode.height = node.height;
3328           newNode.leaf = node.leaf;
3329           calcBBox(node, this.toBBox);
3330           calcBBox(newNode, this.toBBox);
3331           if (level)
3332             insertPath[level - 1].children.push(newNode);
3333           else
3334             this._splitRoot(node, newNode);
3335         },
3336         _splitRoot: function(node, newNode) {
3337           this.data = createNode([node, newNode]);
3338           this.data.height = node.height + 1;
3339           this.data.leaf = false;
3340           calcBBox(this.data, this.toBBox);
3341         },
3342         _chooseSplitIndex: function(node, m, M) {
3343           var i2, bbox1, bbox2, overlap, area, minOverlap, minArea, index;
3344           minOverlap = minArea = Infinity;
3345           for (i2 = m; i2 <= M - m; i2++) {
3346             bbox1 = distBBox(node, 0, i2, this.toBBox);
3347             bbox2 = distBBox(node, i2, M, this.toBBox);
3348             overlap = intersectionArea(bbox1, bbox2);
3349             area = bboxArea(bbox1) + bboxArea(bbox2);
3350             if (overlap < minOverlap) {
3351               minOverlap = overlap;
3352               index = i2;
3353               minArea = area < minArea ? area : minArea;
3354             } else if (overlap === minOverlap) {
3355               if (area < minArea) {
3356                 minArea = area;
3357                 index = i2;
3358               }
3359             }
3360           }
3361           return index;
3362         },
3363         // sorts node children by the best axis for split
3364         _chooseSplitAxis: function(node, m, M) {
3365           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);
3366           if (xMargin < yMargin)
3367             node.children.sort(compareMinX);
3368         },
3369         // total margin of all possible split distributions where each node is at least m full
3370         _allDistMargin: function(node, m, M, compare) {
3371           node.children.sort(compare);
3372           var toBBox = this.toBBox, leftBBox = distBBox(node, 0, m, toBBox), rightBBox = distBBox(node, M - m, M, toBBox), margin = bboxMargin(leftBBox) + bboxMargin(rightBBox), i2, child;
3373           for (i2 = m; i2 < M - m; i2++) {
3374             child = node.children[i2];
3375             extend2(leftBBox, node.leaf ? toBBox(child) : child);
3376             margin += bboxMargin(leftBBox);
3377           }
3378           for (i2 = M - m - 1; i2 >= m; i2--) {
3379             child = node.children[i2];
3380             extend2(rightBBox, node.leaf ? toBBox(child) : child);
3381             margin += bboxMargin(rightBBox);
3382           }
3383           return margin;
3384         },
3385         _adjustParentBBoxes: function(bbox2, path, level) {
3386           for (var i2 = level; i2 >= 0; i2--) {
3387             extend2(path[i2], bbox2);
3388           }
3389         },
3390         _condense: function(path) {
3391           for (var i2 = path.length - 1, siblings; i2 >= 0; i2--) {
3392             if (path[i2].children.length === 0) {
3393               if (i2 > 0) {
3394                 siblings = path[i2 - 1].children;
3395                 siblings.splice(siblings.indexOf(path[i2]), 1);
3396               } else
3397                 this.clear();
3398             } else
3399               calcBBox(path[i2], this.toBBox);
3400           }
3401         },
3402         _initFormat: function(format2) {
3403           var compareArr = ["return a", " - b", ";"];
3404           this.compareMinX = new Function("a", "b", compareArr.join(format2[0]));
3405           this.compareMinY = new Function("a", "b", compareArr.join(format2[1]));
3406           this.toBBox = new Function(
3407             "a",
3408             "return {minX: a" + format2[0] + ", minY: a" + format2[1] + ", maxX: a" + format2[2] + ", maxY: a" + format2[3] + "};"
3409           );
3410         }
3411       };
3412       function findItem(item, items, equalsFn) {
3413         if (!equalsFn)
3414           return items.indexOf(item);
3415         for (var i2 = 0; i2 < items.length; i2++) {
3416           if (equalsFn(item, items[i2]))
3417             return i2;
3418         }
3419         return -1;
3420       }
3421       function calcBBox(node, toBBox) {
3422         distBBox(node, 0, node.children.length, toBBox, node);
3423       }
3424       function distBBox(node, k, p, toBBox, destNode) {
3425         if (!destNode)
3426           destNode = createNode(null);
3427         destNode.minX = Infinity;
3428         destNode.minY = Infinity;
3429         destNode.maxX = -Infinity;
3430         destNode.maxY = -Infinity;
3431         for (var i2 = k, child; i2 < p; i2++) {
3432           child = node.children[i2];
3433           extend2(destNode, node.leaf ? toBBox(child) : child);
3434         }
3435         return destNode;
3436       }
3437       function extend2(a, b) {
3438         a.minX = Math.min(a.minX, b.minX);
3439         a.minY = Math.min(a.minY, b.minY);
3440         a.maxX = Math.max(a.maxX, b.maxX);
3441         a.maxY = Math.max(a.maxY, b.maxY);
3442         return a;
3443       }
3444       function compareNodeMinX(a, b) {
3445         return a.minX - b.minX;
3446       }
3447       function compareNodeMinY(a, b) {
3448         return a.minY - b.minY;
3449       }
3450       function bboxArea(a) {
3451         return (a.maxX - a.minX) * (a.maxY - a.minY);
3452       }
3453       function bboxMargin(a) {
3454         return a.maxX - a.minX + (a.maxY - a.minY);
3455       }
3456       function enlargedArea(a, b) {
3457         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));
3458       }
3459       function intersectionArea(a, b) {
3460         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);
3461         return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
3462       }
3463       function contains(a, b) {
3464         return a.minX <= b.minX && a.minY <= b.minY && b.maxX <= a.maxX && b.maxY <= a.maxY;
3465       }
3466       function intersects(a, b) {
3467         return b.minX <= a.maxX && b.minY <= a.maxY && b.maxX >= a.minX && b.maxY >= a.minY;
3468       }
3469       function createNode(children2) {
3470         return {
3471           children: children2,
3472           height: 1,
3473           leaf: true,
3474           minX: Infinity,
3475           minY: Infinity,
3476           maxX: -Infinity,
3477           maxY: -Infinity
3478         };
3479       }
3480       function multiSelect(arr, left, right, n2, compare) {
3481         var stack = [left, right], mid;
3482         while (stack.length) {
3483           right = stack.pop();
3484           left = stack.pop();
3485           if (right - left <= n2)
3486             continue;
3487           mid = left + Math.ceil((right - left) / n2 / 2) * n2;
3488           quickselect2(arr, mid, left, right, compare);
3489           stack.push(left, mid, mid, right);
3490         }
3491       }
3492     }
3493   });
3494
3495   // node_modules/lineclip/index.js
3496   var require_lineclip = __commonJS({
3497     "node_modules/lineclip/index.js"(exports2, module2) {
3498       "use strict";
3499       module2.exports = lineclip2;
3500       lineclip2.polyline = lineclip2;
3501       lineclip2.polygon = polygonclip2;
3502       function lineclip2(points, bbox2, result) {
3503         var len = points.length, codeA = bitCode2(points[0], bbox2), part = [], i2, a, b, codeB, lastCode;
3504         if (!result)
3505           result = [];
3506         for (i2 = 1; i2 < len; i2++) {
3507           a = points[i2 - 1];
3508           b = points[i2];
3509           codeB = lastCode = bitCode2(b, bbox2);
3510           while (true) {
3511             if (!(codeA | codeB)) {
3512               part.push(a);
3513               if (codeB !== lastCode) {
3514                 part.push(b);
3515                 if (i2 < len - 1) {
3516                   result.push(part);
3517                   part = [];
3518                 }
3519               } else if (i2 === len - 1) {
3520                 part.push(b);
3521               }
3522               break;
3523             } else if (codeA & codeB) {
3524               break;
3525             } else if (codeA) {
3526               a = intersect2(a, b, codeA, bbox2);
3527               codeA = bitCode2(a, bbox2);
3528             } else {
3529               b = intersect2(a, b, codeB, bbox2);
3530               codeB = bitCode2(b, bbox2);
3531             }
3532           }
3533           codeA = lastCode;
3534         }
3535         if (part.length)
3536           result.push(part);
3537         return result;
3538       }
3539       function polygonclip2(points, bbox2) {
3540         var result, edge, prev, prevInside, i2, p, inside;
3541         for (edge = 1; edge <= 8; edge *= 2) {
3542           result = [];
3543           prev = points[points.length - 1];
3544           prevInside = !(bitCode2(prev, bbox2) & edge);
3545           for (i2 = 0; i2 < points.length; i2++) {
3546             p = points[i2];
3547             inside = !(bitCode2(p, bbox2) & edge);
3548             if (inside !== prevInside)
3549               result.push(intersect2(prev, p, edge, bbox2));
3550             if (inside)
3551               result.push(p);
3552             prev = p;
3553             prevInside = inside;
3554           }
3555           points = result;
3556           if (!points.length)
3557             break;
3558         }
3559         return result;
3560       }
3561       function intersect2(a, b, edge, bbox2) {
3562         return edge & 8 ? [a[0] + (b[0] - a[0]) * (bbox2[3] - a[1]) / (b[1] - a[1]), bbox2[3]] : (
3563           // top
3564           edge & 4 ? [a[0] + (b[0] - a[0]) * (bbox2[1] - a[1]) / (b[1] - a[1]), bbox2[1]] : (
3565             // bottom
3566             edge & 2 ? [bbox2[2], a[1] + (b[1] - a[1]) * (bbox2[2] - a[0]) / (b[0] - a[0])] : (
3567               // right
3568               edge & 1 ? [bbox2[0], a[1] + (b[1] - a[1]) * (bbox2[0] - a[0]) / (b[0] - a[0])] : (
3569                 // left
3570                 null
3571               )
3572             )
3573           )
3574         );
3575       }
3576       function bitCode2(p, bbox2) {
3577         var code = 0;
3578         if (p[0] < bbox2[0])
3579           code |= 1;
3580         else if (p[0] > bbox2[2])
3581           code |= 2;
3582         if (p[1] < bbox2[1])
3583           code |= 4;
3584         else if (p[1] > bbox2[3])
3585           code |= 8;
3586         return code;
3587       }
3588     }
3589   });
3590
3591   // node_modules/which-polygon/index.js
3592   var require_which_polygon = __commonJS({
3593     "node_modules/which-polygon/index.js"(exports2, module2) {
3594       "use strict";
3595       var rbush = require_rbush();
3596       var lineclip2 = require_lineclip();
3597       module2.exports = whichPolygon5;
3598       function whichPolygon5(data) {
3599         var bboxes = [];
3600         for (var i2 = 0; i2 < data.features.length; i2++) {
3601           var feature3 = data.features[i2];
3602           if (!feature3.geometry)
3603             continue;
3604           var coords = feature3.geometry.coordinates;
3605           if (feature3.geometry.type === "Polygon") {
3606             bboxes.push(treeItem(coords, feature3.properties));
3607           } else if (feature3.geometry.type === "MultiPolygon") {
3608             for (var j2 = 0; j2 < coords.length; j2++) {
3609               bboxes.push(treeItem(coords[j2], feature3.properties));
3610             }
3611           }
3612         }
3613         var tree = rbush().load(bboxes);
3614         function query(p, multi) {
3615           var output = [], result = tree.search({
3616             minX: p[0],
3617             minY: p[1],
3618             maxX: p[0],
3619             maxY: p[1]
3620           });
3621           for (var i3 = 0; i3 < result.length; i3++) {
3622             if (insidePolygon(result[i3].coords, p)) {
3623               if (multi)
3624                 output.push(result[i3].props);
3625               else
3626                 return result[i3].props;
3627             }
3628           }
3629           return multi && output.length ? output : null;
3630         }
3631         query.tree = tree;
3632         query.bbox = function queryBBox(bbox2) {
3633           var output = [];
3634           var result = tree.search({
3635             minX: bbox2[0],
3636             minY: bbox2[1],
3637             maxX: bbox2[2],
3638             maxY: bbox2[3]
3639           });
3640           for (var i3 = 0; i3 < result.length; i3++) {
3641             if (polygonIntersectsBBox(result[i3].coords, bbox2)) {
3642               output.push(result[i3].props);
3643             }
3644           }
3645           return output;
3646         };
3647         return query;
3648       }
3649       function polygonIntersectsBBox(polygon2, bbox2) {
3650         var bboxCenter = [
3651           (bbox2[0] + bbox2[2]) / 2,
3652           (bbox2[1] + bbox2[3]) / 2
3653         ];
3654         if (insidePolygon(polygon2, bboxCenter))
3655           return true;
3656         for (var i2 = 0; i2 < polygon2.length; i2++) {
3657           if (lineclip2(polygon2[i2], bbox2).length > 0)
3658             return true;
3659         }
3660         return false;
3661       }
3662       function insidePolygon(rings, p) {
3663         var inside = false;
3664         for (var i2 = 0, len = rings.length; i2 < len; i2++) {
3665           var ring = rings[i2];
3666           for (var j2 = 0, len2 = ring.length, k = len2 - 1; j2 < len2; k = j2++) {
3667             if (rayIntersect(p, ring[j2], ring[k]))
3668               inside = !inside;
3669           }
3670         }
3671         return inside;
3672       }
3673       function rayIntersect(p, p1, p2) {
3674         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];
3675       }
3676       function treeItem(coords, props) {
3677         var item = {
3678           minX: Infinity,
3679           minY: Infinity,
3680           maxX: -Infinity,
3681           maxY: -Infinity,
3682           coords,
3683           props
3684         };
3685         for (var i2 = 0; i2 < coords[0].length; i2++) {
3686           var p = coords[0][i2];
3687           item.minX = Math.min(item.minX, p[0]);
3688           item.minY = Math.min(item.minY, p[1]);
3689           item.maxX = Math.max(item.maxX, p[0]);
3690           item.maxY = Math.max(item.maxY, p[1]);
3691         }
3692         return item;
3693       }
3694     }
3695   });
3696
3697   // node_modules/wgs84/index.js
3698   var require_wgs84 = __commonJS({
3699     "node_modules/wgs84/index.js"(exports2, module2) {
3700       module2.exports.RADIUS = 6378137;
3701       module2.exports.FLATTENING = 1 / 298.257223563;
3702       module2.exports.POLAR_RADIUS = 63567523142e-4;
3703     }
3704   });
3705
3706   // node_modules/@mapbox/geojson-area/index.js
3707   var require_geojson_area = __commonJS({
3708     "node_modules/@mapbox/geojson-area/index.js"(exports2, module2) {
3709       var wgs84 = require_wgs84();
3710       module2.exports.geometry = geometry;
3711       module2.exports.ring = ringArea;
3712       function geometry(_) {
3713         var area = 0, i2;
3714         switch (_.type) {
3715           case "Polygon":
3716             return polygonArea(_.coordinates);
3717           case "MultiPolygon":
3718             for (i2 = 0; i2 < _.coordinates.length; i2++) {
3719               area += polygonArea(_.coordinates[i2]);
3720             }
3721             return area;
3722           case "Point":
3723           case "MultiPoint":
3724           case "LineString":
3725           case "MultiLineString":
3726             return 0;
3727           case "GeometryCollection":
3728             for (i2 = 0; i2 < _.geometries.length; i2++) {
3729               area += geometry(_.geometries[i2]);
3730             }
3731             return area;
3732         }
3733       }
3734       function polygonArea(coords) {
3735         var area = 0;
3736         if (coords && coords.length > 0) {
3737           area += Math.abs(ringArea(coords[0]));
3738           for (var i2 = 1; i2 < coords.length; i2++) {
3739             area -= Math.abs(ringArea(coords[i2]));
3740           }
3741         }
3742         return area;
3743       }
3744       function ringArea(coords) {
3745         var p1, p2, p3, lowerIndex, middleIndex, upperIndex, i2, area = 0, coordsLength = coords.length;
3746         if (coordsLength > 2) {
3747           for (i2 = 0; i2 < coordsLength; i2++) {
3748             if (i2 === coordsLength - 2) {
3749               lowerIndex = coordsLength - 2;
3750               middleIndex = coordsLength - 1;
3751               upperIndex = 0;
3752             } else if (i2 === coordsLength - 1) {
3753               lowerIndex = coordsLength - 1;
3754               middleIndex = 0;
3755               upperIndex = 1;
3756             } else {
3757               lowerIndex = i2;
3758               middleIndex = i2 + 1;
3759               upperIndex = i2 + 2;
3760             }
3761             p1 = coords[lowerIndex];
3762             p2 = coords[middleIndex];
3763             p3 = coords[upperIndex];
3764             area += (rad(p3[0]) - rad(p1[0])) * Math.sin(rad(p2[1]));
3765           }
3766           area = area * wgs84.RADIUS * wgs84.RADIUS / 2;
3767         }
3768         return area;
3769       }
3770       function rad(_) {
3771         return _ * Math.PI / 180;
3772       }
3773     }
3774   });
3775
3776   // node_modules/circle-to-polygon/input-validation/validateCenter.js
3777   var require_validateCenter = __commonJS({
3778     "node_modules/circle-to-polygon/input-validation/validateCenter.js"(exports2) {
3779       exports2.validateCenter = function validateCenter(center) {
3780         var validCenterLengths = [2, 3];
3781         if (!Array.isArray(center) || !validCenterLengths.includes(center.length)) {
3782           throw new Error("ERROR! Center has to be an array of length two or three");
3783         }
3784         var [lng, lat] = center;
3785         if (typeof lng !== "number" || typeof lat !== "number") {
3786           throw new Error(
3787             `ERROR! Longitude and Latitude has to be numbers but where ${typeof lng} and ${typeof lat}`
3788           );
3789         }
3790         if (lng > 180 || lng < -180) {
3791           throw new Error(`ERROR! Longitude has to be between -180 and 180 but was ${lng}`);
3792         }
3793         if (lat > 90 || lat < -90) {
3794           throw new Error(`ERROR! Latitude has to be between -90 and 90 but was ${lat}`);
3795         }
3796       };
3797     }
3798   });
3799
3800   // node_modules/circle-to-polygon/input-validation/validateRadius.js
3801   var require_validateRadius = __commonJS({
3802     "node_modules/circle-to-polygon/input-validation/validateRadius.js"(exports2) {
3803       exports2.validateRadius = function validateRadius(radius) {
3804         if (typeof radius !== "number") {
3805           throw new Error(`ERROR! Radius has to be a positive number but was: ${typeof radius}`);
3806         }
3807         if (radius <= 0) {
3808           throw new Error(`ERROR! Radius has to be a positive number but was: ${radius}`);
3809         }
3810       };
3811     }
3812   });
3813
3814   // node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js
3815   var require_validateNumberOfEdges = __commonJS({
3816     "node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js"(exports2) {
3817       exports2.validateNumberOfEdges = function validateNumberOfEdges(numberOfEdges) {
3818         if (typeof numberOfEdges !== "number") {
3819           const ARGUMENT_TYPE = Array.isArray(numberOfEdges) ? "array" : typeof numberOfEdges;
3820           throw new Error(`ERROR! Number of edges has to be a number but was: ${ARGUMENT_TYPE}`);
3821         }
3822         if (numberOfEdges < 3) {
3823           throw new Error(`ERROR! Number of edges has to be at least 3 but was: ${numberOfEdges}`);
3824         }
3825       };
3826     }
3827   });
3828
3829   // node_modules/circle-to-polygon/input-validation/validateEarthRadius.js
3830   var require_validateEarthRadius = __commonJS({
3831     "node_modules/circle-to-polygon/input-validation/validateEarthRadius.js"(exports2) {
3832       exports2.validateEarthRadius = function validateEarthRadius(earthRadius2) {
3833         if (typeof earthRadius2 !== "number") {
3834           const ARGUMENT_TYPE = Array.isArray(earthRadius2) ? "array" : typeof earthRadius2;
3835           throw new Error(`ERROR! Earth radius has to be a number but was: ${ARGUMENT_TYPE}`);
3836         }
3837         if (earthRadius2 <= 0) {
3838           throw new Error(`ERROR! Earth radius has to be a positive number but was: ${earthRadius2}`);
3839         }
3840       };
3841     }
3842   });
3843
3844   // node_modules/circle-to-polygon/input-validation/validateBearing.js
3845   var require_validateBearing = __commonJS({
3846     "node_modules/circle-to-polygon/input-validation/validateBearing.js"(exports2) {
3847       exports2.validateBearing = function validateBearing(bearing) {
3848         if (typeof bearing !== "number") {
3849           const ARGUMENT_TYPE = Array.isArray(bearing) ? "array" : typeof bearing;
3850           throw new Error(`ERROR! Bearing has to be a number but was: ${ARGUMENT_TYPE}`);
3851         }
3852       };
3853     }
3854   });
3855
3856   // node_modules/circle-to-polygon/input-validation/index.js
3857   var require_input_validation = __commonJS({
3858     "node_modules/circle-to-polygon/input-validation/index.js"(exports2) {
3859       var validateCenter = require_validateCenter().validateCenter;
3860       var validateRadius = require_validateRadius().validateRadius;
3861       var validateNumberOfEdges = require_validateNumberOfEdges().validateNumberOfEdges;
3862       var validateEarthRadius = require_validateEarthRadius().validateEarthRadius;
3863       var validateBearing = require_validateBearing().validateBearing;
3864       function validateInput({ center, radius, numberOfEdges, earthRadius: earthRadius2, bearing }) {
3865         validateCenter(center);
3866         validateRadius(radius);
3867         validateNumberOfEdges(numberOfEdges);
3868         validateEarthRadius(earthRadius2);
3869         validateBearing(bearing);
3870       }
3871       exports2.validateCenter = validateCenter;
3872       exports2.validateRadius = validateRadius;
3873       exports2.validateNumberOfEdges = validateNumberOfEdges;
3874       exports2.validateEarthRadius = validateEarthRadius;
3875       exports2.validateBearing = validateBearing;
3876       exports2.validateInput = validateInput;
3877     }
3878   });
3879
3880   // node_modules/circle-to-polygon/index.js
3881   var require_circle_to_polygon = __commonJS({
3882     "node_modules/circle-to-polygon/index.js"(exports2, module2) {
3883       "use strict";
3884       var { validateInput } = require_input_validation();
3885       var defaultEarthRadius = 6378137;
3886       function toRadians(angleInDegrees) {
3887         return angleInDegrees * Math.PI / 180;
3888       }
3889       function toDegrees(angleInRadians) {
3890         return angleInRadians * 180 / Math.PI;
3891       }
3892       function offset(c1, distance, earthRadius2, bearing) {
3893         var lat1 = toRadians(c1[1]);
3894         var lon1 = toRadians(c1[0]);
3895         var dByR = distance / earthRadius2;
3896         var lat = Math.asin(
3897           Math.sin(lat1) * Math.cos(dByR) + Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing)
3898         );
3899         var lon = lon1 + Math.atan2(
3900           Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1),
3901           Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat)
3902         );
3903         return [toDegrees(lon), toDegrees(lat)];
3904       }
3905       module2.exports = function circleToPolygon2(center, radius, options2) {
3906         var n2 = getNumberOfEdges(options2);
3907         var earthRadius2 = getEarthRadius(options2);
3908         var bearing = getBearing(options2);
3909         var direction = getDirection(options2);
3910         validateInput({ center, radius, numberOfEdges: n2, earthRadius: earthRadius2, bearing });
3911         var start2 = toRadians(bearing);
3912         var coordinates = [];
3913         for (var i2 = 0; i2 < n2; ++i2) {
3914           coordinates.push(
3915             offset(
3916               center,
3917               radius,
3918               earthRadius2,
3919               start2 + direction * 2 * Math.PI * -i2 / n2
3920             )
3921           );
3922         }
3923         coordinates.push(coordinates[0]);
3924         return {
3925           type: "Polygon",
3926           coordinates: [coordinates]
3927         };
3928       };
3929       function getNumberOfEdges(options2) {
3930         if (isUndefinedOrNull(options2)) {
3931           return 32;
3932         } else if (isObjectNotArray(options2)) {
3933           var numberOfEdges = options2.numberOfEdges;
3934           return numberOfEdges === void 0 ? 32 : numberOfEdges;
3935         }
3936         return options2;
3937       }
3938       function getEarthRadius(options2) {
3939         if (isUndefinedOrNull(options2)) {
3940           return defaultEarthRadius;
3941         } else if (isObjectNotArray(options2)) {
3942           var earthRadius2 = options2.earthRadius;
3943           return earthRadius2 === void 0 ? defaultEarthRadius : earthRadius2;
3944         }
3945         return defaultEarthRadius;
3946       }
3947       function getDirection(options2) {
3948         if (isObjectNotArray(options2) && options2.rightHandRule) {
3949           return -1;
3950         }
3951         return 1;
3952       }
3953       function getBearing(options2) {
3954         if (isUndefinedOrNull(options2)) {
3955           return 0;
3956         } else if (isObjectNotArray(options2)) {
3957           var bearing = options2.bearing;
3958           return bearing === void 0 ? 0 : bearing;
3959         }
3960         return 0;
3961       }
3962       function isObjectNotArray(argument) {
3963         return argument !== null && typeof argument === "object" && !Array.isArray(argument);
3964       }
3965       function isUndefinedOrNull(argument) {
3966         return argument === null || argument === void 0;
3967       }
3968     }
3969   });
3970
3971   // node_modules/polygon-clipping/dist/polygon-clipping.umd.js
3972   var require_polygon_clipping_umd = __commonJS({
3973     "node_modules/polygon-clipping/dist/polygon-clipping.umd.js"(exports2, module2) {
3974       (function(global3, factory) {
3975         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());
3976       })(exports2, function() {
3977         "use strict";
3978         function _classCallCheck(instance, Constructor) {
3979           if (!(instance instanceof Constructor)) {
3980             throw new TypeError("Cannot call a class as a function");
3981           }
3982         }
3983         function _defineProperties(target, props) {
3984           for (var i2 = 0; i2 < props.length; i2++) {
3985             var descriptor = props[i2];
3986             descriptor.enumerable = descriptor.enumerable || false;
3987             descriptor.configurable = true;
3988             if ("value" in descriptor)
3989               descriptor.writable = true;
3990             Object.defineProperty(target, descriptor.key, descriptor);
3991           }
3992         }
3993         function _createClass(Constructor, protoProps, staticProps) {
3994           if (protoProps)
3995             _defineProperties(Constructor.prototype, protoProps);
3996           if (staticProps)
3997             _defineProperties(Constructor, staticProps);
3998           return Constructor;
3999         }
4000         var Node = (
4001           /** @class */
4002           function() {
4003             function Node2(key, data) {
4004               this.next = null;
4005               this.key = key;
4006               this.data = data;
4007               this.left = null;
4008               this.right = null;
4009             }
4010             return Node2;
4011           }()
4012         );
4013         function DEFAULT_COMPARE(a, b) {
4014           return a > b ? 1 : a < b ? -1 : 0;
4015         }
4016         function splay(i2, t, comparator) {
4017           var N = new Node(null, null);
4018           var l = N;
4019           var r = N;
4020           while (true) {
4021             var cmp2 = comparator(i2, t.key);
4022             if (cmp2 < 0) {
4023               if (t.left === null)
4024                 break;
4025               if (comparator(i2, t.left.key) < 0) {
4026                 var y = t.left;
4027                 t.left = y.right;
4028                 y.right = t;
4029                 t = y;
4030                 if (t.left === null)
4031                   break;
4032               }
4033               r.left = t;
4034               r = t;
4035               t = t.left;
4036             } else if (cmp2 > 0) {
4037               if (t.right === null)
4038                 break;
4039               if (comparator(i2, t.right.key) > 0) {
4040                 var y = t.right;
4041                 t.right = y.left;
4042                 y.left = t;
4043                 t = y;
4044                 if (t.right === null)
4045                   break;
4046               }
4047               l.right = t;
4048               l = t;
4049               t = t.right;
4050             } else
4051               break;
4052           }
4053           l.right = t.left;
4054           r.left = t.right;
4055           t.left = N.right;
4056           t.right = N.left;
4057           return t;
4058         }
4059         function insert(i2, data, t, comparator) {
4060           var node = new Node(i2, data);
4061           if (t === null) {
4062             node.left = node.right = null;
4063             return node;
4064           }
4065           t = splay(i2, t, comparator);
4066           var cmp2 = comparator(i2, t.key);
4067           if (cmp2 < 0) {
4068             node.left = t.left;
4069             node.right = t;
4070             t.left = null;
4071           } else if (cmp2 >= 0) {
4072             node.right = t.right;
4073             node.left = t;
4074             t.right = null;
4075           }
4076           return node;
4077         }
4078         function split(key, v, comparator) {
4079           var left = null;
4080           var right = null;
4081           if (v) {
4082             v = splay(key, v, comparator);
4083             var cmp2 = comparator(v.key, key);
4084             if (cmp2 === 0) {
4085               left = v.left;
4086               right = v.right;
4087             } else if (cmp2 < 0) {
4088               right = v.right;
4089               v.right = null;
4090               left = v;
4091             } else {
4092               left = v.left;
4093               v.left = null;
4094               right = v;
4095             }
4096           }
4097           return {
4098             left,
4099             right
4100           };
4101         }
4102         function merge2(left, right, comparator) {
4103           if (right === null)
4104             return left;
4105           if (left === null)
4106             return right;
4107           right = splay(left.key, right, comparator);
4108           right.left = left;
4109           return right;
4110         }
4111         function printRow(root3, prefix, isTail, out, printNode) {
4112           if (root3) {
4113             out("" + prefix + (isTail ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ") + printNode(root3) + "\n");
4114             var indent2 = prefix + (isTail ? "    " : "\u2502   ");
4115             if (root3.left)
4116               printRow(root3.left, indent2, false, out, printNode);
4117             if (root3.right)
4118               printRow(root3.right, indent2, true, out, printNode);
4119           }
4120         }
4121         var Tree = (
4122           /** @class */
4123           function() {
4124             function Tree2(comparator) {
4125               if (comparator === void 0) {
4126                 comparator = DEFAULT_COMPARE;
4127               }
4128               this._root = null;
4129               this._size = 0;
4130               this._comparator = comparator;
4131             }
4132             Tree2.prototype.insert = function(key, data) {
4133               this._size++;
4134               return this._root = insert(key, data, this._root, this._comparator);
4135             };
4136             Tree2.prototype.add = function(key, data) {
4137               var node = new Node(key, data);
4138               if (this._root === null) {
4139                 node.left = node.right = null;
4140                 this._size++;
4141                 this._root = node;
4142               }
4143               var comparator = this._comparator;
4144               var t = splay(key, this._root, comparator);
4145               var cmp2 = comparator(key, t.key);
4146               if (cmp2 === 0)
4147                 this._root = t;
4148               else {
4149                 if (cmp2 < 0) {
4150                   node.left = t.left;
4151                   node.right = t;
4152                   t.left = null;
4153                 } else if (cmp2 > 0) {
4154                   node.right = t.right;
4155                   node.left = t;
4156                   t.right = null;
4157                 }
4158                 this._size++;
4159                 this._root = node;
4160               }
4161               return this._root;
4162             };
4163             Tree2.prototype.remove = function(key) {
4164               this._root = this._remove(key, this._root, this._comparator);
4165             };
4166             Tree2.prototype._remove = function(i2, t, comparator) {
4167               var x;
4168               if (t === null)
4169                 return null;
4170               t = splay(i2, t, comparator);
4171               var cmp2 = comparator(i2, t.key);
4172               if (cmp2 === 0) {
4173                 if (t.left === null) {
4174                   x = t.right;
4175                 } else {
4176                   x = splay(i2, t.left, comparator);
4177                   x.right = t.right;
4178                 }
4179                 this._size--;
4180                 return x;
4181               }
4182               return t;
4183             };
4184             Tree2.prototype.pop = function() {
4185               var node = this._root;
4186               if (node) {
4187                 while (node.left) {
4188                   node = node.left;
4189                 }
4190                 this._root = splay(node.key, this._root, this._comparator);
4191                 this._root = this._remove(node.key, this._root, this._comparator);
4192                 return {
4193                   key: node.key,
4194                   data: node.data
4195                 };
4196               }
4197               return null;
4198             };
4199             Tree2.prototype.findStatic = function(key) {
4200               var current = this._root;
4201               var compare = this._comparator;
4202               while (current) {
4203                 var cmp2 = compare(key, current.key);
4204                 if (cmp2 === 0)
4205                   return current;
4206                 else if (cmp2 < 0)
4207                   current = current.left;
4208                 else
4209                   current = current.right;
4210               }
4211               return null;
4212             };
4213             Tree2.prototype.find = function(key) {
4214               if (this._root) {
4215                 this._root = splay(key, this._root, this._comparator);
4216                 if (this._comparator(key, this._root.key) !== 0)
4217                   return null;
4218               }
4219               return this._root;
4220             };
4221             Tree2.prototype.contains = function(key) {
4222               var current = this._root;
4223               var compare = this._comparator;
4224               while (current) {
4225                 var cmp2 = compare(key, current.key);
4226                 if (cmp2 === 0)
4227                   return true;
4228                 else if (cmp2 < 0)
4229                   current = current.left;
4230                 else
4231                   current = current.right;
4232               }
4233               return false;
4234             };
4235             Tree2.prototype.forEach = function(visitor, ctx) {
4236               var current = this._root;
4237               var Q = [];
4238               var done = false;
4239               while (!done) {
4240                 if (current !== null) {
4241                   Q.push(current);
4242                   current = current.left;
4243                 } else {
4244                   if (Q.length !== 0) {
4245                     current = Q.pop();
4246                     visitor.call(ctx, current);
4247                     current = current.right;
4248                   } else
4249                     done = true;
4250                 }
4251               }
4252               return this;
4253             };
4254             Tree2.prototype.range = function(low, high, fn, ctx) {
4255               var Q = [];
4256               var compare = this._comparator;
4257               var node = this._root;
4258               var cmp2;
4259               while (Q.length !== 0 || node) {
4260                 if (node) {
4261                   Q.push(node);
4262                   node = node.left;
4263                 } else {
4264                   node = Q.pop();
4265                   cmp2 = compare(node.key, high);
4266                   if (cmp2 > 0) {
4267                     break;
4268                   } else if (compare(node.key, low) >= 0) {
4269                     if (fn.call(ctx, node))
4270                       return this;
4271                   }
4272                   node = node.right;
4273                 }
4274               }
4275               return this;
4276             };
4277             Tree2.prototype.keys = function() {
4278               var keys2 = [];
4279               this.forEach(function(_a) {
4280                 var key = _a.key;
4281                 return keys2.push(key);
4282               });
4283               return keys2;
4284             };
4285             Tree2.prototype.values = function() {
4286               var values = [];
4287               this.forEach(function(_a) {
4288                 var data = _a.data;
4289                 return values.push(data);
4290               });
4291               return values;
4292             };
4293             Tree2.prototype.min = function() {
4294               if (this._root)
4295                 return this.minNode(this._root).key;
4296               return null;
4297             };
4298             Tree2.prototype.max = function() {
4299               if (this._root)
4300                 return this.maxNode(this._root).key;
4301               return null;
4302             };
4303             Tree2.prototype.minNode = function(t) {
4304               if (t === void 0) {
4305                 t = this._root;
4306               }
4307               if (t)
4308                 while (t.left) {
4309                   t = t.left;
4310                 }
4311               return t;
4312             };
4313             Tree2.prototype.maxNode = function(t) {
4314               if (t === void 0) {
4315                 t = this._root;
4316               }
4317               if (t)
4318                 while (t.right) {
4319                   t = t.right;
4320                 }
4321               return t;
4322             };
4323             Tree2.prototype.at = function(index2) {
4324               var current = this._root;
4325               var done = false;
4326               var i2 = 0;
4327               var Q = [];
4328               while (!done) {
4329                 if (current) {
4330                   Q.push(current);
4331                   current = current.left;
4332                 } else {
4333                   if (Q.length > 0) {
4334                     current = Q.pop();
4335                     if (i2 === index2)
4336                       return current;
4337                     i2++;
4338                     current = current.right;
4339                   } else
4340                     done = true;
4341                 }
4342               }
4343               return null;
4344             };
4345             Tree2.prototype.next = function(d) {
4346               var root3 = this._root;
4347               var successor = null;
4348               if (d.right) {
4349                 successor = d.right;
4350                 while (successor.left) {
4351                   successor = successor.left;
4352                 }
4353                 return successor;
4354               }
4355               var comparator = this._comparator;
4356               while (root3) {
4357                 var cmp2 = comparator(d.key, root3.key);
4358                 if (cmp2 === 0)
4359                   break;
4360                 else if (cmp2 < 0) {
4361                   successor = root3;
4362                   root3 = root3.left;
4363                 } else
4364                   root3 = root3.right;
4365               }
4366               return successor;
4367             };
4368             Tree2.prototype.prev = function(d) {
4369               var root3 = this._root;
4370               var predecessor = null;
4371               if (d.left !== null) {
4372                 predecessor = d.left;
4373                 while (predecessor.right) {
4374                   predecessor = predecessor.right;
4375                 }
4376                 return predecessor;
4377               }
4378               var comparator = this._comparator;
4379               while (root3) {
4380                 var cmp2 = comparator(d.key, root3.key);
4381                 if (cmp2 === 0)
4382                   break;
4383                 else if (cmp2 < 0)
4384                   root3 = root3.left;
4385                 else {
4386                   predecessor = root3;
4387                   root3 = root3.right;
4388                 }
4389               }
4390               return predecessor;
4391             };
4392             Tree2.prototype.clear = function() {
4393               this._root = null;
4394               this._size = 0;
4395               return this;
4396             };
4397             Tree2.prototype.toList = function() {
4398               return toList(this._root);
4399             };
4400             Tree2.prototype.load = function(keys2, values, presort) {
4401               if (values === void 0) {
4402                 values = [];
4403               }
4404               if (presort === void 0) {
4405                 presort = false;
4406               }
4407               var size = keys2.length;
4408               var comparator = this._comparator;
4409               if (presort)
4410                 sort(keys2, values, 0, size - 1, comparator);
4411               if (this._root === null) {
4412                 this._root = loadRecursive(keys2, values, 0, size);
4413                 this._size = size;
4414               } else {
4415                 var mergedList = mergeLists(this.toList(), createList(keys2, values), comparator);
4416                 size = this._size + size;
4417                 this._root = sortedListToBST({
4418                   head: mergedList
4419                 }, 0, size);
4420               }
4421               return this;
4422             };
4423             Tree2.prototype.isEmpty = function() {
4424               return this._root === null;
4425             };
4426             Object.defineProperty(Tree2.prototype, "size", {
4427               get: function get4() {
4428                 return this._size;
4429               },
4430               enumerable: true,
4431               configurable: true
4432             });
4433             Object.defineProperty(Tree2.prototype, "root", {
4434               get: function get4() {
4435                 return this._root;
4436               },
4437               enumerable: true,
4438               configurable: true
4439             });
4440             Tree2.prototype.toString = function(printNode) {
4441               if (printNode === void 0) {
4442                 printNode = function printNode2(n2) {
4443                   return String(n2.key);
4444                 };
4445               }
4446               var out = [];
4447               printRow(this._root, "", true, function(v) {
4448                 return out.push(v);
4449               }, printNode);
4450               return out.join("");
4451             };
4452             Tree2.prototype.update = function(key, newKey, newData) {
4453               var comparator = this._comparator;
4454               var _a = split(key, this._root, comparator), left = _a.left, right = _a.right;
4455               if (comparator(key, newKey) < 0) {
4456                 right = insert(newKey, newData, right, comparator);
4457               } else {
4458                 left = insert(newKey, newData, left, comparator);
4459               }
4460               this._root = merge2(left, right, comparator);
4461             };
4462             Tree2.prototype.split = function(key) {
4463               return split(key, this._root, this._comparator);
4464             };
4465             return Tree2;
4466           }()
4467         );
4468         function loadRecursive(keys2, values, start2, end) {
4469           var size = end - start2;
4470           if (size > 0) {
4471             var middle = start2 + Math.floor(size / 2);
4472             var key = keys2[middle];
4473             var data = values[middle];
4474             var node = new Node(key, data);
4475             node.left = loadRecursive(keys2, values, start2, middle);
4476             node.right = loadRecursive(keys2, values, middle + 1, end);
4477             return node;
4478           }
4479           return null;
4480         }
4481         function createList(keys2, values) {
4482           var head = new Node(null, null);
4483           var p = head;
4484           for (var i2 = 0; i2 < keys2.length; i2++) {
4485             p = p.next = new Node(keys2[i2], values[i2]);
4486           }
4487           p.next = null;
4488           return head.next;
4489         }
4490         function toList(root3) {
4491           var current = root3;
4492           var Q = [];
4493           var done = false;
4494           var head = new Node(null, null);
4495           var p = head;
4496           while (!done) {
4497             if (current) {
4498               Q.push(current);
4499               current = current.left;
4500             } else {
4501               if (Q.length > 0) {
4502                 current = p = p.next = Q.pop();
4503                 current = current.right;
4504               } else
4505                 done = true;
4506             }
4507           }
4508           p.next = null;
4509           return head.next;
4510         }
4511         function sortedListToBST(list, start2, end) {
4512           var size = end - start2;
4513           if (size > 0) {
4514             var middle = start2 + Math.floor(size / 2);
4515             var left = sortedListToBST(list, start2, middle);
4516             var root3 = list.head;
4517             root3.left = left;
4518             list.head = list.head.next;
4519             root3.right = sortedListToBST(list, middle + 1, end);
4520             return root3;
4521           }
4522           return null;
4523         }
4524         function mergeLists(l1, l2, compare) {
4525           var head = new Node(null, null);
4526           var p = head;
4527           var p1 = l1;
4528           var p2 = l2;
4529           while (p1 !== null && p2 !== null) {
4530             if (compare(p1.key, p2.key) < 0) {
4531               p.next = p1;
4532               p1 = p1.next;
4533             } else {
4534               p.next = p2;
4535               p2 = p2.next;
4536             }
4537             p = p.next;
4538           }
4539           if (p1 !== null) {
4540             p.next = p1;
4541           } else if (p2 !== null) {
4542             p.next = p2;
4543           }
4544           return head.next;
4545         }
4546         function sort(keys2, values, left, right, compare) {
4547           if (left >= right)
4548             return;
4549           var pivot = keys2[left + right >> 1];
4550           var i2 = left - 1;
4551           var j2 = right + 1;
4552           while (true) {
4553             do {
4554               i2++;
4555             } while (compare(keys2[i2], pivot) < 0);
4556             do {
4557               j2--;
4558             } while (compare(keys2[j2], pivot) > 0);
4559             if (i2 >= j2)
4560               break;
4561             var tmp = keys2[i2];
4562             keys2[i2] = keys2[j2];
4563             keys2[j2] = tmp;
4564             tmp = values[i2];
4565             values[i2] = values[j2];
4566             values[j2] = tmp;
4567           }
4568           sort(keys2, values, left, j2, compare);
4569           sort(keys2, values, j2 + 1, right, compare);
4570         }
4571         var isInBbox = function isInBbox2(bbox2, point2) {
4572           return bbox2.ll.x <= point2.x && point2.x <= bbox2.ur.x && bbox2.ll.y <= point2.y && point2.y <= bbox2.ur.y;
4573         };
4574         var getBboxOverlap = function getBboxOverlap2(b1, b2) {
4575           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)
4576             return null;
4577           var lowerX = b1.ll.x < b2.ll.x ? b2.ll.x : b1.ll.x;
4578           var upperX = b1.ur.x < b2.ur.x ? b1.ur.x : b2.ur.x;
4579           var lowerY = b1.ll.y < b2.ll.y ? b2.ll.y : b1.ll.y;
4580           var upperY = b1.ur.y < b2.ur.y ? b1.ur.y : b2.ur.y;
4581           return {
4582             ll: {
4583               x: lowerX,
4584               y: lowerY
4585             },
4586             ur: {
4587               x: upperX,
4588               y: upperY
4589             }
4590           };
4591         };
4592         var epsilon3 = Number.EPSILON;
4593         if (epsilon3 === void 0)
4594           epsilon3 = Math.pow(2, -52);
4595         var EPSILON_SQ = epsilon3 * epsilon3;
4596         var cmp = function cmp2(a, b) {
4597           if (-epsilon3 < a && a < epsilon3) {
4598             if (-epsilon3 < b && b < epsilon3) {
4599               return 0;
4600             }
4601           }
4602           var ab = a - b;
4603           if (ab * ab < EPSILON_SQ * a * b) {
4604             return 0;
4605           }
4606           return a < b ? -1 : 1;
4607         };
4608         var PtRounder = /* @__PURE__ */ function() {
4609           function PtRounder2() {
4610             _classCallCheck(this, PtRounder2);
4611             this.reset();
4612           }
4613           _createClass(PtRounder2, [{
4614             key: "reset",
4615             value: function reset() {
4616               this.xRounder = new CoordRounder();
4617               this.yRounder = new CoordRounder();
4618             }
4619           }, {
4620             key: "round",
4621             value: function round(x, y) {
4622               return {
4623                 x: this.xRounder.round(x),
4624                 y: this.yRounder.round(y)
4625               };
4626             }
4627           }]);
4628           return PtRounder2;
4629         }();
4630         var CoordRounder = /* @__PURE__ */ function() {
4631           function CoordRounder2() {
4632             _classCallCheck(this, CoordRounder2);
4633             this.tree = new Tree();
4634             this.round(0);
4635           }
4636           _createClass(CoordRounder2, [{
4637             key: "round",
4638             value: function round(coord2) {
4639               var node = this.tree.add(coord2);
4640               var prevNode = this.tree.prev(node);
4641               if (prevNode !== null && cmp(node.key, prevNode.key) === 0) {
4642                 this.tree.remove(coord2);
4643                 return prevNode.key;
4644               }
4645               var nextNode = this.tree.next(node);
4646               if (nextNode !== null && cmp(node.key, nextNode.key) === 0) {
4647                 this.tree.remove(coord2);
4648                 return nextNode.key;
4649               }
4650               return coord2;
4651             }
4652           }]);
4653           return CoordRounder2;
4654         }();
4655         var rounder = new PtRounder();
4656         var crossProduct = function crossProduct2(a, b) {
4657           return a.x * b.y - a.y * b.x;
4658         };
4659         var dotProduct = function dotProduct2(a, b) {
4660           return a.x * b.x + a.y * b.y;
4661         };
4662         var compareVectorAngles = function compareVectorAngles2(basePt, endPt1, endPt2) {
4663           var v1 = {
4664             x: endPt1.x - basePt.x,
4665             y: endPt1.y - basePt.y
4666           };
4667           var v2 = {
4668             x: endPt2.x - basePt.x,
4669             y: endPt2.y - basePt.y
4670           };
4671           var kross = crossProduct(v1, v2);
4672           return cmp(kross, 0);
4673         };
4674         var length = function length2(v) {
4675           return Math.sqrt(dotProduct(v, v));
4676         };
4677         var sineOfAngle = function sineOfAngle2(pShared, pBase, pAngle) {
4678           var vBase = {
4679             x: pBase.x - pShared.x,
4680             y: pBase.y - pShared.y
4681           };
4682           var vAngle = {
4683             x: pAngle.x - pShared.x,
4684             y: pAngle.y - pShared.y
4685           };
4686           return crossProduct(vAngle, vBase) / length(vAngle) / length(vBase);
4687         };
4688         var cosineOfAngle = function cosineOfAngle2(pShared, pBase, pAngle) {
4689           var vBase = {
4690             x: pBase.x - pShared.x,
4691             y: pBase.y - pShared.y
4692           };
4693           var vAngle = {
4694             x: pAngle.x - pShared.x,
4695             y: pAngle.y - pShared.y
4696           };
4697           return dotProduct(vAngle, vBase) / length(vAngle) / length(vBase);
4698         };
4699         var horizontalIntersection = function horizontalIntersection2(pt, v, y) {
4700           if (v.y === 0)
4701             return null;
4702           return {
4703             x: pt.x + v.x / v.y * (y - pt.y),
4704             y
4705           };
4706         };
4707         var verticalIntersection = function verticalIntersection2(pt, v, x) {
4708           if (v.x === 0)
4709             return null;
4710           return {
4711             x,
4712             y: pt.y + v.y / v.x * (x - pt.x)
4713           };
4714         };
4715         var intersection = function intersection2(pt1, v1, pt2, v2) {
4716           if (v1.x === 0)
4717             return verticalIntersection(pt2, v2, pt1.x);
4718           if (v2.x === 0)
4719             return verticalIntersection(pt1, v1, pt2.x);
4720           if (v1.y === 0)
4721             return horizontalIntersection(pt2, v2, pt1.y);
4722           if (v2.y === 0)
4723             return horizontalIntersection(pt1, v1, pt2.y);
4724           var kross = crossProduct(v1, v2);
4725           if (kross == 0)
4726             return null;
4727           var ve = {
4728             x: pt2.x - pt1.x,
4729             y: pt2.y - pt1.y
4730           };
4731           var d1 = crossProduct(ve, v1) / kross;
4732           var d2 = crossProduct(ve, v2) / kross;
4733           var x12 = pt1.x + d2 * v1.x, x2 = pt2.x + d1 * v2.x;
4734           var y12 = pt1.y + d2 * v1.y, y2 = pt2.y + d1 * v2.y;
4735           var x = (x12 + x2) / 2;
4736           var y = (y12 + y2) / 2;
4737           return {
4738             x,
4739             y
4740           };
4741         };
4742         var SweepEvent = /* @__PURE__ */ function() {
4743           _createClass(SweepEvent2, null, [{
4744             key: "compare",
4745             // for ordering sweep events in the sweep event queue
4746             value: function compare(a, b) {
4747               var ptCmp = SweepEvent2.comparePoints(a.point, b.point);
4748               if (ptCmp !== 0)
4749                 return ptCmp;
4750               if (a.point !== b.point)
4751                 a.link(b);
4752               if (a.isLeft !== b.isLeft)
4753                 return a.isLeft ? 1 : -1;
4754               return Segment.compare(a.segment, b.segment);
4755             }
4756             // for ordering points in sweep line order
4757           }, {
4758             key: "comparePoints",
4759             value: function comparePoints(aPt, bPt) {
4760               if (aPt.x < bPt.x)
4761                 return -1;
4762               if (aPt.x > bPt.x)
4763                 return 1;
4764               if (aPt.y < bPt.y)
4765                 return -1;
4766               if (aPt.y > bPt.y)
4767                 return 1;
4768               return 0;
4769             }
4770             // Warning: 'point' input will be modified and re-used (for performance)
4771           }]);
4772           function SweepEvent2(point2, isLeft) {
4773             _classCallCheck(this, SweepEvent2);
4774             if (point2.events === void 0)
4775               point2.events = [this];
4776             else
4777               point2.events.push(this);
4778             this.point = point2;
4779             this.isLeft = isLeft;
4780           }
4781           _createClass(SweepEvent2, [{
4782             key: "link",
4783             value: function link2(other) {
4784               if (other.point === this.point) {
4785                 throw new Error("Tried to link already linked events");
4786               }
4787               var otherEvents = other.point.events;
4788               for (var i2 = 0, iMax = otherEvents.length; i2 < iMax; i2++) {
4789                 var evt = otherEvents[i2];
4790                 this.point.events.push(evt);
4791                 evt.point = this.point;
4792               }
4793               this.checkForConsuming();
4794             }
4795             /* Do a pass over our linked events and check to see if any pair
4796              * of segments match, and should be consumed. */
4797           }, {
4798             key: "checkForConsuming",
4799             value: function checkForConsuming() {
4800               var numEvents = this.point.events.length;
4801               for (var i2 = 0; i2 < numEvents; i2++) {
4802                 var evt1 = this.point.events[i2];
4803                 if (evt1.segment.consumedBy !== void 0)
4804                   continue;
4805                 for (var j2 = i2 + 1; j2 < numEvents; j2++) {
4806                   var evt2 = this.point.events[j2];
4807                   if (evt2.consumedBy !== void 0)
4808                     continue;
4809                   if (evt1.otherSE.point.events !== evt2.otherSE.point.events)
4810                     continue;
4811                   evt1.segment.consume(evt2.segment);
4812                 }
4813               }
4814             }
4815           }, {
4816             key: "getAvailableLinkedEvents",
4817             value: function getAvailableLinkedEvents() {
4818               var events = [];
4819               for (var i2 = 0, iMax = this.point.events.length; i2 < iMax; i2++) {
4820                 var evt = this.point.events[i2];
4821                 if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {
4822                   events.push(evt);
4823                 }
4824               }
4825               return events;
4826             }
4827             /**
4828              * Returns a comparator function for sorting linked events that will
4829              * favor the event that will give us the smallest left-side angle.
4830              * All ring construction starts as low as possible heading to the right,
4831              * so by always turning left as sharp as possible we'll get polygons
4832              * without uncessary loops & holes.
4833              *
4834              * The comparator function has a compute cache such that it avoids
4835              * re-computing already-computed values.
4836              */
4837           }, {
4838             key: "getLeftmostComparator",
4839             value: function getLeftmostComparator(baseEvent) {
4840               var _this = this;
4841               var cache = /* @__PURE__ */ new Map();
4842               var fillCache = function fillCache2(linkedEvent) {
4843                 var nextEvent = linkedEvent.otherSE;
4844                 cache.set(linkedEvent, {
4845                   sine: sineOfAngle(_this.point, baseEvent.point, nextEvent.point),
4846                   cosine: cosineOfAngle(_this.point, baseEvent.point, nextEvent.point)
4847                 });
4848               };
4849               return function(a, b) {
4850                 if (!cache.has(a))
4851                   fillCache(a);
4852                 if (!cache.has(b))
4853                   fillCache(b);
4854                 var _cache$get = cache.get(a), asine = _cache$get.sine, acosine = _cache$get.cosine;
4855                 var _cache$get2 = cache.get(b), bsine = _cache$get2.sine, bcosine = _cache$get2.cosine;
4856                 if (asine >= 0 && bsine >= 0) {
4857                   if (acosine < bcosine)
4858                     return 1;
4859                   if (acosine > bcosine)
4860                     return -1;
4861                   return 0;
4862                 }
4863                 if (asine < 0 && bsine < 0) {
4864                   if (acosine < bcosine)
4865                     return -1;
4866                   if (acosine > bcosine)
4867                     return 1;
4868                   return 0;
4869                 }
4870                 if (bsine < asine)
4871                   return -1;
4872                 if (bsine > asine)
4873                   return 1;
4874                 return 0;
4875               };
4876             }
4877           }]);
4878           return SweepEvent2;
4879         }();
4880         var segmentId = 0;
4881         var Segment = /* @__PURE__ */ function() {
4882           _createClass(Segment2, null, [{
4883             key: "compare",
4884             /* This compare() function is for ordering segments in the sweep
4885              * line tree, and does so according to the following criteria:
4886              *
4887              * Consider the vertical line that lies an infinestimal step to the
4888              * right of the right-more of the two left endpoints of the input
4889              * segments. Imagine slowly moving a point up from negative infinity
4890              * in the increasing y direction. Which of the two segments will that
4891              * point intersect first? That segment comes 'before' the other one.
4892              *
4893              * If neither segment would be intersected by such a line, (if one
4894              * or more of the segments are vertical) then the line to be considered
4895              * is directly on the right-more of the two left inputs.
4896              */
4897             value: function compare(a, b) {
4898               var alx = a.leftSE.point.x;
4899               var blx = b.leftSE.point.x;
4900               var arx = a.rightSE.point.x;
4901               var brx = b.rightSE.point.x;
4902               if (brx < alx)
4903                 return 1;
4904               if (arx < blx)
4905                 return -1;
4906               var aly = a.leftSE.point.y;
4907               var bly = b.leftSE.point.y;
4908               var ary = a.rightSE.point.y;
4909               var bry = b.rightSE.point.y;
4910               if (alx < blx) {
4911                 if (bly < aly && bly < ary)
4912                   return 1;
4913                 if (bly > aly && bly > ary)
4914                   return -1;
4915                 var aCmpBLeft = a.comparePoint(b.leftSE.point);
4916                 if (aCmpBLeft < 0)
4917                   return 1;
4918                 if (aCmpBLeft > 0)
4919                   return -1;
4920                 var bCmpARight = b.comparePoint(a.rightSE.point);
4921                 if (bCmpARight !== 0)
4922                   return bCmpARight;
4923                 return -1;
4924               }
4925               if (alx > blx) {
4926                 if (aly < bly && aly < bry)
4927                   return -1;
4928                 if (aly > bly && aly > bry)
4929                   return 1;
4930                 var bCmpALeft = b.comparePoint(a.leftSE.point);
4931                 if (bCmpALeft !== 0)
4932                   return bCmpALeft;
4933                 var aCmpBRight = a.comparePoint(b.rightSE.point);
4934                 if (aCmpBRight < 0)
4935                   return 1;
4936                 if (aCmpBRight > 0)
4937                   return -1;
4938                 return 1;
4939               }
4940               if (aly < bly)
4941                 return -1;
4942               if (aly > bly)
4943                 return 1;
4944               if (arx < brx) {
4945                 var _bCmpARight = b.comparePoint(a.rightSE.point);
4946                 if (_bCmpARight !== 0)
4947                   return _bCmpARight;
4948               }
4949               if (arx > brx) {
4950                 var _aCmpBRight = a.comparePoint(b.rightSE.point);
4951                 if (_aCmpBRight < 0)
4952                   return 1;
4953                 if (_aCmpBRight > 0)
4954                   return -1;
4955               }
4956               if (arx !== brx) {
4957                 var ay = ary - aly;
4958                 var ax = arx - alx;
4959                 var by = bry - bly;
4960                 var bx = brx - blx;
4961                 if (ay > ax && by < bx)
4962                   return 1;
4963                 if (ay < ax && by > bx)
4964                   return -1;
4965               }
4966               if (arx > brx)
4967                 return 1;
4968               if (arx < brx)
4969                 return -1;
4970               if (ary < bry)
4971                 return -1;
4972               if (ary > bry)
4973                 return 1;
4974               if (a.id < b.id)
4975                 return -1;
4976               if (a.id > b.id)
4977                 return 1;
4978               return 0;
4979             }
4980             /* Warning: a reference to ringWindings input will be stored,
4981              *  and possibly will be later modified */
4982           }]);
4983           function Segment2(leftSE, rightSE, rings, windings) {
4984             _classCallCheck(this, Segment2);
4985             this.id = ++segmentId;
4986             this.leftSE = leftSE;
4987             leftSE.segment = this;
4988             leftSE.otherSE = rightSE;
4989             this.rightSE = rightSE;
4990             rightSE.segment = this;
4991             rightSE.otherSE = leftSE;
4992             this.rings = rings;
4993             this.windings = windings;
4994           }
4995           _createClass(Segment2, [{
4996             key: "replaceRightSE",
4997             /* When a segment is split, the rightSE is replaced with a new sweep event */
4998             value: function replaceRightSE(newRightSE) {
4999               this.rightSE = newRightSE;
5000               this.rightSE.segment = this;
5001               this.rightSE.otherSE = this.leftSE;
5002               this.leftSE.otherSE = this.rightSE;
5003             }
5004           }, {
5005             key: "bbox",
5006             value: function bbox2() {
5007               var y12 = this.leftSE.point.y;
5008               var y2 = this.rightSE.point.y;
5009               return {
5010                 ll: {
5011                   x: this.leftSE.point.x,
5012                   y: y12 < y2 ? y12 : y2
5013                 },
5014                 ur: {
5015                   x: this.rightSE.point.x,
5016                   y: y12 > y2 ? y12 : y2
5017                 }
5018               };
5019             }
5020             /* A vector from the left point to the right */
5021           }, {
5022             key: "vector",
5023             value: function vector() {
5024               return {
5025                 x: this.rightSE.point.x - this.leftSE.point.x,
5026                 y: this.rightSE.point.y - this.leftSE.point.y
5027               };
5028             }
5029           }, {
5030             key: "isAnEndpoint",
5031             value: function isAnEndpoint(pt) {
5032               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;
5033             }
5034             /* Compare this segment with a point.
5035              *
5036              * A point P is considered to be colinear to a segment if there
5037              * exists a distance D such that if we travel along the segment
5038              * from one * endpoint towards the other a distance D, we find
5039              * ourselves at point P.
5040              *
5041              * Return value indicates:
5042              *
5043              *   1: point lies above the segment (to the left of vertical)
5044              *   0: point is colinear to segment
5045              *  -1: point lies below the segment (to the right of vertical)
5046              */
5047           }, {
5048             key: "comparePoint",
5049             value: function comparePoint(point2) {
5050               if (this.isAnEndpoint(point2))
5051                 return 0;
5052               var lPt = this.leftSE.point;
5053               var rPt = this.rightSE.point;
5054               var v = this.vector();
5055               if (lPt.x === rPt.x) {
5056                 if (point2.x === lPt.x)
5057                   return 0;
5058                 return point2.x < lPt.x ? 1 : -1;
5059               }
5060               var yDist = (point2.y - lPt.y) / v.y;
5061               var xFromYDist = lPt.x + yDist * v.x;
5062               if (point2.x === xFromYDist)
5063                 return 0;
5064               var xDist = (point2.x - lPt.x) / v.x;
5065               var yFromXDist = lPt.y + xDist * v.y;
5066               if (point2.y === yFromXDist)
5067                 return 0;
5068               return point2.y < yFromXDist ? -1 : 1;
5069             }
5070             /**
5071              * Given another segment, returns the first non-trivial intersection
5072              * between the two segments (in terms of sweep line ordering), if it exists.
5073              *
5074              * A 'non-trivial' intersection is one that will cause one or both of the
5075              * segments to be split(). As such, 'trivial' vs. 'non-trivial' intersection:
5076              *
5077              *   * endpoint of segA with endpoint of segB --> trivial
5078              *   * endpoint of segA with point along segB --> non-trivial
5079              *   * endpoint of segB with point along segA --> non-trivial
5080              *   * point along segA with point along segB --> non-trivial
5081              *
5082              * If no non-trivial intersection exists, return null
5083              * Else, return null.
5084              */
5085           }, {
5086             key: "getIntersection",
5087             value: function getIntersection(other) {
5088               var tBbox = this.bbox();
5089               var oBbox = other.bbox();
5090               var bboxOverlap = getBboxOverlap(tBbox, oBbox);
5091               if (bboxOverlap === null)
5092                 return null;
5093               var tlp = this.leftSE.point;
5094               var trp = this.rightSE.point;
5095               var olp = other.leftSE.point;
5096               var orp = other.rightSE.point;
5097               var touchesOtherLSE = isInBbox(tBbox, olp) && this.comparePoint(olp) === 0;
5098               var touchesThisLSE = isInBbox(oBbox, tlp) && other.comparePoint(tlp) === 0;
5099               var touchesOtherRSE = isInBbox(tBbox, orp) && this.comparePoint(orp) === 0;
5100               var touchesThisRSE = isInBbox(oBbox, trp) && other.comparePoint(trp) === 0;
5101               if (touchesThisLSE && touchesOtherLSE) {
5102                 if (touchesThisRSE && !touchesOtherRSE)
5103                   return trp;
5104                 if (!touchesThisRSE && touchesOtherRSE)
5105                   return orp;
5106                 return null;
5107               }
5108               if (touchesThisLSE) {
5109                 if (touchesOtherRSE) {
5110                   if (tlp.x === orp.x && tlp.y === orp.y)
5111                     return null;
5112                 }
5113                 return tlp;
5114               }
5115               if (touchesOtherLSE) {
5116                 if (touchesThisRSE) {
5117                   if (trp.x === olp.x && trp.y === olp.y)
5118                     return null;
5119                 }
5120                 return olp;
5121               }
5122               if (touchesThisRSE && touchesOtherRSE)
5123                 return null;
5124               if (touchesThisRSE)
5125                 return trp;
5126               if (touchesOtherRSE)
5127                 return orp;
5128               var pt = intersection(tlp, this.vector(), olp, other.vector());
5129               if (pt === null)
5130                 return null;
5131               if (!isInBbox(bboxOverlap, pt))
5132                 return null;
5133               return rounder.round(pt.x, pt.y);
5134             }
5135             /**
5136              * Split the given segment into multiple segments on the given points.
5137              *  * Each existing segment will retain its leftSE and a new rightSE will be
5138              *    generated for it.
5139              *  * A new segment will be generated which will adopt the original segment's
5140              *    rightSE, and a new leftSE will be generated for it.
5141              *  * If there are more than two points given to split on, new segments
5142              *    in the middle will be generated with new leftSE and rightSE's.
5143              *  * An array of the newly generated SweepEvents will be returned.
5144              *
5145              * Warning: input array of points is modified
5146              */
5147           }, {
5148             key: "split",
5149             value: function split2(point2) {
5150               var newEvents = [];
5151               var alreadyLinked = point2.events !== void 0;
5152               var newLeftSE = new SweepEvent(point2, true);
5153               var newRightSE = new SweepEvent(point2, false);
5154               var oldRightSE = this.rightSE;
5155               this.replaceRightSE(newRightSE);
5156               newEvents.push(newRightSE);
5157               newEvents.push(newLeftSE);
5158               var newSeg = new Segment2(newLeftSE, oldRightSE, this.rings.slice(), this.windings.slice());
5159               if (SweepEvent.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {
5160                 newSeg.swapEvents();
5161               }
5162               if (SweepEvent.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {
5163                 this.swapEvents();
5164               }
5165               if (alreadyLinked) {
5166                 newLeftSE.checkForConsuming();
5167                 newRightSE.checkForConsuming();
5168               }
5169               return newEvents;
5170             }
5171             /* Swap which event is left and right */
5172           }, {
5173             key: "swapEvents",
5174             value: function swapEvents() {
5175               var tmpEvt = this.rightSE;
5176               this.rightSE = this.leftSE;
5177               this.leftSE = tmpEvt;
5178               this.leftSE.isLeft = true;
5179               this.rightSE.isLeft = false;
5180               for (var i2 = 0, iMax = this.windings.length; i2 < iMax; i2++) {
5181                 this.windings[i2] *= -1;
5182               }
5183             }
5184             /* Consume another segment. We take their rings under our wing
5185              * and mark them as consumed. Use for perfectly overlapping segments */
5186           }, {
5187             key: "consume",
5188             value: function consume(other) {
5189               var consumer = this;
5190               var consumee = other;
5191               while (consumer.consumedBy) {
5192                 consumer = consumer.consumedBy;
5193               }
5194               while (consumee.consumedBy) {
5195                 consumee = consumee.consumedBy;
5196               }
5197               var cmp2 = Segment2.compare(consumer, consumee);
5198               if (cmp2 === 0)
5199                 return;
5200               if (cmp2 > 0) {
5201                 var tmp = consumer;
5202                 consumer = consumee;
5203                 consumee = tmp;
5204               }
5205               if (consumer.prev === consumee) {
5206                 var _tmp = consumer;
5207                 consumer = consumee;
5208                 consumee = _tmp;
5209               }
5210               for (var i2 = 0, iMax = consumee.rings.length; i2 < iMax; i2++) {
5211                 var ring = consumee.rings[i2];
5212                 var winding = consumee.windings[i2];
5213                 var index2 = consumer.rings.indexOf(ring);
5214                 if (index2 === -1) {
5215                   consumer.rings.push(ring);
5216                   consumer.windings.push(winding);
5217                 } else
5218                   consumer.windings[index2] += winding;
5219               }
5220               consumee.rings = null;
5221               consumee.windings = null;
5222               consumee.consumedBy = consumer;
5223               consumee.leftSE.consumedBy = consumer.leftSE;
5224               consumee.rightSE.consumedBy = consumer.rightSE;
5225             }
5226             /* The first segment previous segment chain that is in the result */
5227           }, {
5228             key: "prevInResult",
5229             value: function prevInResult() {
5230               if (this._prevInResult !== void 0)
5231                 return this._prevInResult;
5232               if (!this.prev)
5233                 this._prevInResult = null;
5234               else if (this.prev.isInResult())
5235                 this._prevInResult = this.prev;
5236               else
5237                 this._prevInResult = this.prev.prevInResult();
5238               return this._prevInResult;
5239             }
5240           }, {
5241             key: "beforeState",
5242             value: function beforeState() {
5243               if (this._beforeState !== void 0)
5244                 return this._beforeState;
5245               if (!this.prev)
5246                 this._beforeState = {
5247                   rings: [],
5248                   windings: [],
5249                   multiPolys: []
5250                 };
5251               else {
5252                 var seg = this.prev.consumedBy || this.prev;
5253                 this._beforeState = seg.afterState();
5254               }
5255               return this._beforeState;
5256             }
5257           }, {
5258             key: "afterState",
5259             value: function afterState() {
5260               if (this._afterState !== void 0)
5261                 return this._afterState;
5262               var beforeState = this.beforeState();
5263               this._afterState = {
5264                 rings: beforeState.rings.slice(0),
5265                 windings: beforeState.windings.slice(0),
5266                 multiPolys: []
5267               };
5268               var ringsAfter = this._afterState.rings;
5269               var windingsAfter = this._afterState.windings;
5270               var mpsAfter = this._afterState.multiPolys;
5271               for (var i2 = 0, iMax = this.rings.length; i2 < iMax; i2++) {
5272                 var ring = this.rings[i2];
5273                 var winding = this.windings[i2];
5274                 var index2 = ringsAfter.indexOf(ring);
5275                 if (index2 === -1) {
5276                   ringsAfter.push(ring);
5277                   windingsAfter.push(winding);
5278                 } else
5279                   windingsAfter[index2] += winding;
5280               }
5281               var polysAfter = [];
5282               var polysExclude = [];
5283               for (var _i = 0, _iMax = ringsAfter.length; _i < _iMax; _i++) {
5284                 if (windingsAfter[_i] === 0)
5285                   continue;
5286                 var _ring = ringsAfter[_i];
5287                 var poly = _ring.poly;
5288                 if (polysExclude.indexOf(poly) !== -1)
5289                   continue;
5290                 if (_ring.isExterior)
5291                   polysAfter.push(poly);
5292                 else {
5293                   if (polysExclude.indexOf(poly) === -1)
5294                     polysExclude.push(poly);
5295                   var _index = polysAfter.indexOf(_ring.poly);
5296                   if (_index !== -1)
5297                     polysAfter.splice(_index, 1);
5298                 }
5299               }
5300               for (var _i2 = 0, _iMax2 = polysAfter.length; _i2 < _iMax2; _i2++) {
5301                 var mp = polysAfter[_i2].multiPoly;
5302                 if (mpsAfter.indexOf(mp) === -1)
5303                   mpsAfter.push(mp);
5304               }
5305               return this._afterState;
5306             }
5307             /* Is this segment part of the final result? */
5308           }, {
5309             key: "isInResult",
5310             value: function isInResult() {
5311               if (this.consumedBy)
5312                 return false;
5313               if (this._isInResult !== void 0)
5314                 return this._isInResult;
5315               var mpsBefore = this.beforeState().multiPolys;
5316               var mpsAfter = this.afterState().multiPolys;
5317               switch (operation.type) {
5318                 case "union": {
5319                   var noBefores = mpsBefore.length === 0;
5320                   var noAfters = mpsAfter.length === 0;
5321                   this._isInResult = noBefores !== noAfters;
5322                   break;
5323                 }
5324                 case "intersection": {
5325                   var least;
5326                   var most;
5327                   if (mpsBefore.length < mpsAfter.length) {
5328                     least = mpsBefore.length;
5329                     most = mpsAfter.length;
5330                   } else {
5331                     least = mpsAfter.length;
5332                     most = mpsBefore.length;
5333                   }
5334                   this._isInResult = most === operation.numMultiPolys && least < most;
5335                   break;
5336                 }
5337                 case "xor": {
5338                   var diff = Math.abs(mpsBefore.length - mpsAfter.length);
5339                   this._isInResult = diff % 2 === 1;
5340                   break;
5341                 }
5342                 case "difference": {
5343                   var isJustSubject = function isJustSubject2(mps) {
5344                     return mps.length === 1 && mps[0].isSubject;
5345                   };
5346                   this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);
5347                   break;
5348                 }
5349                 default:
5350                   throw new Error("Unrecognized operation type found ".concat(operation.type));
5351               }
5352               return this._isInResult;
5353             }
5354           }], [{
5355             key: "fromRing",
5356             value: function fromRing(pt1, pt2, ring) {
5357               var leftPt, rightPt, winding;
5358               var cmpPts = SweepEvent.comparePoints(pt1, pt2);
5359               if (cmpPts < 0) {
5360                 leftPt = pt1;
5361                 rightPt = pt2;
5362                 winding = 1;
5363               } else if (cmpPts > 0) {
5364                 leftPt = pt2;
5365                 rightPt = pt1;
5366                 winding = -1;
5367               } else
5368                 throw new Error("Tried to create degenerate segment at [".concat(pt1.x, ", ").concat(pt1.y, "]"));
5369               var leftSE = new SweepEvent(leftPt, true);
5370               var rightSE = new SweepEvent(rightPt, false);
5371               return new Segment2(leftSE, rightSE, [ring], [winding]);
5372             }
5373           }]);
5374           return Segment2;
5375         }();
5376         var RingIn = /* @__PURE__ */ function() {
5377           function RingIn2(geomRing, poly, isExterior) {
5378             _classCallCheck(this, RingIn2);
5379             if (!Array.isArray(geomRing) || geomRing.length === 0) {
5380               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5381             }
5382             this.poly = poly;
5383             this.isExterior = isExterior;
5384             this.segments = [];
5385             if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
5386               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5387             }
5388             var firstPoint = rounder.round(geomRing[0][0], geomRing[0][1]);
5389             this.bbox = {
5390               ll: {
5391                 x: firstPoint.x,
5392                 y: firstPoint.y
5393               },
5394               ur: {
5395                 x: firstPoint.x,
5396                 y: firstPoint.y
5397               }
5398             };
5399             var prevPoint = firstPoint;
5400             for (var i2 = 1, iMax = geomRing.length; i2 < iMax; i2++) {
5401               if (typeof geomRing[i2][0] !== "number" || typeof geomRing[i2][1] !== "number") {
5402                 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5403               }
5404               var point2 = rounder.round(geomRing[i2][0], geomRing[i2][1]);
5405               if (point2.x === prevPoint.x && point2.y === prevPoint.y)
5406                 continue;
5407               this.segments.push(Segment.fromRing(prevPoint, point2, this));
5408               if (point2.x < this.bbox.ll.x)
5409                 this.bbox.ll.x = point2.x;
5410               if (point2.y < this.bbox.ll.y)
5411                 this.bbox.ll.y = point2.y;
5412               if (point2.x > this.bbox.ur.x)
5413                 this.bbox.ur.x = point2.x;
5414               if (point2.y > this.bbox.ur.y)
5415                 this.bbox.ur.y = point2.y;
5416               prevPoint = point2;
5417             }
5418             if (firstPoint.x !== prevPoint.x || firstPoint.y !== prevPoint.y) {
5419               this.segments.push(Segment.fromRing(prevPoint, firstPoint, this));
5420             }
5421           }
5422           _createClass(RingIn2, [{
5423             key: "getSweepEvents",
5424             value: function getSweepEvents() {
5425               var sweepEvents = [];
5426               for (var i2 = 0, iMax = this.segments.length; i2 < iMax; i2++) {
5427                 var segment = this.segments[i2];
5428                 sweepEvents.push(segment.leftSE);
5429                 sweepEvents.push(segment.rightSE);
5430               }
5431               return sweepEvents;
5432             }
5433           }]);
5434           return RingIn2;
5435         }();
5436         var PolyIn = /* @__PURE__ */ function() {
5437           function PolyIn2(geomPoly, multiPoly) {
5438             _classCallCheck(this, PolyIn2);
5439             if (!Array.isArray(geomPoly)) {
5440               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5441             }
5442             this.exteriorRing = new RingIn(geomPoly[0], this, true);
5443             this.bbox = {
5444               ll: {
5445                 x: this.exteriorRing.bbox.ll.x,
5446                 y: this.exteriorRing.bbox.ll.y
5447               },
5448               ur: {
5449                 x: this.exteriorRing.bbox.ur.x,
5450                 y: this.exteriorRing.bbox.ur.y
5451               }
5452             };
5453             this.interiorRings = [];
5454             for (var i2 = 1, iMax = geomPoly.length; i2 < iMax; i2++) {
5455               var ring = new RingIn(geomPoly[i2], this, false);
5456               if (ring.bbox.ll.x < this.bbox.ll.x)
5457                 this.bbox.ll.x = ring.bbox.ll.x;
5458               if (ring.bbox.ll.y < this.bbox.ll.y)
5459                 this.bbox.ll.y = ring.bbox.ll.y;
5460               if (ring.bbox.ur.x > this.bbox.ur.x)
5461                 this.bbox.ur.x = ring.bbox.ur.x;
5462               if (ring.bbox.ur.y > this.bbox.ur.y)
5463                 this.bbox.ur.y = ring.bbox.ur.y;
5464               this.interiorRings.push(ring);
5465             }
5466             this.multiPoly = multiPoly;
5467           }
5468           _createClass(PolyIn2, [{
5469             key: "getSweepEvents",
5470             value: function getSweepEvents() {
5471               var sweepEvents = this.exteriorRing.getSweepEvents();
5472               for (var i2 = 0, iMax = this.interiorRings.length; i2 < iMax; i2++) {
5473                 var ringSweepEvents = this.interiorRings[i2].getSweepEvents();
5474                 for (var j2 = 0, jMax = ringSweepEvents.length; j2 < jMax; j2++) {
5475                   sweepEvents.push(ringSweepEvents[j2]);
5476                 }
5477               }
5478               return sweepEvents;
5479             }
5480           }]);
5481           return PolyIn2;
5482         }();
5483         var MultiPolyIn = /* @__PURE__ */ function() {
5484           function MultiPolyIn2(geom, isSubject) {
5485             _classCallCheck(this, MultiPolyIn2);
5486             if (!Array.isArray(geom)) {
5487               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5488             }
5489             try {
5490               if (typeof geom[0][0][0] === "number")
5491                 geom = [geom];
5492             } catch (ex) {
5493             }
5494             this.polys = [];
5495             this.bbox = {
5496               ll: {
5497                 x: Number.POSITIVE_INFINITY,
5498                 y: Number.POSITIVE_INFINITY
5499               },
5500               ur: {
5501                 x: Number.NEGATIVE_INFINITY,
5502                 y: Number.NEGATIVE_INFINITY
5503               }
5504             };
5505             for (var i2 = 0, iMax = geom.length; i2 < iMax; i2++) {
5506               var poly = new PolyIn(geom[i2], this);
5507               if (poly.bbox.ll.x < this.bbox.ll.x)
5508                 this.bbox.ll.x = poly.bbox.ll.x;
5509               if (poly.bbox.ll.y < this.bbox.ll.y)
5510                 this.bbox.ll.y = poly.bbox.ll.y;
5511               if (poly.bbox.ur.x > this.bbox.ur.x)
5512                 this.bbox.ur.x = poly.bbox.ur.x;
5513               if (poly.bbox.ur.y > this.bbox.ur.y)
5514                 this.bbox.ur.y = poly.bbox.ur.y;
5515               this.polys.push(poly);
5516             }
5517             this.isSubject = isSubject;
5518           }
5519           _createClass(MultiPolyIn2, [{
5520             key: "getSweepEvents",
5521             value: function getSweepEvents() {
5522               var sweepEvents = [];
5523               for (var i2 = 0, iMax = this.polys.length; i2 < iMax; i2++) {
5524                 var polySweepEvents = this.polys[i2].getSweepEvents();
5525                 for (var j2 = 0, jMax = polySweepEvents.length; j2 < jMax; j2++) {
5526                   sweepEvents.push(polySweepEvents[j2]);
5527                 }
5528               }
5529               return sweepEvents;
5530             }
5531           }]);
5532           return MultiPolyIn2;
5533         }();
5534         var RingOut = /* @__PURE__ */ function() {
5535           _createClass(RingOut2, null, [{
5536             key: "factory",
5537             /* Given the segments from the sweep line pass, compute & return a series
5538              * of closed rings from all the segments marked to be part of the result */
5539             value: function factory(allSegments) {
5540               var ringsOut = [];
5541               for (var i2 = 0, iMax = allSegments.length; i2 < iMax; i2++) {
5542                 var segment = allSegments[i2];
5543                 if (!segment.isInResult() || segment.ringOut)
5544                   continue;
5545                 var prevEvent = null;
5546                 var event = segment.leftSE;
5547                 var nextEvent = segment.rightSE;
5548                 var events = [event];
5549                 var startingPoint = event.point;
5550                 var intersectionLEs = [];
5551                 while (true) {
5552                   prevEvent = event;
5553                   event = nextEvent;
5554                   events.push(event);
5555                   if (event.point === startingPoint)
5556                     break;
5557                   while (true) {
5558                     var availableLEs = event.getAvailableLinkedEvents();
5559                     if (availableLEs.length === 0) {
5560                       var firstPt = events[0].point;
5561                       var lastPt = events[events.length - 1].point;
5562                       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, "]."));
5563                     }
5564                     if (availableLEs.length === 1) {
5565                       nextEvent = availableLEs[0].otherSE;
5566                       break;
5567                     }
5568                     var indexLE = null;
5569                     for (var j2 = 0, jMax = intersectionLEs.length; j2 < jMax; j2++) {
5570                       if (intersectionLEs[j2].point === event.point) {
5571                         indexLE = j2;
5572                         break;
5573                       }
5574                     }
5575                     if (indexLE !== null) {
5576                       var intersectionLE = intersectionLEs.splice(indexLE)[0];
5577                       var ringEvents = events.splice(intersectionLE.index);
5578                       ringEvents.unshift(ringEvents[0].otherSE);
5579                       ringsOut.push(new RingOut2(ringEvents.reverse()));
5580                       continue;
5581                     }
5582                     intersectionLEs.push({
5583                       index: events.length,
5584                       point: event.point
5585                     });
5586                     var comparator = event.getLeftmostComparator(prevEvent);
5587                     nextEvent = availableLEs.sort(comparator)[0].otherSE;
5588                     break;
5589                   }
5590                 }
5591                 ringsOut.push(new RingOut2(events));
5592               }
5593               return ringsOut;
5594             }
5595           }]);
5596           function RingOut2(events) {
5597             _classCallCheck(this, RingOut2);
5598             this.events = events;
5599             for (var i2 = 0, iMax = events.length; i2 < iMax; i2++) {
5600               events[i2].segment.ringOut = this;
5601             }
5602             this.poly = null;
5603           }
5604           _createClass(RingOut2, [{
5605             key: "getGeom",
5606             value: function getGeom2() {
5607               var prevPt = this.events[0].point;
5608               var points = [prevPt];
5609               for (var i2 = 1, iMax = this.events.length - 1; i2 < iMax; i2++) {
5610                 var _pt = this.events[i2].point;
5611                 var _nextPt = this.events[i2 + 1].point;
5612                 if (compareVectorAngles(_pt, prevPt, _nextPt) === 0)
5613                   continue;
5614                 points.push(_pt);
5615                 prevPt = _pt;
5616               }
5617               if (points.length === 1)
5618                 return null;
5619               var pt = points[0];
5620               var nextPt = points[1];
5621               if (compareVectorAngles(pt, prevPt, nextPt) === 0)
5622                 points.shift();
5623               points.push(points[0]);
5624               var step = this.isExteriorRing() ? 1 : -1;
5625               var iStart = this.isExteriorRing() ? 0 : points.length - 1;
5626               var iEnd = this.isExteriorRing() ? points.length : -1;
5627               var orderedPoints = [];
5628               for (var _i = iStart; _i != iEnd; _i += step) {
5629                 orderedPoints.push([points[_i].x, points[_i].y]);
5630               }
5631               return orderedPoints;
5632             }
5633           }, {
5634             key: "isExteriorRing",
5635             value: function isExteriorRing() {
5636               if (this._isExteriorRing === void 0) {
5637                 var enclosing = this.enclosingRing();
5638                 this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;
5639               }
5640               return this._isExteriorRing;
5641             }
5642           }, {
5643             key: "enclosingRing",
5644             value: function enclosingRing() {
5645               if (this._enclosingRing === void 0) {
5646                 this._enclosingRing = this._calcEnclosingRing();
5647               }
5648               return this._enclosingRing;
5649             }
5650             /* Returns the ring that encloses this one, if any */
5651           }, {
5652             key: "_calcEnclosingRing",
5653             value: function _calcEnclosingRing() {
5654               var leftMostEvt = this.events[0];
5655               for (var i2 = 1, iMax = this.events.length; i2 < iMax; i2++) {
5656                 var evt = this.events[i2];
5657                 if (SweepEvent.compare(leftMostEvt, evt) > 0)
5658                   leftMostEvt = evt;
5659               }
5660               var prevSeg = leftMostEvt.segment.prevInResult();
5661               var prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
5662               while (true) {
5663                 if (!prevSeg)
5664                   return null;
5665                 if (!prevPrevSeg)
5666                   return prevSeg.ringOut;
5667                 if (prevPrevSeg.ringOut !== prevSeg.ringOut) {
5668                   if (prevPrevSeg.ringOut.enclosingRing() !== prevSeg.ringOut) {
5669                     return prevSeg.ringOut;
5670                   } else
5671                     return prevSeg.ringOut.enclosingRing();
5672                 }
5673                 prevSeg = prevPrevSeg.prevInResult();
5674                 prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
5675               }
5676             }
5677           }]);
5678           return RingOut2;
5679         }();
5680         var PolyOut = /* @__PURE__ */ function() {
5681           function PolyOut2(exteriorRing) {
5682             _classCallCheck(this, PolyOut2);
5683             this.exteriorRing = exteriorRing;
5684             exteriorRing.poly = this;
5685             this.interiorRings = [];
5686           }
5687           _createClass(PolyOut2, [{
5688             key: "addInterior",
5689             value: function addInterior(ring) {
5690               this.interiorRings.push(ring);
5691               ring.poly = this;
5692             }
5693           }, {
5694             key: "getGeom",
5695             value: function getGeom2() {
5696               var geom = [this.exteriorRing.getGeom()];
5697               if (geom[0] === null)
5698                 return null;
5699               for (var i2 = 0, iMax = this.interiorRings.length; i2 < iMax; i2++) {
5700                 var ringGeom = this.interiorRings[i2].getGeom();
5701                 if (ringGeom === null)
5702                   continue;
5703                 geom.push(ringGeom);
5704               }
5705               return geom;
5706             }
5707           }]);
5708           return PolyOut2;
5709         }();
5710         var MultiPolyOut = /* @__PURE__ */ function() {
5711           function MultiPolyOut2(rings) {
5712             _classCallCheck(this, MultiPolyOut2);
5713             this.rings = rings;
5714             this.polys = this._composePolys(rings);
5715           }
5716           _createClass(MultiPolyOut2, [{
5717             key: "getGeom",
5718             value: function getGeom2() {
5719               var geom = [];
5720               for (var i2 = 0, iMax = this.polys.length; i2 < iMax; i2++) {
5721                 var polyGeom = this.polys[i2].getGeom();
5722                 if (polyGeom === null)
5723                   continue;
5724                 geom.push(polyGeom);
5725               }
5726               return geom;
5727             }
5728           }, {
5729             key: "_composePolys",
5730             value: function _composePolys(rings) {
5731               var polys = [];
5732               for (var i2 = 0, iMax = rings.length; i2 < iMax; i2++) {
5733                 var ring = rings[i2];
5734                 if (ring.poly)
5735                   continue;
5736                 if (ring.isExteriorRing())
5737                   polys.push(new PolyOut(ring));
5738                 else {
5739                   var enclosingRing = ring.enclosingRing();
5740                   if (!enclosingRing.poly)
5741                     polys.push(new PolyOut(enclosingRing));
5742                   enclosingRing.poly.addInterior(ring);
5743                 }
5744               }
5745               return polys;
5746             }
5747           }]);
5748           return MultiPolyOut2;
5749         }();
5750         var SweepLine = /* @__PURE__ */ function() {
5751           function SweepLine2(queue) {
5752             var comparator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Segment.compare;
5753             _classCallCheck(this, SweepLine2);
5754             this.queue = queue;
5755             this.tree = new Tree(comparator);
5756             this.segments = [];
5757           }
5758           _createClass(SweepLine2, [{
5759             key: "process",
5760             value: function process2(event) {
5761               var segment = event.segment;
5762               var newEvents = [];
5763               if (event.consumedBy) {
5764                 if (event.isLeft)
5765                   this.queue.remove(event.otherSE);
5766                 else
5767                   this.tree.remove(segment);
5768                 return newEvents;
5769               }
5770               var node = event.isLeft ? this.tree.insert(segment) : this.tree.find(segment);
5771               if (!node)
5772                 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.");
5773               var prevNode = node;
5774               var nextNode = node;
5775               var prevSeg = void 0;
5776               var nextSeg = void 0;
5777               while (prevSeg === void 0) {
5778                 prevNode = this.tree.prev(prevNode);
5779                 if (prevNode === null)
5780                   prevSeg = null;
5781                 else if (prevNode.key.consumedBy === void 0)
5782                   prevSeg = prevNode.key;
5783               }
5784               while (nextSeg === void 0) {
5785                 nextNode = this.tree.next(nextNode);
5786                 if (nextNode === null)
5787                   nextSeg = null;
5788                 else if (nextNode.key.consumedBy === void 0)
5789                   nextSeg = nextNode.key;
5790               }
5791               if (event.isLeft) {
5792                 var prevMySplitter = null;
5793                 if (prevSeg) {
5794                   var prevInter = prevSeg.getIntersection(segment);
5795                   if (prevInter !== null) {
5796                     if (!segment.isAnEndpoint(prevInter))
5797                       prevMySplitter = prevInter;
5798                     if (!prevSeg.isAnEndpoint(prevInter)) {
5799                       var newEventsFromSplit = this._splitSafely(prevSeg, prevInter);
5800                       for (var i2 = 0, iMax = newEventsFromSplit.length; i2 < iMax; i2++) {
5801                         newEvents.push(newEventsFromSplit[i2]);
5802                       }
5803                     }
5804                   }
5805                 }
5806                 var nextMySplitter = null;
5807                 if (nextSeg) {
5808                   var nextInter = nextSeg.getIntersection(segment);
5809                   if (nextInter !== null) {
5810                     if (!segment.isAnEndpoint(nextInter))
5811                       nextMySplitter = nextInter;
5812                     if (!nextSeg.isAnEndpoint(nextInter)) {
5813                       var _newEventsFromSplit = this._splitSafely(nextSeg, nextInter);
5814                       for (var _i = 0, _iMax = _newEventsFromSplit.length; _i < _iMax; _i++) {
5815                         newEvents.push(_newEventsFromSplit[_i]);
5816                       }
5817                     }
5818                   }
5819                 }
5820                 if (prevMySplitter !== null || nextMySplitter !== null) {
5821                   var mySplitter = null;
5822                   if (prevMySplitter === null)
5823                     mySplitter = nextMySplitter;
5824                   else if (nextMySplitter === null)
5825                     mySplitter = prevMySplitter;
5826                   else {
5827                     var cmpSplitters = SweepEvent.comparePoints(prevMySplitter, nextMySplitter);
5828                     mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;
5829                   }
5830                   this.queue.remove(segment.rightSE);
5831                   newEvents.push(segment.rightSE);
5832                   var _newEventsFromSplit2 = segment.split(mySplitter);
5833                   for (var _i2 = 0, _iMax2 = _newEventsFromSplit2.length; _i2 < _iMax2; _i2++) {
5834                     newEvents.push(_newEventsFromSplit2[_i2]);
5835                   }
5836                 }
5837                 if (newEvents.length > 0) {
5838                   this.tree.remove(segment);
5839                   newEvents.push(event);
5840                 } else {
5841                   this.segments.push(segment);
5842                   segment.prev = prevSeg;
5843                 }
5844               } else {
5845                 if (prevSeg && nextSeg) {
5846                   var inter = prevSeg.getIntersection(nextSeg);
5847                   if (inter !== null) {
5848                     if (!prevSeg.isAnEndpoint(inter)) {
5849                       var _newEventsFromSplit3 = this._splitSafely(prevSeg, inter);
5850                       for (var _i3 = 0, _iMax3 = _newEventsFromSplit3.length; _i3 < _iMax3; _i3++) {
5851                         newEvents.push(_newEventsFromSplit3[_i3]);
5852                       }
5853                     }
5854                     if (!nextSeg.isAnEndpoint(inter)) {
5855                       var _newEventsFromSplit4 = this._splitSafely(nextSeg, inter);
5856                       for (var _i4 = 0, _iMax4 = _newEventsFromSplit4.length; _i4 < _iMax4; _i4++) {
5857                         newEvents.push(_newEventsFromSplit4[_i4]);
5858                       }
5859                     }
5860                   }
5861                 }
5862                 this.tree.remove(segment);
5863               }
5864               return newEvents;
5865             }
5866             /* Safely split a segment that is currently in the datastructures
5867              * IE - a segment other than the one that is currently being processed. */
5868           }, {
5869             key: "_splitSafely",
5870             value: function _splitSafely(seg, pt) {
5871               this.tree.remove(seg);
5872               var rightSE = seg.rightSE;
5873               this.queue.remove(rightSE);
5874               var newEvents = seg.split(pt);
5875               newEvents.push(rightSE);
5876               if (seg.consumedBy === void 0)
5877                 this.tree.insert(seg);
5878               return newEvents;
5879             }
5880           }]);
5881           return SweepLine2;
5882         }();
5883         var POLYGON_CLIPPING_MAX_QUEUE_SIZE = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1e6;
5884         var POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1e6;
5885         var Operation = /* @__PURE__ */ function() {
5886           function Operation2() {
5887             _classCallCheck(this, Operation2);
5888           }
5889           _createClass(Operation2, [{
5890             key: "run",
5891             value: function run(type2, geom, moreGeoms) {
5892               operation.type = type2;
5893               rounder.reset();
5894               var multipolys = [new MultiPolyIn(geom, true)];
5895               for (var i2 = 0, iMax = moreGeoms.length; i2 < iMax; i2++) {
5896                 multipolys.push(new MultiPolyIn(moreGeoms[i2], false));
5897               }
5898               operation.numMultiPolys = multipolys.length;
5899               if (operation.type === "difference") {
5900                 var subject = multipolys[0];
5901                 var _i = 1;
5902                 while (_i < multipolys.length) {
5903                   if (getBboxOverlap(multipolys[_i].bbox, subject.bbox) !== null)
5904                     _i++;
5905                   else
5906                     multipolys.splice(_i, 1);
5907                 }
5908               }
5909               if (operation.type === "intersection") {
5910                 for (var _i2 = 0, _iMax = multipolys.length; _i2 < _iMax; _i2++) {
5911                   var mpA = multipolys[_i2];
5912                   for (var j2 = _i2 + 1, jMax = multipolys.length; j2 < jMax; j2++) {
5913                     if (getBboxOverlap(mpA.bbox, multipolys[j2].bbox) === null)
5914                       return [];
5915                   }
5916                 }
5917               }
5918               var queue = new Tree(SweepEvent.compare);
5919               for (var _i3 = 0, _iMax2 = multipolys.length; _i3 < _iMax2; _i3++) {
5920                 var sweepEvents = multipolys[_i3].getSweepEvents();
5921                 for (var _j = 0, _jMax = sweepEvents.length; _j < _jMax; _j++) {
5922                   queue.insert(sweepEvents[_j]);
5923                   if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
5924                     throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");
5925                   }
5926                 }
5927               }
5928               var sweepLine = new SweepLine(queue);
5929               var prevQueueSize = queue.size;
5930               var node = queue.pop();
5931               while (node) {
5932                 var evt = node.key;
5933                 if (queue.size === prevQueueSize) {
5934                   var seg = evt.segment;
5935                   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.");
5936                 }
5937                 if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
5938                   throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");
5939                 }
5940                 if (sweepLine.segments.length > POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS) {
5941                   throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");
5942                 }
5943                 var newEvents = sweepLine.process(evt);
5944                 for (var _i4 = 0, _iMax3 = newEvents.length; _i4 < _iMax3; _i4++) {
5945                   var _evt = newEvents[_i4];
5946                   if (_evt.consumedBy === void 0)
5947                     queue.insert(_evt);
5948                 }
5949                 prevQueueSize = queue.size;
5950                 node = queue.pop();
5951               }
5952               rounder.reset();
5953               var ringsOut = RingOut.factory(sweepLine.segments);
5954               var result = new MultiPolyOut(ringsOut);
5955               return result.getGeom();
5956             }
5957           }]);
5958           return Operation2;
5959         }();
5960         var operation = new Operation();
5961         var union = function union2(geom) {
5962           for (var _len = arguments.length, moreGeoms = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
5963             moreGeoms[_key - 1] = arguments[_key];
5964           }
5965           return operation.run("union", geom, moreGeoms);
5966         };
5967         var intersection$1 = function intersection2(geom) {
5968           for (var _len2 = arguments.length, moreGeoms = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
5969             moreGeoms[_key2 - 1] = arguments[_key2];
5970           }
5971           return operation.run("intersection", geom, moreGeoms);
5972         };
5973         var xor = function xor2(geom) {
5974           for (var _len3 = arguments.length, moreGeoms = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
5975             moreGeoms[_key3 - 1] = arguments[_key3];
5976           }
5977           return operation.run("xor", geom, moreGeoms);
5978         };
5979         var difference = function difference2(subjectGeom) {
5980           for (var _len4 = arguments.length, clippingGeoms = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
5981             clippingGeoms[_key4 - 1] = arguments[_key4];
5982           }
5983           return operation.run("difference", subjectGeom, clippingGeoms);
5984         };
5985         var index = {
5986           union,
5987           intersection: intersection$1,
5988           xor,
5989           difference
5990         };
5991         return index;
5992       });
5993     }
5994   });
5995
5996   // node_modules/geojson-precision/index.js
5997   var require_geojson_precision = __commonJS({
5998     "node_modules/geojson-precision/index.js"(exports2, module2) {
5999       (function() {
6000         function parse(t, coordinatePrecision, extrasPrecision) {
6001           function point2(p) {
6002             return p.map(function(e, index) {
6003               if (index < 2) {
6004                 return 1 * e.toFixed(coordinatePrecision);
6005               } else {
6006                 return 1 * e.toFixed(extrasPrecision);
6007               }
6008             });
6009           }
6010           function multi(l) {
6011             return l.map(point2);
6012           }
6013           function poly(p) {
6014             return p.map(multi);
6015           }
6016           function multiPoly(m) {
6017             return m.map(poly);
6018           }
6019           function geometry(obj) {
6020             if (!obj) {
6021               return {};
6022             }
6023             switch (obj.type) {
6024               case "Point":
6025                 obj.coordinates = point2(obj.coordinates);
6026                 return obj;
6027               case "LineString":
6028               case "MultiPoint":
6029                 obj.coordinates = multi(obj.coordinates);
6030                 return obj;
6031               case "Polygon":
6032               case "MultiLineString":
6033                 obj.coordinates = poly(obj.coordinates);
6034                 return obj;
6035               case "MultiPolygon":
6036                 obj.coordinates = multiPoly(obj.coordinates);
6037                 return obj;
6038               case "GeometryCollection":
6039                 obj.geometries = obj.geometries.map(geometry);
6040                 return obj;
6041               default:
6042                 return {};
6043             }
6044           }
6045           function feature3(obj) {
6046             obj.geometry = geometry(obj.geometry);
6047             return obj;
6048           }
6049           function featureCollection(f2) {
6050             f2.features = f2.features.map(feature3);
6051             return f2;
6052           }
6053           function geometryCollection(g) {
6054             g.geometries = g.geometries.map(geometry);
6055             return g;
6056           }
6057           if (!t) {
6058             return t;
6059           }
6060           switch (t.type) {
6061             case "Feature":
6062               return feature3(t);
6063             case "GeometryCollection":
6064               return geometryCollection(t);
6065             case "FeatureCollection":
6066               return featureCollection(t);
6067             case "Point":
6068             case "LineString":
6069             case "Polygon":
6070             case "MultiPoint":
6071             case "MultiPolygon":
6072             case "MultiLineString":
6073               return geometry(t);
6074             default:
6075               return t;
6076           }
6077         }
6078         module2.exports = parse;
6079         module2.exports.parse = parse;
6080       })();
6081     }
6082   });
6083
6084   // node_modules/@aitodotai/json-stringify-pretty-compact/index.js
6085   var require_json_stringify_pretty_compact = __commonJS({
6086     "node_modules/@aitodotai/json-stringify-pretty-compact/index.js"(exports2, module2) {
6087       function isObject3(obj) {
6088         return typeof obj === "object" && obj !== null;
6089       }
6090       function forEach(obj, cb) {
6091         if (Array.isArray(obj)) {
6092           obj.forEach(cb);
6093         } else if (isObject3(obj)) {
6094           Object.keys(obj).forEach(function(key) {
6095             var val = obj[key];
6096             cb(val, key);
6097           });
6098         }
6099       }
6100       function getTreeDepth(obj) {
6101         var depth = 0;
6102         if (Array.isArray(obj) || isObject3(obj)) {
6103           forEach(obj, function(val) {
6104             if (Array.isArray(val) || isObject3(val)) {
6105               var tmpDepth = getTreeDepth(val);
6106               if (tmpDepth > depth) {
6107                 depth = tmpDepth;
6108               }
6109             }
6110           });
6111           return depth + 1;
6112         }
6113         return depth;
6114       }
6115       function stringify3(obj, options2) {
6116         options2 = options2 || {};
6117         var indent2 = JSON.stringify([1], null, get4(options2, "indent", 2)).slice(2, -3);
6118         var addMargin = get4(options2, "margins", false);
6119         var addArrayMargin = get4(options2, "arrayMargins", false);
6120         var addObjectMargin = get4(options2, "objectMargins", false);
6121         var maxLength = indent2 === "" ? Infinity : get4(options2, "maxLength", 80);
6122         var maxNesting = get4(options2, "maxNesting", Infinity);
6123         return function _stringify(obj2, currentIndent, reserved) {
6124           if (obj2 && typeof obj2.toJSON === "function") {
6125             obj2 = obj2.toJSON();
6126           }
6127           var string = JSON.stringify(obj2);
6128           if (string === void 0) {
6129             return string;
6130           }
6131           var length = maxLength - currentIndent.length - reserved;
6132           var treeDepth = getTreeDepth(obj2);
6133           if (treeDepth <= maxNesting && string.length <= length) {
6134             var prettified = prettify(string, {
6135               addMargin,
6136               addArrayMargin,
6137               addObjectMargin
6138             });
6139             if (prettified.length <= length) {
6140               return prettified;
6141             }
6142           }
6143           if (isObject3(obj2)) {
6144             var nextIndent = currentIndent + indent2;
6145             var items = [];
6146             var delimiters;
6147             var comma = function(array2, index2) {
6148               return index2 === array2.length - 1 ? 0 : 1;
6149             };
6150             if (Array.isArray(obj2)) {
6151               for (var index = 0; index < obj2.length; index++) {
6152                 items.push(
6153                   _stringify(obj2[index], nextIndent, comma(obj2, index)) || "null"
6154                 );
6155               }
6156               delimiters = "[]";
6157             } else {
6158               Object.keys(obj2).forEach(function(key, index2, array2) {
6159                 var keyPart = JSON.stringify(key) + ": ";
6160                 var value = _stringify(
6161                   obj2[key],
6162                   nextIndent,
6163                   keyPart.length + comma(array2, index2)
6164                 );
6165                 if (value !== void 0) {
6166                   items.push(keyPart + value);
6167                 }
6168               });
6169               delimiters = "{}";
6170             }
6171             if (items.length > 0) {
6172               return [
6173                 delimiters[0],
6174                 indent2 + items.join(",\n" + nextIndent),
6175                 delimiters[1]
6176               ].join("\n" + currentIndent);
6177             }
6178           }
6179           return string;
6180         }(obj, "", 0);
6181       }
6182       var stringOrChar = /("(?:[^\\"]|\\.)*")|[:,\][}{]/g;
6183       function prettify(string, options2) {
6184         options2 = options2 || {};
6185         var tokens = {
6186           "{": "{",
6187           "}": "}",
6188           "[": "[",
6189           "]": "]",
6190           ",": ", ",
6191           ":": ": "
6192         };
6193         if (options2.addMargin || options2.addObjectMargin) {
6194           tokens["{"] = "{ ";
6195           tokens["}"] = " }";
6196         }
6197         if (options2.addMargin || options2.addArrayMargin) {
6198           tokens["["] = "[ ";
6199           tokens["]"] = " ]";
6200         }
6201         return string.replace(stringOrChar, function(match, string2) {
6202           return string2 ? match : tokens[match];
6203         });
6204       }
6205       function get4(options2, name, defaultValue) {
6206         return name in options2 ? options2[name] : defaultValue;
6207       }
6208       module2.exports = stringify3;
6209     }
6210   });
6211
6212   // node_modules/aes-js/index.js
6213   var require_aes_js = __commonJS({
6214     "node_modules/aes-js/index.js"(exports2, module2) {
6215       (function(root3) {
6216         "use strict";
6217         function checkInt(value) {
6218           return parseInt(value) === value;
6219         }
6220         function checkInts(arrayish) {
6221           if (!checkInt(arrayish.length)) {
6222             return false;
6223           }
6224           for (var i2 = 0; i2 < arrayish.length; i2++) {
6225             if (!checkInt(arrayish[i2]) || arrayish[i2] < 0 || arrayish[i2] > 255) {
6226               return false;
6227             }
6228           }
6229           return true;
6230         }
6231         function coerceArray(arg, copy2) {
6232           if (arg.buffer && arg.name === "Uint8Array") {
6233             if (copy2) {
6234               if (arg.slice) {
6235                 arg = arg.slice();
6236               } else {
6237                 arg = Array.prototype.slice.call(arg);
6238               }
6239             }
6240             return arg;
6241           }
6242           if (Array.isArray(arg)) {
6243             if (!checkInts(arg)) {
6244               throw new Error("Array contains invalid value: " + arg);
6245             }
6246             return new Uint8Array(arg);
6247           }
6248           if (checkInt(arg.length) && checkInts(arg)) {
6249             return new Uint8Array(arg);
6250           }
6251           throw new Error("unsupported array-like object");
6252         }
6253         function createArray(length) {
6254           return new Uint8Array(length);
6255         }
6256         function copyArray(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) {
6257           if (sourceStart != null || sourceEnd != null) {
6258             if (sourceArray.slice) {
6259               sourceArray = sourceArray.slice(sourceStart, sourceEnd);
6260             } else {
6261               sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd);
6262             }
6263           }
6264           targetArray.set(sourceArray, targetStart);
6265         }
6266         var convertUtf8 = function() {
6267           function toBytes(text2) {
6268             var result = [], i2 = 0;
6269             text2 = encodeURI(text2);
6270             while (i2 < text2.length) {
6271               var c = text2.charCodeAt(i2++);
6272               if (c === 37) {
6273                 result.push(parseInt(text2.substr(i2, 2), 16));
6274                 i2 += 2;
6275               } else {
6276                 result.push(c);
6277               }
6278             }
6279             return coerceArray(result);
6280           }
6281           function fromBytes(bytes) {
6282             var result = [], i2 = 0;
6283             while (i2 < bytes.length) {
6284               var c = bytes[i2];
6285               if (c < 128) {
6286                 result.push(String.fromCharCode(c));
6287                 i2++;
6288               } else if (c > 191 && c < 224) {
6289                 result.push(String.fromCharCode((c & 31) << 6 | bytes[i2 + 1] & 63));
6290                 i2 += 2;
6291               } else {
6292                 result.push(String.fromCharCode((c & 15) << 12 | (bytes[i2 + 1] & 63) << 6 | bytes[i2 + 2] & 63));
6293                 i2 += 3;
6294               }
6295             }
6296             return result.join("");
6297           }
6298           return {
6299             toBytes,
6300             fromBytes
6301           };
6302         }();
6303         var convertHex = function() {
6304           function toBytes(text2) {
6305             var result = [];
6306             for (var i2 = 0; i2 < text2.length; i2 += 2) {
6307               result.push(parseInt(text2.substr(i2, 2), 16));
6308             }
6309             return result;
6310           }
6311           var Hex = "0123456789abcdef";
6312           function fromBytes(bytes) {
6313             var result = [];
6314             for (var i2 = 0; i2 < bytes.length; i2++) {
6315               var v = bytes[i2];
6316               result.push(Hex[(v & 240) >> 4] + Hex[v & 15]);
6317             }
6318             return result.join("");
6319           }
6320           return {
6321             toBytes,
6322             fromBytes
6323           };
6324         }();
6325         var numberOfRounds = { 16: 10, 24: 12, 32: 14 };
6326         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];
6327         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];
6328         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];
6329         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];
6330         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];
6331         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];
6332         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];
6333         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];
6334         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];
6335         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];
6336         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];
6337         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];
6338         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];
6339         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];
6340         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];
6341         function convertToInt32(bytes) {
6342           var result = [];
6343           for (var i2 = 0; i2 < bytes.length; i2 += 4) {
6344             result.push(
6345               bytes[i2] << 24 | bytes[i2 + 1] << 16 | bytes[i2 + 2] << 8 | bytes[i2 + 3]
6346             );
6347           }
6348           return result;
6349         }
6350         var AES = function(key) {
6351           if (!(this instanceof AES)) {
6352             throw Error("AES must be instanitated with `new`");
6353           }
6354           Object.defineProperty(this, "key", {
6355             value: coerceArray(key, true)
6356           });
6357           this._prepare();
6358         };
6359         AES.prototype._prepare = function() {
6360           var rounds = numberOfRounds[this.key.length];
6361           if (rounds == null) {
6362             throw new Error("invalid key size (must be 16, 24 or 32 bytes)");
6363           }
6364           this._Ke = [];
6365           this._Kd = [];
6366           for (var i2 = 0; i2 <= rounds; i2++) {
6367             this._Ke.push([0, 0, 0, 0]);
6368             this._Kd.push([0, 0, 0, 0]);
6369           }
6370           var roundKeyCount = (rounds + 1) * 4;
6371           var KC = this.key.length / 4;
6372           var tk = convertToInt32(this.key);
6373           var index;
6374           for (var i2 = 0; i2 < KC; i2++) {
6375             index = i2 >> 2;
6376             this._Ke[index][i2 % 4] = tk[i2];
6377             this._Kd[rounds - index][i2 % 4] = tk[i2];
6378           }
6379           var rconpointer = 0;
6380           var t = KC, tt;
6381           while (t < roundKeyCount) {
6382             tt = tk[KC - 1];
6383             tk[0] ^= S[tt >> 16 & 255] << 24 ^ S[tt >> 8 & 255] << 16 ^ S[tt & 255] << 8 ^ S[tt >> 24 & 255] ^ rcon[rconpointer] << 24;
6384             rconpointer += 1;
6385             if (KC != 8) {
6386               for (var i2 = 1; i2 < KC; i2++) {
6387                 tk[i2] ^= tk[i2 - 1];
6388               }
6389             } else {
6390               for (var i2 = 1; i2 < KC / 2; i2++) {
6391                 tk[i2] ^= tk[i2 - 1];
6392               }
6393               tt = tk[KC / 2 - 1];
6394               tk[KC / 2] ^= S[tt & 255] ^ S[tt >> 8 & 255] << 8 ^ S[tt >> 16 & 255] << 16 ^ S[tt >> 24 & 255] << 24;
6395               for (var i2 = KC / 2 + 1; i2 < KC; i2++) {
6396                 tk[i2] ^= tk[i2 - 1];
6397               }
6398             }
6399             var i2 = 0, r, c;
6400             while (i2 < KC && t < roundKeyCount) {
6401               r = t >> 2;
6402               c = t % 4;
6403               this._Ke[r][c] = tk[i2];
6404               this._Kd[rounds - r][c] = tk[i2++];
6405               t++;
6406             }
6407           }
6408           for (var r = 1; r < rounds; r++) {
6409             for (var c = 0; c < 4; c++) {
6410               tt = this._Kd[r][c];
6411               this._Kd[r][c] = U1[tt >> 24 & 255] ^ U2[tt >> 16 & 255] ^ U3[tt >> 8 & 255] ^ U4[tt & 255];
6412             }
6413           }
6414         };
6415         AES.prototype.encrypt = function(plaintext) {
6416           if (plaintext.length != 16) {
6417             throw new Error("invalid plaintext size (must be 16 bytes)");
6418           }
6419           var rounds = this._Ke.length - 1;
6420           var a = [0, 0, 0, 0];
6421           var t = convertToInt32(plaintext);
6422           for (var i2 = 0; i2 < 4; i2++) {
6423             t[i2] ^= this._Ke[0][i2];
6424           }
6425           for (var r = 1; r < rounds; r++) {
6426             for (var i2 = 0; i2 < 4; i2++) {
6427               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];
6428             }
6429             t = a.slice();
6430           }
6431           var result = createArray(16), tt;
6432           for (var i2 = 0; i2 < 4; i2++) {
6433             tt = this._Ke[rounds][i2];
6434             result[4 * i2] = (S[t[i2] >> 24 & 255] ^ tt >> 24) & 255;
6435             result[4 * i2 + 1] = (S[t[(i2 + 1) % 4] >> 16 & 255] ^ tt >> 16) & 255;
6436             result[4 * i2 + 2] = (S[t[(i2 + 2) % 4] >> 8 & 255] ^ tt >> 8) & 255;
6437             result[4 * i2 + 3] = (S[t[(i2 + 3) % 4] & 255] ^ tt) & 255;
6438           }
6439           return result;
6440         };
6441         AES.prototype.decrypt = function(ciphertext) {
6442           if (ciphertext.length != 16) {
6443             throw new Error("invalid ciphertext size (must be 16 bytes)");
6444           }
6445           var rounds = this._Kd.length - 1;
6446           var a = [0, 0, 0, 0];
6447           var t = convertToInt32(ciphertext);
6448           for (var i2 = 0; i2 < 4; i2++) {
6449             t[i2] ^= this._Kd[0][i2];
6450           }
6451           for (var r = 1; r < rounds; r++) {
6452             for (var i2 = 0; i2 < 4; i2++) {
6453               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];
6454             }
6455             t = a.slice();
6456           }
6457           var result = createArray(16), tt;
6458           for (var i2 = 0; i2 < 4; i2++) {
6459             tt = this._Kd[rounds][i2];
6460             result[4 * i2] = (Si[t[i2] >> 24 & 255] ^ tt >> 24) & 255;
6461             result[4 * i2 + 1] = (Si[t[(i2 + 3) % 4] >> 16 & 255] ^ tt >> 16) & 255;
6462             result[4 * i2 + 2] = (Si[t[(i2 + 2) % 4] >> 8 & 255] ^ tt >> 8) & 255;
6463             result[4 * i2 + 3] = (Si[t[(i2 + 1) % 4] & 255] ^ tt) & 255;
6464           }
6465           return result;
6466         };
6467         var ModeOfOperationECB = function(key) {
6468           if (!(this instanceof ModeOfOperationECB)) {
6469             throw Error("AES must be instanitated with `new`");
6470           }
6471           this.description = "Electronic Code Block";
6472           this.name = "ecb";
6473           this._aes = new AES(key);
6474         };
6475         ModeOfOperationECB.prototype.encrypt = function(plaintext) {
6476           plaintext = coerceArray(plaintext);
6477           if (plaintext.length % 16 !== 0) {
6478             throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
6479           }
6480           var ciphertext = createArray(plaintext.length);
6481           var block2 = createArray(16);
6482           for (var i2 = 0; i2 < plaintext.length; i2 += 16) {
6483             copyArray(plaintext, block2, 0, i2, i2 + 16);
6484             block2 = this._aes.encrypt(block2);
6485             copyArray(block2, ciphertext, i2);
6486           }
6487           return ciphertext;
6488         };
6489         ModeOfOperationECB.prototype.decrypt = function(ciphertext) {
6490           ciphertext = coerceArray(ciphertext);
6491           if (ciphertext.length % 16 !== 0) {
6492             throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
6493           }
6494           var plaintext = createArray(ciphertext.length);
6495           var block2 = createArray(16);
6496           for (var i2 = 0; i2 < ciphertext.length; i2 += 16) {
6497             copyArray(ciphertext, block2, 0, i2, i2 + 16);
6498             block2 = this._aes.decrypt(block2);
6499             copyArray(block2, plaintext, i2);
6500           }
6501           return plaintext;
6502         };
6503         var ModeOfOperationCBC = function(key, iv) {
6504           if (!(this instanceof ModeOfOperationCBC)) {
6505             throw Error("AES must be instanitated with `new`");
6506           }
6507           this.description = "Cipher Block Chaining";
6508           this.name = "cbc";
6509           if (!iv) {
6510             iv = createArray(16);
6511           } else if (iv.length != 16) {
6512             throw new Error("invalid initialation vector size (must be 16 bytes)");
6513           }
6514           this._lastCipherblock = coerceArray(iv, true);
6515           this._aes = new AES(key);
6516         };
6517         ModeOfOperationCBC.prototype.encrypt = function(plaintext) {
6518           plaintext = coerceArray(plaintext);
6519           if (plaintext.length % 16 !== 0) {
6520             throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
6521           }
6522           var ciphertext = createArray(plaintext.length);
6523           var block2 = createArray(16);
6524           for (var i2 = 0; i2 < plaintext.length; i2 += 16) {
6525             copyArray(plaintext, block2, 0, i2, i2 + 16);
6526             for (var j2 = 0; j2 < 16; j2++) {
6527               block2[j2] ^= this._lastCipherblock[j2];
6528             }
6529             this._lastCipherblock = this._aes.encrypt(block2);
6530             copyArray(this._lastCipherblock, ciphertext, i2);
6531           }
6532           return ciphertext;
6533         };
6534         ModeOfOperationCBC.prototype.decrypt = function(ciphertext) {
6535           ciphertext = coerceArray(ciphertext);
6536           if (ciphertext.length % 16 !== 0) {
6537             throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
6538           }
6539           var plaintext = createArray(ciphertext.length);
6540           var block2 = createArray(16);
6541           for (var i2 = 0; i2 < ciphertext.length; i2 += 16) {
6542             copyArray(ciphertext, block2, 0, i2, i2 + 16);
6543             block2 = this._aes.decrypt(block2);
6544             for (var j2 = 0; j2 < 16; j2++) {
6545               plaintext[i2 + j2] = block2[j2] ^ this._lastCipherblock[j2];
6546             }
6547             copyArray(ciphertext, this._lastCipherblock, 0, i2, i2 + 16);
6548           }
6549           return plaintext;
6550         };
6551         var ModeOfOperationCFB = function(key, iv, segmentSize) {
6552           if (!(this instanceof ModeOfOperationCFB)) {
6553             throw Error("AES must be instanitated with `new`");
6554           }
6555           this.description = "Cipher Feedback";
6556           this.name = "cfb";
6557           if (!iv) {
6558             iv = createArray(16);
6559           } else if (iv.length != 16) {
6560             throw new Error("invalid initialation vector size (must be 16 size)");
6561           }
6562           if (!segmentSize) {
6563             segmentSize = 1;
6564           }
6565           this.segmentSize = segmentSize;
6566           this._shiftRegister = coerceArray(iv, true);
6567           this._aes = new AES(key);
6568         };
6569         ModeOfOperationCFB.prototype.encrypt = function(plaintext) {
6570           if (plaintext.length % this.segmentSize != 0) {
6571             throw new Error("invalid plaintext size (must be segmentSize bytes)");
6572           }
6573           var encrypted = coerceArray(plaintext, true);
6574           var xorSegment;
6575           for (var i2 = 0; i2 < encrypted.length; i2 += this.segmentSize) {
6576             xorSegment = this._aes.encrypt(this._shiftRegister);
6577             for (var j2 = 0; j2 < this.segmentSize; j2++) {
6578               encrypted[i2 + j2] ^= xorSegment[j2];
6579             }
6580             copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
6581             copyArray(encrypted, this._shiftRegister, 16 - this.segmentSize, i2, i2 + this.segmentSize);
6582           }
6583           return encrypted;
6584         };
6585         ModeOfOperationCFB.prototype.decrypt = function(ciphertext) {
6586           if (ciphertext.length % this.segmentSize != 0) {
6587             throw new Error("invalid ciphertext size (must be segmentSize bytes)");
6588           }
6589           var plaintext = coerceArray(ciphertext, true);
6590           var xorSegment;
6591           for (var i2 = 0; i2 < plaintext.length; i2 += this.segmentSize) {
6592             xorSegment = this._aes.encrypt(this._shiftRegister);
6593             for (var j2 = 0; j2 < this.segmentSize; j2++) {
6594               plaintext[i2 + j2] ^= xorSegment[j2];
6595             }
6596             copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
6597             copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i2, i2 + this.segmentSize);
6598           }
6599           return plaintext;
6600         };
6601         var ModeOfOperationOFB = function(key, iv) {
6602           if (!(this instanceof ModeOfOperationOFB)) {
6603             throw Error("AES must be instanitated with `new`");
6604           }
6605           this.description = "Output Feedback";
6606           this.name = "ofb";
6607           if (!iv) {
6608             iv = createArray(16);
6609           } else if (iv.length != 16) {
6610             throw new Error("invalid initialation vector size (must be 16 bytes)");
6611           }
6612           this._lastPrecipher = coerceArray(iv, true);
6613           this._lastPrecipherIndex = 16;
6614           this._aes = new AES(key);
6615         };
6616         ModeOfOperationOFB.prototype.encrypt = function(plaintext) {
6617           var encrypted = coerceArray(plaintext, true);
6618           for (var i2 = 0; i2 < encrypted.length; i2++) {
6619             if (this._lastPrecipherIndex === 16) {
6620               this._lastPrecipher = this._aes.encrypt(this._lastPrecipher);
6621               this._lastPrecipherIndex = 0;
6622             }
6623             encrypted[i2] ^= this._lastPrecipher[this._lastPrecipherIndex++];
6624           }
6625           return encrypted;
6626         };
6627         ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt;
6628         var Counter = function(initialValue) {
6629           if (!(this instanceof Counter)) {
6630             throw Error("Counter must be instanitated with `new`");
6631           }
6632           if (initialValue !== 0 && !initialValue) {
6633             initialValue = 1;
6634           }
6635           if (typeof initialValue === "number") {
6636             this._counter = createArray(16);
6637             this.setValue(initialValue);
6638           } else {
6639             this.setBytes(initialValue);
6640           }
6641         };
6642         Counter.prototype.setValue = function(value) {
6643           if (typeof value !== "number" || parseInt(value) != value) {
6644             throw new Error("invalid counter value (must be an integer)");
6645           }
6646           if (value > Number.MAX_SAFE_INTEGER) {
6647             throw new Error("integer value out of safe range");
6648           }
6649           for (var index = 15; index >= 0; --index) {
6650             this._counter[index] = value % 256;
6651             value = parseInt(value / 256);
6652           }
6653         };
6654         Counter.prototype.setBytes = function(bytes) {
6655           bytes = coerceArray(bytes, true);
6656           if (bytes.length != 16) {
6657             throw new Error("invalid counter bytes size (must be 16 bytes)");
6658           }
6659           this._counter = bytes;
6660         };
6661         Counter.prototype.increment = function() {
6662           for (var i2 = 15; i2 >= 0; i2--) {
6663             if (this._counter[i2] === 255) {
6664               this._counter[i2] = 0;
6665             } else {
6666               this._counter[i2]++;
6667               break;
6668             }
6669           }
6670         };
6671         var ModeOfOperationCTR = function(key, counter) {
6672           if (!(this instanceof ModeOfOperationCTR)) {
6673             throw Error("AES must be instanitated with `new`");
6674           }
6675           this.description = "Counter";
6676           this.name = "ctr";
6677           if (!(counter instanceof Counter)) {
6678             counter = new Counter(counter);
6679           }
6680           this._counter = counter;
6681           this._remainingCounter = null;
6682           this._remainingCounterIndex = 16;
6683           this._aes = new AES(key);
6684         };
6685         ModeOfOperationCTR.prototype.encrypt = function(plaintext) {
6686           var encrypted = coerceArray(plaintext, true);
6687           for (var i2 = 0; i2 < encrypted.length; i2++) {
6688             if (this._remainingCounterIndex === 16) {
6689               this._remainingCounter = this._aes.encrypt(this._counter._counter);
6690               this._remainingCounterIndex = 0;
6691               this._counter.increment();
6692             }
6693             encrypted[i2] ^= this._remainingCounter[this._remainingCounterIndex++];
6694           }
6695           return encrypted;
6696         };
6697         ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt;
6698         function pkcs7pad(data) {
6699           data = coerceArray(data, true);
6700           var padder = 16 - data.length % 16;
6701           var result = createArray(data.length + padder);
6702           copyArray(data, result);
6703           for (var i2 = data.length; i2 < result.length; i2++) {
6704             result[i2] = padder;
6705           }
6706           return result;
6707         }
6708         function pkcs7strip(data) {
6709           data = coerceArray(data, true);
6710           if (data.length < 16) {
6711             throw new Error("PKCS#7 invalid length");
6712           }
6713           var padder = data[data.length - 1];
6714           if (padder > 16) {
6715             throw new Error("PKCS#7 padding byte out of range");
6716           }
6717           var length = data.length - padder;
6718           for (var i2 = 0; i2 < padder; i2++) {
6719             if (data[length + i2] !== padder) {
6720               throw new Error("PKCS#7 invalid padding byte");
6721             }
6722           }
6723           var result = createArray(length);
6724           copyArray(data, result, 0, 0, length);
6725           return result;
6726         }
6727         var aesjs2 = {
6728           AES,
6729           Counter,
6730           ModeOfOperation: {
6731             ecb: ModeOfOperationECB,
6732             cbc: ModeOfOperationCBC,
6733             cfb: ModeOfOperationCFB,
6734             ofb: ModeOfOperationOFB,
6735             ctr: ModeOfOperationCTR
6736           },
6737           utils: {
6738             hex: convertHex,
6739             utf8: convertUtf8
6740           },
6741           padding: {
6742             pkcs7: {
6743               pad: pkcs7pad,
6744               strip: pkcs7strip
6745             }
6746           },
6747           _arrayTest: {
6748             coerceArray,
6749             createArray,
6750             copyArray
6751           }
6752         };
6753         if (typeof exports2 !== "undefined") {
6754           module2.exports = aesjs2;
6755         } else if (typeof define === "function" && define.amd) {
6756           define([], function() {
6757             return aesjs2;
6758           });
6759         } else {
6760           if (root3.aesjs) {
6761             aesjs2._aesjs = root3.aesjs;
6762           }
6763           root3.aesjs = aesjs2;
6764         }
6765       })(exports2);
6766     }
6767   });
6768
6769   // node_modules/lodash/lodash.js
6770   var require_lodash = __commonJS({
6771     "node_modules/lodash/lodash.js"(exports2, module2) {
6772       (function() {
6773         var undefined2;
6774         var VERSION = "4.17.21";
6775         var LARGE_ARRAY_SIZE2 = 200;
6776         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`";
6777         var HASH_UNDEFINED4 = "__lodash_hash_undefined__";
6778         var MAX_MEMOIZE_SIZE = 500;
6779         var PLACEHOLDER = "__lodash_placeholder__";
6780         var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
6781         var COMPARE_PARTIAL_FLAG5 = 1, COMPARE_UNORDERED_FLAG3 = 2;
6782         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;
6783         var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
6784         var HOT_COUNT = 800, HOT_SPAN = 16;
6785         var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
6786         var INFINITY2 = 1 / 0, MAX_SAFE_INTEGER3 = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN2 = 0 / 0;
6787         var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
6788         var wrapFlags = [
6789           ["ary", WRAP_ARY_FLAG],
6790           ["bind", WRAP_BIND_FLAG],
6791           ["bindKey", WRAP_BIND_KEY_FLAG],
6792           ["curry", WRAP_CURRY_FLAG],
6793           ["curryRight", WRAP_CURRY_RIGHT_FLAG],
6794           ["flip", WRAP_FLIP_FLAG],
6795           ["partial", WRAP_PARTIAL_FLAG],
6796           ["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
6797           ["rearg", WRAP_REARG_FLAG]
6798         ];
6799         var argsTag4 = "[object Arguments]", arrayTag3 = "[object Array]", asyncTag2 = "[object AsyncFunction]", boolTag3 = "[object Boolean]", dateTag3 = "[object Date]", domExcTag = "[object DOMException]", errorTag3 = "[object Error]", funcTag3 = "[object Function]", genTag2 = "[object GeneratorFunction]", mapTag4 = "[object Map]", numberTag3 = "[object Number]", nullTag2 = "[object Null]", objectTag4 = "[object Object]", promiseTag2 = "[object Promise]", proxyTag2 = "[object Proxy]", regexpTag3 = "[object RegExp]", setTag4 = "[object Set]", stringTag3 = "[object String]", symbolTag3 = "[object Symbol]", undefinedTag2 = "[object Undefined]", weakMapTag3 = "[object WeakMap]", weakSetTag = "[object WeakSet]";
6800         var arrayBufferTag3 = "[object ArrayBuffer]", dataViewTag4 = "[object DataView]", float32Tag2 = "[object Float32Array]", float64Tag2 = "[object Float64Array]", int8Tag2 = "[object Int8Array]", int16Tag2 = "[object Int16Array]", int32Tag2 = "[object Int32Array]", uint8Tag2 = "[object Uint8Array]", uint8ClampedTag2 = "[object Uint8ClampedArray]", uint16Tag2 = "[object Uint16Array]", uint32Tag2 = "[object Uint32Array]";
6801         var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
6802         var reEscapedHtml2 = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml2 = /[&<>"']/g, reHasEscapedHtml2 = RegExp(reEscapedHtml2.source), reHasUnescapedHtml2 = RegExp(reUnescapedHtml2.source);
6803         var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
6804         var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
6805         var reRegExpChar2 = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar2.source);
6806         var reTrimStart2 = /^\s+/;
6807         var reWhitespace2 = /\s/;
6808         var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
6809         var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
6810         var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
6811         var reEscapeChar = /\\(\\)?/g;
6812         var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
6813         var reFlags = /\w*$/;
6814         var reIsBadHex2 = /^[-+]0x[0-9a-f]+$/i;
6815         var reIsBinary2 = /^0b[01]+$/i;
6816         var reIsHostCtor2 = /^\[object .+?Constructor\]$/;
6817         var reIsOctal2 = /^0o[0-7]+$/i;
6818         var reIsUint2 = /^(?:0|[1-9]\d*)$/;
6819         var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
6820         var reNoMatch = /($^)/;
6821         var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
6822         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;
6823         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";
6824         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("|") + ")";
6825         var reApos = RegExp(rsApos, "g");
6826         var reComboMark = RegExp(rsCombo, "g");
6827         var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
6828         var reUnicodeWord = RegExp([
6829           rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
6830           rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
6831           rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
6832           rsUpper + "+" + rsOptContrUpper,
6833           rsOrdUpper,
6834           rsOrdLower,
6835           rsDigits,
6836           rsEmoji
6837         ].join("|"), "g");
6838         var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
6839         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 ]/;
6840         var contextProps = [
6841           "Array",
6842           "Buffer",
6843           "DataView",
6844           "Date",
6845           "Error",
6846           "Float32Array",
6847           "Float64Array",
6848           "Function",
6849           "Int8Array",
6850           "Int16Array",
6851           "Int32Array",
6852           "Map",
6853           "Math",
6854           "Object",
6855           "Promise",
6856           "RegExp",
6857           "Set",
6858           "String",
6859           "Symbol",
6860           "TypeError",
6861           "Uint8Array",
6862           "Uint8ClampedArray",
6863           "Uint16Array",
6864           "Uint32Array",
6865           "WeakMap",
6866           "_",
6867           "clearTimeout",
6868           "isFinite",
6869           "parseInt",
6870           "setTimeout"
6871         ];
6872         var templateCounter = -1;
6873         var typedArrayTags2 = {};
6874         typedArrayTags2[float32Tag2] = typedArrayTags2[float64Tag2] = typedArrayTags2[int8Tag2] = typedArrayTags2[int16Tag2] = typedArrayTags2[int32Tag2] = typedArrayTags2[uint8Tag2] = typedArrayTags2[uint8ClampedTag2] = typedArrayTags2[uint16Tag2] = typedArrayTags2[uint32Tag2] = true;
6875         typedArrayTags2[argsTag4] = typedArrayTags2[arrayTag3] = typedArrayTags2[arrayBufferTag3] = typedArrayTags2[boolTag3] = typedArrayTags2[dataViewTag4] = typedArrayTags2[dateTag3] = typedArrayTags2[errorTag3] = typedArrayTags2[funcTag3] = typedArrayTags2[mapTag4] = typedArrayTags2[numberTag3] = typedArrayTags2[objectTag4] = typedArrayTags2[regexpTag3] = typedArrayTags2[setTag4] = typedArrayTags2[stringTag3] = typedArrayTags2[weakMapTag3] = false;
6876         var cloneableTags = {};
6877         cloneableTags[argsTag4] = cloneableTags[arrayTag3] = cloneableTags[arrayBufferTag3] = cloneableTags[dataViewTag4] = cloneableTags[boolTag3] = cloneableTags[dateTag3] = cloneableTags[float32Tag2] = cloneableTags[float64Tag2] = cloneableTags[int8Tag2] = cloneableTags[int16Tag2] = cloneableTags[int32Tag2] = cloneableTags[mapTag4] = cloneableTags[numberTag3] = cloneableTags[objectTag4] = cloneableTags[regexpTag3] = cloneableTags[setTag4] = cloneableTags[stringTag3] = cloneableTags[symbolTag3] = cloneableTags[uint8Tag2] = cloneableTags[uint8ClampedTag2] = cloneableTags[uint16Tag2] = cloneableTags[uint32Tag2] = true;
6878         cloneableTags[errorTag3] = cloneableTags[funcTag3] = cloneableTags[weakMapTag3] = false;
6879         var deburredLetters = {
6880           // Latin-1 Supplement block.
6881           "\xC0": "A",
6882           "\xC1": "A",
6883           "\xC2": "A",
6884           "\xC3": "A",
6885           "\xC4": "A",
6886           "\xC5": "A",
6887           "\xE0": "a",
6888           "\xE1": "a",
6889           "\xE2": "a",
6890           "\xE3": "a",
6891           "\xE4": "a",
6892           "\xE5": "a",
6893           "\xC7": "C",
6894           "\xE7": "c",
6895           "\xD0": "D",
6896           "\xF0": "d",
6897           "\xC8": "E",
6898           "\xC9": "E",
6899           "\xCA": "E",
6900           "\xCB": "E",
6901           "\xE8": "e",
6902           "\xE9": "e",
6903           "\xEA": "e",
6904           "\xEB": "e",
6905           "\xCC": "I",
6906           "\xCD": "I",
6907           "\xCE": "I",
6908           "\xCF": "I",
6909           "\xEC": "i",
6910           "\xED": "i",
6911           "\xEE": "i",
6912           "\xEF": "i",
6913           "\xD1": "N",
6914           "\xF1": "n",
6915           "\xD2": "O",
6916           "\xD3": "O",
6917           "\xD4": "O",
6918           "\xD5": "O",
6919           "\xD6": "O",
6920           "\xD8": "O",
6921           "\xF2": "o",
6922           "\xF3": "o",
6923           "\xF4": "o",
6924           "\xF5": "o",
6925           "\xF6": "o",
6926           "\xF8": "o",
6927           "\xD9": "U",
6928           "\xDA": "U",
6929           "\xDB": "U",
6930           "\xDC": "U",
6931           "\xF9": "u",
6932           "\xFA": "u",
6933           "\xFB": "u",
6934           "\xFC": "u",
6935           "\xDD": "Y",
6936           "\xFD": "y",
6937           "\xFF": "y",
6938           "\xC6": "Ae",
6939           "\xE6": "ae",
6940           "\xDE": "Th",
6941           "\xFE": "th",
6942           "\xDF": "ss",
6943           // Latin Extended-A block.
6944           "\u0100": "A",
6945           "\u0102": "A",
6946           "\u0104": "A",
6947           "\u0101": "a",
6948           "\u0103": "a",
6949           "\u0105": "a",
6950           "\u0106": "C",
6951           "\u0108": "C",
6952           "\u010A": "C",
6953           "\u010C": "C",
6954           "\u0107": "c",
6955           "\u0109": "c",
6956           "\u010B": "c",
6957           "\u010D": "c",
6958           "\u010E": "D",
6959           "\u0110": "D",
6960           "\u010F": "d",
6961           "\u0111": "d",
6962           "\u0112": "E",
6963           "\u0114": "E",
6964           "\u0116": "E",
6965           "\u0118": "E",
6966           "\u011A": "E",
6967           "\u0113": "e",
6968           "\u0115": "e",
6969           "\u0117": "e",
6970           "\u0119": "e",
6971           "\u011B": "e",
6972           "\u011C": "G",
6973           "\u011E": "G",
6974           "\u0120": "G",
6975           "\u0122": "G",
6976           "\u011D": "g",
6977           "\u011F": "g",
6978           "\u0121": "g",
6979           "\u0123": "g",
6980           "\u0124": "H",
6981           "\u0126": "H",
6982           "\u0125": "h",
6983           "\u0127": "h",
6984           "\u0128": "I",
6985           "\u012A": "I",
6986           "\u012C": "I",
6987           "\u012E": "I",
6988           "\u0130": "I",
6989           "\u0129": "i",
6990           "\u012B": "i",
6991           "\u012D": "i",
6992           "\u012F": "i",
6993           "\u0131": "i",
6994           "\u0134": "J",
6995           "\u0135": "j",
6996           "\u0136": "K",
6997           "\u0137": "k",
6998           "\u0138": "k",
6999           "\u0139": "L",
7000           "\u013B": "L",
7001           "\u013D": "L",
7002           "\u013F": "L",
7003           "\u0141": "L",
7004           "\u013A": "l",
7005           "\u013C": "l",
7006           "\u013E": "l",
7007           "\u0140": "l",
7008           "\u0142": "l",
7009           "\u0143": "N",
7010           "\u0145": "N",
7011           "\u0147": "N",
7012           "\u014A": "N",
7013           "\u0144": "n",
7014           "\u0146": "n",
7015           "\u0148": "n",
7016           "\u014B": "n",
7017           "\u014C": "O",
7018           "\u014E": "O",
7019           "\u0150": "O",
7020           "\u014D": "o",
7021           "\u014F": "o",
7022           "\u0151": "o",
7023           "\u0154": "R",
7024           "\u0156": "R",
7025           "\u0158": "R",
7026           "\u0155": "r",
7027           "\u0157": "r",
7028           "\u0159": "r",
7029           "\u015A": "S",
7030           "\u015C": "S",
7031           "\u015E": "S",
7032           "\u0160": "S",
7033           "\u015B": "s",
7034           "\u015D": "s",
7035           "\u015F": "s",
7036           "\u0161": "s",
7037           "\u0162": "T",
7038           "\u0164": "T",
7039           "\u0166": "T",
7040           "\u0163": "t",
7041           "\u0165": "t",
7042           "\u0167": "t",
7043           "\u0168": "U",
7044           "\u016A": "U",
7045           "\u016C": "U",
7046           "\u016E": "U",
7047           "\u0170": "U",
7048           "\u0172": "U",
7049           "\u0169": "u",
7050           "\u016B": "u",
7051           "\u016D": "u",
7052           "\u016F": "u",
7053           "\u0171": "u",
7054           "\u0173": "u",
7055           "\u0174": "W",
7056           "\u0175": "w",
7057           "\u0176": "Y",
7058           "\u0177": "y",
7059           "\u0178": "Y",
7060           "\u0179": "Z",
7061           "\u017B": "Z",
7062           "\u017D": "Z",
7063           "\u017A": "z",
7064           "\u017C": "z",
7065           "\u017E": "z",
7066           "\u0132": "IJ",
7067           "\u0133": "ij",
7068           "\u0152": "Oe",
7069           "\u0153": "oe",
7070           "\u0149": "'n",
7071           "\u017F": "s"
7072         };
7073         var htmlEscapes2 = {
7074           "&": "&amp;",
7075           "<": "&lt;",
7076           ">": "&gt;",
7077           '"': "&quot;",
7078           "'": "&#39;"
7079         };
7080         var htmlUnescapes2 = {
7081           "&amp;": "&",
7082           "&lt;": "<",
7083           "&gt;": ">",
7084           "&quot;": '"',
7085           "&#39;": "'"
7086         };
7087         var stringEscapes = {
7088           "\\": "\\",
7089           "'": "'",
7090           "\n": "n",
7091           "\r": "r",
7092           "\u2028": "u2028",
7093           "\u2029": "u2029"
7094         };
7095         var freeParseFloat = parseFloat, freeParseInt2 = parseInt;
7096         var freeGlobal2 = typeof global == "object" && global && global.Object === Object && global;
7097         var freeSelf2 = typeof self == "object" && self && self.Object === Object && self;
7098         var root3 = freeGlobal2 || freeSelf2 || Function("return this")();
7099         var freeExports3 = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2;
7100         var freeModule3 = freeExports3 && typeof module2 == "object" && module2 && !module2.nodeType && module2;
7101         var moduleExports3 = freeModule3 && freeModule3.exports === freeExports3;
7102         var freeProcess2 = moduleExports3 && freeGlobal2.process;
7103         var nodeUtil2 = function() {
7104           try {
7105             var types = freeModule3 && freeModule3.require && freeModule3.require("util").types;
7106             if (types) {
7107               return types;
7108             }
7109             return freeProcess2 && freeProcess2.binding && freeProcess2.binding("util");
7110           } catch (e) {
7111           }
7112         }();
7113         var nodeIsArrayBuffer = nodeUtil2 && nodeUtil2.isArrayBuffer, nodeIsDate = nodeUtil2 && nodeUtil2.isDate, nodeIsMap = nodeUtil2 && nodeUtil2.isMap, nodeIsRegExp = nodeUtil2 && nodeUtil2.isRegExp, nodeIsSet = nodeUtil2 && nodeUtil2.isSet, nodeIsTypedArray2 = nodeUtil2 && nodeUtil2.isTypedArray;
7114         function apply(func, thisArg, args) {
7115           switch (args.length) {
7116             case 0:
7117               return func.call(thisArg);
7118             case 1:
7119               return func.call(thisArg, args[0]);
7120             case 2:
7121               return func.call(thisArg, args[0], args[1]);
7122             case 3:
7123               return func.call(thisArg, args[0], args[1], args[2]);
7124           }
7125           return func.apply(thisArg, args);
7126         }
7127         function arrayAggregator(array2, setter, iteratee, accumulator) {
7128           var index = -1, length = array2 == null ? 0 : array2.length;
7129           while (++index < length) {
7130             var value = array2[index];
7131             setter(accumulator, value, iteratee(value), array2);
7132           }
7133           return accumulator;
7134         }
7135         function arrayEach(array2, iteratee) {
7136           var index = -1, length = array2 == null ? 0 : array2.length;
7137           while (++index < length) {
7138             if (iteratee(array2[index], index, array2) === false) {
7139               break;
7140             }
7141           }
7142           return array2;
7143         }
7144         function arrayEachRight(array2, iteratee) {
7145           var length = array2 == null ? 0 : array2.length;
7146           while (length--) {
7147             if (iteratee(array2[length], length, array2) === false) {
7148               break;
7149             }
7150           }
7151           return array2;
7152         }
7153         function arrayEvery(array2, predicate) {
7154           var index = -1, length = array2 == null ? 0 : array2.length;
7155           while (++index < length) {
7156             if (!predicate(array2[index], index, array2)) {
7157               return false;
7158             }
7159           }
7160           return true;
7161         }
7162         function arrayFilter2(array2, predicate) {
7163           var index = -1, length = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
7164           while (++index < length) {
7165             var value = array2[index];
7166             if (predicate(value, index, array2)) {
7167               result[resIndex++] = value;
7168             }
7169           }
7170           return result;
7171         }
7172         function arrayIncludes(array2, value) {
7173           var length = array2 == null ? 0 : array2.length;
7174           return !!length && baseIndexOf(array2, value, 0) > -1;
7175         }
7176         function arrayIncludesWith(array2, value, comparator) {
7177           var index = -1, length = array2 == null ? 0 : array2.length;
7178           while (++index < length) {
7179             if (comparator(value, array2[index])) {
7180               return true;
7181             }
7182           }
7183           return false;
7184         }
7185         function arrayMap2(array2, iteratee) {
7186           var index = -1, length = array2 == null ? 0 : array2.length, result = Array(length);
7187           while (++index < length) {
7188             result[index] = iteratee(array2[index], index, array2);
7189           }
7190           return result;
7191         }
7192         function arrayPush2(array2, values) {
7193           var index = -1, length = values.length, offset = array2.length;
7194           while (++index < length) {
7195             array2[offset + index] = values[index];
7196           }
7197           return array2;
7198         }
7199         function arrayReduce(array2, iteratee, accumulator, initAccum) {
7200           var index = -1, length = array2 == null ? 0 : array2.length;
7201           if (initAccum && length) {
7202             accumulator = array2[++index];
7203           }
7204           while (++index < length) {
7205             accumulator = iteratee(accumulator, array2[index], index, array2);
7206           }
7207           return accumulator;
7208         }
7209         function arrayReduceRight(array2, iteratee, accumulator, initAccum) {
7210           var length = array2 == null ? 0 : array2.length;
7211           if (initAccum && length) {
7212             accumulator = array2[--length];
7213           }
7214           while (length--) {
7215             accumulator = iteratee(accumulator, array2[length], length, array2);
7216           }
7217           return accumulator;
7218         }
7219         function arraySome2(array2, predicate) {
7220           var index = -1, length = array2 == null ? 0 : array2.length;
7221           while (++index < length) {
7222             if (predicate(array2[index], index, array2)) {
7223               return true;
7224             }
7225           }
7226           return false;
7227         }
7228         var asciiSize = baseProperty("length");
7229         function asciiToArray(string) {
7230           return string.split("");
7231         }
7232         function asciiWords(string) {
7233           return string.match(reAsciiWord) || [];
7234         }
7235         function baseFindKey(collection, predicate, eachFunc) {
7236           var result;
7237           eachFunc(collection, function(value, key, collection2) {
7238             if (predicate(value, key, collection2)) {
7239               result = key;
7240               return false;
7241             }
7242           });
7243           return result;
7244         }
7245         function baseFindIndex(array2, predicate, fromIndex, fromRight) {
7246           var length = array2.length, index = fromIndex + (fromRight ? 1 : -1);
7247           while (fromRight ? index-- : ++index < length) {
7248             if (predicate(array2[index], index, array2)) {
7249               return index;
7250             }
7251           }
7252           return -1;
7253         }
7254         function baseIndexOf(array2, value, fromIndex) {
7255           return value === value ? strictIndexOf(array2, value, fromIndex) : baseFindIndex(array2, baseIsNaN, fromIndex);
7256         }
7257         function baseIndexOfWith(array2, value, fromIndex, comparator) {
7258           var index = fromIndex - 1, length = array2.length;
7259           while (++index < length) {
7260             if (comparator(array2[index], value)) {
7261               return index;
7262             }
7263           }
7264           return -1;
7265         }
7266         function baseIsNaN(value) {
7267           return value !== value;
7268         }
7269         function baseMean(array2, iteratee) {
7270           var length = array2 == null ? 0 : array2.length;
7271           return length ? baseSum(array2, iteratee) / length : NAN2;
7272         }
7273         function baseProperty(key) {
7274           return function(object) {
7275             return object == null ? undefined2 : object[key];
7276           };
7277         }
7278         function basePropertyOf2(object) {
7279           return function(key) {
7280             return object == null ? undefined2 : object[key];
7281           };
7282         }
7283         function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
7284           eachFunc(collection, function(value, index, collection2) {
7285             accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
7286           });
7287           return accumulator;
7288         }
7289         function baseSortBy(array2, comparer) {
7290           var length = array2.length;
7291           array2.sort(comparer);
7292           while (length--) {
7293             array2[length] = array2[length].value;
7294           }
7295           return array2;
7296         }
7297         function baseSum(array2, iteratee) {
7298           var result, index = -1, length = array2.length;
7299           while (++index < length) {
7300             var current = iteratee(array2[index]);
7301             if (current !== undefined2) {
7302               result = result === undefined2 ? current : result + current;
7303             }
7304           }
7305           return result;
7306         }
7307         function baseTimes2(n2, iteratee) {
7308           var index = -1, result = Array(n2);
7309           while (++index < n2) {
7310             result[index] = iteratee(index);
7311           }
7312           return result;
7313         }
7314         function baseToPairs(object, props) {
7315           return arrayMap2(props, function(key) {
7316             return [key, object[key]];
7317           });
7318         }
7319         function baseTrim2(string) {
7320           return string ? string.slice(0, trimmedEndIndex2(string) + 1).replace(reTrimStart2, "") : string;
7321         }
7322         function baseUnary2(func) {
7323           return function(value) {
7324             return func(value);
7325           };
7326         }
7327         function baseValues(object, props) {
7328           return arrayMap2(props, function(key) {
7329             return object[key];
7330           });
7331         }
7332         function cacheHas2(cache, key) {
7333           return cache.has(key);
7334         }
7335         function charsStartIndex(strSymbols, chrSymbols) {
7336           var index = -1, length = strSymbols.length;
7337           while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
7338           }
7339           return index;
7340         }
7341         function charsEndIndex(strSymbols, chrSymbols) {
7342           var index = strSymbols.length;
7343           while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
7344           }
7345           return index;
7346         }
7347         function countHolders(array2, placeholder) {
7348           var length = array2.length, result = 0;
7349           while (length--) {
7350             if (array2[length] === placeholder) {
7351               ++result;
7352             }
7353           }
7354           return result;
7355         }
7356         var deburrLetter = basePropertyOf2(deburredLetters);
7357         var escapeHtmlChar2 = basePropertyOf2(htmlEscapes2);
7358         function escapeStringChar(chr) {
7359           return "\\" + stringEscapes[chr];
7360         }
7361         function getValue2(object, key) {
7362           return object == null ? undefined2 : object[key];
7363         }
7364         function hasUnicode(string) {
7365           return reHasUnicode.test(string);
7366         }
7367         function hasUnicodeWord(string) {
7368           return reHasUnicodeWord.test(string);
7369         }
7370         function iteratorToArray(iterator) {
7371           var data, result = [];
7372           while (!(data = iterator.next()).done) {
7373             result.push(data.value);
7374           }
7375           return result;
7376         }
7377         function mapToArray2(map2) {
7378           var index = -1, result = Array(map2.size);
7379           map2.forEach(function(value, key) {
7380             result[++index] = [key, value];
7381           });
7382           return result;
7383         }
7384         function overArg2(func, transform2) {
7385           return function(arg) {
7386             return func(transform2(arg));
7387           };
7388         }
7389         function replaceHolders(array2, placeholder) {
7390           var index = -1, length = array2.length, resIndex = 0, result = [];
7391           while (++index < length) {
7392             var value = array2[index];
7393             if (value === placeholder || value === PLACEHOLDER) {
7394               array2[index] = PLACEHOLDER;
7395               result[resIndex++] = index;
7396             }
7397           }
7398           return result;
7399         }
7400         function setToArray2(set3) {
7401           var index = -1, result = Array(set3.size);
7402           set3.forEach(function(value) {
7403             result[++index] = value;
7404           });
7405           return result;
7406         }
7407         function setToPairs(set3) {
7408           var index = -1, result = Array(set3.size);
7409           set3.forEach(function(value) {
7410             result[++index] = [value, value];
7411           });
7412           return result;
7413         }
7414         function strictIndexOf(array2, value, fromIndex) {
7415           var index = fromIndex - 1, length = array2.length;
7416           while (++index < length) {
7417             if (array2[index] === value) {
7418               return index;
7419             }
7420           }
7421           return -1;
7422         }
7423         function strictLastIndexOf(array2, value, fromIndex) {
7424           var index = fromIndex + 1;
7425           while (index--) {
7426             if (array2[index] === value) {
7427               return index;
7428             }
7429           }
7430           return index;
7431         }
7432         function stringSize(string) {
7433           return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
7434         }
7435         function stringToArray(string) {
7436           return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
7437         }
7438         function trimmedEndIndex2(string) {
7439           var index = string.length;
7440           while (index-- && reWhitespace2.test(string.charAt(index))) {
7441           }
7442           return index;
7443         }
7444         var unescapeHtmlChar2 = basePropertyOf2(htmlUnescapes2);
7445         function unicodeSize(string) {
7446           var result = reUnicode.lastIndex = 0;
7447           while (reUnicode.test(string)) {
7448             ++result;
7449           }
7450           return result;
7451         }
7452         function unicodeToArray(string) {
7453           return string.match(reUnicode) || [];
7454         }
7455         function unicodeWords(string) {
7456           return string.match(reUnicodeWord) || [];
7457         }
7458         var runInContext = function runInContext2(context) {
7459           context = context == null ? root3 : _.defaults(root3.Object(), context, _.pick(root3, contextProps));
7460           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;
7461           var arrayProto2 = Array2.prototype, funcProto3 = Function2.prototype, objectProto13 = Object2.prototype;
7462           var coreJsData2 = context["__core-js_shared__"];
7463           var funcToString3 = funcProto3.toString;
7464           var hasOwnProperty10 = objectProto13.hasOwnProperty;
7465           var idCounter = 0;
7466           var maskSrcKey2 = function() {
7467             var uid = /[^.]+$/.exec(coreJsData2 && coreJsData2.keys && coreJsData2.keys.IE_PROTO || "");
7468             return uid ? "Symbol(src)_1." + uid : "";
7469           }();
7470           var nativeObjectToString3 = objectProto13.toString;
7471           var objectCtorString = funcToString3.call(Object2);
7472           var oldDash = root3._;
7473           var reIsNative2 = RegExp2(
7474             "^" + funcToString3.call(hasOwnProperty10).replace(reRegExpChar2, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
7475           );
7476           var Buffer3 = moduleExports3 ? context.Buffer : undefined2, Symbol3 = context.Symbol, Uint8Array3 = context.Uint8Array, allocUnsafe = Buffer3 ? Buffer3.allocUnsafe : undefined2, getPrototype = overArg2(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable3 = objectProto13.propertyIsEnumerable, splice2 = arrayProto2.splice, spreadableSymbol = Symbol3 ? Symbol3.isConcatSpreadable : undefined2, symIterator = Symbol3 ? Symbol3.iterator : undefined2, symToStringTag3 = Symbol3 ? Symbol3.toStringTag : undefined2;
7477           var defineProperty = function() {
7478             try {
7479               var func = getNative2(Object2, "defineProperty");
7480               func({}, "", {});
7481               return func;
7482             } catch (e) {
7483             }
7484           }();
7485           var ctxClearTimeout = context.clearTimeout !== root3.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root3.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root3.setTimeout && context.setTimeout;
7486           var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols2 = Object2.getOwnPropertySymbols, nativeIsBuffer2 = Buffer3 ? Buffer3.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto2.join, nativeKeys2 = overArg2(Object2.keys, Object2), nativeMax2 = Math2.max, nativeMin2 = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto2.reverse;
7487           var DataView3 = getNative2(context, "DataView"), Map3 = getNative2(context, "Map"), Promise3 = getNative2(context, "Promise"), Set3 = getNative2(context, "Set"), WeakMap2 = getNative2(context, "WeakMap"), nativeCreate2 = getNative2(Object2, "create");
7488           var metaMap = WeakMap2 && new WeakMap2();
7489           var realNames = {};
7490           var dataViewCtorString2 = toSource2(DataView3), mapCtorString2 = toSource2(Map3), promiseCtorString2 = toSource2(Promise3), setCtorString2 = toSource2(Set3), weakMapCtorString2 = toSource2(WeakMap2);
7491           var symbolProto3 = Symbol3 ? Symbol3.prototype : undefined2, symbolValueOf2 = symbolProto3 ? symbolProto3.valueOf : undefined2, symbolToString2 = symbolProto3 ? symbolProto3.toString : undefined2;
7492           function lodash(value) {
7493             if (isObjectLike2(value) && !isArray2(value) && !(value instanceof LazyWrapper)) {
7494               if (value instanceof LodashWrapper) {
7495                 return value;
7496               }
7497               if (hasOwnProperty10.call(value, "__wrapped__")) {
7498                 return wrapperClone(value);
7499               }
7500             }
7501             return new LodashWrapper(value);
7502           }
7503           var baseCreate = function() {
7504             function object() {
7505             }
7506             return function(proto) {
7507               if (!isObject3(proto)) {
7508                 return {};
7509               }
7510               if (objectCreate) {
7511                 return objectCreate(proto);
7512               }
7513               object.prototype = proto;
7514               var result2 = new object();
7515               object.prototype = undefined2;
7516               return result2;
7517             };
7518           }();
7519           function baseLodash() {
7520           }
7521           function LodashWrapper(value, chainAll) {
7522             this.__wrapped__ = value;
7523             this.__actions__ = [];
7524             this.__chain__ = !!chainAll;
7525             this.__index__ = 0;
7526             this.__values__ = undefined2;
7527           }
7528           lodash.templateSettings = {
7529             /**
7530              * Used to detect `data` property values to be HTML-escaped.
7531              *
7532              * @memberOf _.templateSettings
7533              * @type {RegExp}
7534              */
7535             "escape": reEscape,
7536             /**
7537              * Used to detect code to be evaluated.
7538              *
7539              * @memberOf _.templateSettings
7540              * @type {RegExp}
7541              */
7542             "evaluate": reEvaluate,
7543             /**
7544              * Used to detect `data` property values to inject.
7545              *
7546              * @memberOf _.templateSettings
7547              * @type {RegExp}
7548              */
7549             "interpolate": reInterpolate,
7550             /**
7551              * Used to reference the data object in the template text.
7552              *
7553              * @memberOf _.templateSettings
7554              * @type {string}
7555              */
7556             "variable": "",
7557             /**
7558              * Used to import variables into the compiled template.
7559              *
7560              * @memberOf _.templateSettings
7561              * @type {Object}
7562              */
7563             "imports": {
7564               /**
7565                * A reference to the `lodash` function.
7566                *
7567                * @memberOf _.templateSettings.imports
7568                * @type {Function}
7569                */
7570               "_": lodash
7571             }
7572           };
7573           lodash.prototype = baseLodash.prototype;
7574           lodash.prototype.constructor = lodash;
7575           LodashWrapper.prototype = baseCreate(baseLodash.prototype);
7576           LodashWrapper.prototype.constructor = LodashWrapper;
7577           function LazyWrapper(value) {
7578             this.__wrapped__ = value;
7579             this.__actions__ = [];
7580             this.__dir__ = 1;
7581             this.__filtered__ = false;
7582             this.__iteratees__ = [];
7583             this.__takeCount__ = MAX_ARRAY_LENGTH;
7584             this.__views__ = [];
7585           }
7586           function lazyClone() {
7587             var result2 = new LazyWrapper(this.__wrapped__);
7588             result2.__actions__ = copyArray(this.__actions__);
7589             result2.__dir__ = this.__dir__;
7590             result2.__filtered__ = this.__filtered__;
7591             result2.__iteratees__ = copyArray(this.__iteratees__);
7592             result2.__takeCount__ = this.__takeCount__;
7593             result2.__views__ = copyArray(this.__views__);
7594             return result2;
7595           }
7596           function lazyReverse() {
7597             if (this.__filtered__) {
7598               var result2 = new LazyWrapper(this);
7599               result2.__dir__ = -1;
7600               result2.__filtered__ = true;
7601             } else {
7602               result2 = this.clone();
7603               result2.__dir__ *= -1;
7604             }
7605             return result2;
7606           }
7607           function lazyValue() {
7608             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__);
7609             if (!isArr || !isRight && arrLength == length && takeCount == length) {
7610               return baseWrapperValue(array2, this.__actions__);
7611             }
7612             var result2 = [];
7613             outer:
7614               while (length-- && resIndex < takeCount) {
7615                 index += dir;
7616                 var iterIndex = -1, value = array2[index];
7617                 while (++iterIndex < iterLength) {
7618                   var data = iteratees[iterIndex], iteratee2 = data.iteratee, type2 = data.type, computed = iteratee2(value);
7619                   if (type2 == LAZY_MAP_FLAG) {
7620                     value = computed;
7621                   } else if (!computed) {
7622                     if (type2 == LAZY_FILTER_FLAG) {
7623                       continue outer;
7624                     } else {
7625                       break outer;
7626                     }
7627                   }
7628                 }
7629                 result2[resIndex++] = value;
7630               }
7631             return result2;
7632           }
7633           LazyWrapper.prototype = baseCreate(baseLodash.prototype);
7634           LazyWrapper.prototype.constructor = LazyWrapper;
7635           function Hash2(entries) {
7636             var index = -1, length = entries == null ? 0 : entries.length;
7637             this.clear();
7638             while (++index < length) {
7639               var entry = entries[index];
7640               this.set(entry[0], entry[1]);
7641             }
7642           }
7643           function hashClear2() {
7644             this.__data__ = nativeCreate2 ? nativeCreate2(null) : {};
7645             this.size = 0;
7646           }
7647           function hashDelete2(key) {
7648             var result2 = this.has(key) && delete this.__data__[key];
7649             this.size -= result2 ? 1 : 0;
7650             return result2;
7651           }
7652           function hashGet2(key) {
7653             var data = this.__data__;
7654             if (nativeCreate2) {
7655               var result2 = data[key];
7656               return result2 === HASH_UNDEFINED4 ? undefined2 : result2;
7657             }
7658             return hasOwnProperty10.call(data, key) ? data[key] : undefined2;
7659           }
7660           function hashHas2(key) {
7661             var data = this.__data__;
7662             return nativeCreate2 ? data[key] !== undefined2 : hasOwnProperty10.call(data, key);
7663           }
7664           function hashSet2(key, value) {
7665             var data = this.__data__;
7666             this.size += this.has(key) ? 0 : 1;
7667             data[key] = nativeCreate2 && value === undefined2 ? HASH_UNDEFINED4 : value;
7668             return this;
7669           }
7670           Hash2.prototype.clear = hashClear2;
7671           Hash2.prototype["delete"] = hashDelete2;
7672           Hash2.prototype.get = hashGet2;
7673           Hash2.prototype.has = hashHas2;
7674           Hash2.prototype.set = hashSet2;
7675           function ListCache2(entries) {
7676             var index = -1, length = entries == null ? 0 : entries.length;
7677             this.clear();
7678             while (++index < length) {
7679               var entry = entries[index];
7680               this.set(entry[0], entry[1]);
7681             }
7682           }
7683           function listCacheClear2() {
7684             this.__data__ = [];
7685             this.size = 0;
7686           }
7687           function listCacheDelete2(key) {
7688             var data = this.__data__, index = assocIndexOf2(data, key);
7689             if (index < 0) {
7690               return false;
7691             }
7692             var lastIndex = data.length - 1;
7693             if (index == lastIndex) {
7694               data.pop();
7695             } else {
7696               splice2.call(data, index, 1);
7697             }
7698             --this.size;
7699             return true;
7700           }
7701           function listCacheGet2(key) {
7702             var data = this.__data__, index = assocIndexOf2(data, key);
7703             return index < 0 ? undefined2 : data[index][1];
7704           }
7705           function listCacheHas2(key) {
7706             return assocIndexOf2(this.__data__, key) > -1;
7707           }
7708           function listCacheSet2(key, value) {
7709             var data = this.__data__, index = assocIndexOf2(data, key);
7710             if (index < 0) {
7711               ++this.size;
7712               data.push([key, value]);
7713             } else {
7714               data[index][1] = value;
7715             }
7716             return this;
7717           }
7718           ListCache2.prototype.clear = listCacheClear2;
7719           ListCache2.prototype["delete"] = listCacheDelete2;
7720           ListCache2.prototype.get = listCacheGet2;
7721           ListCache2.prototype.has = listCacheHas2;
7722           ListCache2.prototype.set = listCacheSet2;
7723           function MapCache2(entries) {
7724             var index = -1, length = entries == null ? 0 : entries.length;
7725             this.clear();
7726             while (++index < length) {
7727               var entry = entries[index];
7728               this.set(entry[0], entry[1]);
7729             }
7730           }
7731           function mapCacheClear2() {
7732             this.size = 0;
7733             this.__data__ = {
7734               "hash": new Hash2(),
7735               "map": new (Map3 || ListCache2)(),
7736               "string": new Hash2()
7737             };
7738           }
7739           function mapCacheDelete2(key) {
7740             var result2 = getMapData2(this, key)["delete"](key);
7741             this.size -= result2 ? 1 : 0;
7742             return result2;
7743           }
7744           function mapCacheGet2(key) {
7745             return getMapData2(this, key).get(key);
7746           }
7747           function mapCacheHas2(key) {
7748             return getMapData2(this, key).has(key);
7749           }
7750           function mapCacheSet2(key, value) {
7751             var data = getMapData2(this, key), size2 = data.size;
7752             data.set(key, value);
7753             this.size += data.size == size2 ? 0 : 1;
7754             return this;
7755           }
7756           MapCache2.prototype.clear = mapCacheClear2;
7757           MapCache2.prototype["delete"] = mapCacheDelete2;
7758           MapCache2.prototype.get = mapCacheGet2;
7759           MapCache2.prototype.has = mapCacheHas2;
7760           MapCache2.prototype.set = mapCacheSet2;
7761           function SetCache2(values2) {
7762             var index = -1, length = values2 == null ? 0 : values2.length;
7763             this.__data__ = new MapCache2();
7764             while (++index < length) {
7765               this.add(values2[index]);
7766             }
7767           }
7768           function setCacheAdd2(value) {
7769             this.__data__.set(value, HASH_UNDEFINED4);
7770             return this;
7771           }
7772           function setCacheHas2(value) {
7773             return this.__data__.has(value);
7774           }
7775           SetCache2.prototype.add = SetCache2.prototype.push = setCacheAdd2;
7776           SetCache2.prototype.has = setCacheHas2;
7777           function Stack2(entries) {
7778             var data = this.__data__ = new ListCache2(entries);
7779             this.size = data.size;
7780           }
7781           function stackClear2() {
7782             this.__data__ = new ListCache2();
7783             this.size = 0;
7784           }
7785           function stackDelete2(key) {
7786             var data = this.__data__, result2 = data["delete"](key);
7787             this.size = data.size;
7788             return result2;
7789           }
7790           function stackGet2(key) {
7791             return this.__data__.get(key);
7792           }
7793           function stackHas2(key) {
7794             return this.__data__.has(key);
7795           }
7796           function stackSet2(key, value) {
7797             var data = this.__data__;
7798             if (data instanceof ListCache2) {
7799               var pairs = data.__data__;
7800               if (!Map3 || pairs.length < LARGE_ARRAY_SIZE2 - 1) {
7801                 pairs.push([key, value]);
7802                 this.size = ++data.size;
7803                 return this;
7804               }
7805               data = this.__data__ = new MapCache2(pairs);
7806             }
7807             data.set(key, value);
7808             this.size = data.size;
7809             return this;
7810           }
7811           Stack2.prototype.clear = stackClear2;
7812           Stack2.prototype["delete"] = stackDelete2;
7813           Stack2.prototype.get = stackGet2;
7814           Stack2.prototype.has = stackHas2;
7815           Stack2.prototype.set = stackSet2;
7816           function arrayLikeKeys2(value, inherited) {
7817             var isArr = isArray2(value), isArg = !isArr && isArguments2(value), isBuff = !isArr && !isArg && isBuffer2(value), isType = !isArr && !isArg && !isBuff && isTypedArray2(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes2(value.length, String2) : [], length = result2.length;
7818             for (var key in value) {
7819               if ((inherited || hasOwnProperty10.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
7820               (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
7821               isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
7822               isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
7823               isIndex2(key, length)))) {
7824                 result2.push(key);
7825               }
7826             }
7827             return result2;
7828           }
7829           function arraySample(array2) {
7830             var length = array2.length;
7831             return length ? array2[baseRandom(0, length - 1)] : undefined2;
7832           }
7833           function arraySampleSize(array2, n2) {
7834             return shuffleSelf(copyArray(array2), baseClamp(n2, 0, array2.length));
7835           }
7836           function arrayShuffle(array2) {
7837             return shuffleSelf(copyArray(array2));
7838           }
7839           function assignMergeValue(object, key, value) {
7840             if (value !== undefined2 && !eq2(object[key], value) || value === undefined2 && !(key in object)) {
7841               baseAssignValue(object, key, value);
7842             }
7843           }
7844           function assignValue(object, key, value) {
7845             var objValue = object[key];
7846             if (!(hasOwnProperty10.call(object, key) && eq2(objValue, value)) || value === undefined2 && !(key in object)) {
7847               baseAssignValue(object, key, value);
7848             }
7849           }
7850           function assocIndexOf2(array2, key) {
7851             var length = array2.length;
7852             while (length--) {
7853               if (eq2(array2[length][0], key)) {
7854                 return length;
7855               }
7856             }
7857             return -1;
7858           }
7859           function baseAggregator(collection, setter, iteratee2, accumulator) {
7860             baseEach(collection, function(value, key, collection2) {
7861               setter(accumulator, value, iteratee2(value), collection2);
7862             });
7863             return accumulator;
7864           }
7865           function baseAssign(object, source) {
7866             return object && copyObject(source, keys2(source), object);
7867           }
7868           function baseAssignIn(object, source) {
7869             return object && copyObject(source, keysIn(source), object);
7870           }
7871           function baseAssignValue(object, key, value) {
7872             if (key == "__proto__" && defineProperty) {
7873               defineProperty(object, key, {
7874                 "configurable": true,
7875                 "enumerable": true,
7876                 "value": value,
7877                 "writable": true
7878               });
7879             } else {
7880               object[key] = value;
7881             }
7882           }
7883           function baseAt(object, paths) {
7884             var index = -1, length = paths.length, result2 = Array2(length), skip = object == null;
7885             while (++index < length) {
7886               result2[index] = skip ? undefined2 : get4(object, paths[index]);
7887             }
7888             return result2;
7889           }
7890           function baseClamp(number3, lower2, upper) {
7891             if (number3 === number3) {
7892               if (upper !== undefined2) {
7893                 number3 = number3 <= upper ? number3 : upper;
7894               }
7895               if (lower2 !== undefined2) {
7896                 number3 = number3 >= lower2 ? number3 : lower2;
7897               }
7898             }
7899             return number3;
7900           }
7901           function baseClone(value, bitmask, customizer, key, object, stack) {
7902             var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
7903             if (customizer) {
7904               result2 = object ? customizer(value, key, object, stack) : customizer(value);
7905             }
7906             if (result2 !== undefined2) {
7907               return result2;
7908             }
7909             if (!isObject3(value)) {
7910               return value;
7911             }
7912             var isArr = isArray2(value);
7913             if (isArr) {
7914               result2 = initCloneArray(value);
7915               if (!isDeep) {
7916                 return copyArray(value, result2);
7917               }
7918             } else {
7919               var tag = getTag2(value), isFunc = tag == funcTag3 || tag == genTag2;
7920               if (isBuffer2(value)) {
7921                 return cloneBuffer(value, isDeep);
7922               }
7923               if (tag == objectTag4 || tag == argsTag4 || isFunc && !object) {
7924                 result2 = isFlat || isFunc ? {} : initCloneObject(value);
7925                 if (!isDeep) {
7926                   return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value));
7927                 }
7928               } else {
7929                 if (!cloneableTags[tag]) {
7930                   return object ? value : {};
7931                 }
7932                 result2 = initCloneByTag(value, tag, isDeep);
7933               }
7934             }
7935             stack || (stack = new Stack2());
7936             var stacked = stack.get(value);
7937             if (stacked) {
7938               return stacked;
7939             }
7940             stack.set(value, result2);
7941             if (isSet(value)) {
7942               value.forEach(function(subValue) {
7943                 result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
7944               });
7945             } else if (isMap(value)) {
7946               value.forEach(function(subValue, key2) {
7947                 result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
7948               });
7949             }
7950             var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys2 : isFlat ? keysIn : keys2;
7951             var props = isArr ? undefined2 : keysFunc(value);
7952             arrayEach(props || value, function(subValue, key2) {
7953               if (props) {
7954                 key2 = subValue;
7955                 subValue = value[key2];
7956               }
7957               assignValue(result2, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
7958             });
7959             return result2;
7960           }
7961           function baseConforms(source) {
7962             var props = keys2(source);
7963             return function(object) {
7964               return baseConformsTo(object, source, props);
7965             };
7966           }
7967           function baseConformsTo(object, source, props) {
7968             var length = props.length;
7969             if (object == null) {
7970               return !length;
7971             }
7972             object = Object2(object);
7973             while (length--) {
7974               var key = props[length], predicate = source[key], value = object[key];
7975               if (value === undefined2 && !(key in object) || !predicate(value)) {
7976                 return false;
7977               }
7978             }
7979             return true;
7980           }
7981           function baseDelay(func, wait, args) {
7982             if (typeof func != "function") {
7983               throw new TypeError2(FUNC_ERROR_TEXT3);
7984             }
7985             return setTimeout2(function() {
7986               func.apply(undefined2, args);
7987             }, wait);
7988           }
7989           function baseDifference(array2, values2, iteratee2, comparator) {
7990             var index = -1, includes2 = arrayIncludes, isCommon = true, length = array2.length, result2 = [], valuesLength = values2.length;
7991             if (!length) {
7992               return result2;
7993             }
7994             if (iteratee2) {
7995               values2 = arrayMap2(values2, baseUnary2(iteratee2));
7996             }
7997             if (comparator) {
7998               includes2 = arrayIncludesWith;
7999               isCommon = false;
8000             } else if (values2.length >= LARGE_ARRAY_SIZE2) {
8001               includes2 = cacheHas2;
8002               isCommon = false;
8003               values2 = new SetCache2(values2);
8004             }
8005             outer:
8006               while (++index < length) {
8007                 var value = array2[index], computed = iteratee2 == null ? value : iteratee2(value);
8008                 value = comparator || value !== 0 ? value : 0;
8009                 if (isCommon && computed === computed) {
8010                   var valuesIndex = valuesLength;
8011                   while (valuesIndex--) {
8012                     if (values2[valuesIndex] === computed) {
8013                       continue outer;
8014                     }
8015                   }
8016                   result2.push(value);
8017                 } else if (!includes2(values2, computed, comparator)) {
8018                   result2.push(value);
8019                 }
8020               }
8021             return result2;
8022           }
8023           var baseEach = createBaseEach(baseForOwn);
8024           var baseEachRight = createBaseEach(baseForOwnRight, true);
8025           function baseEvery(collection, predicate) {
8026             var result2 = true;
8027             baseEach(collection, function(value, index, collection2) {
8028               result2 = !!predicate(value, index, collection2);
8029               return result2;
8030             });
8031             return result2;
8032           }
8033           function baseExtremum(array2, iteratee2, comparator) {
8034             var index = -1, length = array2.length;
8035             while (++index < length) {
8036               var value = array2[index], current = iteratee2(value);
8037               if (current != null && (computed === undefined2 ? current === current && !isSymbol2(current) : comparator(current, computed))) {
8038                 var computed = current, result2 = value;
8039               }
8040             }
8041             return result2;
8042           }
8043           function baseFill(array2, value, start2, end) {
8044             var length = array2.length;
8045             start2 = toInteger(start2);
8046             if (start2 < 0) {
8047               start2 = -start2 > length ? 0 : length + start2;
8048             }
8049             end = end === undefined2 || end > length ? length : toInteger(end);
8050             if (end < 0) {
8051               end += length;
8052             }
8053             end = start2 > end ? 0 : toLength(end);
8054             while (start2 < end) {
8055               array2[start2++] = value;
8056             }
8057             return array2;
8058           }
8059           function baseFilter(collection, predicate) {
8060             var result2 = [];
8061             baseEach(collection, function(value, index, collection2) {
8062               if (predicate(value, index, collection2)) {
8063                 result2.push(value);
8064               }
8065             });
8066             return result2;
8067           }
8068           function baseFlatten(array2, depth, predicate, isStrict, result2) {
8069             var index = -1, length = array2.length;
8070             predicate || (predicate = isFlattenable);
8071             result2 || (result2 = []);
8072             while (++index < length) {
8073               var value = array2[index];
8074               if (depth > 0 && predicate(value)) {
8075                 if (depth > 1) {
8076                   baseFlatten(value, depth - 1, predicate, isStrict, result2);
8077                 } else {
8078                   arrayPush2(result2, value);
8079                 }
8080               } else if (!isStrict) {
8081                 result2[result2.length] = value;
8082               }
8083             }
8084             return result2;
8085           }
8086           var baseFor = createBaseFor();
8087           var baseForRight = createBaseFor(true);
8088           function baseForOwn(object, iteratee2) {
8089             return object && baseFor(object, iteratee2, keys2);
8090           }
8091           function baseForOwnRight(object, iteratee2) {
8092             return object && baseForRight(object, iteratee2, keys2);
8093           }
8094           function baseFunctions(object, props) {
8095             return arrayFilter2(props, function(key) {
8096               return isFunction2(object[key]);
8097             });
8098           }
8099           function baseGet(object, path) {
8100             path = castPath(path, object);
8101             var index = 0, length = path.length;
8102             while (object != null && index < length) {
8103               object = object[toKey(path[index++])];
8104             }
8105             return index && index == length ? object : undefined2;
8106           }
8107           function baseGetAllKeys2(object, keysFunc, symbolsFunc) {
8108             var result2 = keysFunc(object);
8109             return isArray2(object) ? result2 : arrayPush2(result2, symbolsFunc(object));
8110           }
8111           function baseGetTag2(value) {
8112             if (value == null) {
8113               return value === undefined2 ? undefinedTag2 : nullTag2;
8114             }
8115             return symToStringTag3 && symToStringTag3 in Object2(value) ? getRawTag2(value) : objectToString2(value);
8116           }
8117           function baseGt(value, other) {
8118             return value > other;
8119           }
8120           function baseHas(object, key) {
8121             return object != null && hasOwnProperty10.call(object, key);
8122           }
8123           function baseHasIn(object, key) {
8124             return object != null && key in Object2(object);
8125           }
8126           function baseInRange(number3, start2, end) {
8127             return number3 >= nativeMin2(start2, end) && number3 < nativeMax2(start2, end);
8128           }
8129           function baseIntersection(arrays, iteratee2, comparator) {
8130             var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = [];
8131             while (othIndex--) {
8132               var array2 = arrays[othIndex];
8133               if (othIndex && iteratee2) {
8134                 array2 = arrayMap2(array2, baseUnary2(iteratee2));
8135               }
8136               maxLength = nativeMin2(array2.length, maxLength);
8137               caches[othIndex] = !comparator && (iteratee2 || length >= 120 && array2.length >= 120) ? new SetCache2(othIndex && array2) : undefined2;
8138             }
8139             array2 = arrays[0];
8140             var index = -1, seen = caches[0];
8141             outer:
8142               while (++index < length && result2.length < maxLength) {
8143                 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
8144                 value = comparator || value !== 0 ? value : 0;
8145                 if (!(seen ? cacheHas2(seen, computed) : includes2(result2, computed, comparator))) {
8146                   othIndex = othLength;
8147                   while (--othIndex) {
8148                     var cache = caches[othIndex];
8149                     if (!(cache ? cacheHas2(cache, computed) : includes2(arrays[othIndex], computed, comparator))) {
8150                       continue outer;
8151                     }
8152                   }
8153                   if (seen) {
8154                     seen.push(computed);
8155                   }
8156                   result2.push(value);
8157                 }
8158               }
8159             return result2;
8160           }
8161           function baseInverter(object, setter, iteratee2, accumulator) {
8162             baseForOwn(object, function(value, key, object2) {
8163               setter(accumulator, iteratee2(value), key, object2);
8164             });
8165             return accumulator;
8166           }
8167           function baseInvoke(object, path, args) {
8168             path = castPath(path, object);
8169             object = parent(object, path);
8170             var func = object == null ? object : object[toKey(last(path))];
8171             return func == null ? undefined2 : apply(func, object, args);
8172           }
8173           function baseIsArguments2(value) {
8174             return isObjectLike2(value) && baseGetTag2(value) == argsTag4;
8175           }
8176           function baseIsArrayBuffer(value) {
8177             return isObjectLike2(value) && baseGetTag2(value) == arrayBufferTag3;
8178           }
8179           function baseIsDate(value) {
8180             return isObjectLike2(value) && baseGetTag2(value) == dateTag3;
8181           }
8182           function baseIsEqual2(value, other, bitmask, customizer, stack) {
8183             if (value === other) {
8184               return true;
8185             }
8186             if (value == null || other == null || !isObjectLike2(value) && !isObjectLike2(other)) {
8187               return value !== value && other !== other;
8188             }
8189             return baseIsEqualDeep2(value, other, bitmask, customizer, baseIsEqual2, stack);
8190           }
8191           function baseIsEqualDeep2(object, other, bitmask, customizer, equalFunc, stack) {
8192             var objIsArr = isArray2(object), othIsArr = isArray2(other), objTag = objIsArr ? arrayTag3 : getTag2(object), othTag = othIsArr ? arrayTag3 : getTag2(other);
8193             objTag = objTag == argsTag4 ? objectTag4 : objTag;
8194             othTag = othTag == argsTag4 ? objectTag4 : othTag;
8195             var objIsObj = objTag == objectTag4, othIsObj = othTag == objectTag4, isSameTag = objTag == othTag;
8196             if (isSameTag && isBuffer2(object)) {
8197               if (!isBuffer2(other)) {
8198                 return false;
8199               }
8200               objIsArr = true;
8201               objIsObj = false;
8202             }
8203             if (isSameTag && !objIsObj) {
8204               stack || (stack = new Stack2());
8205               return objIsArr || isTypedArray2(object) ? equalArrays2(object, other, bitmask, customizer, equalFunc, stack) : equalByTag2(object, other, objTag, bitmask, customizer, equalFunc, stack);
8206             }
8207             if (!(bitmask & COMPARE_PARTIAL_FLAG5)) {
8208               var objIsWrapped = objIsObj && hasOwnProperty10.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty10.call(other, "__wrapped__");
8209               if (objIsWrapped || othIsWrapped) {
8210                 var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
8211                 stack || (stack = new Stack2());
8212                 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
8213               }
8214             }
8215             if (!isSameTag) {
8216               return false;
8217             }
8218             stack || (stack = new Stack2());
8219             return equalObjects2(object, other, bitmask, customizer, equalFunc, stack);
8220           }
8221           function baseIsMap(value) {
8222             return isObjectLike2(value) && getTag2(value) == mapTag4;
8223           }
8224           function baseIsMatch(object, source, matchData, customizer) {
8225             var index = matchData.length, length = index, noCustomizer = !customizer;
8226             if (object == null) {
8227               return !length;
8228             }
8229             object = Object2(object);
8230             while (index--) {
8231               var data = matchData[index];
8232               if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
8233                 return false;
8234               }
8235             }
8236             while (++index < length) {
8237               data = matchData[index];
8238               var key = data[0], objValue = object[key], srcValue = data[1];
8239               if (noCustomizer && data[2]) {
8240                 if (objValue === undefined2 && !(key in object)) {
8241                   return false;
8242                 }
8243               } else {
8244                 var stack = new Stack2();
8245                 if (customizer) {
8246                   var result2 = customizer(objValue, srcValue, key, object, source, stack);
8247                 }
8248                 if (!(result2 === undefined2 ? baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3, customizer, stack) : result2)) {
8249                   return false;
8250                 }
8251               }
8252             }
8253             return true;
8254           }
8255           function baseIsNative2(value) {
8256             if (!isObject3(value) || isMasked2(value)) {
8257               return false;
8258             }
8259             var pattern = isFunction2(value) ? reIsNative2 : reIsHostCtor2;
8260             return pattern.test(toSource2(value));
8261           }
8262           function baseIsRegExp(value) {
8263             return isObjectLike2(value) && baseGetTag2(value) == regexpTag3;
8264           }
8265           function baseIsSet(value) {
8266             return isObjectLike2(value) && getTag2(value) == setTag4;
8267           }
8268           function baseIsTypedArray2(value) {
8269             return isObjectLike2(value) && isLength2(value.length) && !!typedArrayTags2[baseGetTag2(value)];
8270           }
8271           function baseIteratee(value) {
8272             if (typeof value == "function") {
8273               return value;
8274             }
8275             if (value == null) {
8276               return identity4;
8277             }
8278             if (typeof value == "object") {
8279               return isArray2(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
8280             }
8281             return property(value);
8282           }
8283           function baseKeys2(object) {
8284             if (!isPrototype2(object)) {
8285               return nativeKeys2(object);
8286             }
8287             var result2 = [];
8288             for (var key in Object2(object)) {
8289               if (hasOwnProperty10.call(object, key) && key != "constructor") {
8290                 result2.push(key);
8291               }
8292             }
8293             return result2;
8294           }
8295           function baseKeysIn(object) {
8296             if (!isObject3(object)) {
8297               return nativeKeysIn(object);
8298             }
8299             var isProto = isPrototype2(object), result2 = [];
8300             for (var key in object) {
8301               if (!(key == "constructor" && (isProto || !hasOwnProperty10.call(object, key)))) {
8302                 result2.push(key);
8303               }
8304             }
8305             return result2;
8306           }
8307           function baseLt(value, other) {
8308             return value < other;
8309           }
8310           function baseMap(collection, iteratee2) {
8311             var index = -1, result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
8312             baseEach(collection, function(value, key, collection2) {
8313               result2[++index] = iteratee2(value, key, collection2);
8314             });
8315             return result2;
8316           }
8317           function baseMatches(source) {
8318             var matchData = getMatchData(source);
8319             if (matchData.length == 1 && matchData[0][2]) {
8320               return matchesStrictComparable(matchData[0][0], matchData[0][1]);
8321             }
8322             return function(object) {
8323               return object === source || baseIsMatch(object, source, matchData);
8324             };
8325           }
8326           function baseMatchesProperty(path, srcValue) {
8327             if (isKey(path) && isStrictComparable(srcValue)) {
8328               return matchesStrictComparable(toKey(path), srcValue);
8329             }
8330             return function(object) {
8331               var objValue = get4(object, path);
8332               return objValue === undefined2 && objValue === srcValue ? hasIn(object, path) : baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3);
8333             };
8334           }
8335           function baseMerge(object, source, srcIndex, customizer, stack) {
8336             if (object === source) {
8337               return;
8338             }
8339             baseFor(source, function(srcValue, key) {
8340               stack || (stack = new Stack2());
8341               if (isObject3(srcValue)) {
8342                 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
8343               } else {
8344                 var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined2;
8345                 if (newValue === undefined2) {
8346                   newValue = srcValue;
8347                 }
8348                 assignMergeValue(object, key, newValue);
8349               }
8350             }, keysIn);
8351           }
8352           function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
8353             var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
8354             if (stacked) {
8355               assignMergeValue(object, key, stacked);
8356               return;
8357             }
8358             var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2;
8359             var isCommon = newValue === undefined2;
8360             if (isCommon) {
8361               var isArr = isArray2(srcValue), isBuff = !isArr && isBuffer2(srcValue), isTyped = !isArr && !isBuff && isTypedArray2(srcValue);
8362               newValue = srcValue;
8363               if (isArr || isBuff || isTyped) {
8364                 if (isArray2(objValue)) {
8365                   newValue = objValue;
8366                 } else if (isArrayLikeObject(objValue)) {
8367                   newValue = copyArray(objValue);
8368                 } else if (isBuff) {
8369                   isCommon = false;
8370                   newValue = cloneBuffer(srcValue, true);
8371                 } else if (isTyped) {
8372                   isCommon = false;
8373                   newValue = cloneTypedArray(srcValue, true);
8374                 } else {
8375                   newValue = [];
8376                 }
8377               } else if (isPlainObject(srcValue) || isArguments2(srcValue)) {
8378                 newValue = objValue;
8379                 if (isArguments2(objValue)) {
8380                   newValue = toPlainObject(objValue);
8381                 } else if (!isObject3(objValue) || isFunction2(objValue)) {
8382                   newValue = initCloneObject(srcValue);
8383                 }
8384               } else {
8385                 isCommon = false;
8386               }
8387             }
8388             if (isCommon) {
8389               stack.set(srcValue, newValue);
8390               mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
8391               stack["delete"](srcValue);
8392             }
8393             assignMergeValue(object, key, newValue);
8394           }
8395           function baseNth(array2, n2) {
8396             var length = array2.length;
8397             if (!length) {
8398               return;
8399             }
8400             n2 += n2 < 0 ? length : 0;
8401             return isIndex2(n2, length) ? array2[n2] : undefined2;
8402           }
8403           function baseOrderBy(collection, iteratees, orders) {
8404             if (iteratees.length) {
8405               iteratees = arrayMap2(iteratees, function(iteratee2) {
8406                 if (isArray2(iteratee2)) {
8407                   return function(value) {
8408                     return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2);
8409                   };
8410                 }
8411                 return iteratee2;
8412               });
8413             } else {
8414               iteratees = [identity4];
8415             }
8416             var index = -1;
8417             iteratees = arrayMap2(iteratees, baseUnary2(getIteratee()));
8418             var result2 = baseMap(collection, function(value, key, collection2) {
8419               var criteria = arrayMap2(iteratees, function(iteratee2) {
8420                 return iteratee2(value);
8421               });
8422               return { "criteria": criteria, "index": ++index, "value": value };
8423             });
8424             return baseSortBy(result2, function(object, other) {
8425               return compareMultiple(object, other, orders);
8426             });
8427           }
8428           function basePick(object, paths) {
8429             return basePickBy(object, paths, function(value, path) {
8430               return hasIn(object, path);
8431             });
8432           }
8433           function basePickBy(object, paths, predicate) {
8434             var index = -1, length = paths.length, result2 = {};
8435             while (++index < length) {
8436               var path = paths[index], value = baseGet(object, path);
8437               if (predicate(value, path)) {
8438                 baseSet(result2, castPath(path, object), value);
8439               }
8440             }
8441             return result2;
8442           }
8443           function basePropertyDeep(path) {
8444             return function(object) {
8445               return baseGet(object, path);
8446             };
8447           }
8448           function basePullAll(array2, values2, iteratee2, comparator) {
8449             var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values2.length, seen = array2;
8450             if (array2 === values2) {
8451               values2 = copyArray(values2);
8452             }
8453             if (iteratee2) {
8454               seen = arrayMap2(array2, baseUnary2(iteratee2));
8455             }
8456             while (++index < length) {
8457               var fromIndex = 0, value = values2[index], computed = iteratee2 ? iteratee2(value) : value;
8458               while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) {
8459                 if (seen !== array2) {
8460                   splice2.call(seen, fromIndex, 1);
8461                 }
8462                 splice2.call(array2, fromIndex, 1);
8463               }
8464             }
8465             return array2;
8466           }
8467           function basePullAt(array2, indexes) {
8468             var length = array2 ? indexes.length : 0, lastIndex = length - 1;
8469             while (length--) {
8470               var index = indexes[length];
8471               if (length == lastIndex || index !== previous) {
8472                 var previous = index;
8473                 if (isIndex2(index)) {
8474                   splice2.call(array2, index, 1);
8475                 } else {
8476                   baseUnset(array2, index);
8477                 }
8478               }
8479             }
8480             return array2;
8481           }
8482           function baseRandom(lower2, upper) {
8483             return lower2 + nativeFloor(nativeRandom() * (upper - lower2 + 1));
8484           }
8485           function baseRange(start2, end, step, fromRight) {
8486             var index = -1, length = nativeMax2(nativeCeil((end - start2) / (step || 1)), 0), result2 = Array2(length);
8487             while (length--) {
8488               result2[fromRight ? length : ++index] = start2;
8489               start2 += step;
8490             }
8491             return result2;
8492           }
8493           function baseRepeat(string, n2) {
8494             var result2 = "";
8495             if (!string || n2 < 1 || n2 > MAX_SAFE_INTEGER3) {
8496               return result2;
8497             }
8498             do {
8499               if (n2 % 2) {
8500                 result2 += string;
8501               }
8502               n2 = nativeFloor(n2 / 2);
8503               if (n2) {
8504                 string += string;
8505               }
8506             } while (n2);
8507             return result2;
8508           }
8509           function baseRest(func, start2) {
8510             return setToString(overRest(func, start2, identity4), func + "");
8511           }
8512           function baseSample(collection) {
8513             return arraySample(values(collection));
8514           }
8515           function baseSampleSize(collection, n2) {
8516             var array2 = values(collection);
8517             return shuffleSelf(array2, baseClamp(n2, 0, array2.length));
8518           }
8519           function baseSet(object, path, value, customizer) {
8520             if (!isObject3(object)) {
8521               return object;
8522             }
8523             path = castPath(path, object);
8524             var index = -1, length = path.length, lastIndex = length - 1, nested = object;
8525             while (nested != null && ++index < length) {
8526               var key = toKey(path[index]), newValue = value;
8527               if (key === "__proto__" || key === "constructor" || key === "prototype") {
8528                 return object;
8529               }
8530               if (index != lastIndex) {
8531                 var objValue = nested[key];
8532                 newValue = customizer ? customizer(objValue, key, nested) : undefined2;
8533                 if (newValue === undefined2) {
8534                   newValue = isObject3(objValue) ? objValue : isIndex2(path[index + 1]) ? [] : {};
8535                 }
8536               }
8537               assignValue(nested, key, newValue);
8538               nested = nested[key];
8539             }
8540             return object;
8541           }
8542           var baseSetData = !metaMap ? identity4 : function(func, data) {
8543             metaMap.set(func, data);
8544             return func;
8545           };
8546           var baseSetToString = !defineProperty ? identity4 : function(func, string) {
8547             return defineProperty(func, "toString", {
8548               "configurable": true,
8549               "enumerable": false,
8550               "value": constant(string),
8551               "writable": true
8552             });
8553           };
8554           function baseShuffle(collection) {
8555             return shuffleSelf(values(collection));
8556           }
8557           function baseSlice(array2, start2, end) {
8558             var index = -1, length = array2.length;
8559             if (start2 < 0) {
8560               start2 = -start2 > length ? 0 : length + start2;
8561             }
8562             end = end > length ? length : end;
8563             if (end < 0) {
8564               end += length;
8565             }
8566             length = start2 > end ? 0 : end - start2 >>> 0;
8567             start2 >>>= 0;
8568             var result2 = Array2(length);
8569             while (++index < length) {
8570               result2[index] = array2[index + start2];
8571             }
8572             return result2;
8573           }
8574           function baseSome(collection, predicate) {
8575             var result2;
8576             baseEach(collection, function(value, index, collection2) {
8577               result2 = predicate(value, index, collection2);
8578               return !result2;
8579             });
8580             return !!result2;
8581           }
8582           function baseSortedIndex(array2, value, retHighest) {
8583             var low = 0, high = array2 == null ? low : array2.length;
8584             if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
8585               while (low < high) {
8586                 var mid = low + high >>> 1, computed = array2[mid];
8587                 if (computed !== null && !isSymbol2(computed) && (retHighest ? computed <= value : computed < value)) {
8588                   low = mid + 1;
8589                 } else {
8590                   high = mid;
8591                 }
8592               }
8593               return high;
8594             }
8595             return baseSortedIndexBy(array2, value, identity4, retHighest);
8596           }
8597           function baseSortedIndexBy(array2, value, iteratee2, retHighest) {
8598             var low = 0, high = array2 == null ? 0 : array2.length;
8599             if (high === 0) {
8600               return 0;
8601             }
8602             value = iteratee2(value);
8603             var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol2(value), valIsUndefined = value === undefined2;
8604             while (low < high) {
8605               var mid = nativeFloor((low + high) / 2), computed = iteratee2(array2[mid]), othIsDefined = computed !== undefined2, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol2(computed);
8606               if (valIsNaN) {
8607                 var setLow = retHighest || othIsReflexive;
8608               } else if (valIsUndefined) {
8609                 setLow = othIsReflexive && (retHighest || othIsDefined);
8610               } else if (valIsNull) {
8611                 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
8612               } else if (valIsSymbol) {
8613                 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
8614               } else if (othIsNull || othIsSymbol) {
8615                 setLow = false;
8616               } else {
8617                 setLow = retHighest ? computed <= value : computed < value;
8618               }
8619               if (setLow) {
8620                 low = mid + 1;
8621               } else {
8622                 high = mid;
8623               }
8624             }
8625             return nativeMin2(high, MAX_ARRAY_INDEX);
8626           }
8627           function baseSortedUniq(array2, iteratee2) {
8628             var index = -1, length = array2.length, resIndex = 0, result2 = [];
8629             while (++index < length) {
8630               var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
8631               if (!index || !eq2(computed, seen)) {
8632                 var seen = computed;
8633                 result2[resIndex++] = value === 0 ? 0 : value;
8634               }
8635             }
8636             return result2;
8637           }
8638           function baseToNumber(value) {
8639             if (typeof value == "number") {
8640               return value;
8641             }
8642             if (isSymbol2(value)) {
8643               return NAN2;
8644             }
8645             return +value;
8646           }
8647           function baseToString2(value) {
8648             if (typeof value == "string") {
8649               return value;
8650             }
8651             if (isArray2(value)) {
8652               return arrayMap2(value, baseToString2) + "";
8653             }
8654             if (isSymbol2(value)) {
8655               return symbolToString2 ? symbolToString2.call(value) : "";
8656             }
8657             var result2 = value + "";
8658             return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2;
8659           }
8660           function baseUniq(array2, iteratee2, comparator) {
8661             var index = -1, includes2 = arrayIncludes, length = array2.length, isCommon = true, result2 = [], seen = result2;
8662             if (comparator) {
8663               isCommon = false;
8664               includes2 = arrayIncludesWith;
8665             } else if (length >= LARGE_ARRAY_SIZE2) {
8666               var set4 = iteratee2 ? null : createSet(array2);
8667               if (set4) {
8668                 return setToArray2(set4);
8669               }
8670               isCommon = false;
8671               includes2 = cacheHas2;
8672               seen = new SetCache2();
8673             } else {
8674               seen = iteratee2 ? [] : result2;
8675             }
8676             outer:
8677               while (++index < length) {
8678                 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
8679                 value = comparator || value !== 0 ? value : 0;
8680                 if (isCommon && computed === computed) {
8681                   var seenIndex = seen.length;
8682                   while (seenIndex--) {
8683                     if (seen[seenIndex] === computed) {
8684                       continue outer;
8685                     }
8686                   }
8687                   if (iteratee2) {
8688                     seen.push(computed);
8689                   }
8690                   result2.push(value);
8691                 } else if (!includes2(seen, computed, comparator)) {
8692                   if (seen !== result2) {
8693                     seen.push(computed);
8694                   }
8695                   result2.push(value);
8696                 }
8697               }
8698             return result2;
8699           }
8700           function baseUnset(object, path) {
8701             path = castPath(path, object);
8702             object = parent(object, path);
8703             return object == null || delete object[toKey(last(path))];
8704           }
8705           function baseUpdate(object, path, updater, customizer) {
8706             return baseSet(object, path, updater(baseGet(object, path)), customizer);
8707           }
8708           function baseWhile(array2, predicate, isDrop, fromRight) {
8709             var length = array2.length, index = fromRight ? length : -1;
8710             while ((fromRight ? index-- : ++index < length) && predicate(array2[index], index, array2)) {
8711             }
8712             return isDrop ? baseSlice(array2, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array2, fromRight ? index + 1 : 0, fromRight ? length : index);
8713           }
8714           function baseWrapperValue(value, actions) {
8715             var result2 = value;
8716             if (result2 instanceof LazyWrapper) {
8717               result2 = result2.value();
8718             }
8719             return arrayReduce(actions, function(result3, action) {
8720               return action.func.apply(action.thisArg, arrayPush2([result3], action.args));
8721             }, result2);
8722           }
8723           function baseXor(arrays, iteratee2, comparator) {
8724             var length = arrays.length;
8725             if (length < 2) {
8726               return length ? baseUniq(arrays[0]) : [];
8727             }
8728             var index = -1, result2 = Array2(length);
8729             while (++index < length) {
8730               var array2 = arrays[index], othIndex = -1;
8731               while (++othIndex < length) {
8732                 if (othIndex != index) {
8733                   result2[index] = baseDifference(result2[index] || array2, arrays[othIndex], iteratee2, comparator);
8734                 }
8735               }
8736             }
8737             return baseUniq(baseFlatten(result2, 1), iteratee2, comparator);
8738           }
8739           function baseZipObject(props, values2, assignFunc) {
8740             var index = -1, length = props.length, valsLength = values2.length, result2 = {};
8741             while (++index < length) {
8742               var value = index < valsLength ? values2[index] : undefined2;
8743               assignFunc(result2, props[index], value);
8744             }
8745             return result2;
8746           }
8747           function castArrayLikeObject(value) {
8748             return isArrayLikeObject(value) ? value : [];
8749           }
8750           function castFunction(value) {
8751             return typeof value == "function" ? value : identity4;
8752           }
8753           function castPath(value, object) {
8754             if (isArray2(value)) {
8755               return value;
8756             }
8757             return isKey(value, object) ? [value] : stringToPath(toString2(value));
8758           }
8759           var castRest = baseRest;
8760           function castSlice(array2, start2, end) {
8761             var length = array2.length;
8762             end = end === undefined2 ? length : end;
8763             return !start2 && end >= length ? array2 : baseSlice(array2, start2, end);
8764           }
8765           var clearTimeout2 = ctxClearTimeout || function(id2) {
8766             return root3.clearTimeout(id2);
8767           };
8768           function cloneBuffer(buffer, isDeep) {
8769             if (isDeep) {
8770               return buffer.slice();
8771             }
8772             var length = buffer.length, result2 = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
8773             buffer.copy(result2);
8774             return result2;
8775           }
8776           function cloneArrayBuffer(arrayBuffer) {
8777             var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
8778             new Uint8Array3(result2).set(new Uint8Array3(arrayBuffer));
8779             return result2;
8780           }
8781           function cloneDataView(dataView, isDeep) {
8782             var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
8783             return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
8784           }
8785           function cloneRegExp(regexp) {
8786             var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp));
8787             result2.lastIndex = regexp.lastIndex;
8788             return result2;
8789           }
8790           function cloneSymbol(symbol) {
8791             return symbolValueOf2 ? Object2(symbolValueOf2.call(symbol)) : {};
8792           }
8793           function cloneTypedArray(typedArray, isDeep) {
8794             var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
8795             return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
8796           }
8797           function compareAscending(value, other) {
8798             if (value !== other) {
8799               var valIsDefined = value !== undefined2, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol2(value);
8800               var othIsDefined = other !== undefined2, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol2(other);
8801               if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
8802                 return 1;
8803               }
8804               if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
8805                 return -1;
8806               }
8807             }
8808             return 0;
8809           }
8810           function compareMultiple(object, other, orders) {
8811             var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
8812             while (++index < length) {
8813               var result2 = compareAscending(objCriteria[index], othCriteria[index]);
8814               if (result2) {
8815                 if (index >= ordersLength) {
8816                   return result2;
8817                 }
8818                 var order = orders[index];
8819                 return result2 * (order == "desc" ? -1 : 1);
8820               }
8821             }
8822             return object.index - other.index;
8823           }
8824           function composeArgs(args, partials, holders, isCurried) {
8825             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;
8826             while (++leftIndex < leftLength) {
8827               result2[leftIndex] = partials[leftIndex];
8828             }
8829             while (++argsIndex < holdersLength) {
8830               if (isUncurried || argsIndex < argsLength) {
8831                 result2[holders[argsIndex]] = args[argsIndex];
8832               }
8833             }
8834             while (rangeLength--) {
8835               result2[leftIndex++] = args[argsIndex++];
8836             }
8837             return result2;
8838           }
8839           function composeArgsRight(args, partials, holders, isCurried) {
8840             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;
8841             while (++argsIndex < rangeLength) {
8842               result2[argsIndex] = args[argsIndex];
8843             }
8844             var offset = argsIndex;
8845             while (++rightIndex < rightLength) {
8846               result2[offset + rightIndex] = partials[rightIndex];
8847             }
8848             while (++holdersIndex < holdersLength) {
8849               if (isUncurried || argsIndex < argsLength) {
8850                 result2[offset + holders[holdersIndex]] = args[argsIndex++];
8851               }
8852             }
8853             return result2;
8854           }
8855           function copyArray(source, array2) {
8856             var index = -1, length = source.length;
8857             array2 || (array2 = Array2(length));
8858             while (++index < length) {
8859               array2[index] = source[index];
8860             }
8861             return array2;
8862           }
8863           function copyObject(source, props, object, customizer) {
8864             var isNew = !object;
8865             object || (object = {});
8866             var index = -1, length = props.length;
8867             while (++index < length) {
8868               var key = props[index];
8869               var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined2;
8870               if (newValue === undefined2) {
8871                 newValue = source[key];
8872               }
8873               if (isNew) {
8874                 baseAssignValue(object, key, newValue);
8875               } else {
8876                 assignValue(object, key, newValue);
8877               }
8878             }
8879             return object;
8880           }
8881           function copySymbols(source, object) {
8882             return copyObject(source, getSymbols2(source), object);
8883           }
8884           function copySymbolsIn(source, object) {
8885             return copyObject(source, getSymbolsIn(source), object);
8886           }
8887           function createAggregator(setter, initializer) {
8888             return function(collection, iteratee2) {
8889               var func = isArray2(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
8890               return func(collection, setter, getIteratee(iteratee2, 2), accumulator);
8891             };
8892           }
8893           function createAssigner(assigner) {
8894             return baseRest(function(object, sources) {
8895               var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined2, guard = length > 2 ? sources[2] : undefined2;
8896               customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : undefined2;
8897               if (guard && isIterateeCall(sources[0], sources[1], guard)) {
8898                 customizer = length < 3 ? undefined2 : customizer;
8899                 length = 1;
8900               }
8901               object = Object2(object);
8902               while (++index < length) {
8903                 var source = sources[index];
8904                 if (source) {
8905                   assigner(object, source, index, customizer);
8906                 }
8907               }
8908               return object;
8909             });
8910           }
8911           function createBaseEach(eachFunc, fromRight) {
8912             return function(collection, iteratee2) {
8913               if (collection == null) {
8914                 return collection;
8915               }
8916               if (!isArrayLike2(collection)) {
8917                 return eachFunc(collection, iteratee2);
8918               }
8919               var length = collection.length, index = fromRight ? length : -1, iterable = Object2(collection);
8920               while (fromRight ? index-- : ++index < length) {
8921                 if (iteratee2(iterable[index], index, iterable) === false) {
8922                   break;
8923                 }
8924               }
8925               return collection;
8926             };
8927           }
8928           function createBaseFor(fromRight) {
8929             return function(object, iteratee2, keysFunc) {
8930               var index = -1, iterable = Object2(object), props = keysFunc(object), length = props.length;
8931               while (length--) {
8932                 var key = props[fromRight ? length : ++index];
8933                 if (iteratee2(iterable[key], key, iterable) === false) {
8934                   break;
8935                 }
8936               }
8937               return object;
8938             };
8939           }
8940           function createBind(func, bitmask, thisArg) {
8941             var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
8942             function wrapper() {
8943               var fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
8944               return fn.apply(isBind ? thisArg : this, arguments);
8945             }
8946             return wrapper;
8947           }
8948           function createCaseFirst(methodName) {
8949             return function(string) {
8950               string = toString2(string);
8951               var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined2;
8952               var chr = strSymbols ? strSymbols[0] : string.charAt(0);
8953               var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
8954               return chr[methodName]() + trailing;
8955             };
8956           }
8957           function createCompounder(callback) {
8958             return function(string) {
8959               return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
8960             };
8961           }
8962           function createCtor(Ctor) {
8963             return function() {
8964               var args = arguments;
8965               switch (args.length) {
8966                 case 0:
8967                   return new Ctor();
8968                 case 1:
8969                   return new Ctor(args[0]);
8970                 case 2:
8971                   return new Ctor(args[0], args[1]);
8972                 case 3:
8973                   return new Ctor(args[0], args[1], args[2]);
8974                 case 4:
8975                   return new Ctor(args[0], args[1], args[2], args[3]);
8976                 case 5:
8977                   return new Ctor(args[0], args[1], args[2], args[3], args[4]);
8978                 case 6:
8979                   return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
8980                 case 7:
8981                   return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
8982               }
8983               var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args);
8984               return isObject3(result2) ? result2 : thisBinding;
8985             };
8986           }
8987           function createCurry(func, bitmask, arity) {
8988             var Ctor = createCtor(func);
8989             function wrapper() {
8990               var length = arguments.length, args = Array2(length), index = length, placeholder = getHolder(wrapper);
8991               while (index--) {
8992                 args[index] = arguments[index];
8993               }
8994               var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
8995               length -= holders.length;
8996               if (length < arity) {
8997                 return createRecurry(
8998                   func,
8999                   bitmask,
9000                   createHybrid,
9001                   wrapper.placeholder,
9002                   undefined2,
9003                   args,
9004                   holders,
9005                   undefined2,
9006                   undefined2,
9007                   arity - length
9008                 );
9009               }
9010               var fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
9011               return apply(fn, this, args);
9012             }
9013             return wrapper;
9014           }
9015           function createFind(findIndexFunc) {
9016             return function(collection, predicate, fromIndex) {
9017               var iterable = Object2(collection);
9018               if (!isArrayLike2(collection)) {
9019                 var iteratee2 = getIteratee(predicate, 3);
9020                 collection = keys2(collection);
9021                 predicate = function(key) {
9022                   return iteratee2(iterable[key], key, iterable);
9023                 };
9024               }
9025               var index = findIndexFunc(collection, predicate, fromIndex);
9026               return index > -1 ? iterable[iteratee2 ? collection[index] : index] : undefined2;
9027             };
9028           }
9029           function createFlow(fromRight) {
9030             return flatRest(function(funcs) {
9031               var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru;
9032               if (fromRight) {
9033                 funcs.reverse();
9034               }
9035               while (index--) {
9036                 var func = funcs[index];
9037                 if (typeof func != "function") {
9038                   throw new TypeError2(FUNC_ERROR_TEXT3);
9039                 }
9040                 if (prereq && !wrapper && getFuncName(func) == "wrapper") {
9041                   var wrapper = new LodashWrapper([], true);
9042                 }
9043               }
9044               index = wrapper ? index : length;
9045               while (++index < length) {
9046                 func = funcs[index];
9047                 var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : undefined2;
9048                 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) {
9049                   wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
9050                 } else {
9051                   wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
9052                 }
9053               }
9054               return function() {
9055                 var args = arguments, value = args[0];
9056                 if (wrapper && args.length == 1 && isArray2(value)) {
9057                   return wrapper.plant(value).value();
9058                 }
9059                 var index2 = 0, result2 = length ? funcs[index2].apply(this, args) : value;
9060                 while (++index2 < length) {
9061                   result2 = funcs[index2].call(this, result2);
9062                 }
9063                 return result2;
9064               };
9065             });
9066           }
9067           function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) {
9068             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);
9069             function wrapper() {
9070               var length = arguments.length, args = Array2(length), index = length;
9071               while (index--) {
9072                 args[index] = arguments[index];
9073               }
9074               if (isCurried) {
9075                 var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
9076               }
9077               if (partials) {
9078                 args = composeArgs(args, partials, holders, isCurried);
9079               }
9080               if (partialsRight) {
9081                 args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
9082               }
9083               length -= holdersCount;
9084               if (isCurried && length < arity) {
9085                 var newHolders = replaceHolders(args, placeholder);
9086                 return createRecurry(
9087                   func,
9088                   bitmask,
9089                   createHybrid,
9090                   wrapper.placeholder,
9091                   thisArg,
9092                   args,
9093                   newHolders,
9094                   argPos,
9095                   ary2,
9096                   arity - length
9097                 );
9098               }
9099               var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
9100               length = args.length;
9101               if (argPos) {
9102                 args = reorder(args, argPos);
9103               } else if (isFlip && length > 1) {
9104                 args.reverse();
9105               }
9106               if (isAry && ary2 < length) {
9107                 args.length = ary2;
9108               }
9109               if (this && this !== root3 && this instanceof wrapper) {
9110                 fn = Ctor || createCtor(fn);
9111               }
9112               return fn.apply(thisBinding, args);
9113             }
9114             return wrapper;
9115           }
9116           function createInverter(setter, toIteratee) {
9117             return function(object, iteratee2) {
9118               return baseInverter(object, setter, toIteratee(iteratee2), {});
9119             };
9120           }
9121           function createMathOperation(operator, defaultValue) {
9122             return function(value, other) {
9123               var result2;
9124               if (value === undefined2 && other === undefined2) {
9125                 return defaultValue;
9126               }
9127               if (value !== undefined2) {
9128                 result2 = value;
9129               }
9130               if (other !== undefined2) {
9131                 if (result2 === undefined2) {
9132                   return other;
9133                 }
9134                 if (typeof value == "string" || typeof other == "string") {
9135                   value = baseToString2(value);
9136                   other = baseToString2(other);
9137                 } else {
9138                   value = baseToNumber(value);
9139                   other = baseToNumber(other);
9140                 }
9141                 result2 = operator(value, other);
9142               }
9143               return result2;
9144             };
9145           }
9146           function createOver(arrayFunc) {
9147             return flatRest(function(iteratees) {
9148               iteratees = arrayMap2(iteratees, baseUnary2(getIteratee()));
9149               return baseRest(function(args) {
9150                 var thisArg = this;
9151                 return arrayFunc(iteratees, function(iteratee2) {
9152                   return apply(iteratee2, thisArg, args);
9153                 });
9154               });
9155             });
9156           }
9157           function createPadding(length, chars) {
9158             chars = chars === undefined2 ? " " : baseToString2(chars);
9159             var charsLength = chars.length;
9160             if (charsLength < 2) {
9161               return charsLength ? baseRepeat(chars, length) : chars;
9162             }
9163             var result2 = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
9164             return hasUnicode(chars) ? castSlice(stringToArray(result2), 0, length).join("") : result2.slice(0, length);
9165           }
9166           function createPartial(func, bitmask, thisArg, partials) {
9167             var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
9168             function wrapper() {
9169               var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
9170               while (++leftIndex < leftLength) {
9171                 args[leftIndex] = partials[leftIndex];
9172               }
9173               while (argsLength--) {
9174                 args[leftIndex++] = arguments[++argsIndex];
9175               }
9176               return apply(fn, isBind ? thisArg : this, args);
9177             }
9178             return wrapper;
9179           }
9180           function createRange(fromRight) {
9181             return function(start2, end, step) {
9182               if (step && typeof step != "number" && isIterateeCall(start2, end, step)) {
9183                 end = step = undefined2;
9184               }
9185               start2 = toFinite(start2);
9186               if (end === undefined2) {
9187                 end = start2;
9188                 start2 = 0;
9189               } else {
9190                 end = toFinite(end);
9191               }
9192               step = step === undefined2 ? start2 < end ? 1 : -1 : toFinite(step);
9193               return baseRange(start2, end, step, fromRight);
9194             };
9195           }
9196           function createRelationalOperation(operator) {
9197             return function(value, other) {
9198               if (!(typeof value == "string" && typeof other == "string")) {
9199                 value = toNumber3(value);
9200                 other = toNumber3(other);
9201               }
9202               return operator(value, other);
9203             };
9204           }
9205           function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) {
9206             var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined2, newHoldersRight = isCurry ? undefined2 : holders, newPartials = isCurry ? partials : undefined2, newPartialsRight = isCurry ? undefined2 : partials;
9207             bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG;
9208             bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
9209             if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
9210               bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
9211             }
9212             var newData = [
9213               func,
9214               bitmask,
9215               thisArg,
9216               newPartials,
9217               newHolders,
9218               newPartialsRight,
9219               newHoldersRight,
9220               argPos,
9221               ary2,
9222               arity
9223             ];
9224             var result2 = wrapFunc.apply(undefined2, newData);
9225             if (isLaziable(func)) {
9226               setData(result2, newData);
9227             }
9228             result2.placeholder = placeholder;
9229             return setWrapToString(result2, func, bitmask);
9230           }
9231           function createRound(methodName) {
9232             var func = Math2[methodName];
9233             return function(number3, precision2) {
9234               number3 = toNumber3(number3);
9235               precision2 = precision2 == null ? 0 : nativeMin2(toInteger(precision2), 292);
9236               if (precision2 && nativeIsFinite(number3)) {
9237                 var pair2 = (toString2(number3) + "e").split("e"), value = func(pair2[0] + "e" + (+pair2[1] + precision2));
9238                 pair2 = (toString2(value) + "e").split("e");
9239                 return +(pair2[0] + "e" + (+pair2[1] - precision2));
9240               }
9241               return func(number3);
9242             };
9243           }
9244           var createSet = !(Set3 && 1 / setToArray2(new Set3([, -0]))[1] == INFINITY2) ? noop3 : function(values2) {
9245             return new Set3(values2);
9246           };
9247           function createToPairs(keysFunc) {
9248             return function(object) {
9249               var tag = getTag2(object);
9250               if (tag == mapTag4) {
9251                 return mapToArray2(object);
9252               }
9253               if (tag == setTag4) {
9254                 return setToPairs(object);
9255               }
9256               return baseToPairs(object, keysFunc(object));
9257             };
9258           }
9259           function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) {
9260             var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
9261             if (!isBindKey && typeof func != "function") {
9262               throw new TypeError2(FUNC_ERROR_TEXT3);
9263             }
9264             var length = partials ? partials.length : 0;
9265             if (!length) {
9266               bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
9267               partials = holders = undefined2;
9268             }
9269             ary2 = ary2 === undefined2 ? ary2 : nativeMax2(toInteger(ary2), 0);
9270             arity = arity === undefined2 ? arity : toInteger(arity);
9271             length -= holders ? holders.length : 0;
9272             if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
9273               var partialsRight = partials, holdersRight = holders;
9274               partials = holders = undefined2;
9275             }
9276             var data = isBindKey ? undefined2 : getData(func);
9277             var newData = [
9278               func,
9279               bitmask,
9280               thisArg,
9281               partials,
9282               holders,
9283               partialsRight,
9284               holdersRight,
9285               argPos,
9286               ary2,
9287               arity
9288             ];
9289             if (data) {
9290               mergeData(newData, data);
9291             }
9292             func = newData[0];
9293             bitmask = newData[1];
9294             thisArg = newData[2];
9295             partials = newData[3];
9296             holders = newData[4];
9297             arity = newData[9] = newData[9] === undefined2 ? isBindKey ? 0 : func.length : nativeMax2(newData[9] - length, 0);
9298             if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
9299               bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
9300             }
9301             if (!bitmask || bitmask == WRAP_BIND_FLAG) {
9302               var result2 = createBind(func, bitmask, thisArg);
9303             } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
9304               result2 = createCurry(func, bitmask, arity);
9305             } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
9306               result2 = createPartial(func, bitmask, thisArg, partials);
9307             } else {
9308               result2 = createHybrid.apply(undefined2, newData);
9309             }
9310             var setter = data ? baseSetData : setData;
9311             return setWrapToString(setter(result2, newData), func, bitmask);
9312           }
9313           function customDefaultsAssignIn(objValue, srcValue, key, object) {
9314             if (objValue === undefined2 || eq2(objValue, objectProto13[key]) && !hasOwnProperty10.call(object, key)) {
9315               return srcValue;
9316             }
9317             return objValue;
9318           }
9319           function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
9320             if (isObject3(objValue) && isObject3(srcValue)) {
9321               stack.set(srcValue, objValue);
9322               baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack);
9323               stack["delete"](srcValue);
9324             }
9325             return objValue;
9326           }
9327           function customOmitClone(value) {
9328             return isPlainObject(value) ? undefined2 : value;
9329           }
9330           function equalArrays2(array2, other, bitmask, customizer, equalFunc, stack) {
9331             var isPartial = bitmask & COMPARE_PARTIAL_FLAG5, arrLength = array2.length, othLength = other.length;
9332             if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
9333               return false;
9334             }
9335             var arrStacked = stack.get(array2);
9336             var othStacked = stack.get(other);
9337             if (arrStacked && othStacked) {
9338               return arrStacked == other && othStacked == array2;
9339             }
9340             var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG3 ? new SetCache2() : undefined2;
9341             stack.set(array2, other);
9342             stack.set(other, array2);
9343             while (++index < arrLength) {
9344               var arrValue = array2[index], othValue = other[index];
9345               if (customizer) {
9346                 var compared = isPartial ? customizer(othValue, arrValue, index, other, array2, stack) : customizer(arrValue, othValue, index, array2, other, stack);
9347               }
9348               if (compared !== undefined2) {
9349                 if (compared) {
9350                   continue;
9351                 }
9352                 result2 = false;
9353                 break;
9354               }
9355               if (seen) {
9356                 if (!arraySome2(other, function(othValue2, othIndex) {
9357                   if (!cacheHas2(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
9358                     return seen.push(othIndex);
9359                   }
9360                 })) {
9361                   result2 = false;
9362                   break;
9363                 }
9364               } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
9365                 result2 = false;
9366                 break;
9367               }
9368             }
9369             stack["delete"](array2);
9370             stack["delete"](other);
9371             return result2;
9372           }
9373           function equalByTag2(object, other, tag, bitmask, customizer, equalFunc, stack) {
9374             switch (tag) {
9375               case dataViewTag4:
9376                 if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
9377                   return false;
9378                 }
9379                 object = object.buffer;
9380                 other = other.buffer;
9381               case arrayBufferTag3:
9382                 if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array3(object), new Uint8Array3(other))) {
9383                   return false;
9384                 }
9385                 return true;
9386               case boolTag3:
9387               case dateTag3:
9388               case numberTag3:
9389                 return eq2(+object, +other);
9390               case errorTag3:
9391                 return object.name == other.name && object.message == other.message;
9392               case regexpTag3:
9393               case stringTag3:
9394                 return object == other + "";
9395               case mapTag4:
9396                 var convert = mapToArray2;
9397               case setTag4:
9398                 var isPartial = bitmask & COMPARE_PARTIAL_FLAG5;
9399                 convert || (convert = setToArray2);
9400                 if (object.size != other.size && !isPartial) {
9401                   return false;
9402                 }
9403                 var stacked = stack.get(object);
9404                 if (stacked) {
9405                   return stacked == other;
9406                 }
9407                 bitmask |= COMPARE_UNORDERED_FLAG3;
9408                 stack.set(object, other);
9409                 var result2 = equalArrays2(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
9410                 stack["delete"](object);
9411                 return result2;
9412               case symbolTag3:
9413                 if (symbolValueOf2) {
9414                   return symbolValueOf2.call(object) == symbolValueOf2.call(other);
9415                 }
9416             }
9417             return false;
9418           }
9419           function equalObjects2(object, other, bitmask, customizer, equalFunc, stack) {
9420             var isPartial = bitmask & COMPARE_PARTIAL_FLAG5, objProps = getAllKeys2(object), objLength = objProps.length, othProps = getAllKeys2(other), othLength = othProps.length;
9421             if (objLength != othLength && !isPartial) {
9422               return false;
9423             }
9424             var index = objLength;
9425             while (index--) {
9426               var key = objProps[index];
9427               if (!(isPartial ? key in other : hasOwnProperty10.call(other, key))) {
9428                 return false;
9429               }
9430             }
9431             var objStacked = stack.get(object);
9432             var othStacked = stack.get(other);
9433             if (objStacked && othStacked) {
9434               return objStacked == other && othStacked == object;
9435             }
9436             var result2 = true;
9437             stack.set(object, other);
9438             stack.set(other, object);
9439             var skipCtor = isPartial;
9440             while (++index < objLength) {
9441               key = objProps[index];
9442               var objValue = object[key], othValue = other[key];
9443               if (customizer) {
9444                 var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
9445               }
9446               if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
9447                 result2 = false;
9448                 break;
9449               }
9450               skipCtor || (skipCtor = key == "constructor");
9451             }
9452             if (result2 && !skipCtor) {
9453               var objCtor = object.constructor, othCtor = other.constructor;
9454               if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
9455                 result2 = false;
9456               }
9457             }
9458             stack["delete"](object);
9459             stack["delete"](other);
9460             return result2;
9461           }
9462           function flatRest(func) {
9463             return setToString(overRest(func, undefined2, flatten2), func + "");
9464           }
9465           function getAllKeys2(object) {
9466             return baseGetAllKeys2(object, keys2, getSymbols2);
9467           }
9468           function getAllKeysIn(object) {
9469             return baseGetAllKeys2(object, keysIn, getSymbolsIn);
9470           }
9471           var getData = !metaMap ? noop3 : function(func) {
9472             return metaMap.get(func);
9473           };
9474           function getFuncName(func) {
9475             var result2 = func.name + "", array2 = realNames[result2], length = hasOwnProperty10.call(realNames, result2) ? array2.length : 0;
9476             while (length--) {
9477               var data = array2[length], otherFunc = data.func;
9478               if (otherFunc == null || otherFunc == func) {
9479                 return data.name;
9480               }
9481             }
9482             return result2;
9483           }
9484           function getHolder(func) {
9485             var object = hasOwnProperty10.call(lodash, "placeholder") ? lodash : func;
9486             return object.placeholder;
9487           }
9488           function getIteratee() {
9489             var result2 = lodash.iteratee || iteratee;
9490             result2 = result2 === iteratee ? baseIteratee : result2;
9491             return arguments.length ? result2(arguments[0], arguments[1]) : result2;
9492           }
9493           function getMapData2(map3, key) {
9494             var data = map3.__data__;
9495             return isKeyable2(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
9496           }
9497           function getMatchData(object) {
9498             var result2 = keys2(object), length = result2.length;
9499             while (length--) {
9500               var key = result2[length], value = object[key];
9501               result2[length] = [key, value, isStrictComparable(value)];
9502             }
9503             return result2;
9504           }
9505           function getNative2(object, key) {
9506             var value = getValue2(object, key);
9507             return baseIsNative2(value) ? value : undefined2;
9508           }
9509           function getRawTag2(value) {
9510             var isOwn = hasOwnProperty10.call(value, symToStringTag3), tag = value[symToStringTag3];
9511             try {
9512               value[symToStringTag3] = undefined2;
9513               var unmasked = true;
9514             } catch (e) {
9515             }
9516             var result2 = nativeObjectToString3.call(value);
9517             if (unmasked) {
9518               if (isOwn) {
9519                 value[symToStringTag3] = tag;
9520               } else {
9521                 delete value[symToStringTag3];
9522               }
9523             }
9524             return result2;
9525           }
9526           var getSymbols2 = !nativeGetSymbols2 ? stubArray2 : function(object) {
9527             if (object == null) {
9528               return [];
9529             }
9530             object = Object2(object);
9531             return arrayFilter2(nativeGetSymbols2(object), function(symbol) {
9532               return propertyIsEnumerable3.call(object, symbol);
9533             });
9534           };
9535           var getSymbolsIn = !nativeGetSymbols2 ? stubArray2 : function(object) {
9536             var result2 = [];
9537             while (object) {
9538               arrayPush2(result2, getSymbols2(object));
9539               object = getPrototype(object);
9540             }
9541             return result2;
9542           };
9543           var getTag2 = baseGetTag2;
9544           if (DataView3 && getTag2(new DataView3(new ArrayBuffer(1))) != dataViewTag4 || Map3 && getTag2(new Map3()) != mapTag4 || Promise3 && getTag2(Promise3.resolve()) != promiseTag2 || Set3 && getTag2(new Set3()) != setTag4 || WeakMap2 && getTag2(new WeakMap2()) != weakMapTag3) {
9545             getTag2 = function(value) {
9546               var result2 = baseGetTag2(value), Ctor = result2 == objectTag4 ? value.constructor : undefined2, ctorString = Ctor ? toSource2(Ctor) : "";
9547               if (ctorString) {
9548                 switch (ctorString) {
9549                   case dataViewCtorString2:
9550                     return dataViewTag4;
9551                   case mapCtorString2:
9552                     return mapTag4;
9553                   case promiseCtorString2:
9554                     return promiseTag2;
9555                   case setCtorString2:
9556                     return setTag4;
9557                   case weakMapCtorString2:
9558                     return weakMapTag3;
9559                 }
9560               }
9561               return result2;
9562             };
9563           }
9564           function getView(start2, end, transforms) {
9565             var index = -1, length = transforms.length;
9566             while (++index < length) {
9567               var data = transforms[index], size2 = data.size;
9568               switch (data.type) {
9569                 case "drop":
9570                   start2 += size2;
9571                   break;
9572                 case "dropRight":
9573                   end -= size2;
9574                   break;
9575                 case "take":
9576                   end = nativeMin2(end, start2 + size2);
9577                   break;
9578                 case "takeRight":
9579                   start2 = nativeMax2(start2, end - size2);
9580                   break;
9581               }
9582             }
9583             return { "start": start2, "end": end };
9584           }
9585           function getWrapDetails(source) {
9586             var match = source.match(reWrapDetails);
9587             return match ? match[1].split(reSplitDetails) : [];
9588           }
9589           function hasPath(object, path, hasFunc) {
9590             path = castPath(path, object);
9591             var index = -1, length = path.length, result2 = false;
9592             while (++index < length) {
9593               var key = toKey(path[index]);
9594               if (!(result2 = object != null && hasFunc(object, key))) {
9595                 break;
9596               }
9597               object = object[key];
9598             }
9599             if (result2 || ++index != length) {
9600               return result2;
9601             }
9602             length = object == null ? 0 : object.length;
9603             return !!length && isLength2(length) && isIndex2(key, length) && (isArray2(object) || isArguments2(object));
9604           }
9605           function initCloneArray(array2) {
9606             var length = array2.length, result2 = new array2.constructor(length);
9607             if (length && typeof array2[0] == "string" && hasOwnProperty10.call(array2, "index")) {
9608               result2.index = array2.index;
9609               result2.input = array2.input;
9610             }
9611             return result2;
9612           }
9613           function initCloneObject(object) {
9614             return typeof object.constructor == "function" && !isPrototype2(object) ? baseCreate(getPrototype(object)) : {};
9615           }
9616           function initCloneByTag(object, tag, isDeep) {
9617             var Ctor = object.constructor;
9618             switch (tag) {
9619               case arrayBufferTag3:
9620                 return cloneArrayBuffer(object);
9621               case boolTag3:
9622               case dateTag3:
9623                 return new Ctor(+object);
9624               case dataViewTag4:
9625                 return cloneDataView(object, isDeep);
9626               case float32Tag2:
9627               case float64Tag2:
9628               case int8Tag2:
9629               case int16Tag2:
9630               case int32Tag2:
9631               case uint8Tag2:
9632               case uint8ClampedTag2:
9633               case uint16Tag2:
9634               case uint32Tag2:
9635                 return cloneTypedArray(object, isDeep);
9636               case mapTag4:
9637                 return new Ctor();
9638               case numberTag3:
9639               case stringTag3:
9640                 return new Ctor(object);
9641               case regexpTag3:
9642                 return cloneRegExp(object);
9643               case setTag4:
9644                 return new Ctor();
9645               case symbolTag3:
9646                 return cloneSymbol(object);
9647             }
9648           }
9649           function insertWrapDetails(source, details) {
9650             var length = details.length;
9651             if (!length) {
9652               return source;
9653             }
9654             var lastIndex = length - 1;
9655             details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex];
9656             details = details.join(length > 2 ? ", " : " ");
9657             return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
9658           }
9659           function isFlattenable(value) {
9660             return isArray2(value) || isArguments2(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
9661           }
9662           function isIndex2(value, length) {
9663             var type2 = typeof value;
9664             length = length == null ? MAX_SAFE_INTEGER3 : length;
9665             return !!length && (type2 == "number" || type2 != "symbol" && reIsUint2.test(value)) && (value > -1 && value % 1 == 0 && value < length);
9666           }
9667           function isIterateeCall(value, index, object) {
9668             if (!isObject3(object)) {
9669               return false;
9670             }
9671             var type2 = typeof index;
9672             if (type2 == "number" ? isArrayLike2(object) && isIndex2(index, object.length) : type2 == "string" && index in object) {
9673               return eq2(object[index], value);
9674             }
9675             return false;
9676           }
9677           function isKey(value, object) {
9678             if (isArray2(value)) {
9679               return false;
9680             }
9681             var type2 = typeof value;
9682             if (type2 == "number" || type2 == "symbol" || type2 == "boolean" || value == null || isSymbol2(value)) {
9683               return true;
9684             }
9685             return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object);
9686           }
9687           function isKeyable2(value) {
9688             var type2 = typeof value;
9689             return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
9690           }
9691           function isLaziable(func) {
9692             var funcName = getFuncName(func), other = lodash[funcName];
9693             if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
9694               return false;
9695             }
9696             if (func === other) {
9697               return true;
9698             }
9699             var data = getData(other);
9700             return !!data && func === data[0];
9701           }
9702           function isMasked2(func) {
9703             return !!maskSrcKey2 && maskSrcKey2 in func;
9704           }
9705           var isMaskable = coreJsData2 ? isFunction2 : stubFalse2;
9706           function isPrototype2(value) {
9707             var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto13;
9708             return value === proto;
9709           }
9710           function isStrictComparable(value) {
9711             return value === value && !isObject3(value);
9712           }
9713           function matchesStrictComparable(key, srcValue) {
9714             return function(object) {
9715               if (object == null) {
9716                 return false;
9717               }
9718               return object[key] === srcValue && (srcValue !== undefined2 || key in Object2(object));
9719             };
9720           }
9721           function memoizeCapped(func) {
9722             var result2 = memoize(func, function(key) {
9723               if (cache.size === MAX_MEMOIZE_SIZE) {
9724                 cache.clear();
9725               }
9726               return key;
9727             });
9728             var cache = result2.cache;
9729             return result2;
9730           }
9731           function mergeData(data, source) {
9732             var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
9733             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;
9734             if (!(isCommon || isCombo)) {
9735               return data;
9736             }
9737             if (srcBitmask & WRAP_BIND_FLAG) {
9738               data[2] = source[2];
9739               newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
9740             }
9741             var value = source[3];
9742             if (value) {
9743               var partials = data[3];
9744               data[3] = partials ? composeArgs(partials, value, source[4]) : value;
9745               data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
9746             }
9747             value = source[5];
9748             if (value) {
9749               partials = data[5];
9750               data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
9751               data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
9752             }
9753             value = source[7];
9754             if (value) {
9755               data[7] = value;
9756             }
9757             if (srcBitmask & WRAP_ARY_FLAG) {
9758               data[8] = data[8] == null ? source[8] : nativeMin2(data[8], source[8]);
9759             }
9760             if (data[9] == null) {
9761               data[9] = source[9];
9762             }
9763             data[0] = source[0];
9764             data[1] = newBitmask;
9765             return data;
9766           }
9767           function nativeKeysIn(object) {
9768             var result2 = [];
9769             if (object != null) {
9770               for (var key in Object2(object)) {
9771                 result2.push(key);
9772               }
9773             }
9774             return result2;
9775           }
9776           function objectToString2(value) {
9777             return nativeObjectToString3.call(value);
9778           }
9779           function overRest(func, start2, transform3) {
9780             start2 = nativeMax2(start2 === undefined2 ? func.length - 1 : start2, 0);
9781             return function() {
9782               var args = arguments, index = -1, length = nativeMax2(args.length - start2, 0), array2 = Array2(length);
9783               while (++index < length) {
9784                 array2[index] = args[start2 + index];
9785               }
9786               index = -1;
9787               var otherArgs = Array2(start2 + 1);
9788               while (++index < start2) {
9789                 otherArgs[index] = args[index];
9790               }
9791               otherArgs[start2] = transform3(array2);
9792               return apply(func, this, otherArgs);
9793             };
9794           }
9795           function parent(object, path) {
9796             return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
9797           }
9798           function reorder(array2, indexes) {
9799             var arrLength = array2.length, length = nativeMin2(indexes.length, arrLength), oldArray = copyArray(array2);
9800             while (length--) {
9801               var index = indexes[length];
9802               array2[length] = isIndex2(index, arrLength) ? oldArray[index] : undefined2;
9803             }
9804             return array2;
9805           }
9806           function safeGet(object, key) {
9807             if (key === "constructor" && typeof object[key] === "function") {
9808               return;
9809             }
9810             if (key == "__proto__") {
9811               return;
9812             }
9813             return object[key];
9814           }
9815           var setData = shortOut(baseSetData);
9816           var setTimeout2 = ctxSetTimeout || function(func, wait) {
9817             return root3.setTimeout(func, wait);
9818           };
9819           var setToString = shortOut(baseSetToString);
9820           function setWrapToString(wrapper, reference, bitmask) {
9821             var source = reference + "";
9822             return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
9823           }
9824           function shortOut(func) {
9825             var count = 0, lastCalled = 0;
9826             return function() {
9827               var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
9828               lastCalled = stamp;
9829               if (remaining > 0) {
9830                 if (++count >= HOT_COUNT) {
9831                   return arguments[0];
9832                 }
9833               } else {
9834                 count = 0;
9835               }
9836               return func.apply(undefined2, arguments);
9837             };
9838           }
9839           function shuffleSelf(array2, size2) {
9840             var index = -1, length = array2.length, lastIndex = length - 1;
9841             size2 = size2 === undefined2 ? length : size2;
9842             while (++index < size2) {
9843               var rand = baseRandom(index, lastIndex), value = array2[rand];
9844               array2[rand] = array2[index];
9845               array2[index] = value;
9846             }
9847             array2.length = size2;
9848             return array2;
9849           }
9850           var stringToPath = memoizeCapped(function(string) {
9851             var result2 = [];
9852             if (string.charCodeAt(0) === 46) {
9853               result2.push("");
9854             }
9855             string.replace(rePropName, function(match, number3, quote2, subString) {
9856               result2.push(quote2 ? subString.replace(reEscapeChar, "$1") : number3 || match);
9857             });
9858             return result2;
9859           });
9860           function toKey(value) {
9861             if (typeof value == "string" || isSymbol2(value)) {
9862               return value;
9863             }
9864             var result2 = value + "";
9865             return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2;
9866           }
9867           function toSource2(func) {
9868             if (func != null) {
9869               try {
9870                 return funcToString3.call(func);
9871               } catch (e) {
9872               }
9873               try {
9874                 return func + "";
9875               } catch (e) {
9876               }
9877             }
9878             return "";
9879           }
9880           function updateWrapDetails(details, bitmask) {
9881             arrayEach(wrapFlags, function(pair2) {
9882               var value = "_." + pair2[0];
9883               if (bitmask & pair2[1] && !arrayIncludes(details, value)) {
9884                 details.push(value);
9885               }
9886             });
9887             return details.sort();
9888           }
9889           function wrapperClone(wrapper) {
9890             if (wrapper instanceof LazyWrapper) {
9891               return wrapper.clone();
9892             }
9893             var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
9894             result2.__actions__ = copyArray(wrapper.__actions__);
9895             result2.__index__ = wrapper.__index__;
9896             result2.__values__ = wrapper.__values__;
9897             return result2;
9898           }
9899           function chunk(array2, size2, guard) {
9900             if (guard ? isIterateeCall(array2, size2, guard) : size2 === undefined2) {
9901               size2 = 1;
9902             } else {
9903               size2 = nativeMax2(toInteger(size2), 0);
9904             }
9905             var length = array2 == null ? 0 : array2.length;
9906             if (!length || size2 < 1) {
9907               return [];
9908             }
9909             var index = 0, resIndex = 0, result2 = Array2(nativeCeil(length / size2));
9910             while (index < length) {
9911               result2[resIndex++] = baseSlice(array2, index, index += size2);
9912             }
9913             return result2;
9914           }
9915           function compact(array2) {
9916             var index = -1, length = array2 == null ? 0 : array2.length, resIndex = 0, result2 = [];
9917             while (++index < length) {
9918               var value = array2[index];
9919               if (value) {
9920                 result2[resIndex++] = value;
9921               }
9922             }
9923             return result2;
9924           }
9925           function concat() {
9926             var length = arguments.length;
9927             if (!length) {
9928               return [];
9929             }
9930             var args = Array2(length - 1), array2 = arguments[0], index = length;
9931             while (index--) {
9932               args[index - 1] = arguments[index];
9933             }
9934             return arrayPush2(isArray2(array2) ? copyArray(array2) : [array2], baseFlatten(args, 1));
9935           }
9936           var difference = baseRest(function(array2, values2) {
9937             return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true)) : [];
9938           });
9939           var differenceBy = baseRest(function(array2, values2) {
9940             var iteratee2 = last(values2);
9941             if (isArrayLikeObject(iteratee2)) {
9942               iteratee2 = undefined2;
9943             }
9944             return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)) : [];
9945           });
9946           var differenceWith = baseRest(function(array2, values2) {
9947             var comparator = last(values2);
9948             if (isArrayLikeObject(comparator)) {
9949               comparator = undefined2;
9950             }
9951             return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true), undefined2, comparator) : [];
9952           });
9953           function drop(array2, n2, guard) {
9954             var length = array2 == null ? 0 : array2.length;
9955             if (!length) {
9956               return [];
9957             }
9958             n2 = guard || n2 === undefined2 ? 1 : toInteger(n2);
9959             return baseSlice(array2, n2 < 0 ? 0 : n2, length);
9960           }
9961           function dropRight(array2, n2, guard) {
9962             var length = array2 == null ? 0 : array2.length;
9963             if (!length) {
9964               return [];
9965             }
9966             n2 = guard || n2 === undefined2 ? 1 : toInteger(n2);
9967             n2 = length - n2;
9968             return baseSlice(array2, 0, n2 < 0 ? 0 : n2);
9969           }
9970           function dropRightWhile(array2, predicate) {
9971             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), true, true) : [];
9972           }
9973           function dropWhile(array2, predicate) {
9974             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), true) : [];
9975           }
9976           function fill(array2, value, start2, end) {
9977             var length = array2 == null ? 0 : array2.length;
9978             if (!length) {
9979               return [];
9980             }
9981             if (start2 && typeof start2 != "number" && isIterateeCall(array2, value, start2)) {
9982               start2 = 0;
9983               end = length;
9984             }
9985             return baseFill(array2, value, start2, end);
9986           }
9987           function findIndex(array2, predicate, fromIndex) {
9988             var length = array2 == null ? 0 : array2.length;
9989             if (!length) {
9990               return -1;
9991             }
9992             var index = fromIndex == null ? 0 : toInteger(fromIndex);
9993             if (index < 0) {
9994               index = nativeMax2(length + index, 0);
9995             }
9996             return baseFindIndex(array2, getIteratee(predicate, 3), index);
9997           }
9998           function findLastIndex(array2, predicate, fromIndex) {
9999             var length = array2 == null ? 0 : array2.length;
10000             if (!length) {
10001               return -1;
10002             }
10003             var index = length - 1;
10004             if (fromIndex !== undefined2) {
10005               index = toInteger(fromIndex);
10006               index = fromIndex < 0 ? nativeMax2(length + index, 0) : nativeMin2(index, length - 1);
10007             }
10008             return baseFindIndex(array2, getIteratee(predicate, 3), index, true);
10009           }
10010           function flatten2(array2) {
10011             var length = array2 == null ? 0 : array2.length;
10012             return length ? baseFlatten(array2, 1) : [];
10013           }
10014           function flattenDeep(array2) {
10015             var length = array2 == null ? 0 : array2.length;
10016             return length ? baseFlatten(array2, INFINITY2) : [];
10017           }
10018           function flattenDepth(array2, depth) {
10019             var length = array2 == null ? 0 : array2.length;
10020             if (!length) {
10021               return [];
10022             }
10023             depth = depth === undefined2 ? 1 : toInteger(depth);
10024             return baseFlatten(array2, depth);
10025           }
10026           function fromPairs(pairs) {
10027             var index = -1, length = pairs == null ? 0 : pairs.length, result2 = {};
10028             while (++index < length) {
10029               var pair2 = pairs[index];
10030               result2[pair2[0]] = pair2[1];
10031             }
10032             return result2;
10033           }
10034           function head(array2) {
10035             return array2 && array2.length ? array2[0] : undefined2;
10036           }
10037           function indexOf(array2, value, fromIndex) {
10038             var length = array2 == null ? 0 : array2.length;
10039             if (!length) {
10040               return -1;
10041             }
10042             var index = fromIndex == null ? 0 : toInteger(fromIndex);
10043             if (index < 0) {
10044               index = nativeMax2(length + index, 0);
10045             }
10046             return baseIndexOf(array2, value, index);
10047           }
10048           function initial(array2) {
10049             var length = array2 == null ? 0 : array2.length;
10050             return length ? baseSlice(array2, 0, -1) : [];
10051           }
10052           var intersection = baseRest(function(arrays) {
10053             var mapped = arrayMap2(arrays, castArrayLikeObject);
10054             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
10055           });
10056           var intersectionBy = baseRest(function(arrays) {
10057             var iteratee2 = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
10058             if (iteratee2 === last(mapped)) {
10059               iteratee2 = undefined2;
10060             } else {
10061               mapped.pop();
10062             }
10063             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : [];
10064           });
10065           var intersectionWith = baseRest(function(arrays) {
10066             var comparator = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
10067             comparator = typeof comparator == "function" ? comparator : undefined2;
10068             if (comparator) {
10069               mapped.pop();
10070             }
10071             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
10072           });
10073           function join(array2, separator) {
10074             return array2 == null ? "" : nativeJoin.call(array2, separator);
10075           }
10076           function last(array2) {
10077             var length = array2 == null ? 0 : array2.length;
10078             return length ? array2[length - 1] : undefined2;
10079           }
10080           function lastIndexOf(array2, value, fromIndex) {
10081             var length = array2 == null ? 0 : array2.length;
10082             if (!length) {
10083               return -1;
10084             }
10085             var index = length;
10086             if (fromIndex !== undefined2) {
10087               index = toInteger(fromIndex);
10088               index = index < 0 ? nativeMax2(length + index, 0) : nativeMin2(index, length - 1);
10089             }
10090             return value === value ? strictLastIndexOf(array2, value, index) : baseFindIndex(array2, baseIsNaN, index, true);
10091           }
10092           function nth(array2, n2) {
10093             return array2 && array2.length ? baseNth(array2, toInteger(n2)) : undefined2;
10094           }
10095           var pull = baseRest(pullAll);
10096           function pullAll(array2, values2) {
10097             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
10098           }
10099           function pullAllBy(array2, values2, iteratee2) {
10100             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2, getIteratee(iteratee2, 2)) : array2;
10101           }
10102           function pullAllWith(array2, values2, comparator) {
10103             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2, undefined2, comparator) : array2;
10104           }
10105           var pullAt = flatRest(function(array2, indexes) {
10106             var length = array2 == null ? 0 : array2.length, result2 = baseAt(array2, indexes);
10107             basePullAt(array2, arrayMap2(indexes, function(index) {
10108               return isIndex2(index, length) ? +index : index;
10109             }).sort(compareAscending));
10110             return result2;
10111           });
10112           function remove2(array2, predicate) {
10113             var result2 = [];
10114             if (!(array2 && array2.length)) {
10115               return result2;
10116             }
10117             var index = -1, indexes = [], length = array2.length;
10118             predicate = getIteratee(predicate, 3);
10119             while (++index < length) {
10120               var value = array2[index];
10121               if (predicate(value, index, array2)) {
10122                 result2.push(value);
10123                 indexes.push(index);
10124               }
10125             }
10126             basePullAt(array2, indexes);
10127             return result2;
10128           }
10129           function reverse(array2) {
10130             return array2 == null ? array2 : nativeReverse.call(array2);
10131           }
10132           function slice(array2, start2, end) {
10133             var length = array2 == null ? 0 : array2.length;
10134             if (!length) {
10135               return [];
10136             }
10137             if (end && typeof end != "number" && isIterateeCall(array2, start2, end)) {
10138               start2 = 0;
10139               end = length;
10140             } else {
10141               start2 = start2 == null ? 0 : toInteger(start2);
10142               end = end === undefined2 ? length : toInteger(end);
10143             }
10144             return baseSlice(array2, start2, end);
10145           }
10146           function sortedIndex(array2, value) {
10147             return baseSortedIndex(array2, value);
10148           }
10149           function sortedIndexBy(array2, value, iteratee2) {
10150             return baseSortedIndexBy(array2, value, getIteratee(iteratee2, 2));
10151           }
10152           function sortedIndexOf(array2, value) {
10153             var length = array2 == null ? 0 : array2.length;
10154             if (length) {
10155               var index = baseSortedIndex(array2, value);
10156               if (index < length && eq2(array2[index], value)) {
10157                 return index;
10158               }
10159             }
10160             return -1;
10161           }
10162           function sortedLastIndex(array2, value) {
10163             return baseSortedIndex(array2, value, true);
10164           }
10165           function sortedLastIndexBy(array2, value, iteratee2) {
10166             return baseSortedIndexBy(array2, value, getIteratee(iteratee2, 2), true);
10167           }
10168           function sortedLastIndexOf(array2, value) {
10169             var length = array2 == null ? 0 : array2.length;
10170             if (length) {
10171               var index = baseSortedIndex(array2, value, true) - 1;
10172               if (eq2(array2[index], value)) {
10173                 return index;
10174               }
10175             }
10176             return -1;
10177           }
10178           function sortedUniq(array2) {
10179             return array2 && array2.length ? baseSortedUniq(array2) : [];
10180           }
10181           function sortedUniqBy(array2, iteratee2) {
10182             return array2 && array2.length ? baseSortedUniq(array2, getIteratee(iteratee2, 2)) : [];
10183           }
10184           function tail(array2) {
10185             var length = array2 == null ? 0 : array2.length;
10186             return length ? baseSlice(array2, 1, length) : [];
10187           }
10188           function take(array2, n2, guard) {
10189             if (!(array2 && array2.length)) {
10190               return [];
10191             }
10192             n2 = guard || n2 === undefined2 ? 1 : toInteger(n2);
10193             return baseSlice(array2, 0, n2 < 0 ? 0 : n2);
10194           }
10195           function takeRight(array2, n2, guard) {
10196             var length = array2 == null ? 0 : array2.length;
10197             if (!length) {
10198               return [];
10199             }
10200             n2 = guard || n2 === undefined2 ? 1 : toInteger(n2);
10201             n2 = length - n2;
10202             return baseSlice(array2, n2 < 0 ? 0 : n2, length);
10203           }
10204           function takeRightWhile(array2, predicate) {
10205             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), false, true) : [];
10206           }
10207           function takeWhile(array2, predicate) {
10208             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3)) : [];
10209           }
10210           var union = baseRest(function(arrays) {
10211             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
10212           });
10213           var unionBy = baseRest(function(arrays) {
10214             var iteratee2 = last(arrays);
10215             if (isArrayLikeObject(iteratee2)) {
10216               iteratee2 = undefined2;
10217             }
10218             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2));
10219           });
10220           var unionWith = baseRest(function(arrays) {
10221             var comparator = last(arrays);
10222             comparator = typeof comparator == "function" ? comparator : undefined2;
10223             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined2, comparator);
10224           });
10225           function uniq(array2) {
10226             return array2 && array2.length ? baseUniq(array2) : [];
10227           }
10228           function uniqBy(array2, iteratee2) {
10229             return array2 && array2.length ? baseUniq(array2, getIteratee(iteratee2, 2)) : [];
10230           }
10231           function uniqWith(array2, comparator) {
10232             comparator = typeof comparator == "function" ? comparator : undefined2;
10233             return array2 && array2.length ? baseUniq(array2, undefined2, comparator) : [];
10234           }
10235           function unzip(array2) {
10236             if (!(array2 && array2.length)) {
10237               return [];
10238             }
10239             var length = 0;
10240             array2 = arrayFilter2(array2, function(group) {
10241               if (isArrayLikeObject(group)) {
10242                 length = nativeMax2(group.length, length);
10243                 return true;
10244               }
10245             });
10246             return baseTimes2(length, function(index) {
10247               return arrayMap2(array2, baseProperty(index));
10248             });
10249           }
10250           function unzipWith(array2, iteratee2) {
10251             if (!(array2 && array2.length)) {
10252               return [];
10253             }
10254             var result2 = unzip(array2);
10255             if (iteratee2 == null) {
10256               return result2;
10257             }
10258             return arrayMap2(result2, function(group) {
10259               return apply(iteratee2, undefined2, group);
10260             });
10261           }
10262           var without = baseRest(function(array2, values2) {
10263             return isArrayLikeObject(array2) ? baseDifference(array2, values2) : [];
10264           });
10265           var xor = baseRest(function(arrays) {
10266             return baseXor(arrayFilter2(arrays, isArrayLikeObject));
10267           });
10268           var xorBy = baseRest(function(arrays) {
10269             var iteratee2 = last(arrays);
10270             if (isArrayLikeObject(iteratee2)) {
10271               iteratee2 = undefined2;
10272             }
10273             return baseXor(arrayFilter2(arrays, isArrayLikeObject), getIteratee(iteratee2, 2));
10274           });
10275           var xorWith = baseRest(function(arrays) {
10276             var comparator = last(arrays);
10277             comparator = typeof comparator == "function" ? comparator : undefined2;
10278             return baseXor(arrayFilter2(arrays, isArrayLikeObject), undefined2, comparator);
10279           });
10280           var zip = baseRest(unzip);
10281           function zipObject(props, values2) {
10282             return baseZipObject(props || [], values2 || [], assignValue);
10283           }
10284           function zipObjectDeep(props, values2) {
10285             return baseZipObject(props || [], values2 || [], baseSet);
10286           }
10287           var zipWith = baseRest(function(arrays) {
10288             var length = arrays.length, iteratee2 = length > 1 ? arrays[length - 1] : undefined2;
10289             iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined2;
10290             return unzipWith(arrays, iteratee2);
10291           });
10292           function chain(value) {
10293             var result2 = lodash(value);
10294             result2.__chain__ = true;
10295             return result2;
10296           }
10297           function tap(value, interceptor) {
10298             interceptor(value);
10299             return value;
10300           }
10301           function thru(value, interceptor) {
10302             return interceptor(value);
10303           }
10304           var wrapperAt = flatRest(function(paths) {
10305             var length = paths.length, start2 = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
10306               return baseAt(object, paths);
10307             };
10308             if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex2(start2)) {
10309               return this.thru(interceptor);
10310             }
10311             value = value.slice(start2, +start2 + (length ? 1 : 0));
10312             value.__actions__.push({
10313               "func": thru,
10314               "args": [interceptor],
10315               "thisArg": undefined2
10316             });
10317             return new LodashWrapper(value, this.__chain__).thru(function(array2) {
10318               if (length && !array2.length) {
10319                 array2.push(undefined2);
10320               }
10321               return array2;
10322             });
10323           });
10324           function wrapperChain() {
10325             return chain(this);
10326           }
10327           function wrapperCommit() {
10328             return new LodashWrapper(this.value(), this.__chain__);
10329           }
10330           function wrapperNext() {
10331             if (this.__values__ === undefined2) {
10332               this.__values__ = toArray(this.value());
10333             }
10334             var done = this.__index__ >= this.__values__.length, value = done ? undefined2 : this.__values__[this.__index__++];
10335             return { "done": done, "value": value };
10336           }
10337           function wrapperToIterator() {
10338             return this;
10339           }
10340           function wrapperPlant(value) {
10341             var result2, parent2 = this;
10342             while (parent2 instanceof baseLodash) {
10343               var clone2 = wrapperClone(parent2);
10344               clone2.__index__ = 0;
10345               clone2.__values__ = undefined2;
10346               if (result2) {
10347                 previous.__wrapped__ = clone2;
10348               } else {
10349                 result2 = clone2;
10350               }
10351               var previous = clone2;
10352               parent2 = parent2.__wrapped__;
10353             }
10354             previous.__wrapped__ = value;
10355             return result2;
10356           }
10357           function wrapperReverse() {
10358             var value = this.__wrapped__;
10359             if (value instanceof LazyWrapper) {
10360               var wrapped = value;
10361               if (this.__actions__.length) {
10362                 wrapped = new LazyWrapper(this);
10363               }
10364               wrapped = wrapped.reverse();
10365               wrapped.__actions__.push({
10366                 "func": thru,
10367                 "args": [reverse],
10368                 "thisArg": undefined2
10369               });
10370               return new LodashWrapper(wrapped, this.__chain__);
10371             }
10372             return this.thru(reverse);
10373           }
10374           function wrapperValue() {
10375             return baseWrapperValue(this.__wrapped__, this.__actions__);
10376           }
10377           var countBy = createAggregator(function(result2, value, key) {
10378             if (hasOwnProperty10.call(result2, key)) {
10379               ++result2[key];
10380             } else {
10381               baseAssignValue(result2, key, 1);
10382             }
10383           });
10384           function every(collection, predicate, guard) {
10385             var func = isArray2(collection) ? arrayEvery : baseEvery;
10386             if (guard && isIterateeCall(collection, predicate, guard)) {
10387               predicate = undefined2;
10388             }
10389             return func(collection, getIteratee(predicate, 3));
10390           }
10391           function filter2(collection, predicate) {
10392             var func = isArray2(collection) ? arrayFilter2 : baseFilter;
10393             return func(collection, getIteratee(predicate, 3));
10394           }
10395           var find2 = createFind(findIndex);
10396           var findLast = createFind(findLastIndex);
10397           function flatMap(collection, iteratee2) {
10398             return baseFlatten(map2(collection, iteratee2), 1);
10399           }
10400           function flatMapDeep(collection, iteratee2) {
10401             return baseFlatten(map2(collection, iteratee2), INFINITY2);
10402           }
10403           function flatMapDepth(collection, iteratee2, depth) {
10404             depth = depth === undefined2 ? 1 : toInteger(depth);
10405             return baseFlatten(map2(collection, iteratee2), depth);
10406           }
10407           function forEach(collection, iteratee2) {
10408             var func = isArray2(collection) ? arrayEach : baseEach;
10409             return func(collection, getIteratee(iteratee2, 3));
10410           }
10411           function forEachRight(collection, iteratee2) {
10412             var func = isArray2(collection) ? arrayEachRight : baseEachRight;
10413             return func(collection, getIteratee(iteratee2, 3));
10414           }
10415           var groupBy = createAggregator(function(result2, value, key) {
10416             if (hasOwnProperty10.call(result2, key)) {
10417               result2[key].push(value);
10418             } else {
10419               baseAssignValue(result2, key, [value]);
10420             }
10421           });
10422           function includes(collection, value, fromIndex, guard) {
10423             collection = isArrayLike2(collection) ? collection : values(collection);
10424             fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
10425             var length = collection.length;
10426             if (fromIndex < 0) {
10427               fromIndex = nativeMax2(length + fromIndex, 0);
10428             }
10429             return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
10430           }
10431           var invokeMap = baseRest(function(collection, path, args) {
10432             var index = -1, isFunc = typeof path == "function", result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
10433             baseEach(collection, function(value) {
10434               result2[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
10435             });
10436             return result2;
10437           });
10438           var keyBy = createAggregator(function(result2, value, key) {
10439             baseAssignValue(result2, key, value);
10440           });
10441           function map2(collection, iteratee2) {
10442             var func = isArray2(collection) ? arrayMap2 : baseMap;
10443             return func(collection, getIteratee(iteratee2, 3));
10444           }
10445           function orderBy(collection, iteratees, orders, guard) {
10446             if (collection == null) {
10447               return [];
10448             }
10449             if (!isArray2(iteratees)) {
10450               iteratees = iteratees == null ? [] : [iteratees];
10451             }
10452             orders = guard ? undefined2 : orders;
10453             if (!isArray2(orders)) {
10454               orders = orders == null ? [] : [orders];
10455             }
10456             return baseOrderBy(collection, iteratees, orders);
10457           }
10458           var partition = createAggregator(function(result2, value, key) {
10459             result2[key ? 0 : 1].push(value);
10460           }, function() {
10461             return [[], []];
10462           });
10463           function reduce(collection, iteratee2, accumulator) {
10464             var func = isArray2(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
10465             return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach);
10466           }
10467           function reduceRight(collection, iteratee2, accumulator) {
10468             var func = isArray2(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
10469             return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight);
10470           }
10471           function reject(collection, predicate) {
10472             var func = isArray2(collection) ? arrayFilter2 : baseFilter;
10473             return func(collection, negate(getIteratee(predicate, 3)));
10474           }
10475           function sample(collection) {
10476             var func = isArray2(collection) ? arraySample : baseSample;
10477             return func(collection);
10478           }
10479           function sampleSize(collection, n2, guard) {
10480             if (guard ? isIterateeCall(collection, n2, guard) : n2 === undefined2) {
10481               n2 = 1;
10482             } else {
10483               n2 = toInteger(n2);
10484             }
10485             var func = isArray2(collection) ? arraySampleSize : baseSampleSize;
10486             return func(collection, n2);
10487           }
10488           function shuffle(collection) {
10489             var func = isArray2(collection) ? arrayShuffle : baseShuffle;
10490             return func(collection);
10491           }
10492           function size(collection) {
10493             if (collection == null) {
10494               return 0;
10495             }
10496             if (isArrayLike2(collection)) {
10497               return isString(collection) ? stringSize(collection) : collection.length;
10498             }
10499             var tag = getTag2(collection);
10500             if (tag == mapTag4 || tag == setTag4) {
10501               return collection.size;
10502             }
10503             return baseKeys2(collection).length;
10504           }
10505           function some(collection, predicate, guard) {
10506             var func = isArray2(collection) ? arraySome2 : baseSome;
10507             if (guard && isIterateeCall(collection, predicate, guard)) {
10508               predicate = undefined2;
10509             }
10510             return func(collection, getIteratee(predicate, 3));
10511           }
10512           var sortBy = baseRest(function(collection, iteratees) {
10513             if (collection == null) {
10514               return [];
10515             }
10516             var length = iteratees.length;
10517             if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
10518               iteratees = [];
10519             } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
10520               iteratees = [iteratees[0]];
10521             }
10522             return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
10523           });
10524           var now3 = ctxNow || function() {
10525             return root3.Date.now();
10526           };
10527           function after(n2, func) {
10528             if (typeof func != "function") {
10529               throw new TypeError2(FUNC_ERROR_TEXT3);
10530             }
10531             n2 = toInteger(n2);
10532             return function() {
10533               if (--n2 < 1) {
10534                 return func.apply(this, arguments);
10535               }
10536             };
10537           }
10538           function ary(func, n2, guard) {
10539             n2 = guard ? undefined2 : n2;
10540             n2 = func && n2 == null ? func.length : n2;
10541             return createWrap(func, WRAP_ARY_FLAG, undefined2, undefined2, undefined2, undefined2, n2);
10542           }
10543           function before(n2, func) {
10544             var result2;
10545             if (typeof func != "function") {
10546               throw new TypeError2(FUNC_ERROR_TEXT3);
10547             }
10548             n2 = toInteger(n2);
10549             return function() {
10550               if (--n2 > 0) {
10551                 result2 = func.apply(this, arguments);
10552               }
10553               if (n2 <= 1) {
10554                 func = undefined2;
10555               }
10556               return result2;
10557             };
10558           }
10559           var bind = baseRest(function(func, thisArg, partials) {
10560             var bitmask = WRAP_BIND_FLAG;
10561             if (partials.length) {
10562               var holders = replaceHolders(partials, getHolder(bind));
10563               bitmask |= WRAP_PARTIAL_FLAG;
10564             }
10565             return createWrap(func, bitmask, thisArg, partials, holders);
10566           });
10567           var bindKey2 = baseRest(function(object, key, partials) {
10568             var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
10569             if (partials.length) {
10570               var holders = replaceHolders(partials, getHolder(bindKey2));
10571               bitmask |= WRAP_PARTIAL_FLAG;
10572             }
10573             return createWrap(key, bitmask, object, partials, holders);
10574           });
10575           function curry(func, arity, guard) {
10576             arity = guard ? undefined2 : arity;
10577             var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
10578             result2.placeholder = curry.placeholder;
10579             return result2;
10580           }
10581           function curryRight(func, arity, guard) {
10582             arity = guard ? undefined2 : arity;
10583             var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
10584             result2.placeholder = curryRight.placeholder;
10585             return result2;
10586           }
10587           function debounce2(func, wait, options2) {
10588             var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
10589             if (typeof func != "function") {
10590               throw new TypeError2(FUNC_ERROR_TEXT3);
10591             }
10592             wait = toNumber3(wait) || 0;
10593             if (isObject3(options2)) {
10594               leading = !!options2.leading;
10595               maxing = "maxWait" in options2;
10596               maxWait = maxing ? nativeMax2(toNumber3(options2.maxWait) || 0, wait) : maxWait;
10597               trailing = "trailing" in options2 ? !!options2.trailing : trailing;
10598             }
10599             function invokeFunc(time) {
10600               var args = lastArgs, thisArg = lastThis;
10601               lastArgs = lastThis = undefined2;
10602               lastInvokeTime = time;
10603               result2 = func.apply(thisArg, args);
10604               return result2;
10605             }
10606             function leadingEdge(time) {
10607               lastInvokeTime = time;
10608               timerId = setTimeout2(timerExpired, wait);
10609               return leading ? invokeFunc(time) : result2;
10610             }
10611             function remainingWait(time) {
10612               var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
10613               return maxing ? nativeMin2(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
10614             }
10615             function shouldInvoke(time) {
10616               var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
10617               return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
10618             }
10619             function timerExpired() {
10620               var time = now3();
10621               if (shouldInvoke(time)) {
10622                 return trailingEdge(time);
10623               }
10624               timerId = setTimeout2(timerExpired, remainingWait(time));
10625             }
10626             function trailingEdge(time) {
10627               timerId = undefined2;
10628               if (trailing && lastArgs) {
10629                 return invokeFunc(time);
10630               }
10631               lastArgs = lastThis = undefined2;
10632               return result2;
10633             }
10634             function cancel() {
10635               if (timerId !== undefined2) {
10636                 clearTimeout2(timerId);
10637               }
10638               lastInvokeTime = 0;
10639               lastArgs = lastCallTime = lastThis = timerId = undefined2;
10640             }
10641             function flush() {
10642               return timerId === undefined2 ? result2 : trailingEdge(now3());
10643             }
10644             function debounced() {
10645               var time = now3(), isInvoking = shouldInvoke(time);
10646               lastArgs = arguments;
10647               lastThis = this;
10648               lastCallTime = time;
10649               if (isInvoking) {
10650                 if (timerId === undefined2) {
10651                   return leadingEdge(lastCallTime);
10652                 }
10653                 if (maxing) {
10654                   clearTimeout2(timerId);
10655                   timerId = setTimeout2(timerExpired, wait);
10656                   return invokeFunc(lastCallTime);
10657                 }
10658               }
10659               if (timerId === undefined2) {
10660                 timerId = setTimeout2(timerExpired, wait);
10661               }
10662               return result2;
10663             }
10664             debounced.cancel = cancel;
10665             debounced.flush = flush;
10666             return debounced;
10667           }
10668           var defer = baseRest(function(func, args) {
10669             return baseDelay(func, 1, args);
10670           });
10671           var delay = baseRest(function(func, wait, args) {
10672             return baseDelay(func, toNumber3(wait) || 0, args);
10673           });
10674           function flip(func) {
10675             return createWrap(func, WRAP_FLIP_FLAG);
10676           }
10677           function memoize(func, resolver) {
10678             if (typeof func != "function" || resolver != null && typeof resolver != "function") {
10679               throw new TypeError2(FUNC_ERROR_TEXT3);
10680             }
10681             var memoized = function() {
10682               var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
10683               if (cache.has(key)) {
10684                 return cache.get(key);
10685               }
10686               var result2 = func.apply(this, args);
10687               memoized.cache = cache.set(key, result2) || cache;
10688               return result2;
10689             };
10690             memoized.cache = new (memoize.Cache || MapCache2)();
10691             return memoized;
10692           }
10693           memoize.Cache = MapCache2;
10694           function negate(predicate) {
10695             if (typeof predicate != "function") {
10696               throw new TypeError2(FUNC_ERROR_TEXT3);
10697             }
10698             return function() {
10699               var args = arguments;
10700               switch (args.length) {
10701                 case 0:
10702                   return !predicate.call(this);
10703                 case 1:
10704                   return !predicate.call(this, args[0]);
10705                 case 2:
10706                   return !predicate.call(this, args[0], args[1]);
10707                 case 3:
10708                   return !predicate.call(this, args[0], args[1], args[2]);
10709               }
10710               return !predicate.apply(this, args);
10711             };
10712           }
10713           function once(func) {
10714             return before(2, func);
10715           }
10716           var overArgs = castRest(function(func, transforms) {
10717             transforms = transforms.length == 1 && isArray2(transforms[0]) ? arrayMap2(transforms[0], baseUnary2(getIteratee())) : arrayMap2(baseFlatten(transforms, 1), baseUnary2(getIteratee()));
10718             var funcsLength = transforms.length;
10719             return baseRest(function(args) {
10720               var index = -1, length = nativeMin2(args.length, funcsLength);
10721               while (++index < length) {
10722                 args[index] = transforms[index].call(this, args[index]);
10723               }
10724               return apply(func, this, args);
10725             });
10726           });
10727           var partial = baseRest(function(func, partials) {
10728             var holders = replaceHolders(partials, getHolder(partial));
10729             return createWrap(func, WRAP_PARTIAL_FLAG, undefined2, partials, holders);
10730           });
10731           var partialRight = baseRest(function(func, partials) {
10732             var holders = replaceHolders(partials, getHolder(partialRight));
10733             return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders);
10734           });
10735           var rearg = flatRest(function(func, indexes) {
10736             return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes);
10737           });
10738           function rest(func, start2) {
10739             if (typeof func != "function") {
10740               throw new TypeError2(FUNC_ERROR_TEXT3);
10741             }
10742             start2 = start2 === undefined2 ? start2 : toInteger(start2);
10743             return baseRest(func, start2);
10744           }
10745           function spread(func, start2) {
10746             if (typeof func != "function") {
10747               throw new TypeError2(FUNC_ERROR_TEXT3);
10748             }
10749             start2 = start2 == null ? 0 : nativeMax2(toInteger(start2), 0);
10750             return baseRest(function(args) {
10751               var array2 = args[start2], otherArgs = castSlice(args, 0, start2);
10752               if (array2) {
10753                 arrayPush2(otherArgs, array2);
10754               }
10755               return apply(func, this, otherArgs);
10756             });
10757           }
10758           function throttle2(func, wait, options2) {
10759             var leading = true, trailing = true;
10760             if (typeof func != "function") {
10761               throw new TypeError2(FUNC_ERROR_TEXT3);
10762             }
10763             if (isObject3(options2)) {
10764               leading = "leading" in options2 ? !!options2.leading : leading;
10765               trailing = "trailing" in options2 ? !!options2.trailing : trailing;
10766             }
10767             return debounce2(func, wait, {
10768               "leading": leading,
10769               "maxWait": wait,
10770               "trailing": trailing
10771             });
10772           }
10773           function unary(func) {
10774             return ary(func, 1);
10775           }
10776           function wrap2(value, wrapper) {
10777             return partial(castFunction(wrapper), value);
10778           }
10779           function castArray() {
10780             if (!arguments.length) {
10781               return [];
10782             }
10783             var value = arguments[0];
10784             return isArray2(value) ? value : [value];
10785           }
10786           function clone(value) {
10787             return baseClone(value, CLONE_SYMBOLS_FLAG);
10788           }
10789           function cloneWith(value, customizer) {
10790             customizer = typeof customizer == "function" ? customizer : undefined2;
10791             return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
10792           }
10793           function cloneDeep(value) {
10794             return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
10795           }
10796           function cloneDeepWith(value, customizer) {
10797             customizer = typeof customizer == "function" ? customizer : undefined2;
10798             return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
10799           }
10800           function conformsTo(object, source) {
10801             return source == null || baseConformsTo(object, source, keys2(source));
10802           }
10803           function eq2(value, other) {
10804             return value === other || value !== value && other !== other;
10805           }
10806           var gt = createRelationalOperation(baseGt);
10807           var gte = createRelationalOperation(function(value, other) {
10808             return value >= other;
10809           });
10810           var isArguments2 = baseIsArguments2(function() {
10811             return arguments;
10812           }()) ? baseIsArguments2 : function(value) {
10813             return isObjectLike2(value) && hasOwnProperty10.call(value, "callee") && !propertyIsEnumerable3.call(value, "callee");
10814           };
10815           var isArray2 = Array2.isArray;
10816           var isArrayBuffer = nodeIsArrayBuffer ? baseUnary2(nodeIsArrayBuffer) : baseIsArrayBuffer;
10817           function isArrayLike2(value) {
10818             return value != null && isLength2(value.length) && !isFunction2(value);
10819           }
10820           function isArrayLikeObject(value) {
10821             return isObjectLike2(value) && isArrayLike2(value);
10822           }
10823           function isBoolean(value) {
10824             return value === true || value === false || isObjectLike2(value) && baseGetTag2(value) == boolTag3;
10825           }
10826           var isBuffer2 = nativeIsBuffer2 || stubFalse2;
10827           var isDate = nodeIsDate ? baseUnary2(nodeIsDate) : baseIsDate;
10828           function isElement2(value) {
10829             return isObjectLike2(value) && value.nodeType === 1 && !isPlainObject(value);
10830           }
10831           function isEmpty(value) {
10832             if (value == null) {
10833               return true;
10834             }
10835             if (isArrayLike2(value) && (isArray2(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer2(value) || isTypedArray2(value) || isArguments2(value))) {
10836               return !value.length;
10837             }
10838             var tag = getTag2(value);
10839             if (tag == mapTag4 || tag == setTag4) {
10840               return !value.size;
10841             }
10842             if (isPrototype2(value)) {
10843               return !baseKeys2(value).length;
10844             }
10845             for (var key in value) {
10846               if (hasOwnProperty10.call(value, key)) {
10847                 return false;
10848               }
10849             }
10850             return true;
10851           }
10852           function isEqual4(value, other) {
10853             return baseIsEqual2(value, other);
10854           }
10855           function isEqualWith(value, other, customizer) {
10856             customizer = typeof customizer == "function" ? customizer : undefined2;
10857             var result2 = customizer ? customizer(value, other) : undefined2;
10858             return result2 === undefined2 ? baseIsEqual2(value, other, undefined2, customizer) : !!result2;
10859           }
10860           function isError(value) {
10861             if (!isObjectLike2(value)) {
10862               return false;
10863             }
10864             var tag = baseGetTag2(value);
10865             return tag == errorTag3 || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
10866           }
10867           function isFinite2(value) {
10868             return typeof value == "number" && nativeIsFinite(value);
10869           }
10870           function isFunction2(value) {
10871             if (!isObject3(value)) {
10872               return false;
10873             }
10874             var tag = baseGetTag2(value);
10875             return tag == funcTag3 || tag == genTag2 || tag == asyncTag2 || tag == proxyTag2;
10876           }
10877           function isInteger(value) {
10878             return typeof value == "number" && value == toInteger(value);
10879           }
10880           function isLength2(value) {
10881             return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER3;
10882           }
10883           function isObject3(value) {
10884             var type2 = typeof value;
10885             return value != null && (type2 == "object" || type2 == "function");
10886           }
10887           function isObjectLike2(value) {
10888             return value != null && typeof value == "object";
10889           }
10890           var isMap = nodeIsMap ? baseUnary2(nodeIsMap) : baseIsMap;
10891           function isMatch(object, source) {
10892             return object === source || baseIsMatch(object, source, getMatchData(source));
10893           }
10894           function isMatchWith(object, source, customizer) {
10895             customizer = typeof customizer == "function" ? customizer : undefined2;
10896             return baseIsMatch(object, source, getMatchData(source), customizer);
10897           }
10898           function isNaN2(value) {
10899             return isNumber2(value) && value != +value;
10900           }
10901           function isNative(value) {
10902             if (isMaskable(value)) {
10903               throw new Error2(CORE_ERROR_TEXT);
10904             }
10905             return baseIsNative2(value);
10906           }
10907           function isNull(value) {
10908             return value === null;
10909           }
10910           function isNil(value) {
10911             return value == null;
10912           }
10913           function isNumber2(value) {
10914             return typeof value == "number" || isObjectLike2(value) && baseGetTag2(value) == numberTag3;
10915           }
10916           function isPlainObject(value) {
10917             if (!isObjectLike2(value) || baseGetTag2(value) != objectTag4) {
10918               return false;
10919             }
10920             var proto = getPrototype(value);
10921             if (proto === null) {
10922               return true;
10923             }
10924             var Ctor = hasOwnProperty10.call(proto, "constructor") && proto.constructor;
10925             return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString3.call(Ctor) == objectCtorString;
10926           }
10927           var isRegExp = nodeIsRegExp ? baseUnary2(nodeIsRegExp) : baseIsRegExp;
10928           function isSafeInteger(value) {
10929             return isInteger(value) && value >= -MAX_SAFE_INTEGER3 && value <= MAX_SAFE_INTEGER3;
10930           }
10931           var isSet = nodeIsSet ? baseUnary2(nodeIsSet) : baseIsSet;
10932           function isString(value) {
10933             return typeof value == "string" || !isArray2(value) && isObjectLike2(value) && baseGetTag2(value) == stringTag3;
10934           }
10935           function isSymbol2(value) {
10936             return typeof value == "symbol" || isObjectLike2(value) && baseGetTag2(value) == symbolTag3;
10937           }
10938           var isTypedArray2 = nodeIsTypedArray2 ? baseUnary2(nodeIsTypedArray2) : baseIsTypedArray2;
10939           function isUndefined(value) {
10940             return value === undefined2;
10941           }
10942           function isWeakMap(value) {
10943             return isObjectLike2(value) && getTag2(value) == weakMapTag3;
10944           }
10945           function isWeakSet(value) {
10946             return isObjectLike2(value) && baseGetTag2(value) == weakSetTag;
10947           }
10948           var lt = createRelationalOperation(baseLt);
10949           var lte = createRelationalOperation(function(value, other) {
10950             return value <= other;
10951           });
10952           function toArray(value) {
10953             if (!value) {
10954               return [];
10955             }
10956             if (isArrayLike2(value)) {
10957               return isString(value) ? stringToArray(value) : copyArray(value);
10958             }
10959             if (symIterator && value[symIterator]) {
10960               return iteratorToArray(value[symIterator]());
10961             }
10962             var tag = getTag2(value), func = tag == mapTag4 ? mapToArray2 : tag == setTag4 ? setToArray2 : values;
10963             return func(value);
10964           }
10965           function toFinite(value) {
10966             if (!value) {
10967               return value === 0 ? value : 0;
10968             }
10969             value = toNumber3(value);
10970             if (value === INFINITY2 || value === -INFINITY2) {
10971               var sign2 = value < 0 ? -1 : 1;
10972               return sign2 * MAX_INTEGER;
10973             }
10974             return value === value ? value : 0;
10975           }
10976           function toInteger(value) {
10977             var result2 = toFinite(value), remainder = result2 % 1;
10978             return result2 === result2 ? remainder ? result2 - remainder : result2 : 0;
10979           }
10980           function toLength(value) {
10981             return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
10982           }
10983           function toNumber3(value) {
10984             if (typeof value == "number") {
10985               return value;
10986             }
10987             if (isSymbol2(value)) {
10988               return NAN2;
10989             }
10990             if (isObject3(value)) {
10991               var other = typeof value.valueOf == "function" ? value.valueOf() : value;
10992               value = isObject3(other) ? other + "" : other;
10993             }
10994             if (typeof value != "string") {
10995               return value === 0 ? value : +value;
10996             }
10997             value = baseTrim2(value);
10998             var isBinary = reIsBinary2.test(value);
10999             return isBinary || reIsOctal2.test(value) ? freeParseInt2(value.slice(2), isBinary ? 2 : 8) : reIsBadHex2.test(value) ? NAN2 : +value;
11000           }
11001           function toPlainObject(value) {
11002             return copyObject(value, keysIn(value));
11003           }
11004           function toSafeInteger(value) {
11005             return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER3, MAX_SAFE_INTEGER3) : value === 0 ? value : 0;
11006           }
11007           function toString2(value) {
11008             return value == null ? "" : baseToString2(value);
11009           }
11010           var assign = createAssigner(function(object, source) {
11011             if (isPrototype2(source) || isArrayLike2(source)) {
11012               copyObject(source, keys2(source), object);
11013               return;
11014             }
11015             for (var key in source) {
11016               if (hasOwnProperty10.call(source, key)) {
11017                 assignValue(object, key, source[key]);
11018               }
11019             }
11020           });
11021           var assignIn = createAssigner(function(object, source) {
11022             copyObject(source, keysIn(source), object);
11023           });
11024           var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
11025             copyObject(source, keysIn(source), object, customizer);
11026           });
11027           var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
11028             copyObject(source, keys2(source), object, customizer);
11029           });
11030           var at = flatRest(baseAt);
11031           function create2(prototype, properties) {
11032             var result2 = baseCreate(prototype);
11033             return properties == null ? result2 : baseAssign(result2, properties);
11034           }
11035           var defaults2 = baseRest(function(object, sources) {
11036             object = Object2(object);
11037             var index = -1;
11038             var length = sources.length;
11039             var guard = length > 2 ? sources[2] : undefined2;
11040             if (guard && isIterateeCall(sources[0], sources[1], guard)) {
11041               length = 1;
11042             }
11043             while (++index < length) {
11044               var source = sources[index];
11045               var props = keysIn(source);
11046               var propsIndex = -1;
11047               var propsLength = props.length;
11048               while (++propsIndex < propsLength) {
11049                 var key = props[propsIndex];
11050                 var value = object[key];
11051                 if (value === undefined2 || eq2(value, objectProto13[key]) && !hasOwnProperty10.call(object, key)) {
11052                   object[key] = source[key];
11053                 }
11054               }
11055             }
11056             return object;
11057           });
11058           var defaultsDeep = baseRest(function(args) {
11059             args.push(undefined2, customDefaultsMerge);
11060             return apply(mergeWith, undefined2, args);
11061           });
11062           function findKey(object, predicate) {
11063             return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
11064           }
11065           function findLastKey(object, predicate) {
11066             return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
11067           }
11068           function forIn(object, iteratee2) {
11069             return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn);
11070           }
11071           function forInRight(object, iteratee2) {
11072             return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn);
11073           }
11074           function forOwn(object, iteratee2) {
11075             return object && baseForOwn(object, getIteratee(iteratee2, 3));
11076           }
11077           function forOwnRight(object, iteratee2) {
11078             return object && baseForOwnRight(object, getIteratee(iteratee2, 3));
11079           }
11080           function functions(object) {
11081             return object == null ? [] : baseFunctions(object, keys2(object));
11082           }
11083           function functionsIn(object) {
11084             return object == null ? [] : baseFunctions(object, keysIn(object));
11085           }
11086           function get4(object, path, defaultValue) {
11087             var result2 = object == null ? undefined2 : baseGet(object, path);
11088             return result2 === undefined2 ? defaultValue : result2;
11089           }
11090           function has(object, path) {
11091             return object != null && hasPath(object, path, baseHas);
11092           }
11093           function hasIn(object, path) {
11094             return object != null && hasPath(object, path, baseHasIn);
11095           }
11096           var invert = createInverter(function(result2, value, key) {
11097             if (value != null && typeof value.toString != "function") {
11098               value = nativeObjectToString3.call(value);
11099             }
11100             result2[value] = key;
11101           }, constant(identity4));
11102           var invertBy = createInverter(function(result2, value, key) {
11103             if (value != null && typeof value.toString != "function") {
11104               value = nativeObjectToString3.call(value);
11105             }
11106             if (hasOwnProperty10.call(result2, value)) {
11107               result2[value].push(key);
11108             } else {
11109               result2[value] = [key];
11110             }
11111           }, getIteratee);
11112           var invoke = baseRest(baseInvoke);
11113           function keys2(object) {
11114             return isArrayLike2(object) ? arrayLikeKeys2(object) : baseKeys2(object);
11115           }
11116           function keysIn(object) {
11117             return isArrayLike2(object) ? arrayLikeKeys2(object, true) : baseKeysIn(object);
11118           }
11119           function mapKeys(object, iteratee2) {
11120             var result2 = {};
11121             iteratee2 = getIteratee(iteratee2, 3);
11122             baseForOwn(object, function(value, key, object2) {
11123               baseAssignValue(result2, iteratee2(value, key, object2), value);
11124             });
11125             return result2;
11126           }
11127           function mapValues(object, iteratee2) {
11128             var result2 = {};
11129             iteratee2 = getIteratee(iteratee2, 3);
11130             baseForOwn(object, function(value, key, object2) {
11131               baseAssignValue(result2, key, iteratee2(value, key, object2));
11132             });
11133             return result2;
11134           }
11135           var merge2 = createAssigner(function(object, source, srcIndex) {
11136             baseMerge(object, source, srcIndex);
11137           });
11138           var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
11139             baseMerge(object, source, srcIndex, customizer);
11140           });
11141           var omit = flatRest(function(object, paths) {
11142             var result2 = {};
11143             if (object == null) {
11144               return result2;
11145             }
11146             var isDeep = false;
11147             paths = arrayMap2(paths, function(path) {
11148               path = castPath(path, object);
11149               isDeep || (isDeep = path.length > 1);
11150               return path;
11151             });
11152             copyObject(object, getAllKeysIn(object), result2);
11153             if (isDeep) {
11154               result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
11155             }
11156             var length = paths.length;
11157             while (length--) {
11158               baseUnset(result2, paths[length]);
11159             }
11160             return result2;
11161           });
11162           function omitBy(object, predicate) {
11163             return pickBy(object, negate(getIteratee(predicate)));
11164           }
11165           var pick = flatRest(function(object, paths) {
11166             return object == null ? {} : basePick(object, paths);
11167           });
11168           function pickBy(object, predicate) {
11169             if (object == null) {
11170               return {};
11171             }
11172             var props = arrayMap2(getAllKeysIn(object), function(prop) {
11173               return [prop];
11174             });
11175             predicate = getIteratee(predicate);
11176             return basePickBy(object, props, function(value, path) {
11177               return predicate(value, path[0]);
11178             });
11179           }
11180           function result(object, path, defaultValue) {
11181             path = castPath(path, object);
11182             var index = -1, length = path.length;
11183             if (!length) {
11184               length = 1;
11185               object = undefined2;
11186             }
11187             while (++index < length) {
11188               var value = object == null ? undefined2 : object[toKey(path[index])];
11189               if (value === undefined2) {
11190                 index = length;
11191                 value = defaultValue;
11192               }
11193               object = isFunction2(value) ? value.call(object) : value;
11194             }
11195             return object;
11196           }
11197           function set3(object, path, value) {
11198             return object == null ? object : baseSet(object, path, value);
11199           }
11200           function setWith(object, path, value, customizer) {
11201             customizer = typeof customizer == "function" ? customizer : undefined2;
11202             return object == null ? object : baseSet(object, path, value, customizer);
11203           }
11204           var toPairs = createToPairs(keys2);
11205           var toPairsIn = createToPairs(keysIn);
11206           function transform2(object, iteratee2, accumulator) {
11207             var isArr = isArray2(object), isArrLike = isArr || isBuffer2(object) || isTypedArray2(object);
11208             iteratee2 = getIteratee(iteratee2, 4);
11209             if (accumulator == null) {
11210               var Ctor = object && object.constructor;
11211               if (isArrLike) {
11212                 accumulator = isArr ? new Ctor() : [];
11213               } else if (isObject3(object)) {
11214                 accumulator = isFunction2(Ctor) ? baseCreate(getPrototype(object)) : {};
11215               } else {
11216                 accumulator = {};
11217               }
11218             }
11219             (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
11220               return iteratee2(accumulator, value, index, object2);
11221             });
11222             return accumulator;
11223           }
11224           function unset(object, path) {
11225             return object == null ? true : baseUnset(object, path);
11226           }
11227           function update(object, path, updater) {
11228             return object == null ? object : baseUpdate(object, path, castFunction(updater));
11229           }
11230           function updateWith(object, path, updater, customizer) {
11231             customizer = typeof customizer == "function" ? customizer : undefined2;
11232             return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
11233           }
11234           function values(object) {
11235             return object == null ? [] : baseValues(object, keys2(object));
11236           }
11237           function valuesIn(object) {
11238             return object == null ? [] : baseValues(object, keysIn(object));
11239           }
11240           function clamp3(number3, lower2, upper) {
11241             if (upper === undefined2) {
11242               upper = lower2;
11243               lower2 = undefined2;
11244             }
11245             if (upper !== undefined2) {
11246               upper = toNumber3(upper);
11247               upper = upper === upper ? upper : 0;
11248             }
11249             if (lower2 !== undefined2) {
11250               lower2 = toNumber3(lower2);
11251               lower2 = lower2 === lower2 ? lower2 : 0;
11252             }
11253             return baseClamp(toNumber3(number3), lower2, upper);
11254           }
11255           function inRange(number3, start2, end) {
11256             start2 = toFinite(start2);
11257             if (end === undefined2) {
11258               end = start2;
11259               start2 = 0;
11260             } else {
11261               end = toFinite(end);
11262             }
11263             number3 = toNumber3(number3);
11264             return baseInRange(number3, start2, end);
11265           }
11266           function random(lower2, upper, floating) {
11267             if (floating && typeof floating != "boolean" && isIterateeCall(lower2, upper, floating)) {
11268               upper = floating = undefined2;
11269             }
11270             if (floating === undefined2) {
11271               if (typeof upper == "boolean") {
11272                 floating = upper;
11273                 upper = undefined2;
11274               } else if (typeof lower2 == "boolean") {
11275                 floating = lower2;
11276                 lower2 = undefined2;
11277               }
11278             }
11279             if (lower2 === undefined2 && upper === undefined2) {
11280               lower2 = 0;
11281               upper = 1;
11282             } else {
11283               lower2 = toFinite(lower2);
11284               if (upper === undefined2) {
11285                 upper = lower2;
11286                 lower2 = 0;
11287               } else {
11288                 upper = toFinite(upper);
11289               }
11290             }
11291             if (lower2 > upper) {
11292               var temp = lower2;
11293               lower2 = upper;
11294               upper = temp;
11295             }
11296             if (floating || lower2 % 1 || upper % 1) {
11297               var rand = nativeRandom();
11298               return nativeMin2(lower2 + rand * (upper - lower2 + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
11299             }
11300             return baseRandom(lower2, upper);
11301           }
11302           var camelCase = createCompounder(function(result2, word, index) {
11303             word = word.toLowerCase();
11304             return result2 + (index ? capitalize(word) : word);
11305           });
11306           function capitalize(string) {
11307             return upperFirst(toString2(string).toLowerCase());
11308           }
11309           function deburr(string) {
11310             string = toString2(string);
11311             return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
11312           }
11313           function endsWith(string, target, position) {
11314             string = toString2(string);
11315             target = baseToString2(target);
11316             var length = string.length;
11317             position = position === undefined2 ? length : baseClamp(toInteger(position), 0, length);
11318             var end = position;
11319             position -= target.length;
11320             return position >= 0 && string.slice(position, end) == target;
11321           }
11322           function escape6(string) {
11323             string = toString2(string);
11324             return string && reHasUnescapedHtml2.test(string) ? string.replace(reUnescapedHtml2, escapeHtmlChar2) : string;
11325           }
11326           function escapeRegExp(string) {
11327             string = toString2(string);
11328             return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar2, "\\$&") : string;
11329           }
11330           var kebabCase = createCompounder(function(result2, word, index) {
11331             return result2 + (index ? "-" : "") + word.toLowerCase();
11332           });
11333           var lowerCase = createCompounder(function(result2, word, index) {
11334             return result2 + (index ? " " : "") + word.toLowerCase();
11335           });
11336           var lowerFirst = createCaseFirst("toLowerCase");
11337           function pad2(string, length, chars) {
11338             string = toString2(string);
11339             length = toInteger(length);
11340             var strLength = length ? stringSize(string) : 0;
11341             if (!length || strLength >= length) {
11342               return string;
11343             }
11344             var mid = (length - strLength) / 2;
11345             return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars);
11346           }
11347           function padEnd(string, length, chars) {
11348             string = toString2(string);
11349             length = toInteger(length);
11350             var strLength = length ? stringSize(string) : 0;
11351             return length && strLength < length ? string + createPadding(length - strLength, chars) : string;
11352           }
11353           function padStart(string, length, chars) {
11354             string = toString2(string);
11355             length = toInteger(length);
11356             var strLength = length ? stringSize(string) : 0;
11357             return length && strLength < length ? createPadding(length - strLength, chars) + string : string;
11358           }
11359           function parseInt2(string, radix, guard) {
11360             if (guard || radix == null) {
11361               radix = 0;
11362             } else if (radix) {
11363               radix = +radix;
11364             }
11365             return nativeParseInt(toString2(string).replace(reTrimStart2, ""), radix || 0);
11366           }
11367           function repeat(string, n2, guard) {
11368             if (guard ? isIterateeCall(string, n2, guard) : n2 === undefined2) {
11369               n2 = 1;
11370             } else {
11371               n2 = toInteger(n2);
11372             }
11373             return baseRepeat(toString2(string), n2);
11374           }
11375           function replace() {
11376             var args = arguments, string = toString2(args[0]);
11377             return args.length < 3 ? string : string.replace(args[1], args[2]);
11378           }
11379           var snakeCase = createCompounder(function(result2, word, index) {
11380             return result2 + (index ? "_" : "") + word.toLowerCase();
11381           });
11382           function split(string, separator, limit) {
11383             if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
11384               separator = limit = undefined2;
11385             }
11386             limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0;
11387             if (!limit) {
11388               return [];
11389             }
11390             string = toString2(string);
11391             if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
11392               separator = baseToString2(separator);
11393               if (!separator && hasUnicode(string)) {
11394                 return castSlice(stringToArray(string), 0, limit);
11395               }
11396             }
11397             return string.split(separator, limit);
11398           }
11399           var startCase = createCompounder(function(result2, word, index) {
11400             return result2 + (index ? " " : "") + upperFirst(word);
11401           });
11402           function startsWith(string, target, position) {
11403             string = toString2(string);
11404             position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
11405             target = baseToString2(target);
11406             return string.slice(position, position + target.length) == target;
11407           }
11408           function template(string, options2, guard) {
11409             var settings = lodash.templateSettings;
11410             if (guard && isIterateeCall(string, options2, guard)) {
11411               options2 = undefined2;
11412             }
11413             string = toString2(string);
11414             options2 = assignInWith({}, options2, settings, customDefaultsAssignIn);
11415             var imports = assignInWith({}, options2.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys2(imports), importsValues = baseValues(imports, importsKeys);
11416             var isEscaping, isEvaluating, index = 0, interpolate = options2.interpolate || reNoMatch, source = "__p += '";
11417             var reDelimiters = RegExp2(
11418               (options2.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options2.evaluate || reNoMatch).source + "|$",
11419               "g"
11420             );
11421             var sourceURL = "//# sourceURL=" + (hasOwnProperty10.call(options2, "sourceURL") ? (options2.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
11422             string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
11423               interpolateValue || (interpolateValue = esTemplateValue);
11424               source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
11425               if (escapeValue) {
11426                 isEscaping = true;
11427                 source += "' +\n__e(" + escapeValue + ") +\n'";
11428               }
11429               if (evaluateValue) {
11430                 isEvaluating = true;
11431                 source += "';\n" + evaluateValue + ";\n__p += '";
11432               }
11433               if (interpolateValue) {
11434                 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
11435               }
11436               index = offset + match.length;
11437               return match;
11438             });
11439             source += "';\n";
11440             var variable = hasOwnProperty10.call(options2, "variable") && options2.variable;
11441             if (!variable) {
11442               source = "with (obj) {\n" + source + "\n}\n";
11443             } else if (reForbiddenIdentifierChars.test(variable)) {
11444               throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT);
11445             }
11446             source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
11447             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}";
11448             var result2 = attempt(function() {
11449               return Function2(importsKeys, sourceURL + "return " + source).apply(undefined2, importsValues);
11450             });
11451             result2.source = source;
11452             if (isError(result2)) {
11453               throw result2;
11454             }
11455             return result2;
11456           }
11457           function toLower(value) {
11458             return toString2(value).toLowerCase();
11459           }
11460           function toUpper(value) {
11461             return toString2(value).toUpperCase();
11462           }
11463           function trim(string, chars, guard) {
11464             string = toString2(string);
11465             if (string && (guard || chars === undefined2)) {
11466               return baseTrim2(string);
11467             }
11468             if (!string || !(chars = baseToString2(chars))) {
11469               return string;
11470             }
11471             var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start2 = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
11472             return castSlice(strSymbols, start2, end).join("");
11473           }
11474           function trimEnd(string, chars, guard) {
11475             string = toString2(string);
11476             if (string && (guard || chars === undefined2)) {
11477               return string.slice(0, trimmedEndIndex2(string) + 1);
11478             }
11479             if (!string || !(chars = baseToString2(chars))) {
11480               return string;
11481             }
11482             var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
11483             return castSlice(strSymbols, 0, end).join("");
11484           }
11485           function trimStart(string, chars, guard) {
11486             string = toString2(string);
11487             if (string && (guard || chars === undefined2)) {
11488               return string.replace(reTrimStart2, "");
11489             }
11490             if (!string || !(chars = baseToString2(chars))) {
11491               return string;
11492             }
11493             var strSymbols = stringToArray(string), start2 = charsStartIndex(strSymbols, stringToArray(chars));
11494             return castSlice(strSymbols, start2).join("");
11495           }
11496           function truncate(string, options2) {
11497             var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
11498             if (isObject3(options2)) {
11499               var separator = "separator" in options2 ? options2.separator : separator;
11500               length = "length" in options2 ? toInteger(options2.length) : length;
11501               omission = "omission" in options2 ? baseToString2(options2.omission) : omission;
11502             }
11503             string = toString2(string);
11504             var strLength = string.length;
11505             if (hasUnicode(string)) {
11506               var strSymbols = stringToArray(string);
11507               strLength = strSymbols.length;
11508             }
11509             if (length >= strLength) {
11510               return string;
11511             }
11512             var end = length - stringSize(omission);
11513             if (end < 1) {
11514               return omission;
11515             }
11516             var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
11517             if (separator === undefined2) {
11518               return result2 + omission;
11519             }
11520             if (strSymbols) {
11521               end += result2.length - end;
11522             }
11523             if (isRegExp(separator)) {
11524               if (string.slice(end).search(separator)) {
11525                 var match, substring = result2;
11526                 if (!separator.global) {
11527                   separator = RegExp2(separator.source, toString2(reFlags.exec(separator)) + "g");
11528                 }
11529                 separator.lastIndex = 0;
11530                 while (match = separator.exec(substring)) {
11531                   var newEnd = match.index;
11532                 }
11533                 result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd);
11534               }
11535             } else if (string.indexOf(baseToString2(separator), end) != end) {
11536               var index = result2.lastIndexOf(separator);
11537               if (index > -1) {
11538                 result2 = result2.slice(0, index);
11539               }
11540             }
11541             return result2 + omission;
11542           }
11543           function unescape4(string) {
11544             string = toString2(string);
11545             return string && reHasEscapedHtml2.test(string) ? string.replace(reEscapedHtml2, unescapeHtmlChar2) : string;
11546           }
11547           var upperCase = createCompounder(function(result2, word, index) {
11548             return result2 + (index ? " " : "") + word.toUpperCase();
11549           });
11550           var upperFirst = createCaseFirst("toUpperCase");
11551           function words(string, pattern, guard) {
11552             string = toString2(string);
11553             pattern = guard ? undefined2 : pattern;
11554             if (pattern === undefined2) {
11555               return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
11556             }
11557             return string.match(pattern) || [];
11558           }
11559           var attempt = baseRest(function(func, args) {
11560             try {
11561               return apply(func, undefined2, args);
11562             } catch (e) {
11563               return isError(e) ? e : new Error2(e);
11564             }
11565           });
11566           var bindAll = flatRest(function(object, methodNames) {
11567             arrayEach(methodNames, function(key) {
11568               key = toKey(key);
11569               baseAssignValue(object, key, bind(object[key], object));
11570             });
11571             return object;
11572           });
11573           function cond(pairs) {
11574             var length = pairs == null ? 0 : pairs.length, toIteratee = getIteratee();
11575             pairs = !length ? [] : arrayMap2(pairs, function(pair2) {
11576               if (typeof pair2[1] != "function") {
11577                 throw new TypeError2(FUNC_ERROR_TEXT3);
11578               }
11579               return [toIteratee(pair2[0]), pair2[1]];
11580             });
11581             return baseRest(function(args) {
11582               var index = -1;
11583               while (++index < length) {
11584                 var pair2 = pairs[index];
11585                 if (apply(pair2[0], this, args)) {
11586                   return apply(pair2[1], this, args);
11587                 }
11588               }
11589             });
11590           }
11591           function conforms(source) {
11592             return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
11593           }
11594           function constant(value) {
11595             return function() {
11596               return value;
11597             };
11598           }
11599           function defaultTo(value, defaultValue) {
11600             return value == null || value !== value ? defaultValue : value;
11601           }
11602           var flow = createFlow();
11603           var flowRight = createFlow(true);
11604           function identity4(value) {
11605             return value;
11606           }
11607           function iteratee(func) {
11608             return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG));
11609           }
11610           function matches(source) {
11611             return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
11612           }
11613           function matchesProperty(path, srcValue) {
11614             return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
11615           }
11616           var method = baseRest(function(path, args) {
11617             return function(object) {
11618               return baseInvoke(object, path, args);
11619             };
11620           });
11621           var methodOf = baseRest(function(object, args) {
11622             return function(path) {
11623               return baseInvoke(object, path, args);
11624             };
11625           });
11626           function mixin(object, source, options2) {
11627             var props = keys2(source), methodNames = baseFunctions(source, props);
11628             if (options2 == null && !(isObject3(source) && (methodNames.length || !props.length))) {
11629               options2 = source;
11630               source = object;
11631               object = this;
11632               methodNames = baseFunctions(source, keys2(source));
11633             }
11634             var chain2 = !(isObject3(options2) && "chain" in options2) || !!options2.chain, isFunc = isFunction2(object);
11635             arrayEach(methodNames, function(methodName) {
11636               var func = source[methodName];
11637               object[methodName] = func;
11638               if (isFunc) {
11639                 object.prototype[methodName] = function() {
11640                   var chainAll = this.__chain__;
11641                   if (chain2 || chainAll) {
11642                     var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray(this.__actions__);
11643                     actions.push({ "func": func, "args": arguments, "thisArg": object });
11644                     result2.__chain__ = chainAll;
11645                     return result2;
11646                   }
11647                   return func.apply(object, arrayPush2([this.value()], arguments));
11648                 };
11649               }
11650             });
11651             return object;
11652           }
11653           function noConflict() {
11654             if (root3._ === this) {
11655               root3._ = oldDash;
11656             }
11657             return this;
11658           }
11659           function noop3() {
11660           }
11661           function nthArg(n2) {
11662             n2 = toInteger(n2);
11663             return baseRest(function(args) {
11664               return baseNth(args, n2);
11665             });
11666           }
11667           var over = createOver(arrayMap2);
11668           var overEvery = createOver(arrayEvery);
11669           var overSome = createOver(arraySome2);
11670           function property(path) {
11671             return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
11672           }
11673           function propertyOf(object) {
11674             return function(path) {
11675               return object == null ? undefined2 : baseGet(object, path);
11676             };
11677           }
11678           var range3 = createRange();
11679           var rangeRight = createRange(true);
11680           function stubArray2() {
11681             return [];
11682           }
11683           function stubFalse2() {
11684             return false;
11685           }
11686           function stubObject() {
11687             return {};
11688           }
11689           function stubString() {
11690             return "";
11691           }
11692           function stubTrue() {
11693             return true;
11694           }
11695           function times(n2, iteratee2) {
11696             n2 = toInteger(n2);
11697             if (n2 < 1 || n2 > MAX_SAFE_INTEGER3) {
11698               return [];
11699             }
11700             var index = MAX_ARRAY_LENGTH, length = nativeMin2(n2, MAX_ARRAY_LENGTH);
11701             iteratee2 = getIteratee(iteratee2);
11702             n2 -= MAX_ARRAY_LENGTH;
11703             var result2 = baseTimes2(length, iteratee2);
11704             while (++index < n2) {
11705               iteratee2(index);
11706             }
11707             return result2;
11708           }
11709           function toPath(value) {
11710             if (isArray2(value)) {
11711               return arrayMap2(value, toKey);
11712             }
11713             return isSymbol2(value) ? [value] : copyArray(stringToPath(toString2(value)));
11714           }
11715           function uniqueId(prefix) {
11716             var id2 = ++idCounter;
11717             return toString2(prefix) + id2;
11718           }
11719           var add = createMathOperation(function(augend, addend) {
11720             return augend + addend;
11721           }, 0);
11722           var ceil = createRound("ceil");
11723           var divide = createMathOperation(function(dividend, divisor) {
11724             return dividend / divisor;
11725           }, 1);
11726           var floor = createRound("floor");
11727           function max3(array2) {
11728             return array2 && array2.length ? baseExtremum(array2, identity4, baseGt) : undefined2;
11729           }
11730           function maxBy(array2, iteratee2) {
11731             return array2 && array2.length ? baseExtremum(array2, getIteratee(iteratee2, 2), baseGt) : undefined2;
11732           }
11733           function mean(array2) {
11734             return baseMean(array2, identity4);
11735           }
11736           function meanBy(array2, iteratee2) {
11737             return baseMean(array2, getIteratee(iteratee2, 2));
11738           }
11739           function min3(array2) {
11740             return array2 && array2.length ? baseExtremum(array2, identity4, baseLt) : undefined2;
11741           }
11742           function minBy(array2, iteratee2) {
11743             return array2 && array2.length ? baseExtremum(array2, getIteratee(iteratee2, 2), baseLt) : undefined2;
11744           }
11745           var multiply = createMathOperation(function(multiplier, multiplicand) {
11746             return multiplier * multiplicand;
11747           }, 1);
11748           var round = createRound("round");
11749           var subtract = createMathOperation(function(minuend, subtrahend) {
11750             return minuend - subtrahend;
11751           }, 0);
11752           function sum(array2) {
11753             return array2 && array2.length ? baseSum(array2, identity4) : 0;
11754           }
11755           function sumBy(array2, iteratee2) {
11756             return array2 && array2.length ? baseSum(array2, getIteratee(iteratee2, 2)) : 0;
11757           }
11758           lodash.after = after;
11759           lodash.ary = ary;
11760           lodash.assign = assign;
11761           lodash.assignIn = assignIn;
11762           lodash.assignInWith = assignInWith;
11763           lodash.assignWith = assignWith;
11764           lodash.at = at;
11765           lodash.before = before;
11766           lodash.bind = bind;
11767           lodash.bindAll = bindAll;
11768           lodash.bindKey = bindKey2;
11769           lodash.castArray = castArray;
11770           lodash.chain = chain;
11771           lodash.chunk = chunk;
11772           lodash.compact = compact;
11773           lodash.concat = concat;
11774           lodash.cond = cond;
11775           lodash.conforms = conforms;
11776           lodash.constant = constant;
11777           lodash.countBy = countBy;
11778           lodash.create = create2;
11779           lodash.curry = curry;
11780           lodash.curryRight = curryRight;
11781           lodash.debounce = debounce2;
11782           lodash.defaults = defaults2;
11783           lodash.defaultsDeep = defaultsDeep;
11784           lodash.defer = defer;
11785           lodash.delay = delay;
11786           lodash.difference = difference;
11787           lodash.differenceBy = differenceBy;
11788           lodash.differenceWith = differenceWith;
11789           lodash.drop = drop;
11790           lodash.dropRight = dropRight;
11791           lodash.dropRightWhile = dropRightWhile;
11792           lodash.dropWhile = dropWhile;
11793           lodash.fill = fill;
11794           lodash.filter = filter2;
11795           lodash.flatMap = flatMap;
11796           lodash.flatMapDeep = flatMapDeep;
11797           lodash.flatMapDepth = flatMapDepth;
11798           lodash.flatten = flatten2;
11799           lodash.flattenDeep = flattenDeep;
11800           lodash.flattenDepth = flattenDepth;
11801           lodash.flip = flip;
11802           lodash.flow = flow;
11803           lodash.flowRight = flowRight;
11804           lodash.fromPairs = fromPairs;
11805           lodash.functions = functions;
11806           lodash.functionsIn = functionsIn;
11807           lodash.groupBy = groupBy;
11808           lodash.initial = initial;
11809           lodash.intersection = intersection;
11810           lodash.intersectionBy = intersectionBy;
11811           lodash.intersectionWith = intersectionWith;
11812           lodash.invert = invert;
11813           lodash.invertBy = invertBy;
11814           lodash.invokeMap = invokeMap;
11815           lodash.iteratee = iteratee;
11816           lodash.keyBy = keyBy;
11817           lodash.keys = keys2;
11818           lodash.keysIn = keysIn;
11819           lodash.map = map2;
11820           lodash.mapKeys = mapKeys;
11821           lodash.mapValues = mapValues;
11822           lodash.matches = matches;
11823           lodash.matchesProperty = matchesProperty;
11824           lodash.memoize = memoize;
11825           lodash.merge = merge2;
11826           lodash.mergeWith = mergeWith;
11827           lodash.method = method;
11828           lodash.methodOf = methodOf;
11829           lodash.mixin = mixin;
11830           lodash.negate = negate;
11831           lodash.nthArg = nthArg;
11832           lodash.omit = omit;
11833           lodash.omitBy = omitBy;
11834           lodash.once = once;
11835           lodash.orderBy = orderBy;
11836           lodash.over = over;
11837           lodash.overArgs = overArgs;
11838           lodash.overEvery = overEvery;
11839           lodash.overSome = overSome;
11840           lodash.partial = partial;
11841           lodash.partialRight = partialRight;
11842           lodash.partition = partition;
11843           lodash.pick = pick;
11844           lodash.pickBy = pickBy;
11845           lodash.property = property;
11846           lodash.propertyOf = propertyOf;
11847           lodash.pull = pull;
11848           lodash.pullAll = pullAll;
11849           lodash.pullAllBy = pullAllBy;
11850           lodash.pullAllWith = pullAllWith;
11851           lodash.pullAt = pullAt;
11852           lodash.range = range3;
11853           lodash.rangeRight = rangeRight;
11854           lodash.rearg = rearg;
11855           lodash.reject = reject;
11856           lodash.remove = remove2;
11857           lodash.rest = rest;
11858           lodash.reverse = reverse;
11859           lodash.sampleSize = sampleSize;
11860           lodash.set = set3;
11861           lodash.setWith = setWith;
11862           lodash.shuffle = shuffle;
11863           lodash.slice = slice;
11864           lodash.sortBy = sortBy;
11865           lodash.sortedUniq = sortedUniq;
11866           lodash.sortedUniqBy = sortedUniqBy;
11867           lodash.split = split;
11868           lodash.spread = spread;
11869           lodash.tail = tail;
11870           lodash.take = take;
11871           lodash.takeRight = takeRight;
11872           lodash.takeRightWhile = takeRightWhile;
11873           lodash.takeWhile = takeWhile;
11874           lodash.tap = tap;
11875           lodash.throttle = throttle2;
11876           lodash.thru = thru;
11877           lodash.toArray = toArray;
11878           lodash.toPairs = toPairs;
11879           lodash.toPairsIn = toPairsIn;
11880           lodash.toPath = toPath;
11881           lodash.toPlainObject = toPlainObject;
11882           lodash.transform = transform2;
11883           lodash.unary = unary;
11884           lodash.union = union;
11885           lodash.unionBy = unionBy;
11886           lodash.unionWith = unionWith;
11887           lodash.uniq = uniq;
11888           lodash.uniqBy = uniqBy;
11889           lodash.uniqWith = uniqWith;
11890           lodash.unset = unset;
11891           lodash.unzip = unzip;
11892           lodash.unzipWith = unzipWith;
11893           lodash.update = update;
11894           lodash.updateWith = updateWith;
11895           lodash.values = values;
11896           lodash.valuesIn = valuesIn;
11897           lodash.without = without;
11898           lodash.words = words;
11899           lodash.wrap = wrap2;
11900           lodash.xor = xor;
11901           lodash.xorBy = xorBy;
11902           lodash.xorWith = xorWith;
11903           lodash.zip = zip;
11904           lodash.zipObject = zipObject;
11905           lodash.zipObjectDeep = zipObjectDeep;
11906           lodash.zipWith = zipWith;
11907           lodash.entries = toPairs;
11908           lodash.entriesIn = toPairsIn;
11909           lodash.extend = assignIn;
11910           lodash.extendWith = assignInWith;
11911           mixin(lodash, lodash);
11912           lodash.add = add;
11913           lodash.attempt = attempt;
11914           lodash.camelCase = camelCase;
11915           lodash.capitalize = capitalize;
11916           lodash.ceil = ceil;
11917           lodash.clamp = clamp3;
11918           lodash.clone = clone;
11919           lodash.cloneDeep = cloneDeep;
11920           lodash.cloneDeepWith = cloneDeepWith;
11921           lodash.cloneWith = cloneWith;
11922           lodash.conformsTo = conformsTo;
11923           lodash.deburr = deburr;
11924           lodash.defaultTo = defaultTo;
11925           lodash.divide = divide;
11926           lodash.endsWith = endsWith;
11927           lodash.eq = eq2;
11928           lodash.escape = escape6;
11929           lodash.escapeRegExp = escapeRegExp;
11930           lodash.every = every;
11931           lodash.find = find2;
11932           lodash.findIndex = findIndex;
11933           lodash.findKey = findKey;
11934           lodash.findLast = findLast;
11935           lodash.findLastIndex = findLastIndex;
11936           lodash.findLastKey = findLastKey;
11937           lodash.floor = floor;
11938           lodash.forEach = forEach;
11939           lodash.forEachRight = forEachRight;
11940           lodash.forIn = forIn;
11941           lodash.forInRight = forInRight;
11942           lodash.forOwn = forOwn;
11943           lodash.forOwnRight = forOwnRight;
11944           lodash.get = get4;
11945           lodash.gt = gt;
11946           lodash.gte = gte;
11947           lodash.has = has;
11948           lodash.hasIn = hasIn;
11949           lodash.head = head;
11950           lodash.identity = identity4;
11951           lodash.includes = includes;
11952           lodash.indexOf = indexOf;
11953           lodash.inRange = inRange;
11954           lodash.invoke = invoke;
11955           lodash.isArguments = isArguments2;
11956           lodash.isArray = isArray2;
11957           lodash.isArrayBuffer = isArrayBuffer;
11958           lodash.isArrayLike = isArrayLike2;
11959           lodash.isArrayLikeObject = isArrayLikeObject;
11960           lodash.isBoolean = isBoolean;
11961           lodash.isBuffer = isBuffer2;
11962           lodash.isDate = isDate;
11963           lodash.isElement = isElement2;
11964           lodash.isEmpty = isEmpty;
11965           lodash.isEqual = isEqual4;
11966           lodash.isEqualWith = isEqualWith;
11967           lodash.isError = isError;
11968           lodash.isFinite = isFinite2;
11969           lodash.isFunction = isFunction2;
11970           lodash.isInteger = isInteger;
11971           lodash.isLength = isLength2;
11972           lodash.isMap = isMap;
11973           lodash.isMatch = isMatch;
11974           lodash.isMatchWith = isMatchWith;
11975           lodash.isNaN = isNaN2;
11976           lodash.isNative = isNative;
11977           lodash.isNil = isNil;
11978           lodash.isNull = isNull;
11979           lodash.isNumber = isNumber2;
11980           lodash.isObject = isObject3;
11981           lodash.isObjectLike = isObjectLike2;
11982           lodash.isPlainObject = isPlainObject;
11983           lodash.isRegExp = isRegExp;
11984           lodash.isSafeInteger = isSafeInteger;
11985           lodash.isSet = isSet;
11986           lodash.isString = isString;
11987           lodash.isSymbol = isSymbol2;
11988           lodash.isTypedArray = isTypedArray2;
11989           lodash.isUndefined = isUndefined;
11990           lodash.isWeakMap = isWeakMap;
11991           lodash.isWeakSet = isWeakSet;
11992           lodash.join = join;
11993           lodash.kebabCase = kebabCase;
11994           lodash.last = last;
11995           lodash.lastIndexOf = lastIndexOf;
11996           lodash.lowerCase = lowerCase;
11997           lodash.lowerFirst = lowerFirst;
11998           lodash.lt = lt;
11999           lodash.lte = lte;
12000           lodash.max = max3;
12001           lodash.maxBy = maxBy;
12002           lodash.mean = mean;
12003           lodash.meanBy = meanBy;
12004           lodash.min = min3;
12005           lodash.minBy = minBy;
12006           lodash.stubArray = stubArray2;
12007           lodash.stubFalse = stubFalse2;
12008           lodash.stubObject = stubObject;
12009           lodash.stubString = stubString;
12010           lodash.stubTrue = stubTrue;
12011           lodash.multiply = multiply;
12012           lodash.nth = nth;
12013           lodash.noConflict = noConflict;
12014           lodash.noop = noop3;
12015           lodash.now = now3;
12016           lodash.pad = pad2;
12017           lodash.padEnd = padEnd;
12018           lodash.padStart = padStart;
12019           lodash.parseInt = parseInt2;
12020           lodash.random = random;
12021           lodash.reduce = reduce;
12022           lodash.reduceRight = reduceRight;
12023           lodash.repeat = repeat;
12024           lodash.replace = replace;
12025           lodash.result = result;
12026           lodash.round = round;
12027           lodash.runInContext = runInContext2;
12028           lodash.sample = sample;
12029           lodash.size = size;
12030           lodash.snakeCase = snakeCase;
12031           lodash.some = some;
12032           lodash.sortedIndex = sortedIndex;
12033           lodash.sortedIndexBy = sortedIndexBy;
12034           lodash.sortedIndexOf = sortedIndexOf;
12035           lodash.sortedLastIndex = sortedLastIndex;
12036           lodash.sortedLastIndexBy = sortedLastIndexBy;
12037           lodash.sortedLastIndexOf = sortedLastIndexOf;
12038           lodash.startCase = startCase;
12039           lodash.startsWith = startsWith;
12040           lodash.subtract = subtract;
12041           lodash.sum = sum;
12042           lodash.sumBy = sumBy;
12043           lodash.template = template;
12044           lodash.times = times;
12045           lodash.toFinite = toFinite;
12046           lodash.toInteger = toInteger;
12047           lodash.toLength = toLength;
12048           lodash.toLower = toLower;
12049           lodash.toNumber = toNumber3;
12050           lodash.toSafeInteger = toSafeInteger;
12051           lodash.toString = toString2;
12052           lodash.toUpper = toUpper;
12053           lodash.trim = trim;
12054           lodash.trimEnd = trimEnd;
12055           lodash.trimStart = trimStart;
12056           lodash.truncate = truncate;
12057           lodash.unescape = unescape4;
12058           lodash.uniqueId = uniqueId;
12059           lodash.upperCase = upperCase;
12060           lodash.upperFirst = upperFirst;
12061           lodash.each = forEach;
12062           lodash.eachRight = forEachRight;
12063           lodash.first = head;
12064           mixin(lodash, function() {
12065             var source = {};
12066             baseForOwn(lodash, function(func, methodName) {
12067               if (!hasOwnProperty10.call(lodash.prototype, methodName)) {
12068                 source[methodName] = func;
12069               }
12070             });
12071             return source;
12072           }(), { "chain": false });
12073           lodash.VERSION = VERSION;
12074           arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
12075             lodash[methodName].placeholder = lodash;
12076           });
12077           arrayEach(["drop", "take"], function(methodName, index) {
12078             LazyWrapper.prototype[methodName] = function(n2) {
12079               n2 = n2 === undefined2 ? 1 : nativeMax2(toInteger(n2), 0);
12080               var result2 = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
12081               if (result2.__filtered__) {
12082                 result2.__takeCount__ = nativeMin2(n2, result2.__takeCount__);
12083               } else {
12084                 result2.__views__.push({
12085                   "size": nativeMin2(n2, MAX_ARRAY_LENGTH),
12086                   "type": methodName + (result2.__dir__ < 0 ? "Right" : "")
12087                 });
12088               }
12089               return result2;
12090             };
12091             LazyWrapper.prototype[methodName + "Right"] = function(n2) {
12092               return this.reverse()[methodName](n2).reverse();
12093             };
12094           });
12095           arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
12096             var type2 = index + 1, isFilter = type2 == LAZY_FILTER_FLAG || type2 == LAZY_WHILE_FLAG;
12097             LazyWrapper.prototype[methodName] = function(iteratee2) {
12098               var result2 = this.clone();
12099               result2.__iteratees__.push({
12100                 "iteratee": getIteratee(iteratee2, 3),
12101                 "type": type2
12102               });
12103               result2.__filtered__ = result2.__filtered__ || isFilter;
12104               return result2;
12105             };
12106           });
12107           arrayEach(["head", "last"], function(methodName, index) {
12108             var takeName = "take" + (index ? "Right" : "");
12109             LazyWrapper.prototype[methodName] = function() {
12110               return this[takeName](1).value()[0];
12111             };
12112           });
12113           arrayEach(["initial", "tail"], function(methodName, index) {
12114             var dropName = "drop" + (index ? "" : "Right");
12115             LazyWrapper.prototype[methodName] = function() {
12116               return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
12117             };
12118           });
12119           LazyWrapper.prototype.compact = function() {
12120             return this.filter(identity4);
12121           };
12122           LazyWrapper.prototype.find = function(predicate) {
12123             return this.filter(predicate).head();
12124           };
12125           LazyWrapper.prototype.findLast = function(predicate) {
12126             return this.reverse().find(predicate);
12127           };
12128           LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
12129             if (typeof path == "function") {
12130               return new LazyWrapper(this);
12131             }
12132             return this.map(function(value) {
12133               return baseInvoke(value, path, args);
12134             });
12135           });
12136           LazyWrapper.prototype.reject = function(predicate) {
12137             return this.filter(negate(getIteratee(predicate)));
12138           };
12139           LazyWrapper.prototype.slice = function(start2, end) {
12140             start2 = toInteger(start2);
12141             var result2 = this;
12142             if (result2.__filtered__ && (start2 > 0 || end < 0)) {
12143               return new LazyWrapper(result2);
12144             }
12145             if (start2 < 0) {
12146               result2 = result2.takeRight(-start2);
12147             } else if (start2) {
12148               result2 = result2.drop(start2);
12149             }
12150             if (end !== undefined2) {
12151               end = toInteger(end);
12152               result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start2);
12153             }
12154             return result2;
12155           };
12156           LazyWrapper.prototype.takeRightWhile = function(predicate) {
12157             return this.reverse().takeWhile(predicate).reverse();
12158           };
12159           LazyWrapper.prototype.toArray = function() {
12160             return this.take(MAX_ARRAY_LENGTH);
12161           };
12162           baseForOwn(LazyWrapper.prototype, function(func, methodName) {
12163             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);
12164             if (!lodashFunc) {
12165               return;
12166             }
12167             lodash.prototype[methodName] = function() {
12168               var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray2(value);
12169               var interceptor = function(value2) {
12170                 var result3 = lodashFunc.apply(lodash, arrayPush2([value2], args));
12171                 return isTaker && chainAll ? result3[0] : result3;
12172               };
12173               if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
12174                 isLazy = useLazy = false;
12175               }
12176               var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
12177               if (!retUnwrapped && useLazy) {
12178                 value = onlyLazy ? value : new LazyWrapper(this);
12179                 var result2 = func.apply(value, args);
12180                 result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined2 });
12181                 return new LodashWrapper(result2, chainAll);
12182               }
12183               if (isUnwrapped && onlyLazy) {
12184                 return func.apply(this, args);
12185               }
12186               result2 = this.thru(interceptor);
12187               return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
12188             };
12189           });
12190           arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
12191             var func = arrayProto2[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
12192             lodash.prototype[methodName] = function() {
12193               var args = arguments;
12194               if (retUnwrapped && !this.__chain__) {
12195                 var value = this.value();
12196                 return func.apply(isArray2(value) ? value : [], args);
12197               }
12198               return this[chainName](function(value2) {
12199                 return func.apply(isArray2(value2) ? value2 : [], args);
12200               });
12201             };
12202           });
12203           baseForOwn(LazyWrapper.prototype, function(func, methodName) {
12204             var lodashFunc = lodash[methodName];
12205             if (lodashFunc) {
12206               var key = lodashFunc.name + "";
12207               if (!hasOwnProperty10.call(realNames, key)) {
12208                 realNames[key] = [];
12209               }
12210               realNames[key].push({ "name": methodName, "func": lodashFunc });
12211             }
12212           });
12213           realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{
12214             "name": "wrapper",
12215             "func": undefined2
12216           }];
12217           LazyWrapper.prototype.clone = lazyClone;
12218           LazyWrapper.prototype.reverse = lazyReverse;
12219           LazyWrapper.prototype.value = lazyValue;
12220           lodash.prototype.at = wrapperAt;
12221           lodash.prototype.chain = wrapperChain;
12222           lodash.prototype.commit = wrapperCommit;
12223           lodash.prototype.next = wrapperNext;
12224           lodash.prototype.plant = wrapperPlant;
12225           lodash.prototype.reverse = wrapperReverse;
12226           lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
12227           lodash.prototype.first = lodash.prototype.head;
12228           if (symIterator) {
12229             lodash.prototype[symIterator] = wrapperToIterator;
12230           }
12231           return lodash;
12232         };
12233         var _ = runInContext();
12234         if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
12235           root3._ = _;
12236           define(function() {
12237             return _;
12238           });
12239         } else if (freeModule3) {
12240           (freeModule3.exports = _)._ = _;
12241           freeExports3._ = _;
12242         } else {
12243           root3._ = _;
12244         }
12245       }).call(exports2);
12246     }
12247   });
12248
12249   // node_modules/fast-deep-equal/index.js
12250   var require_fast_deep_equal = __commonJS({
12251     "node_modules/fast-deep-equal/index.js"(exports2, module2) {
12252       "use strict";
12253       module2.exports = function equal(a, b) {
12254         if (a === b)
12255           return true;
12256         if (a && b && typeof a == "object" && typeof b == "object") {
12257           if (a.constructor !== b.constructor)
12258             return false;
12259           var length, i2, keys2;
12260           if (Array.isArray(a)) {
12261             length = a.length;
12262             if (length != b.length)
12263               return false;
12264             for (i2 = length; i2-- !== 0; )
12265               if (!equal(a[i2], b[i2]))
12266                 return false;
12267             return true;
12268           }
12269           if (a.constructor === RegExp)
12270             return a.source === b.source && a.flags === b.flags;
12271           if (a.valueOf !== Object.prototype.valueOf)
12272             return a.valueOf() === b.valueOf();
12273           if (a.toString !== Object.prototype.toString)
12274             return a.toString() === b.toString();
12275           keys2 = Object.keys(a);
12276           length = keys2.length;
12277           if (length !== Object.keys(b).length)
12278             return false;
12279           for (i2 = length; i2-- !== 0; )
12280             if (!Object.prototype.hasOwnProperty.call(b, keys2[i2]))
12281               return false;
12282           for (i2 = length; i2-- !== 0; ) {
12283             var key = keys2[i2];
12284             if (!equal(a[key], b[key]))
12285               return false;
12286           }
12287           return true;
12288         }
12289         return a !== a && b !== b;
12290       };
12291     }
12292   });
12293
12294   // node_modules/rbush/rbush.min.js
12295   var require_rbush_min = __commonJS({
12296     "node_modules/rbush/rbush.min.js"(exports2, module2) {
12297       !function(t, i2) {
12298         "object" == typeof exports2 && "undefined" != typeof module2 ? module2.exports = i2() : "function" == typeof define && define.amd ? define(i2) : (t = t || self).RBush = i2();
12299       }(exports2, function() {
12300         "use strict";
12301         function t(t2, r2, e3, a2, h2) {
12302           !function t3(n3, r3, e4, a3, h3) {
12303             for (; a3 > e4; ) {
12304               if (a3 - e4 > 600) {
12305                 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));
12306                 t3(n3, r3, m2, c2, h3);
12307               }
12308               var p2 = n3[r3], d2 = e4, x = a3;
12309               for (i2(n3, e4, r3), h3(n3[a3], p2) > 0 && i2(n3, e4, a3); d2 < x; ) {
12310                 for (i2(n3, d2, x), d2++, x--; h3(n3[d2], p2) < 0; )
12311                   d2++;
12312                 for (; h3(n3[x], p2) > 0; )
12313                   x--;
12314               }
12315               0 === h3(n3[e4], p2) ? i2(n3, e4, x) : i2(n3, ++x, a3), x <= r3 && (e4 = x + 1), r3 <= x && (a3 = x - 1);
12316             }
12317           }(t2, r2, e3 || 0, a2 || t2.length - 1, h2 || n2);
12318         }
12319         function i2(t2, i3, n3) {
12320           var r2 = t2[i3];
12321           t2[i3] = t2[n3], t2[n3] = r2;
12322         }
12323         function n2(t2, i3) {
12324           return t2 < i3 ? -1 : t2 > i3 ? 1 : 0;
12325         }
12326         var r = function(t2) {
12327           void 0 === t2 && (t2 = 9), this._maxEntries = Math.max(4, t2), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
12328         };
12329         function e(t2, i3, n3) {
12330           if (!n3)
12331             return i3.indexOf(t2);
12332           for (var r2 = 0; r2 < i3.length; r2++)
12333             if (n3(t2, i3[r2]))
12334               return r2;
12335           return -1;
12336         }
12337         function a(t2, i3) {
12338           h(t2, 0, t2.children.length, i3, t2);
12339         }
12340         function h(t2, i3, n3, r2, e3) {
12341           e3 || (e3 = p(null)), e3.minX = 1 / 0, e3.minY = 1 / 0, e3.maxX = -1 / 0, e3.maxY = -1 / 0;
12342           for (var a2 = i3; a2 < n3; a2++) {
12343             var h2 = t2.children[a2];
12344             o(e3, t2.leaf ? r2(h2) : h2);
12345           }
12346           return e3;
12347         }
12348         function o(t2, i3) {
12349           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;
12350         }
12351         function s(t2, i3) {
12352           return t2.minX - i3.minX;
12353         }
12354         function l(t2, i3) {
12355           return t2.minY - i3.minY;
12356         }
12357         function f2(t2) {
12358           return (t2.maxX - t2.minX) * (t2.maxY - t2.minY);
12359         }
12360         function u(t2) {
12361           return t2.maxX - t2.minX + (t2.maxY - t2.minY);
12362         }
12363         function m(t2, i3) {
12364           return t2.minX <= i3.minX && t2.minY <= i3.minY && i3.maxX <= t2.maxX && i3.maxY <= t2.maxY;
12365         }
12366         function c(t2, i3) {
12367           return i3.minX <= t2.maxX && i3.minY <= t2.maxY && i3.maxX >= t2.minX && i3.maxY >= t2.minY;
12368         }
12369         function p(t2) {
12370           return { children: t2, height: 1, leaf: true, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
12371         }
12372         function d(i3, n3, r2, e3, a2) {
12373           for (var h2 = [n3, r2]; h2.length; )
12374             if (!((r2 = h2.pop()) - (n3 = h2.pop()) <= e3)) {
12375               var o2 = n3 + Math.ceil((r2 - n3) / e3 / 2) * e3;
12376               t(i3, o2, n3, r2, a2), h2.push(n3, o2, o2, r2);
12377             }
12378         }
12379         return r.prototype.all = function() {
12380           return this._all(this.data, []);
12381         }, r.prototype.search = function(t2) {
12382           var i3 = this.data, n3 = [];
12383           if (!c(t2, i3))
12384             return n3;
12385           for (var r2 = this.toBBox, e3 = []; i3; ) {
12386             for (var a2 = 0; a2 < i3.children.length; a2++) {
12387               var h2 = i3.children[a2], o2 = i3.leaf ? r2(h2) : h2;
12388               c(t2, o2) && (i3.leaf ? n3.push(h2) : m(t2, o2) ? this._all(h2, n3) : e3.push(h2));
12389             }
12390             i3 = e3.pop();
12391           }
12392           return n3;
12393         }, r.prototype.collides = function(t2) {
12394           var i3 = this.data;
12395           if (!c(t2, i3))
12396             return false;
12397           for (var n3 = []; i3; ) {
12398             for (var r2 = 0; r2 < i3.children.length; r2++) {
12399               var e3 = i3.children[r2], a2 = i3.leaf ? this.toBBox(e3) : e3;
12400               if (c(t2, a2)) {
12401                 if (i3.leaf || m(t2, a2))
12402                   return true;
12403                 n3.push(e3);
12404               }
12405             }
12406             i3 = n3.pop();
12407           }
12408           return false;
12409         }, r.prototype.load = function(t2) {
12410           if (!t2 || !t2.length)
12411             return this;
12412           if (t2.length < this._minEntries) {
12413             for (var i3 = 0; i3 < t2.length; i3++)
12414               this.insert(t2[i3]);
12415             return this;
12416           }
12417           var n3 = this._build(t2.slice(), 0, t2.length - 1, 0);
12418           if (this.data.children.length)
12419             if (this.data.height === n3.height)
12420               this._splitRoot(this.data, n3);
12421             else {
12422               if (this.data.height < n3.height) {
12423                 var r2 = this.data;
12424                 this.data = n3, n3 = r2;
12425               }
12426               this._insert(n3, this.data.height - n3.height - 1, true);
12427             }
12428           else
12429             this.data = n3;
12430           return this;
12431         }, r.prototype.insert = function(t2) {
12432           return t2 && this._insert(t2, this.data.height - 1), this;
12433         }, r.prototype.clear = function() {
12434           return this.data = p([]), this;
12435         }, r.prototype.remove = function(t2, i3) {
12436           if (!t2)
12437             return this;
12438           for (var n3, r2, a2, h2 = this.data, o2 = this.toBBox(t2), s2 = [], l2 = []; h2 || s2.length; ) {
12439             if (h2 || (h2 = s2.pop(), r2 = s2[s2.length - 1], n3 = l2.pop(), a2 = true), h2.leaf) {
12440               var f3 = e(t2, h2.children, i3);
12441               if (-1 !== f3)
12442                 return h2.children.splice(f3, 1), s2.push(h2), this._condense(s2), this;
12443             }
12444             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]);
12445           }
12446           return this;
12447         }, r.prototype.toBBox = function(t2) {
12448           return t2;
12449         }, r.prototype.compareMinX = function(t2, i3) {
12450           return t2.minX - i3.minX;
12451         }, r.prototype.compareMinY = function(t2, i3) {
12452           return t2.minY - i3.minY;
12453         }, r.prototype.toJSON = function() {
12454           return this.data;
12455         }, r.prototype.fromJSON = function(t2) {
12456           return this.data = t2, this;
12457         }, r.prototype._all = function(t2, i3) {
12458           for (var n3 = []; t2; )
12459             t2.leaf ? i3.push.apply(i3, t2.children) : n3.push.apply(n3, t2.children), t2 = n3.pop();
12460           return i3;
12461         }, r.prototype._build = function(t2, i3, n3, r2) {
12462           var e3, h2 = n3 - i3 + 1, o2 = this._maxEntries;
12463           if (h2 <= o2)
12464             return a(e3 = p(t2.slice(i3, n3 + 1)), this.toBBox), e3;
12465           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;
12466           var s2 = Math.ceil(h2 / o2), l2 = s2 * Math.ceil(Math.sqrt(o2));
12467           d(t2, i3, n3, l2, this.compareMinX);
12468           for (var f3 = i3; f3 <= n3; f3 += l2) {
12469             var u2 = Math.min(f3 + l2 - 1, n3);
12470             d(t2, f3, u2, s2, this.compareMinY);
12471             for (var m2 = f3; m2 <= u2; m2 += s2) {
12472               var c2 = Math.min(m2 + s2 - 1, u2);
12473               e3.children.push(this._build(t2, m2, c2, r2 - 1));
12474             }
12475           }
12476           return a(e3, this.toBBox), e3;
12477         }, r.prototype._chooseSubtree = function(t2, i3, n3, r2) {
12478           for (; r2.push(i3), !i3.leaf && r2.length - 1 !== n3; ) {
12479             for (var e3 = 1 / 0, a2 = 1 / 0, h2 = void 0, o2 = 0; o2 < i3.children.length; o2++) {
12480               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);
12481               u2 < a2 ? (a2 = u2, e3 = l2 < e3 ? l2 : e3, h2 = s2) : u2 === a2 && l2 < e3 && (e3 = l2, h2 = s2);
12482             }
12483             i3 = h2 || i3.children[0];
12484           }
12485           var m2, c2;
12486           return i3;
12487         }, r.prototype._insert = function(t2, i3, n3) {
12488           var r2 = n3 ? t2 : this.toBBox(t2), e3 = [], a2 = this._chooseSubtree(r2, this.data, i3, e3);
12489           for (a2.children.push(t2), o(a2, r2); i3 >= 0 && e3[i3].children.length > this._maxEntries; )
12490             this._split(e3, i3), i3--;
12491           this._adjustParentBBoxes(r2, e3, i3);
12492         }, r.prototype._split = function(t2, i3) {
12493           var n3 = t2[i3], r2 = n3.children.length, e3 = this._minEntries;
12494           this._chooseSplitAxis(n3, e3, r2);
12495           var h2 = this._chooseSplitIndex(n3, e3, r2), o2 = p(n3.children.splice(h2, n3.children.length - h2));
12496           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);
12497         }, r.prototype._splitRoot = function(t2, i3) {
12498           this.data = p([t2, i3]), this.data.height = t2.height + 1, this.data.leaf = false, a(this.data, this.toBBox);
12499         }, r.prototype._chooseSplitIndex = function(t2, i3, n3) {
12500           for (var r2, e3, a2, o2, s2, l2, u2, m2 = 1 / 0, c2 = 1 / 0, p2 = i3; p2 <= n3 - i3; p2++) {
12501             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);
12502             v < m2 ? (m2 = v, r2 = p2, c2 = M < c2 ? M : c2) : v === m2 && M < c2 && (c2 = M, r2 = p2);
12503           }
12504           return r2 || n3 - i3;
12505         }, r.prototype._chooseSplitAxis = function(t2, i3, n3) {
12506           var r2 = t2.leaf ? this.compareMinX : s, e3 = t2.leaf ? this.compareMinY : l;
12507           this._allDistMargin(t2, i3, n3, r2) < this._allDistMargin(t2, i3, n3, e3) && t2.children.sort(r2);
12508         }, r.prototype._allDistMargin = function(t2, i3, n3, r2) {
12509           t2.children.sort(r2);
12510           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++) {
12511             var m2 = t2.children[f3];
12512             o(a2, t2.leaf ? e3(m2) : m2), l2 += u(a2);
12513           }
12514           for (var c2 = n3 - i3 - 1; c2 >= i3; c2--) {
12515             var p2 = t2.children[c2];
12516             o(s2, t2.leaf ? e3(p2) : p2), l2 += u(s2);
12517           }
12518           return l2;
12519         }, r.prototype._adjustParentBBoxes = function(t2, i3, n3) {
12520           for (var r2 = n3; r2 >= 0; r2--)
12521             o(i3[r2], t2);
12522         }, r.prototype._condense = function(t2) {
12523           for (var i3 = t2.length - 1, n3 = void 0; i3 >= 0; i3--)
12524             0 === t2[i3].children.length ? i3 > 0 ? (n3 = t2[i3 - 1].children).splice(n3.indexOf(t2[i3]), 1) : this.clear() : a(t2[i3], this.toBBox);
12525         }, r;
12526       });
12527     }
12528   });
12529
12530   // node_modules/ieee754/index.js
12531   var require_ieee754 = __commonJS({
12532     "node_modules/ieee754/index.js"(exports2) {
12533       exports2.read = function(buffer, offset, isLE, mLen, nBytes) {
12534         var e, m;
12535         var eLen = nBytes * 8 - mLen - 1;
12536         var eMax = (1 << eLen) - 1;
12537         var eBias = eMax >> 1;
12538         var nBits = -7;
12539         var i2 = isLE ? nBytes - 1 : 0;
12540         var d = isLE ? -1 : 1;
12541         var s = buffer[offset + i2];
12542         i2 += d;
12543         e = s & (1 << -nBits) - 1;
12544         s >>= -nBits;
12545         nBits += eLen;
12546         for (; nBits > 0; e = e * 256 + buffer[offset + i2], i2 += d, nBits -= 8) {
12547         }
12548         m = e & (1 << -nBits) - 1;
12549         e >>= -nBits;
12550         nBits += mLen;
12551         for (; nBits > 0; m = m * 256 + buffer[offset + i2], i2 += d, nBits -= 8) {
12552         }
12553         if (e === 0) {
12554           e = 1 - eBias;
12555         } else if (e === eMax) {
12556           return m ? NaN : (s ? -1 : 1) * Infinity;
12557         } else {
12558           m = m + Math.pow(2, mLen);
12559           e = e - eBias;
12560         }
12561         return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
12562       };
12563       exports2.write = function(buffer, value, offset, isLE, mLen, nBytes) {
12564         var e, m, c;
12565         var eLen = nBytes * 8 - mLen - 1;
12566         var eMax = (1 << eLen) - 1;
12567         var eBias = eMax >> 1;
12568         var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
12569         var i2 = isLE ? 0 : nBytes - 1;
12570         var d = isLE ? 1 : -1;
12571         var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
12572         value = Math.abs(value);
12573         if (isNaN(value) || value === Infinity) {
12574           m = isNaN(value) ? 1 : 0;
12575           e = eMax;
12576         } else {
12577           e = Math.floor(Math.log(value) / Math.LN2);
12578           if (value * (c = Math.pow(2, -e)) < 1) {
12579             e--;
12580             c *= 2;
12581           }
12582           if (e + eBias >= 1) {
12583             value += rt / c;
12584           } else {
12585             value += rt * Math.pow(2, 1 - eBias);
12586           }
12587           if (value * c >= 2) {
12588             e++;
12589             c /= 2;
12590           }
12591           if (e + eBias >= eMax) {
12592             m = 0;
12593             e = eMax;
12594           } else if (e + eBias >= 1) {
12595             m = (value * c - 1) * Math.pow(2, mLen);
12596             e = e + eBias;
12597           } else {
12598             m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
12599             e = 0;
12600           }
12601         }
12602         for (; mLen >= 8; buffer[offset + i2] = m & 255, i2 += d, m /= 256, mLen -= 8) {
12603         }
12604         e = e << mLen | m;
12605         eLen += mLen;
12606         for (; eLen > 0; buffer[offset + i2] = e & 255, i2 += d, e /= 256, eLen -= 8) {
12607         }
12608         buffer[offset + i2 - d] |= s * 128;
12609       };
12610     }
12611   });
12612
12613   // node_modules/pbf/index.js
12614   var require_pbf = __commonJS({
12615     "node_modules/pbf/index.js"(exports2, module2) {
12616       "use strict";
12617       module2.exports = Pbf;
12618       var ieee754 = require_ieee754();
12619       function Pbf(buf) {
12620         this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);
12621         this.pos = 0;
12622         this.type = 0;
12623         this.length = this.buf.length;
12624       }
12625       Pbf.Varint = 0;
12626       Pbf.Fixed64 = 1;
12627       Pbf.Bytes = 2;
12628       Pbf.Fixed32 = 5;
12629       var SHIFT_LEFT_32 = (1 << 16) * (1 << 16);
12630       var SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
12631       var TEXT_DECODER_MIN_LENGTH = 12;
12632       var utf8TextDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder("utf8");
12633       Pbf.prototype = {
12634         destroy: function() {
12635           this.buf = null;
12636         },
12637         // === READING =================================================================
12638         readFields: function(readField, result, end) {
12639           end = end || this.length;
12640           while (this.pos < end) {
12641             var val = this.readVarint(), tag = val >> 3, startPos = this.pos;
12642             this.type = val & 7;
12643             readField(tag, result, this);
12644             if (this.pos === startPos)
12645               this.skip(val);
12646           }
12647           return result;
12648         },
12649         readMessage: function(readField, result) {
12650           return this.readFields(readField, result, this.readVarint() + this.pos);
12651         },
12652         readFixed32: function() {
12653           var val = readUInt32(this.buf, this.pos);
12654           this.pos += 4;
12655           return val;
12656         },
12657         readSFixed32: function() {
12658           var val = readInt32(this.buf, this.pos);
12659           this.pos += 4;
12660           return val;
12661         },
12662         // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)
12663         readFixed64: function() {
12664           var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
12665           this.pos += 8;
12666           return val;
12667         },
12668         readSFixed64: function() {
12669           var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
12670           this.pos += 8;
12671           return val;
12672         },
12673         readFloat: function() {
12674           var val = ieee754.read(this.buf, this.pos, true, 23, 4);
12675           this.pos += 4;
12676           return val;
12677         },
12678         readDouble: function() {
12679           var val = ieee754.read(this.buf, this.pos, true, 52, 8);
12680           this.pos += 8;
12681           return val;
12682         },
12683         readVarint: function(isSigned) {
12684           var buf = this.buf, val, b;
12685           b = buf[this.pos++];
12686           val = b & 127;
12687           if (b < 128)
12688             return val;
12689           b = buf[this.pos++];
12690           val |= (b & 127) << 7;
12691           if (b < 128)
12692             return val;
12693           b = buf[this.pos++];
12694           val |= (b & 127) << 14;
12695           if (b < 128)
12696             return val;
12697           b = buf[this.pos++];
12698           val |= (b & 127) << 21;
12699           if (b < 128)
12700             return val;
12701           b = buf[this.pos];
12702           val |= (b & 15) << 28;
12703           return readVarintRemainder(val, isSigned, this);
12704         },
12705         readVarint64: function() {
12706           return this.readVarint(true);
12707         },
12708         readSVarint: function() {
12709           var num = this.readVarint();
12710           return num % 2 === 1 ? (num + 1) / -2 : num / 2;
12711         },
12712         readBoolean: function() {
12713           return Boolean(this.readVarint());
12714         },
12715         readString: function() {
12716           var end = this.readVarint() + this.pos;
12717           var pos = this.pos;
12718           this.pos = end;
12719           if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
12720             return readUtf8TextDecoder(this.buf, pos, end);
12721           }
12722           return readUtf8(this.buf, pos, end);
12723         },
12724         readBytes: function() {
12725           var end = this.readVarint() + this.pos, buffer = this.buf.subarray(this.pos, end);
12726           this.pos = end;
12727           return buffer;
12728         },
12729         // verbose for performance reasons; doesn't affect gzipped size
12730         readPackedVarint: function(arr, isSigned) {
12731           if (this.type !== Pbf.Bytes)
12732             return arr.push(this.readVarint(isSigned));
12733           var end = readPackedEnd(this);
12734           arr = arr || [];
12735           while (this.pos < end)
12736             arr.push(this.readVarint(isSigned));
12737           return arr;
12738         },
12739         readPackedSVarint: function(arr) {
12740           if (this.type !== Pbf.Bytes)
12741             return arr.push(this.readSVarint());
12742           var end = readPackedEnd(this);
12743           arr = arr || [];
12744           while (this.pos < end)
12745             arr.push(this.readSVarint());
12746           return arr;
12747         },
12748         readPackedBoolean: function(arr) {
12749           if (this.type !== Pbf.Bytes)
12750             return arr.push(this.readBoolean());
12751           var end = readPackedEnd(this);
12752           arr = arr || [];
12753           while (this.pos < end)
12754             arr.push(this.readBoolean());
12755           return arr;
12756         },
12757         readPackedFloat: function(arr) {
12758           if (this.type !== Pbf.Bytes)
12759             return arr.push(this.readFloat());
12760           var end = readPackedEnd(this);
12761           arr = arr || [];
12762           while (this.pos < end)
12763             arr.push(this.readFloat());
12764           return arr;
12765         },
12766         readPackedDouble: function(arr) {
12767           if (this.type !== Pbf.Bytes)
12768             return arr.push(this.readDouble());
12769           var end = readPackedEnd(this);
12770           arr = arr || [];
12771           while (this.pos < end)
12772             arr.push(this.readDouble());
12773           return arr;
12774         },
12775         readPackedFixed32: function(arr) {
12776           if (this.type !== Pbf.Bytes)
12777             return arr.push(this.readFixed32());
12778           var end = readPackedEnd(this);
12779           arr = arr || [];
12780           while (this.pos < end)
12781             arr.push(this.readFixed32());
12782           return arr;
12783         },
12784         readPackedSFixed32: function(arr) {
12785           if (this.type !== Pbf.Bytes)
12786             return arr.push(this.readSFixed32());
12787           var end = readPackedEnd(this);
12788           arr = arr || [];
12789           while (this.pos < end)
12790             arr.push(this.readSFixed32());
12791           return arr;
12792         },
12793         readPackedFixed64: function(arr) {
12794           if (this.type !== Pbf.Bytes)
12795             return arr.push(this.readFixed64());
12796           var end = readPackedEnd(this);
12797           arr = arr || [];
12798           while (this.pos < end)
12799             arr.push(this.readFixed64());
12800           return arr;
12801         },
12802         readPackedSFixed64: function(arr) {
12803           if (this.type !== Pbf.Bytes)
12804             return arr.push(this.readSFixed64());
12805           var end = readPackedEnd(this);
12806           arr = arr || [];
12807           while (this.pos < end)
12808             arr.push(this.readSFixed64());
12809           return arr;
12810         },
12811         skip: function(val) {
12812           var type2 = val & 7;
12813           if (type2 === Pbf.Varint)
12814             while (this.buf[this.pos++] > 127) {
12815             }
12816           else if (type2 === Pbf.Bytes)
12817             this.pos = this.readVarint() + this.pos;
12818           else if (type2 === Pbf.Fixed32)
12819             this.pos += 4;
12820           else if (type2 === Pbf.Fixed64)
12821             this.pos += 8;
12822           else
12823             throw new Error("Unimplemented type: " + type2);
12824         },
12825         // === WRITING =================================================================
12826         writeTag: function(tag, type2) {
12827           this.writeVarint(tag << 3 | type2);
12828         },
12829         realloc: function(min3) {
12830           var length = this.length || 16;
12831           while (length < this.pos + min3)
12832             length *= 2;
12833           if (length !== this.length) {
12834             var buf = new Uint8Array(length);
12835             buf.set(this.buf);
12836             this.buf = buf;
12837             this.length = length;
12838           }
12839         },
12840         finish: function() {
12841           this.length = this.pos;
12842           this.pos = 0;
12843           return this.buf.subarray(0, this.length);
12844         },
12845         writeFixed32: function(val) {
12846           this.realloc(4);
12847           writeInt32(this.buf, val, this.pos);
12848           this.pos += 4;
12849         },
12850         writeSFixed32: function(val) {
12851           this.realloc(4);
12852           writeInt32(this.buf, val, this.pos);
12853           this.pos += 4;
12854         },
12855         writeFixed64: function(val) {
12856           this.realloc(8);
12857           writeInt32(this.buf, val & -1, this.pos);
12858           writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
12859           this.pos += 8;
12860         },
12861         writeSFixed64: function(val) {
12862           this.realloc(8);
12863           writeInt32(this.buf, val & -1, this.pos);
12864           writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
12865           this.pos += 8;
12866         },
12867         writeVarint: function(val) {
12868           val = +val || 0;
12869           if (val > 268435455 || val < 0) {
12870             writeBigVarint(val, this);
12871             return;
12872           }
12873           this.realloc(4);
12874           this.buf[this.pos++] = val & 127 | (val > 127 ? 128 : 0);
12875           if (val <= 127)
12876             return;
12877           this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
12878           if (val <= 127)
12879             return;
12880           this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
12881           if (val <= 127)
12882             return;
12883           this.buf[this.pos++] = val >>> 7 & 127;
12884         },
12885         writeSVarint: function(val) {
12886           this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);
12887         },
12888         writeBoolean: function(val) {
12889           this.writeVarint(Boolean(val));
12890         },
12891         writeString: function(str2) {
12892           str2 = String(str2);
12893           this.realloc(str2.length * 4);
12894           this.pos++;
12895           var startPos = this.pos;
12896           this.pos = writeUtf8(this.buf, str2, this.pos);
12897           var len = this.pos - startPos;
12898           if (len >= 128)
12899             makeRoomForExtraLength(startPos, len, this);
12900           this.pos = startPos - 1;
12901           this.writeVarint(len);
12902           this.pos += len;
12903         },
12904         writeFloat: function(val) {
12905           this.realloc(4);
12906           ieee754.write(this.buf, val, this.pos, true, 23, 4);
12907           this.pos += 4;
12908         },
12909         writeDouble: function(val) {
12910           this.realloc(8);
12911           ieee754.write(this.buf, val, this.pos, true, 52, 8);
12912           this.pos += 8;
12913         },
12914         writeBytes: function(buffer) {
12915           var len = buffer.length;
12916           this.writeVarint(len);
12917           this.realloc(len);
12918           for (var i2 = 0; i2 < len; i2++)
12919             this.buf[this.pos++] = buffer[i2];
12920         },
12921         writeRawMessage: function(fn, obj) {
12922           this.pos++;
12923           var startPos = this.pos;
12924           fn(obj, this);
12925           var len = this.pos - startPos;
12926           if (len >= 128)
12927             makeRoomForExtraLength(startPos, len, this);
12928           this.pos = startPos - 1;
12929           this.writeVarint(len);
12930           this.pos += len;
12931         },
12932         writeMessage: function(tag, fn, obj) {
12933           this.writeTag(tag, Pbf.Bytes);
12934           this.writeRawMessage(fn, obj);
12935         },
12936         writePackedVarint: function(tag, arr) {
12937           if (arr.length)
12938             this.writeMessage(tag, writePackedVarint, arr);
12939         },
12940         writePackedSVarint: function(tag, arr) {
12941           if (arr.length)
12942             this.writeMessage(tag, writePackedSVarint, arr);
12943         },
12944         writePackedBoolean: function(tag, arr) {
12945           if (arr.length)
12946             this.writeMessage(tag, writePackedBoolean, arr);
12947         },
12948         writePackedFloat: function(tag, arr) {
12949           if (arr.length)
12950             this.writeMessage(tag, writePackedFloat, arr);
12951         },
12952         writePackedDouble: function(tag, arr) {
12953           if (arr.length)
12954             this.writeMessage(tag, writePackedDouble, arr);
12955         },
12956         writePackedFixed32: function(tag, arr) {
12957           if (arr.length)
12958             this.writeMessage(tag, writePackedFixed32, arr);
12959         },
12960         writePackedSFixed32: function(tag, arr) {
12961           if (arr.length)
12962             this.writeMessage(tag, writePackedSFixed32, arr);
12963         },
12964         writePackedFixed64: function(tag, arr) {
12965           if (arr.length)
12966             this.writeMessage(tag, writePackedFixed64, arr);
12967         },
12968         writePackedSFixed64: function(tag, arr) {
12969           if (arr.length)
12970             this.writeMessage(tag, writePackedSFixed64, arr);
12971         },
12972         writeBytesField: function(tag, buffer) {
12973           this.writeTag(tag, Pbf.Bytes);
12974           this.writeBytes(buffer);
12975         },
12976         writeFixed32Field: function(tag, val) {
12977           this.writeTag(tag, Pbf.Fixed32);
12978           this.writeFixed32(val);
12979         },
12980         writeSFixed32Field: function(tag, val) {
12981           this.writeTag(tag, Pbf.Fixed32);
12982           this.writeSFixed32(val);
12983         },
12984         writeFixed64Field: function(tag, val) {
12985           this.writeTag(tag, Pbf.Fixed64);
12986           this.writeFixed64(val);
12987         },
12988         writeSFixed64Field: function(tag, val) {
12989           this.writeTag(tag, Pbf.Fixed64);
12990           this.writeSFixed64(val);
12991         },
12992         writeVarintField: function(tag, val) {
12993           this.writeTag(tag, Pbf.Varint);
12994           this.writeVarint(val);
12995         },
12996         writeSVarintField: function(tag, val) {
12997           this.writeTag(tag, Pbf.Varint);
12998           this.writeSVarint(val);
12999         },
13000         writeStringField: function(tag, str2) {
13001           this.writeTag(tag, Pbf.Bytes);
13002           this.writeString(str2);
13003         },
13004         writeFloatField: function(tag, val) {
13005           this.writeTag(tag, Pbf.Fixed32);
13006           this.writeFloat(val);
13007         },
13008         writeDoubleField: function(tag, val) {
13009           this.writeTag(tag, Pbf.Fixed64);
13010           this.writeDouble(val);
13011         },
13012         writeBooleanField: function(tag, val) {
13013           this.writeVarintField(tag, Boolean(val));
13014         }
13015       };
13016       function readVarintRemainder(l, s, p) {
13017         var buf = p.buf, h, b;
13018         b = buf[p.pos++];
13019         h = (b & 112) >> 4;
13020         if (b < 128)
13021           return toNum(l, h, s);
13022         b = buf[p.pos++];
13023         h |= (b & 127) << 3;
13024         if (b < 128)
13025           return toNum(l, h, s);
13026         b = buf[p.pos++];
13027         h |= (b & 127) << 10;
13028         if (b < 128)
13029           return toNum(l, h, s);
13030         b = buf[p.pos++];
13031         h |= (b & 127) << 17;
13032         if (b < 128)
13033           return toNum(l, h, s);
13034         b = buf[p.pos++];
13035         h |= (b & 127) << 24;
13036         if (b < 128)
13037           return toNum(l, h, s);
13038         b = buf[p.pos++];
13039         h |= (b & 1) << 31;
13040         if (b < 128)
13041           return toNum(l, h, s);
13042         throw new Error("Expected varint not more than 10 bytes");
13043       }
13044       function readPackedEnd(pbf) {
13045         return pbf.type === Pbf.Bytes ? pbf.readVarint() + pbf.pos : pbf.pos + 1;
13046       }
13047       function toNum(low, high, isSigned) {
13048         if (isSigned) {
13049           return high * 4294967296 + (low >>> 0);
13050         }
13051         return (high >>> 0) * 4294967296 + (low >>> 0);
13052       }
13053       function writeBigVarint(val, pbf) {
13054         var low, high;
13055         if (val >= 0) {
13056           low = val % 4294967296 | 0;
13057           high = val / 4294967296 | 0;
13058         } else {
13059           low = ~(-val % 4294967296);
13060           high = ~(-val / 4294967296);
13061           if (low ^ 4294967295) {
13062             low = low + 1 | 0;
13063           } else {
13064             low = 0;
13065             high = high + 1 | 0;
13066           }
13067         }
13068         if (val >= 18446744073709552e3 || val < -18446744073709552e3) {
13069           throw new Error("Given varint doesn't fit into 10 bytes");
13070         }
13071         pbf.realloc(10);
13072         writeBigVarintLow(low, high, pbf);
13073         writeBigVarintHigh(high, pbf);
13074       }
13075       function writeBigVarintLow(low, high, pbf) {
13076         pbf.buf[pbf.pos++] = low & 127 | 128;
13077         low >>>= 7;
13078         pbf.buf[pbf.pos++] = low & 127 | 128;
13079         low >>>= 7;
13080         pbf.buf[pbf.pos++] = low & 127 | 128;
13081         low >>>= 7;
13082         pbf.buf[pbf.pos++] = low & 127 | 128;
13083         low >>>= 7;
13084         pbf.buf[pbf.pos] = low & 127;
13085       }
13086       function writeBigVarintHigh(high, pbf) {
13087         var lsb = (high & 7) << 4;
13088         pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 128 : 0);
13089         if (!high)
13090           return;
13091         pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
13092         if (!high)
13093           return;
13094         pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
13095         if (!high)
13096           return;
13097         pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
13098         if (!high)
13099           return;
13100         pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
13101         if (!high)
13102           return;
13103         pbf.buf[pbf.pos++] = high & 127;
13104       }
13105       function makeRoomForExtraLength(startPos, len, pbf) {
13106         var extraLen = len <= 16383 ? 1 : len <= 2097151 ? 2 : len <= 268435455 ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
13107         pbf.realloc(extraLen);
13108         for (var i2 = pbf.pos - 1; i2 >= startPos; i2--)
13109           pbf.buf[i2 + extraLen] = pbf.buf[i2];
13110       }
13111       function writePackedVarint(arr, pbf) {
13112         for (var i2 = 0; i2 < arr.length; i2++)
13113           pbf.writeVarint(arr[i2]);
13114       }
13115       function writePackedSVarint(arr, pbf) {
13116         for (var i2 = 0; i2 < arr.length; i2++)
13117           pbf.writeSVarint(arr[i2]);
13118       }
13119       function writePackedFloat(arr, pbf) {
13120         for (var i2 = 0; i2 < arr.length; i2++)
13121           pbf.writeFloat(arr[i2]);
13122       }
13123       function writePackedDouble(arr, pbf) {
13124         for (var i2 = 0; i2 < arr.length; i2++)
13125           pbf.writeDouble(arr[i2]);
13126       }
13127       function writePackedBoolean(arr, pbf) {
13128         for (var i2 = 0; i2 < arr.length; i2++)
13129           pbf.writeBoolean(arr[i2]);
13130       }
13131       function writePackedFixed32(arr, pbf) {
13132         for (var i2 = 0; i2 < arr.length; i2++)
13133           pbf.writeFixed32(arr[i2]);
13134       }
13135       function writePackedSFixed32(arr, pbf) {
13136         for (var i2 = 0; i2 < arr.length; i2++)
13137           pbf.writeSFixed32(arr[i2]);
13138       }
13139       function writePackedFixed64(arr, pbf) {
13140         for (var i2 = 0; i2 < arr.length; i2++)
13141           pbf.writeFixed64(arr[i2]);
13142       }
13143       function writePackedSFixed64(arr, pbf) {
13144         for (var i2 = 0; i2 < arr.length; i2++)
13145           pbf.writeSFixed64(arr[i2]);
13146       }
13147       function readUInt32(buf, pos) {
13148         return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + buf[pos + 3] * 16777216;
13149       }
13150       function writeInt32(buf, val, pos) {
13151         buf[pos] = val;
13152         buf[pos + 1] = val >>> 8;
13153         buf[pos + 2] = val >>> 16;
13154         buf[pos + 3] = val >>> 24;
13155       }
13156       function readInt32(buf, pos) {
13157         return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + (buf[pos + 3] << 24);
13158       }
13159       function readUtf8(buf, pos, end) {
13160         var str2 = "";
13161         var i2 = pos;
13162         while (i2 < end) {
13163           var b0 = buf[i2];
13164           var c = null;
13165           var bytesPerSequence = b0 > 239 ? 4 : b0 > 223 ? 3 : b0 > 191 ? 2 : 1;
13166           if (i2 + bytesPerSequence > end)
13167             break;
13168           var b1, b2, b3;
13169           if (bytesPerSequence === 1) {
13170             if (b0 < 128) {
13171               c = b0;
13172             }
13173           } else if (bytesPerSequence === 2) {
13174             b1 = buf[i2 + 1];
13175             if ((b1 & 192) === 128) {
13176               c = (b0 & 31) << 6 | b1 & 63;
13177               if (c <= 127) {
13178                 c = null;
13179               }
13180             }
13181           } else if (bytesPerSequence === 3) {
13182             b1 = buf[i2 + 1];
13183             b2 = buf[i2 + 2];
13184             if ((b1 & 192) === 128 && (b2 & 192) === 128) {
13185               c = (b0 & 15) << 12 | (b1 & 63) << 6 | b2 & 63;
13186               if (c <= 2047 || c >= 55296 && c <= 57343) {
13187                 c = null;
13188               }
13189             }
13190           } else if (bytesPerSequence === 4) {
13191             b1 = buf[i2 + 1];
13192             b2 = buf[i2 + 2];
13193             b3 = buf[i2 + 3];
13194             if ((b1 & 192) === 128 && (b2 & 192) === 128 && (b3 & 192) === 128) {
13195               c = (b0 & 15) << 18 | (b1 & 63) << 12 | (b2 & 63) << 6 | b3 & 63;
13196               if (c <= 65535 || c >= 1114112) {
13197                 c = null;
13198               }
13199             }
13200           }
13201           if (c === null) {
13202             c = 65533;
13203             bytesPerSequence = 1;
13204           } else if (c > 65535) {
13205             c -= 65536;
13206             str2 += String.fromCharCode(c >>> 10 & 1023 | 55296);
13207             c = 56320 | c & 1023;
13208           }
13209           str2 += String.fromCharCode(c);
13210           i2 += bytesPerSequence;
13211         }
13212         return str2;
13213       }
13214       function readUtf8TextDecoder(buf, pos, end) {
13215         return utf8TextDecoder.decode(buf.subarray(pos, end));
13216       }
13217       function writeUtf8(buf, str2, pos) {
13218         for (var i2 = 0, c, lead; i2 < str2.length; i2++) {
13219           c = str2.charCodeAt(i2);
13220           if (c > 55295 && c < 57344) {
13221             if (lead) {
13222               if (c < 56320) {
13223                 buf[pos++] = 239;
13224                 buf[pos++] = 191;
13225                 buf[pos++] = 189;
13226                 lead = c;
13227                 continue;
13228               } else {
13229                 c = lead - 55296 << 10 | c - 56320 | 65536;
13230                 lead = null;
13231               }
13232             } else {
13233               if (c > 56319 || i2 + 1 === str2.length) {
13234                 buf[pos++] = 239;
13235                 buf[pos++] = 191;
13236                 buf[pos++] = 189;
13237               } else {
13238                 lead = c;
13239               }
13240               continue;
13241             }
13242           } else if (lead) {
13243             buf[pos++] = 239;
13244             buf[pos++] = 191;
13245             buf[pos++] = 189;
13246             lead = null;
13247           }
13248           if (c < 128) {
13249             buf[pos++] = c;
13250           } else {
13251             if (c < 2048) {
13252               buf[pos++] = c >> 6 | 192;
13253             } else {
13254               if (c < 65536) {
13255                 buf[pos++] = c >> 12 | 224;
13256               } else {
13257                 buf[pos++] = c >> 18 | 240;
13258                 buf[pos++] = c >> 12 & 63 | 128;
13259               }
13260               buf[pos++] = c >> 6 & 63 | 128;
13261             }
13262             buf[pos++] = c & 63 | 128;
13263           }
13264         }
13265         return pos;
13266       }
13267     }
13268   });
13269
13270   // node_modules/@mapbox/point-geometry/index.js
13271   var require_point_geometry = __commonJS({
13272     "node_modules/@mapbox/point-geometry/index.js"(exports2, module2) {
13273       "use strict";
13274       module2.exports = Point;
13275       function Point(x, y) {
13276         this.x = x;
13277         this.y = y;
13278       }
13279       Point.prototype = {
13280         /**
13281          * Clone this point, returning a new point that can be modified
13282          * without affecting the old one.
13283          * @return {Point} the clone
13284          */
13285         clone: function() {
13286           return new Point(this.x, this.y);
13287         },
13288         /**
13289          * Add this point's x & y coordinates to another point,
13290          * yielding a new point.
13291          * @param {Point} p the other point
13292          * @return {Point} output point
13293          */
13294         add: function(p) {
13295           return this.clone()._add(p);
13296         },
13297         /**
13298          * Subtract this point's x & y coordinates to from point,
13299          * yielding a new point.
13300          * @param {Point} p the other point
13301          * @return {Point} output point
13302          */
13303         sub: function(p) {
13304           return this.clone()._sub(p);
13305         },
13306         /**
13307          * Multiply this point's x & y coordinates by point,
13308          * yielding a new point.
13309          * @param {Point} p the other point
13310          * @return {Point} output point
13311          */
13312         multByPoint: function(p) {
13313           return this.clone()._multByPoint(p);
13314         },
13315         /**
13316          * Divide this point's x & y coordinates by point,
13317          * yielding a new point.
13318          * @param {Point} p the other point
13319          * @return {Point} output point
13320          */
13321         divByPoint: function(p) {
13322           return this.clone()._divByPoint(p);
13323         },
13324         /**
13325          * Multiply this point's x & y coordinates by a factor,
13326          * yielding a new point.
13327          * @param {Point} k factor
13328          * @return {Point} output point
13329          */
13330         mult: function(k) {
13331           return this.clone()._mult(k);
13332         },
13333         /**
13334          * Divide this point's x & y coordinates by a factor,
13335          * yielding a new point.
13336          * @param {Point} k factor
13337          * @return {Point} output point
13338          */
13339         div: function(k) {
13340           return this.clone()._div(k);
13341         },
13342         /**
13343          * Rotate this point around the 0, 0 origin by an angle a,
13344          * given in radians
13345          * @param {Number} a angle to rotate around, in radians
13346          * @return {Point} output point
13347          */
13348         rotate: function(a) {
13349           return this.clone()._rotate(a);
13350         },
13351         /**
13352          * Rotate this point around p point by an angle a,
13353          * given in radians
13354          * @param {Number} a angle to rotate around, in radians
13355          * @param {Point} p Point to rotate around
13356          * @return {Point} output point
13357          */
13358         rotateAround: function(a, p) {
13359           return this.clone()._rotateAround(a, p);
13360         },
13361         /**
13362          * Multiply this point by a 4x1 transformation matrix
13363          * @param {Array<Number>} m transformation matrix
13364          * @return {Point} output point
13365          */
13366         matMult: function(m) {
13367           return this.clone()._matMult(m);
13368         },
13369         /**
13370          * Calculate this point but as a unit vector from 0, 0, meaning
13371          * that the distance from the resulting point to the 0, 0
13372          * coordinate will be equal to 1 and the angle from the resulting
13373          * point to the 0, 0 coordinate will be the same as before.
13374          * @return {Point} unit vector point
13375          */
13376         unit: function() {
13377           return this.clone()._unit();
13378         },
13379         /**
13380          * Compute a perpendicular point, where the new y coordinate
13381          * is the old x coordinate and the new x coordinate is the old y
13382          * coordinate multiplied by -1
13383          * @return {Point} perpendicular point
13384          */
13385         perp: function() {
13386           return this.clone()._perp();
13387         },
13388         /**
13389          * Return a version of this point with the x & y coordinates
13390          * rounded to integers.
13391          * @return {Point} rounded point
13392          */
13393         round: function() {
13394           return this.clone()._round();
13395         },
13396         /**
13397          * Return the magitude of this point: this is the Euclidean
13398          * distance from the 0, 0 coordinate to this point's x and y
13399          * coordinates.
13400          * @return {Number} magnitude
13401          */
13402         mag: function() {
13403           return Math.sqrt(this.x * this.x + this.y * this.y);
13404         },
13405         /**
13406          * Judge whether this point is equal to another point, returning
13407          * true or false.
13408          * @param {Point} other the other point
13409          * @return {boolean} whether the points are equal
13410          */
13411         equals: function(other) {
13412           return this.x === other.x && this.y === other.y;
13413         },
13414         /**
13415          * Calculate the distance from this point to another point
13416          * @param {Point} p the other point
13417          * @return {Number} distance
13418          */
13419         dist: function(p) {
13420           return Math.sqrt(this.distSqr(p));
13421         },
13422         /**
13423          * Calculate the distance from this point to another point,
13424          * without the square root step. Useful if you're comparing
13425          * relative distances.
13426          * @param {Point} p the other point
13427          * @return {Number} distance
13428          */
13429         distSqr: function(p) {
13430           var dx = p.x - this.x, dy = p.y - this.y;
13431           return dx * dx + dy * dy;
13432         },
13433         /**
13434          * Get the angle from the 0, 0 coordinate to this point, in radians
13435          * coordinates.
13436          * @return {Number} angle
13437          */
13438         angle: function() {
13439           return Math.atan2(this.y, this.x);
13440         },
13441         /**
13442          * Get the angle from this point to another point, in radians
13443          * @param {Point} b the other point
13444          * @return {Number} angle
13445          */
13446         angleTo: function(b) {
13447           return Math.atan2(this.y - b.y, this.x - b.x);
13448         },
13449         /**
13450          * Get the angle between this point and another point, in radians
13451          * @param {Point} b the other point
13452          * @return {Number} angle
13453          */
13454         angleWith: function(b) {
13455           return this.angleWithSep(b.x, b.y);
13456         },
13457         /*
13458          * Find the angle of the two vectors, solving the formula for
13459          * the cross product a x b = |a||b|sin(θ) for θ.
13460          * @param {Number} x the x-coordinate
13461          * @param {Number} y the y-coordinate
13462          * @return {Number} the angle in radians
13463          */
13464         angleWithSep: function(x, y) {
13465           return Math.atan2(
13466             this.x * y - this.y * x,
13467             this.x * x + this.y * y
13468           );
13469         },
13470         _matMult: function(m) {
13471           var x = m[0] * this.x + m[1] * this.y, y = m[2] * this.x + m[3] * this.y;
13472           this.x = x;
13473           this.y = y;
13474           return this;
13475         },
13476         _add: function(p) {
13477           this.x += p.x;
13478           this.y += p.y;
13479           return this;
13480         },
13481         _sub: function(p) {
13482           this.x -= p.x;
13483           this.y -= p.y;
13484           return this;
13485         },
13486         _mult: function(k) {
13487           this.x *= k;
13488           this.y *= k;
13489           return this;
13490         },
13491         _div: function(k) {
13492           this.x /= k;
13493           this.y /= k;
13494           return this;
13495         },
13496         _multByPoint: function(p) {
13497           this.x *= p.x;
13498           this.y *= p.y;
13499           return this;
13500         },
13501         _divByPoint: function(p) {
13502           this.x /= p.x;
13503           this.y /= p.y;
13504           return this;
13505         },
13506         _unit: function() {
13507           this._div(this.mag());
13508           return this;
13509         },
13510         _perp: function() {
13511           var y = this.y;
13512           this.y = this.x;
13513           this.x = -y;
13514           return this;
13515         },
13516         _rotate: function(angle2) {
13517           var cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x = cos2 * this.x - sin2 * this.y, y = sin2 * this.x + cos2 * this.y;
13518           this.x = x;
13519           this.y = y;
13520           return this;
13521         },
13522         _rotateAround: function(angle2, p) {
13523           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);
13524           this.x = x;
13525           this.y = y;
13526           return this;
13527         },
13528         _round: function() {
13529           this.x = Math.round(this.x);
13530           this.y = Math.round(this.y);
13531           return this;
13532         }
13533       };
13534       Point.convert = function(a) {
13535         if (a instanceof Point) {
13536           return a;
13537         }
13538         if (Array.isArray(a)) {
13539           return new Point(a[0], a[1]);
13540         }
13541         return a;
13542       };
13543     }
13544   });
13545
13546   // node_modules/@mapbox/vector-tile/lib/vectortilefeature.js
13547   var require_vectortilefeature = __commonJS({
13548     "node_modules/@mapbox/vector-tile/lib/vectortilefeature.js"(exports2, module2) {
13549       "use strict";
13550       var Point = require_point_geometry();
13551       module2.exports = VectorTileFeature;
13552       function VectorTileFeature(pbf, end, extent, keys2, values) {
13553         this.properties = {};
13554         this.extent = extent;
13555         this.type = 0;
13556         this._pbf = pbf;
13557         this._geometry = -1;
13558         this._keys = keys2;
13559         this._values = values;
13560         pbf.readFields(readFeature, this, end);
13561       }
13562       function readFeature(tag, feature3, pbf) {
13563         if (tag == 1)
13564           feature3.id = pbf.readVarint();
13565         else if (tag == 2)
13566           readTag(pbf, feature3);
13567         else if (tag == 3)
13568           feature3.type = pbf.readVarint();
13569         else if (tag == 4)
13570           feature3._geometry = pbf.pos;
13571       }
13572       function readTag(pbf, feature3) {
13573         var end = pbf.readVarint() + pbf.pos;
13574         while (pbf.pos < end) {
13575           var key = feature3._keys[pbf.readVarint()], value = feature3._values[pbf.readVarint()];
13576           feature3.properties[key] = value;
13577         }
13578       }
13579       VectorTileFeature.types = ["Unknown", "Point", "LineString", "Polygon"];
13580       VectorTileFeature.prototype.loadGeometry = function() {
13581         var pbf = this._pbf;
13582         pbf.pos = this._geometry;
13583         var end = pbf.readVarint() + pbf.pos, cmd = 1, length = 0, x = 0, y = 0, lines = [], line;
13584         while (pbf.pos < end) {
13585           if (length <= 0) {
13586             var cmdLen = pbf.readVarint();
13587             cmd = cmdLen & 7;
13588             length = cmdLen >> 3;
13589           }
13590           length--;
13591           if (cmd === 1 || cmd === 2) {
13592             x += pbf.readSVarint();
13593             y += pbf.readSVarint();
13594             if (cmd === 1) {
13595               if (line)
13596                 lines.push(line);
13597               line = [];
13598             }
13599             line.push(new Point(x, y));
13600           } else if (cmd === 7) {
13601             if (line) {
13602               line.push(line[0].clone());
13603             }
13604           } else {
13605             throw new Error("unknown command " + cmd);
13606           }
13607         }
13608         if (line)
13609           lines.push(line);
13610         return lines;
13611       };
13612       VectorTileFeature.prototype.bbox = function() {
13613         var pbf = this._pbf;
13614         pbf.pos = this._geometry;
13615         var end = pbf.readVarint() + pbf.pos, cmd = 1, length = 0, x = 0, y = 0, x12 = Infinity, x2 = -Infinity, y12 = Infinity, y2 = -Infinity;
13616         while (pbf.pos < end) {
13617           if (length <= 0) {
13618             var cmdLen = pbf.readVarint();
13619             cmd = cmdLen & 7;
13620             length = cmdLen >> 3;
13621           }
13622           length--;
13623           if (cmd === 1 || cmd === 2) {
13624             x += pbf.readSVarint();
13625             y += pbf.readSVarint();
13626             if (x < x12)
13627               x12 = x;
13628             if (x > x2)
13629               x2 = x;
13630             if (y < y12)
13631               y12 = y;
13632             if (y > y2)
13633               y2 = y;
13634           } else if (cmd !== 7) {
13635             throw new Error("unknown command " + cmd);
13636           }
13637         }
13638         return [x12, y12, x2, y2];
13639       };
13640       VectorTileFeature.prototype.toGeoJSON = function(x, y, z) {
13641         var size = this.extent * Math.pow(2, z), x05 = this.extent * x, y05 = this.extent * y, coords = this.loadGeometry(), type2 = VectorTileFeature.types[this.type], i2, j2;
13642         function project(line) {
13643           for (var j3 = 0; j3 < line.length; j3++) {
13644             var p = line[j3], y2 = 180 - (p.y + y05) * 360 / size;
13645             line[j3] = [
13646               (p.x + x05) * 360 / size - 180,
13647               360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90
13648             ];
13649           }
13650         }
13651         switch (this.type) {
13652           case 1:
13653             var points = [];
13654             for (i2 = 0; i2 < coords.length; i2++) {
13655               points[i2] = coords[i2][0];
13656             }
13657             coords = points;
13658             project(coords);
13659             break;
13660           case 2:
13661             for (i2 = 0; i2 < coords.length; i2++) {
13662               project(coords[i2]);
13663             }
13664             break;
13665           case 3:
13666             coords = classifyRings(coords);
13667             for (i2 = 0; i2 < coords.length; i2++) {
13668               for (j2 = 0; j2 < coords[i2].length; j2++) {
13669                 project(coords[i2][j2]);
13670               }
13671             }
13672             break;
13673         }
13674         if (coords.length === 1) {
13675           coords = coords[0];
13676         } else {
13677           type2 = "Multi" + type2;
13678         }
13679         var result = {
13680           type: "Feature",
13681           geometry: {
13682             type: type2,
13683             coordinates: coords
13684           },
13685           properties: this.properties
13686         };
13687         if ("id" in this) {
13688           result.id = this.id;
13689         }
13690         return result;
13691       };
13692       function classifyRings(rings) {
13693         var len = rings.length;
13694         if (len <= 1)
13695           return [rings];
13696         var polygons = [], polygon2, ccw;
13697         for (var i2 = 0; i2 < len; i2++) {
13698           var area = signedArea(rings[i2]);
13699           if (area === 0)
13700             continue;
13701           if (ccw === void 0)
13702             ccw = area < 0;
13703           if (ccw === area < 0) {
13704             if (polygon2)
13705               polygons.push(polygon2);
13706             polygon2 = [rings[i2]];
13707           } else {
13708             polygon2.push(rings[i2]);
13709           }
13710         }
13711         if (polygon2)
13712           polygons.push(polygon2);
13713         return polygons;
13714       }
13715       function signedArea(ring) {
13716         var sum = 0;
13717         for (var i2 = 0, len = ring.length, j2 = len - 1, p1, p2; i2 < len; j2 = i2++) {
13718           p1 = ring[i2];
13719           p2 = ring[j2];
13720           sum += (p2.x - p1.x) * (p1.y + p2.y);
13721         }
13722         return sum;
13723       }
13724     }
13725   });
13726
13727   // node_modules/@mapbox/vector-tile/lib/vectortilelayer.js
13728   var require_vectortilelayer = __commonJS({
13729     "node_modules/@mapbox/vector-tile/lib/vectortilelayer.js"(exports2, module2) {
13730       "use strict";
13731       var VectorTileFeature = require_vectortilefeature();
13732       module2.exports = VectorTileLayer;
13733       function VectorTileLayer(pbf, end) {
13734         this.version = 1;
13735         this.name = null;
13736         this.extent = 4096;
13737         this.length = 0;
13738         this._pbf = pbf;
13739         this._keys = [];
13740         this._values = [];
13741         this._features = [];
13742         pbf.readFields(readLayer, this, end);
13743         this.length = this._features.length;
13744       }
13745       function readLayer(tag, layer, pbf) {
13746         if (tag === 15)
13747           layer.version = pbf.readVarint();
13748         else if (tag === 1)
13749           layer.name = pbf.readString();
13750         else if (tag === 5)
13751           layer.extent = pbf.readVarint();
13752         else if (tag === 2)
13753           layer._features.push(pbf.pos);
13754         else if (tag === 3)
13755           layer._keys.push(pbf.readString());
13756         else if (tag === 4)
13757           layer._values.push(readValueMessage(pbf));
13758       }
13759       function readValueMessage(pbf) {
13760         var value = null, end = pbf.readVarint() + pbf.pos;
13761         while (pbf.pos < end) {
13762           var tag = pbf.readVarint() >> 3;
13763           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;
13764         }
13765         return value;
13766       }
13767       VectorTileLayer.prototype.feature = function(i2) {
13768         if (i2 < 0 || i2 >= this._features.length)
13769           throw new Error("feature index out of bounds");
13770         this._pbf.pos = this._features[i2];
13771         var end = this._pbf.readVarint() + this._pbf.pos;
13772         return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);
13773       };
13774     }
13775   });
13776
13777   // node_modules/@mapbox/vector-tile/lib/vectortile.js
13778   var require_vectortile = __commonJS({
13779     "node_modules/@mapbox/vector-tile/lib/vectortile.js"(exports2, module2) {
13780       "use strict";
13781       var VectorTileLayer = require_vectortilelayer();
13782       module2.exports = VectorTile2;
13783       function VectorTile2(pbf, end) {
13784         this.layers = pbf.readFields(readTile, {}, end);
13785       }
13786       function readTile(tag, layers, pbf) {
13787         if (tag === 3) {
13788           var layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
13789           if (layer.length)
13790             layers[layer.name] = layer;
13791         }
13792       }
13793     }
13794   });
13795
13796   // node_modules/@mapbox/vector-tile/index.js
13797   var require_vector_tile = __commonJS({
13798     "node_modules/@mapbox/vector-tile/index.js"(exports2, module2) {
13799       module2.exports.VectorTile = require_vectortile();
13800       module2.exports.VectorTileFeature = require_vectortilefeature();
13801       module2.exports.VectorTileLayer = require_vectortilelayer();
13802     }
13803   });
13804
13805   // node_modules/fast-json-stable-stringify/index.js
13806   var require_fast_json_stable_stringify = __commonJS({
13807     "node_modules/fast-json-stable-stringify/index.js"(exports2, module2) {
13808       "use strict";
13809       module2.exports = function(data, opts) {
13810         if (!opts)
13811           opts = {};
13812         if (typeof opts === "function")
13813           opts = { cmp: opts };
13814         var cycles = typeof opts.cycles === "boolean" ? opts.cycles : false;
13815         var cmp = opts.cmp && function(f2) {
13816           return function(node) {
13817             return function(a, b) {
13818               var aobj = { key: a, value: node[a] };
13819               var bobj = { key: b, value: node[b] };
13820               return f2(aobj, bobj);
13821             };
13822           };
13823         }(opts.cmp);
13824         var seen = [];
13825         return function stringify3(node) {
13826           if (node && node.toJSON && typeof node.toJSON === "function") {
13827             node = node.toJSON();
13828           }
13829           if (node === void 0)
13830             return;
13831           if (typeof node == "number")
13832             return isFinite(node) ? "" + node : "null";
13833           if (typeof node !== "object")
13834             return JSON.stringify(node);
13835           var i2, out;
13836           if (Array.isArray(node)) {
13837             out = "[";
13838             for (i2 = 0; i2 < node.length; i2++) {
13839               if (i2)
13840                 out += ",";
13841               out += stringify3(node[i2]) || "null";
13842             }
13843             return out + "]";
13844           }
13845           if (node === null)
13846             return "null";
13847           if (seen.indexOf(node) !== -1) {
13848             if (cycles)
13849               return JSON.stringify("__cycle__");
13850             throw new TypeError("Converting circular structure to JSON");
13851           }
13852           var seenIndex = seen.push(node) - 1;
13853           var keys2 = Object.keys(node).sort(cmp && cmp(node));
13854           out = "";
13855           for (i2 = 0; i2 < keys2.length; i2++) {
13856             var key = keys2[i2];
13857             var value = stringify3(node[key]);
13858             if (!value)
13859               continue;
13860             if (out)
13861               out += ",";
13862             out += JSON.stringify(key) + ":" + value;
13863           }
13864           seen.splice(seenIndex, 1);
13865           return "{" + out + "}";
13866         }(data);
13867       };
13868     }
13869   });
13870
13871   // node_modules/@mapbox/sexagesimal/index.js
13872   var require_sexagesimal = __commonJS({
13873     "node_modules/@mapbox/sexagesimal/index.js"(exports2, module2) {
13874       module2.exports = element;
13875       module2.exports.pair = pair2;
13876       module2.exports.format = format2;
13877       module2.exports.formatPair = formatPair;
13878       module2.exports.coordToDMS = coordToDMS;
13879       function element(input, dims) {
13880         var result = search(input, dims);
13881         return result === null ? null : result.val;
13882       }
13883       function formatPair(input) {
13884         return format2(input.lat, "lat") + " " + format2(input.lon, "lon");
13885       }
13886       function format2(input, dim) {
13887         var dms = coordToDMS(input, dim);
13888         return dms.whole + "\xB0 " + (dms.minutes ? dms.minutes + "' " : "") + (dms.seconds ? dms.seconds + '" ' : "") + dms.dir;
13889       }
13890       function coordToDMS(input, dim) {
13891         var dirs = { lat: ["N", "S"], lon: ["E", "W"] }[dim] || "";
13892         var dir = dirs[input >= 0 ? 0 : 1];
13893         var abs3 = Math.abs(input);
13894         var whole = Math.floor(abs3);
13895         var fraction = abs3 - whole;
13896         var fractionMinutes = fraction * 60;
13897         var minutes = Math.floor(fractionMinutes);
13898         var seconds = Math.floor((fractionMinutes - minutes) * 60);
13899         return {
13900           whole,
13901           minutes,
13902           seconds,
13903           dir
13904         };
13905       }
13906       function search(input, dims) {
13907         if (!dims)
13908           dims = "NSEW";
13909         if (typeof input !== "string")
13910           return null;
13911         input = input.toUpperCase();
13912         var regex = /^[\s\,]*([NSEW])?\s*([\-|\—|\―]?[0-9.]+)[°º˚]?\s*(?:([0-9.]+)['’′‘]\s*)?(?:([0-9.]+)(?:''|"|”|″)\s*)?([NSEW])?/;
13913         var m = input.match(regex);
13914         if (!m)
13915           return null;
13916         var matched = m[0];
13917         var dim;
13918         if (m[1] && m[5]) {
13919           dim = m[1];
13920           matched = matched.slice(0, -1);
13921         } else {
13922           dim = m[1] || m[5];
13923         }
13924         if (dim && dims.indexOf(dim) === -1)
13925           return null;
13926         var deg = m[2] ? parseFloat(m[2]) : 0;
13927         var min3 = m[3] ? parseFloat(m[3]) / 60 : 0;
13928         var sec = m[4] ? parseFloat(m[4]) / 3600 : 0;
13929         var sign2 = deg < 0 ? -1 : 1;
13930         if (dim === "S" || dim === "W")
13931           sign2 *= -1;
13932         return {
13933           val: (Math.abs(deg) + min3 + sec) * sign2,
13934           dim,
13935           matched,
13936           remain: input.slice(matched.length)
13937         };
13938       }
13939       function pair2(input, dims) {
13940         input = input.trim();
13941         var one2 = search(input, dims);
13942         if (!one2)
13943           return null;
13944         input = one2.remain.trim();
13945         var two = search(input, dims);
13946         if (!two || two.remain)
13947           return null;
13948         if (one2.dim) {
13949           return swapdim(one2.val, two.val, one2.dim);
13950         } else {
13951           return [one2.val, two.val];
13952         }
13953       }
13954       function swapdim(a, b, dim) {
13955         if (dim === "N" || dim === "S")
13956           return [a, b];
13957         if (dim === "W" || dim === "E")
13958           return [b, a];
13959       }
13960     }
13961   });
13962
13963   // node_modules/store/src/util.js
13964   var require_util = __commonJS({
13965     "node_modules/store/src/util.js"(exports2, module2) {
13966       var assign = make_assign();
13967       var create2 = make_create();
13968       var trim = make_trim();
13969       var Global = typeof window !== "undefined" ? window : global;
13970       module2.exports = {
13971         assign,
13972         create: create2,
13973         trim,
13974         bind,
13975         slice,
13976         each,
13977         map: map2,
13978         pluck,
13979         isList,
13980         isFunction: isFunction2,
13981         isObject: isObject3,
13982         Global
13983       };
13984       function make_assign() {
13985         if (Object.assign) {
13986           return Object.assign;
13987         } else {
13988           return function shimAssign(obj, props1, props2, etc) {
13989             for (var i2 = 1; i2 < arguments.length; i2++) {
13990               each(Object(arguments[i2]), function(val, key) {
13991                 obj[key] = val;
13992               });
13993             }
13994             return obj;
13995           };
13996         }
13997       }
13998       function make_create() {
13999         if (Object.create) {
14000           return function create3(obj, assignProps1, assignProps2, etc) {
14001             var assignArgsList = slice(arguments, 1);
14002             return assign.apply(this, [Object.create(obj)].concat(assignArgsList));
14003           };
14004         } else {
14005           let F2 = function() {
14006           };
14007           var F = F2;
14008           return function create3(obj, assignProps1, assignProps2, etc) {
14009             var assignArgsList = slice(arguments, 1);
14010             F2.prototype = obj;
14011             return assign.apply(this, [new F2()].concat(assignArgsList));
14012           };
14013         }
14014       }
14015       function make_trim() {
14016         if (String.prototype.trim) {
14017           return function trim2(str2) {
14018             return String.prototype.trim.call(str2);
14019           };
14020         } else {
14021           return function trim2(str2) {
14022             return str2.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
14023           };
14024         }
14025       }
14026       function bind(obj, fn) {
14027         return function() {
14028           return fn.apply(obj, Array.prototype.slice.call(arguments, 0));
14029         };
14030       }
14031       function slice(arr, index) {
14032         return Array.prototype.slice.call(arr, index || 0);
14033       }
14034       function each(obj, fn) {
14035         pluck(obj, function(val, key) {
14036           fn(val, key);
14037           return false;
14038         });
14039       }
14040       function map2(obj, fn) {
14041         var res = isList(obj) ? [] : {};
14042         pluck(obj, function(v, k) {
14043           res[k] = fn(v, k);
14044           return false;
14045         });
14046         return res;
14047       }
14048       function pluck(obj, fn) {
14049         if (isList(obj)) {
14050           for (var i2 = 0; i2 < obj.length; i2++) {
14051             if (fn(obj[i2], i2)) {
14052               return obj[i2];
14053             }
14054           }
14055         } else {
14056           for (var key in obj) {
14057             if (obj.hasOwnProperty(key)) {
14058               if (fn(obj[key], key)) {
14059                 return obj[key];
14060               }
14061             }
14062           }
14063         }
14064       }
14065       function isList(val) {
14066         return val != null && typeof val != "function" && typeof val.length == "number";
14067       }
14068       function isFunction2(val) {
14069         return val && {}.toString.call(val) === "[object Function]";
14070       }
14071       function isObject3(val) {
14072         return val && {}.toString.call(val) === "[object Object]";
14073       }
14074     }
14075   });
14076
14077   // node_modules/store/src/store-engine.js
14078   var require_store_engine = __commonJS({
14079     "node_modules/store/src/store-engine.js"(exports2, module2) {
14080       var util = require_util();
14081       var slice = util.slice;
14082       var pluck = util.pluck;
14083       var each = util.each;
14084       var bind = util.bind;
14085       var create2 = util.create;
14086       var isList = util.isList;
14087       var isFunction2 = util.isFunction;
14088       var isObject3 = util.isObject;
14089       module2.exports = {
14090         createStore
14091       };
14092       var storeAPI = {
14093         version: "2.0.12",
14094         enabled: false,
14095         // get returns the value of the given key. If that value
14096         // is undefined, it returns optionalDefaultValue instead.
14097         get: function(key, optionalDefaultValue) {
14098           var data = this.storage.read(this._namespacePrefix + key);
14099           return this._deserialize(data, optionalDefaultValue);
14100         },
14101         // set will store the given value at key and returns value.
14102         // Calling set with value === undefined is equivalent to calling remove.
14103         set: function(key, value) {
14104           if (value === void 0) {
14105             return this.remove(key);
14106           }
14107           this.storage.write(this._namespacePrefix + key, this._serialize(value));
14108           return value;
14109         },
14110         // remove deletes the key and value stored at the given key.
14111         remove: function(key) {
14112           this.storage.remove(this._namespacePrefix + key);
14113         },
14114         // each will call the given callback once for each key-value pair
14115         // in this store.
14116         each: function(callback) {
14117           var self2 = this;
14118           this.storage.each(function(val, namespacedKey) {
14119             callback.call(self2, self2._deserialize(val), (namespacedKey || "").replace(self2._namespaceRegexp, ""));
14120           });
14121         },
14122         // clearAll will remove all the stored key-value pairs in this store.
14123         clearAll: function() {
14124           this.storage.clearAll();
14125         },
14126         // additional functionality that can't live in plugins
14127         // ---------------------------------------------------
14128         // hasNamespace returns true if this store instance has the given namespace.
14129         hasNamespace: function(namespace) {
14130           return this._namespacePrefix == "__storejs_" + namespace + "_";
14131         },
14132         // createStore creates a store.js instance with the first
14133         // functioning storage in the list of storage candidates,
14134         // and applies the the given mixins to the instance.
14135         createStore: function() {
14136           return createStore.apply(this, arguments);
14137         },
14138         addPlugin: function(plugin) {
14139           this._addPlugin(plugin);
14140         },
14141         namespace: function(namespace) {
14142           return createStore(this.storage, this.plugins, namespace);
14143         }
14144       };
14145       function _warn() {
14146         var _console = typeof console == "undefined" ? null : console;
14147         if (!_console) {
14148           return;
14149         }
14150         var fn = _console.warn ? _console.warn : _console.log;
14151         fn.apply(_console, arguments);
14152       }
14153       function createStore(storages, plugins, namespace) {
14154         if (!namespace) {
14155           namespace = "";
14156         }
14157         if (storages && !isList(storages)) {
14158           storages = [storages];
14159         }
14160         if (plugins && !isList(plugins)) {
14161           plugins = [plugins];
14162         }
14163         var namespacePrefix = namespace ? "__storejs_" + namespace + "_" : "";
14164         var namespaceRegexp = namespace ? new RegExp("^" + namespacePrefix) : null;
14165         var legalNamespaces = /^[a-zA-Z0-9_\-]*$/;
14166         if (!legalNamespaces.test(namespace)) {
14167           throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes");
14168         }
14169         var _privateStoreProps = {
14170           _namespacePrefix: namespacePrefix,
14171           _namespaceRegexp: namespaceRegexp,
14172           _testStorage: function(storage) {
14173             try {
14174               var testStr = "__storejs__test__";
14175               storage.write(testStr, testStr);
14176               var ok = storage.read(testStr) === testStr;
14177               storage.remove(testStr);
14178               return ok;
14179             } catch (e) {
14180               return false;
14181             }
14182           },
14183           _assignPluginFnProp: function(pluginFnProp, propName) {
14184             var oldFn = this[propName];
14185             this[propName] = function pluginFn() {
14186               var args = slice(arguments, 0);
14187               var self2 = this;
14188               function super_fn() {
14189                 if (!oldFn) {
14190                   return;
14191                 }
14192                 each(arguments, function(arg, i2) {
14193                   args[i2] = arg;
14194                 });
14195                 return oldFn.apply(self2, args);
14196               }
14197               var newFnArgs = [super_fn].concat(args);
14198               return pluginFnProp.apply(self2, newFnArgs);
14199             };
14200           },
14201           _serialize: function(obj) {
14202             return JSON.stringify(obj);
14203           },
14204           _deserialize: function(strVal, defaultVal) {
14205             if (!strVal) {
14206               return defaultVal;
14207             }
14208             var val = "";
14209             try {
14210               val = JSON.parse(strVal);
14211             } catch (e) {
14212               val = strVal;
14213             }
14214             return val !== void 0 ? val : defaultVal;
14215           },
14216           _addStorage: function(storage) {
14217             if (this.enabled) {
14218               return;
14219             }
14220             if (this._testStorage(storage)) {
14221               this.storage = storage;
14222               this.enabled = true;
14223             }
14224           },
14225           _addPlugin: function(plugin) {
14226             var self2 = this;
14227             if (isList(plugin)) {
14228               each(plugin, function(plugin2) {
14229                 self2._addPlugin(plugin2);
14230               });
14231               return;
14232             }
14233             var seenPlugin = pluck(this.plugins, function(seenPlugin2) {
14234               return plugin === seenPlugin2;
14235             });
14236             if (seenPlugin) {
14237               return;
14238             }
14239             this.plugins.push(plugin);
14240             if (!isFunction2(plugin)) {
14241               throw new Error("Plugins must be function values that return objects");
14242             }
14243             var pluginProperties = plugin.call(this);
14244             if (!isObject3(pluginProperties)) {
14245               throw new Error("Plugins must return an object of function properties");
14246             }
14247             each(pluginProperties, function(pluginFnProp, propName) {
14248               if (!isFunction2(pluginFnProp)) {
14249                 throw new Error("Bad plugin property: " + propName + " from plugin " + plugin.name + ". Plugins should only return functions.");
14250               }
14251               self2._assignPluginFnProp(pluginFnProp, propName);
14252             });
14253           },
14254           // Put deprecated properties in the private API, so as to not expose it to accidential
14255           // discovery through inspection of the store object.
14256           // Deprecated: addStorage
14257           addStorage: function(storage) {
14258             _warn("store.addStorage(storage) is deprecated. Use createStore([storages])");
14259             this._addStorage(storage);
14260           }
14261         };
14262         var store2 = create2(_privateStoreProps, storeAPI, {
14263           plugins: []
14264         });
14265         store2.raw = {};
14266         each(store2, function(prop, propName) {
14267           if (isFunction2(prop)) {
14268             store2.raw[propName] = bind(store2, prop);
14269           }
14270         });
14271         each(storages, function(storage) {
14272           store2._addStorage(storage);
14273         });
14274         each(plugins, function(plugin) {
14275           store2._addPlugin(plugin);
14276         });
14277         return store2;
14278       }
14279     }
14280   });
14281
14282   // node_modules/store/storages/localStorage.js
14283   var require_localStorage = __commonJS({
14284     "node_modules/store/storages/localStorage.js"(exports2, module2) {
14285       var util = require_util();
14286       var Global = util.Global;
14287       module2.exports = {
14288         name: "localStorage",
14289         read,
14290         write,
14291         each,
14292         remove: remove2,
14293         clearAll
14294       };
14295       function localStorage2() {
14296         return Global.localStorage;
14297       }
14298       function read(key) {
14299         return localStorage2().getItem(key);
14300       }
14301       function write(key, data) {
14302         return localStorage2().setItem(key, data);
14303       }
14304       function each(fn) {
14305         for (var i2 = localStorage2().length - 1; i2 >= 0; i2--) {
14306           var key = localStorage2().key(i2);
14307           fn(read(key), key);
14308         }
14309       }
14310       function remove2(key) {
14311         return localStorage2().removeItem(key);
14312       }
14313       function clearAll() {
14314         return localStorage2().clear();
14315       }
14316     }
14317   });
14318
14319   // node_modules/store/storages/oldFF-globalStorage.js
14320   var require_oldFF_globalStorage = __commonJS({
14321     "node_modules/store/storages/oldFF-globalStorage.js"(exports2, module2) {
14322       var util = require_util();
14323       var Global = util.Global;
14324       module2.exports = {
14325         name: "oldFF-globalStorage",
14326         read,
14327         write,
14328         each,
14329         remove: remove2,
14330         clearAll
14331       };
14332       var globalStorage = Global.globalStorage;
14333       function read(key) {
14334         return globalStorage[key];
14335       }
14336       function write(key, data) {
14337         globalStorage[key] = data;
14338       }
14339       function each(fn) {
14340         for (var i2 = globalStorage.length - 1; i2 >= 0; i2--) {
14341           var key = globalStorage.key(i2);
14342           fn(globalStorage[key], key);
14343         }
14344       }
14345       function remove2(key) {
14346         return globalStorage.removeItem(key);
14347       }
14348       function clearAll() {
14349         each(function(key, _) {
14350           delete globalStorage[key];
14351         });
14352       }
14353     }
14354   });
14355
14356   // node_modules/store/storages/oldIE-userDataStorage.js
14357   var require_oldIE_userDataStorage = __commonJS({
14358     "node_modules/store/storages/oldIE-userDataStorage.js"(exports2, module2) {
14359       var util = require_util();
14360       var Global = util.Global;
14361       module2.exports = {
14362         name: "oldIE-userDataStorage",
14363         write,
14364         read,
14365         each,
14366         remove: remove2,
14367         clearAll
14368       };
14369       var storageName = "storejs";
14370       var doc = Global.document;
14371       var _withStorageEl = _makeIEStorageElFunction();
14372       var disable = (Global.navigator ? Global.navigator.userAgent : "").match(/ (MSIE 8|MSIE 9|MSIE 10)\./);
14373       function write(unfixedKey, data) {
14374         if (disable) {
14375           return;
14376         }
14377         var fixedKey = fixKey(unfixedKey);
14378         _withStorageEl(function(storageEl) {
14379           storageEl.setAttribute(fixedKey, data);
14380           storageEl.save(storageName);
14381         });
14382       }
14383       function read(unfixedKey) {
14384         if (disable) {
14385           return;
14386         }
14387         var fixedKey = fixKey(unfixedKey);
14388         var res = null;
14389         _withStorageEl(function(storageEl) {
14390           res = storageEl.getAttribute(fixedKey);
14391         });
14392         return res;
14393       }
14394       function each(callback) {
14395         _withStorageEl(function(storageEl) {
14396           var attributes = storageEl.XMLDocument.documentElement.attributes;
14397           for (var i2 = attributes.length - 1; i2 >= 0; i2--) {
14398             var attr = attributes[i2];
14399             callback(storageEl.getAttribute(attr.name), attr.name);
14400           }
14401         });
14402       }
14403       function remove2(unfixedKey) {
14404         var fixedKey = fixKey(unfixedKey);
14405         _withStorageEl(function(storageEl) {
14406           storageEl.removeAttribute(fixedKey);
14407           storageEl.save(storageName);
14408         });
14409       }
14410       function clearAll() {
14411         _withStorageEl(function(storageEl) {
14412           var attributes = storageEl.XMLDocument.documentElement.attributes;
14413           storageEl.load(storageName);
14414           for (var i2 = attributes.length - 1; i2 >= 0; i2--) {
14415             storageEl.removeAttribute(attributes[i2].name);
14416           }
14417           storageEl.save(storageName);
14418         });
14419       }
14420       var forbiddenCharsRegex = new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]", "g");
14421       function fixKey(key) {
14422         return key.replace(/^\d/, "___$&").replace(forbiddenCharsRegex, "___");
14423       }
14424       function _makeIEStorageElFunction() {
14425         if (!doc || !doc.documentElement || !doc.documentElement.addBehavior) {
14426           return null;
14427         }
14428         var scriptTag = "script", storageOwner, storageContainer, storageEl;
14429         try {
14430           storageContainer = new ActiveXObject("htmlfile");
14431           storageContainer.open();
14432           storageContainer.write("<" + scriptTag + ">document.w=window</" + scriptTag + '><iframe src="/favicon.ico"></iframe>');
14433           storageContainer.close();
14434           storageOwner = storageContainer.w.frames[0].document;
14435           storageEl = storageOwner.createElement("div");
14436         } catch (e) {
14437           storageEl = doc.createElement("div");
14438           storageOwner = doc.body;
14439         }
14440         return function(storeFunction) {
14441           var args = [].slice.call(arguments, 0);
14442           args.unshift(storageEl);
14443           storageOwner.appendChild(storageEl);
14444           storageEl.addBehavior("#default#userData");
14445           storageEl.load(storageName);
14446           storeFunction.apply(this, args);
14447           storageOwner.removeChild(storageEl);
14448           return;
14449         };
14450       }
14451     }
14452   });
14453
14454   // node_modules/store/storages/cookieStorage.js
14455   var require_cookieStorage = __commonJS({
14456     "node_modules/store/storages/cookieStorage.js"(exports2, module2) {
14457       var util = require_util();
14458       var Global = util.Global;
14459       var trim = util.trim;
14460       module2.exports = {
14461         name: "cookieStorage",
14462         read,
14463         write,
14464         each,
14465         remove: remove2,
14466         clearAll
14467       };
14468       var doc = Global.document;
14469       function read(key) {
14470         if (!key || !_has(key)) {
14471           return null;
14472         }
14473         var regexpStr = "(?:^|.*;\\s*)" + escape(key).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";
14474         return unescape(doc.cookie.replace(new RegExp(regexpStr), "$1"));
14475       }
14476       function each(callback) {
14477         var cookies = doc.cookie.split(/; ?/g);
14478         for (var i2 = cookies.length - 1; i2 >= 0; i2--) {
14479           if (!trim(cookies[i2])) {
14480             continue;
14481           }
14482           var kvp = cookies[i2].split("=");
14483           var key = unescape(kvp[0]);
14484           var val = unescape(kvp[1]);
14485           callback(val, key);
14486         }
14487       }
14488       function write(key, data) {
14489         if (!key) {
14490           return;
14491         }
14492         doc.cookie = escape(key) + "=" + escape(data) + "; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/";
14493       }
14494       function remove2(key) {
14495         if (!key || !_has(key)) {
14496           return;
14497         }
14498         doc.cookie = escape(key) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/";
14499       }
14500       function clearAll() {
14501         each(function(_, key) {
14502           remove2(key);
14503         });
14504       }
14505       function _has(key) {
14506         return new RegExp("(?:^|;\\s*)" + escape(key).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=").test(doc.cookie);
14507       }
14508     }
14509   });
14510
14511   // node_modules/store/storages/sessionStorage.js
14512   var require_sessionStorage = __commonJS({
14513     "node_modules/store/storages/sessionStorage.js"(exports2, module2) {
14514       var util = require_util();
14515       var Global = util.Global;
14516       module2.exports = {
14517         name: "sessionStorage",
14518         read,
14519         write,
14520         each,
14521         remove: remove2,
14522         clearAll
14523       };
14524       function sessionStorage() {
14525         return Global.sessionStorage;
14526       }
14527       function read(key) {
14528         return sessionStorage().getItem(key);
14529       }
14530       function write(key, data) {
14531         return sessionStorage().setItem(key, data);
14532       }
14533       function each(fn) {
14534         for (var i2 = sessionStorage().length - 1; i2 >= 0; i2--) {
14535           var key = sessionStorage().key(i2);
14536           fn(read(key), key);
14537         }
14538       }
14539       function remove2(key) {
14540         return sessionStorage().removeItem(key);
14541       }
14542       function clearAll() {
14543         return sessionStorage().clear();
14544       }
14545     }
14546   });
14547
14548   // node_modules/store/storages/memoryStorage.js
14549   var require_memoryStorage = __commonJS({
14550     "node_modules/store/storages/memoryStorage.js"(exports2, module2) {
14551       module2.exports = {
14552         name: "memoryStorage",
14553         read,
14554         write,
14555         each,
14556         remove: remove2,
14557         clearAll
14558       };
14559       var memoryStorage = {};
14560       function read(key) {
14561         return memoryStorage[key];
14562       }
14563       function write(key, data) {
14564         memoryStorage[key] = data;
14565       }
14566       function each(callback) {
14567         for (var key in memoryStorage) {
14568           if (memoryStorage.hasOwnProperty(key)) {
14569             callback(memoryStorage[key], key);
14570           }
14571         }
14572       }
14573       function remove2(key) {
14574         delete memoryStorage[key];
14575       }
14576       function clearAll(key) {
14577         memoryStorage = {};
14578       }
14579     }
14580   });
14581
14582   // node_modules/store/storages/all.js
14583   var require_all = __commonJS({
14584     "node_modules/store/storages/all.js"(exports2, module2) {
14585       module2.exports = [
14586         // Listed in order of usage preference
14587         require_localStorage(),
14588         require_oldFF_globalStorage(),
14589         require_oldIE_userDataStorage(),
14590         require_cookieStorage(),
14591         require_sessionStorage(),
14592         require_memoryStorage()
14593       ];
14594     }
14595   });
14596
14597   // node_modules/store/plugins/lib/json2.js
14598   var require_json2 = __commonJS({
14599     "node_modules/store/plugins/lib/json2.js"(exports, module) {
14600       if (typeof JSON !== "object") {
14601         JSON = {};
14602       }
14603       (function() {
14604         "use strict";
14605         var rx_one = /^[\],:{}\s]*$/;
14606         var rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g;
14607         var rx_three = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;
14608         var rx_four = /(?:^|:|,)(?:\s*\[)+/g;
14609         var rx_escapable = /[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
14610         var rx_dangerous = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
14611         function f(n2) {
14612           return n2 < 10 ? "0" + n2 : n2;
14613         }
14614         function this_value() {
14615           return this.valueOf();
14616         }
14617         if (typeof Date.prototype.toJSON !== "function") {
14618           Date.prototype.toJSON = function() {
14619             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;
14620           };
14621           Boolean.prototype.toJSON = this_value;
14622           Number.prototype.toJSON = this_value;
14623           String.prototype.toJSON = this_value;
14624         }
14625         var gap;
14626         var indent;
14627         var meta;
14628         var rep;
14629         function quote(string) {
14630           rx_escapable.lastIndex = 0;
14631           return rx_escapable.test(string) ? '"' + string.replace(rx_escapable, function(a) {
14632             var c = meta[a];
14633             return typeof c === "string" ? c : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
14634           }) + '"' : '"' + string + '"';
14635         }
14636         function str(key, holder) {
14637           var i2;
14638           var k;
14639           var v;
14640           var length;
14641           var mind = gap;
14642           var partial;
14643           var value = holder[key];
14644           if (value && typeof value === "object" && typeof value.toJSON === "function") {
14645             value = value.toJSON(key);
14646           }
14647           if (typeof rep === "function") {
14648             value = rep.call(holder, key, value);
14649           }
14650           switch (typeof value) {
14651             case "string":
14652               return quote(value);
14653             case "number":
14654               return isFinite(value) ? String(value) : "null";
14655             case "boolean":
14656             case "null":
14657               return String(value);
14658             case "object":
14659               if (!value) {
14660                 return "null";
14661               }
14662               gap += indent;
14663               partial = [];
14664               if (Object.prototype.toString.apply(value) === "[object Array]") {
14665                 length = value.length;
14666                 for (i2 = 0; i2 < length; i2 += 1) {
14667                   partial[i2] = str(i2, value) || "null";
14668                 }
14669                 v = partial.length === 0 ? "[]" : gap ? "[\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "]" : "[" + partial.join(",") + "]";
14670                 gap = mind;
14671                 return v;
14672               }
14673               if (rep && typeof rep === "object") {
14674                 length = rep.length;
14675                 for (i2 = 0; i2 < length; i2 += 1) {
14676                   if (typeof rep[i2] === "string") {
14677                     k = rep[i2];
14678                     v = str(k, value);
14679                     if (v) {
14680                       partial.push(quote(k) + (gap ? ": " : ":") + v);
14681                     }
14682                   }
14683                 }
14684               } else {
14685                 for (k in value) {
14686                   if (Object.prototype.hasOwnProperty.call(value, k)) {
14687                     v = str(k, value);
14688                     if (v) {
14689                       partial.push(quote(k) + (gap ? ": " : ":") + v);
14690                     }
14691                   }
14692                 }
14693               }
14694               v = partial.length === 0 ? "{}" : gap ? "{\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "}" : "{" + partial.join(",") + "}";
14695               gap = mind;
14696               return v;
14697           }
14698         }
14699         if (typeof JSON.stringify !== "function") {
14700           meta = {
14701             // table of character substitutions
14702             "\b": "\\b",
14703             "   ": "\\t",
14704             "\n": "\\n",
14705             "\f": "\\f",
14706             "\r": "\\r",
14707             '"': '\\"',
14708             "\\": "\\\\"
14709           };
14710           JSON.stringify = function(value, replacer, space) {
14711             var i2;
14712             gap = "";
14713             indent = "";
14714             if (typeof space === "number") {
14715               for (i2 = 0; i2 < space; i2 += 1) {
14716                 indent += " ";
14717               }
14718             } else if (typeof space === "string") {
14719               indent = space;
14720             }
14721             rep = replacer;
14722             if (replacer && typeof replacer !== "function" && (typeof replacer !== "object" || typeof replacer.length !== "number")) {
14723               throw new Error("JSON.stringify");
14724             }
14725             return str("", { "": value });
14726           };
14727         }
14728         if (typeof JSON.parse !== "function") {
14729           JSON.parse = function(text, reviver) {
14730             var j;
14731             function walk(holder, key) {
14732               var k;
14733               var v;
14734               var value = holder[key];
14735               if (value && typeof value === "object") {
14736                 for (k in value) {
14737                   if (Object.prototype.hasOwnProperty.call(value, k)) {
14738                     v = walk(value, k);
14739                     if (v !== void 0) {
14740                       value[k] = v;
14741                     } else {
14742                       delete value[k];
14743                     }
14744                   }
14745                 }
14746               }
14747               return reviver.call(holder, key, value);
14748             }
14749             text = String(text);
14750             rx_dangerous.lastIndex = 0;
14751             if (rx_dangerous.test(text)) {
14752               text = text.replace(rx_dangerous, function(a) {
14753                 return "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
14754               });
14755             }
14756             if (rx_one.test(
14757               text.replace(rx_two, "@").replace(rx_three, "]").replace(rx_four, "")
14758             )) {
14759               j = eval("(" + text + ")");
14760               return typeof reviver === "function" ? walk({ "": j }, "") : j;
14761             }
14762             throw new SyntaxError("JSON.parse");
14763           };
14764         }
14765       })();
14766     }
14767   });
14768
14769   // node_modules/store/plugins/json2.js
14770   var require_json22 = __commonJS({
14771     "node_modules/store/plugins/json2.js"(exports2, module2) {
14772       module2.exports = json2Plugin;
14773       function json2Plugin() {
14774         require_json2();
14775         return {};
14776       }
14777     }
14778   });
14779
14780   // node_modules/store/dist/store.legacy.js
14781   var require_store_legacy = __commonJS({
14782     "node_modules/store/dist/store.legacy.js"(exports2, module2) {
14783       var engine = require_store_engine();
14784       var storages = require_all();
14785       var plugins = [require_json22()];
14786       module2.exports = engine.createStore(storages, plugins);
14787     }
14788   });
14789
14790   // node_modules/whatwg-fetch/fetch.js
14791   var global2 = typeof globalThis !== "undefined" && globalThis || typeof self !== "undefined" && self || typeof global2 !== "undefined" && global2;
14792   var support = {
14793     searchParams: "URLSearchParams" in global2,
14794     iterable: "Symbol" in global2 && "iterator" in Symbol,
14795     blob: "FileReader" in global2 && "Blob" in global2 && function() {
14796       try {
14797         new Blob();
14798         return true;
14799       } catch (e) {
14800         return false;
14801       }
14802     }(),
14803     formData: "FormData" in global2,
14804     arrayBuffer: "ArrayBuffer" in global2
14805   };
14806   function isDataView(obj) {
14807     return obj && DataView.prototype.isPrototypeOf(obj);
14808   }
14809   if (support.arrayBuffer) {
14810     viewClasses = [
14811       "[object Int8Array]",
14812       "[object Uint8Array]",
14813       "[object Uint8ClampedArray]",
14814       "[object Int16Array]",
14815       "[object Uint16Array]",
14816       "[object Int32Array]",
14817       "[object Uint32Array]",
14818       "[object Float32Array]",
14819       "[object Float64Array]"
14820     ];
14821     isArrayBufferView = ArrayBuffer.isView || function(obj) {
14822       return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1;
14823     };
14824   }
14825   var viewClasses;
14826   var isArrayBufferView;
14827   function normalizeName(name) {
14828     if (typeof name !== "string") {
14829       name = String(name);
14830     }
14831     if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === "") {
14832       throw new TypeError('Invalid character in header field name: "' + name + '"');
14833     }
14834     return name.toLowerCase();
14835   }
14836   function normalizeValue(value) {
14837     if (typeof value !== "string") {
14838       value = String(value);
14839     }
14840     return value;
14841   }
14842   function iteratorFor(items) {
14843     var iterator = {
14844       next: function() {
14845         var value = items.shift();
14846         return { done: value === void 0, value };
14847       }
14848     };
14849     if (support.iterable) {
14850       iterator[Symbol.iterator] = function() {
14851         return iterator;
14852       };
14853     }
14854     return iterator;
14855   }
14856   function Headers(headers) {
14857     this.map = {};
14858     if (headers instanceof Headers) {
14859       headers.forEach(function(value, name) {
14860         this.append(name, value);
14861       }, this);
14862     } else if (Array.isArray(headers)) {
14863       headers.forEach(function(header) {
14864         this.append(header[0], header[1]);
14865       }, this);
14866     } else if (headers) {
14867       Object.getOwnPropertyNames(headers).forEach(function(name) {
14868         this.append(name, headers[name]);
14869       }, this);
14870     }
14871   }
14872   Headers.prototype.append = function(name, value) {
14873     name = normalizeName(name);
14874     value = normalizeValue(value);
14875     var oldValue = this.map[name];
14876     this.map[name] = oldValue ? oldValue + ", " + value : value;
14877   };
14878   Headers.prototype["delete"] = function(name) {
14879     delete this.map[normalizeName(name)];
14880   };
14881   Headers.prototype.get = function(name) {
14882     name = normalizeName(name);
14883     return this.has(name) ? this.map[name] : null;
14884   };
14885   Headers.prototype.has = function(name) {
14886     return this.map.hasOwnProperty(normalizeName(name));
14887   };
14888   Headers.prototype.set = function(name, value) {
14889     this.map[normalizeName(name)] = normalizeValue(value);
14890   };
14891   Headers.prototype.forEach = function(callback, thisArg) {
14892     for (var name in this.map) {
14893       if (this.map.hasOwnProperty(name)) {
14894         callback.call(thisArg, this.map[name], name, this);
14895       }
14896     }
14897   };
14898   Headers.prototype.keys = function() {
14899     var items = [];
14900     this.forEach(function(value, name) {
14901       items.push(name);
14902     });
14903     return iteratorFor(items);
14904   };
14905   Headers.prototype.values = function() {
14906     var items = [];
14907     this.forEach(function(value) {
14908       items.push(value);
14909     });
14910     return iteratorFor(items);
14911   };
14912   Headers.prototype.entries = function() {
14913     var items = [];
14914     this.forEach(function(value, name) {
14915       items.push([name, value]);
14916     });
14917     return iteratorFor(items);
14918   };
14919   if (support.iterable) {
14920     Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
14921   }
14922   function consumed(body) {
14923     if (body.bodyUsed) {
14924       return Promise.reject(new TypeError("Already read"));
14925     }
14926     body.bodyUsed = true;
14927   }
14928   function fileReaderReady(reader) {
14929     return new Promise(function(resolve, reject) {
14930       reader.onload = function() {
14931         resolve(reader.result);
14932       };
14933       reader.onerror = function() {
14934         reject(reader.error);
14935       };
14936     });
14937   }
14938   function readBlobAsArrayBuffer(blob) {
14939     var reader = new FileReader();
14940     var promise = fileReaderReady(reader);
14941     reader.readAsArrayBuffer(blob);
14942     return promise;
14943   }
14944   function readBlobAsText(blob) {
14945     var reader = new FileReader();
14946     var promise = fileReaderReady(reader);
14947     reader.readAsText(blob);
14948     return promise;
14949   }
14950   function readArrayBufferAsText(buf) {
14951     var view = new Uint8Array(buf);
14952     var chars = new Array(view.length);
14953     for (var i2 = 0; i2 < view.length; i2++) {
14954       chars[i2] = String.fromCharCode(view[i2]);
14955     }
14956     return chars.join("");
14957   }
14958   function bufferClone(buf) {
14959     if (buf.slice) {
14960       return buf.slice(0);
14961     } else {
14962       var view = new Uint8Array(buf.byteLength);
14963       view.set(new Uint8Array(buf));
14964       return view.buffer;
14965     }
14966   }
14967   function Body() {
14968     this.bodyUsed = false;
14969     this._initBody = function(body) {
14970       this.bodyUsed = this.bodyUsed;
14971       this._bodyInit = body;
14972       if (!body) {
14973         this._bodyText = "";
14974       } else if (typeof body === "string") {
14975         this._bodyText = body;
14976       } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
14977         this._bodyBlob = body;
14978       } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
14979         this._bodyFormData = body;
14980       } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
14981         this._bodyText = body.toString();
14982       } else if (support.arrayBuffer && support.blob && isDataView(body)) {
14983         this._bodyArrayBuffer = bufferClone(body.buffer);
14984         this._bodyInit = new Blob([this._bodyArrayBuffer]);
14985       } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
14986         this._bodyArrayBuffer = bufferClone(body);
14987       } else {
14988         this._bodyText = body = Object.prototype.toString.call(body);
14989       }
14990       if (!this.headers.get("content-type")) {
14991         if (typeof body === "string") {
14992           this.headers.set("content-type", "text/plain;charset=UTF-8");
14993         } else if (this._bodyBlob && this._bodyBlob.type) {
14994           this.headers.set("content-type", this._bodyBlob.type);
14995         } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
14996           this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8");
14997         }
14998       }
14999     };
15000     if (support.blob) {
15001       this.blob = function() {
15002         var rejected = consumed(this);
15003         if (rejected) {
15004           return rejected;
15005         }
15006         if (this._bodyBlob) {
15007           return Promise.resolve(this._bodyBlob);
15008         } else if (this._bodyArrayBuffer) {
15009           return Promise.resolve(new Blob([this._bodyArrayBuffer]));
15010         } else if (this._bodyFormData) {
15011           throw new Error("could not read FormData body as blob");
15012         } else {
15013           return Promise.resolve(new Blob([this._bodyText]));
15014         }
15015       };
15016       this.arrayBuffer = function() {
15017         if (this._bodyArrayBuffer) {
15018           var isConsumed = consumed(this);
15019           if (isConsumed) {
15020             return isConsumed;
15021           }
15022           if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
15023             return Promise.resolve(
15024               this._bodyArrayBuffer.buffer.slice(
15025                 this._bodyArrayBuffer.byteOffset,
15026                 this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
15027               )
15028             );
15029           } else {
15030             return Promise.resolve(this._bodyArrayBuffer);
15031           }
15032         } else {
15033           return this.blob().then(readBlobAsArrayBuffer);
15034         }
15035       };
15036     }
15037     this.text = function() {
15038       var rejected = consumed(this);
15039       if (rejected) {
15040         return rejected;
15041       }
15042       if (this._bodyBlob) {
15043         return readBlobAsText(this._bodyBlob);
15044       } else if (this._bodyArrayBuffer) {
15045         return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer));
15046       } else if (this._bodyFormData) {
15047         throw new Error("could not read FormData body as text");
15048       } else {
15049         return Promise.resolve(this._bodyText);
15050       }
15051     };
15052     if (support.formData) {
15053       this.formData = function() {
15054         return this.text().then(decode);
15055       };
15056     }
15057     this.json = function() {
15058       return this.text().then(JSON.parse);
15059     };
15060     return this;
15061   }
15062   var methods = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
15063   function normalizeMethod(method) {
15064     var upcased = method.toUpperCase();
15065     return methods.indexOf(upcased) > -1 ? upcased : method;
15066   }
15067   function Request(input, options2) {
15068     if (!(this instanceof Request)) {
15069       throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
15070     }
15071     options2 = options2 || {};
15072     var body = options2.body;
15073     if (input instanceof Request) {
15074       if (input.bodyUsed) {
15075         throw new TypeError("Already read");
15076       }
15077       this.url = input.url;
15078       this.credentials = input.credentials;
15079       if (!options2.headers) {
15080         this.headers = new Headers(input.headers);
15081       }
15082       this.method = input.method;
15083       this.mode = input.mode;
15084       this.signal = input.signal;
15085       if (!body && input._bodyInit != null) {
15086         body = input._bodyInit;
15087         input.bodyUsed = true;
15088       }
15089     } else {
15090       this.url = String(input);
15091     }
15092     this.credentials = options2.credentials || this.credentials || "same-origin";
15093     if (options2.headers || !this.headers) {
15094       this.headers = new Headers(options2.headers);
15095     }
15096     this.method = normalizeMethod(options2.method || this.method || "GET");
15097     this.mode = options2.mode || this.mode || null;
15098     this.signal = options2.signal || this.signal;
15099     this.referrer = null;
15100     if ((this.method === "GET" || this.method === "HEAD") && body) {
15101       throw new TypeError("Body not allowed for GET or HEAD requests");
15102     }
15103     this._initBody(body);
15104     if (this.method === "GET" || this.method === "HEAD") {
15105       if (options2.cache === "no-store" || options2.cache === "no-cache") {
15106         var reParamSearch = /([?&])_=[^&]*/;
15107         if (reParamSearch.test(this.url)) {
15108           this.url = this.url.replace(reParamSearch, "$1_=" + (/* @__PURE__ */ new Date()).getTime());
15109         } else {
15110           var reQueryString = /\?/;
15111           this.url += (reQueryString.test(this.url) ? "&" : "?") + "_=" + (/* @__PURE__ */ new Date()).getTime();
15112         }
15113       }
15114     }
15115   }
15116   Request.prototype.clone = function() {
15117     return new Request(this, { body: this._bodyInit });
15118   };
15119   function decode(body) {
15120     var form = new FormData();
15121     body.trim().split("&").forEach(function(bytes) {
15122       if (bytes) {
15123         var split = bytes.split("=");
15124         var name = split.shift().replace(/\+/g, " ");
15125         var value = split.join("=").replace(/\+/g, " ");
15126         form.append(decodeURIComponent(name), decodeURIComponent(value));
15127       }
15128     });
15129     return form;
15130   }
15131   function parseHeaders(rawHeaders) {
15132     var headers = new Headers();
15133     var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, " ");
15134     preProcessedHeaders.split("\r").map(function(header) {
15135       return header.indexOf("\n") === 0 ? header.substr(1, header.length) : header;
15136     }).forEach(function(line) {
15137       var parts = line.split(":");
15138       var key = parts.shift().trim();
15139       if (key) {
15140         var value = parts.join(":").trim();
15141         headers.append(key, value);
15142       }
15143     });
15144     return headers;
15145   }
15146   Body.call(Request.prototype);
15147   function Response(bodyInit, options2) {
15148     if (!(this instanceof Response)) {
15149       throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
15150     }
15151     if (!options2) {
15152       options2 = {};
15153     }
15154     this.type = "default";
15155     this.status = options2.status === void 0 ? 200 : options2.status;
15156     this.ok = this.status >= 200 && this.status < 300;
15157     this.statusText = options2.statusText === void 0 ? "" : "" + options2.statusText;
15158     this.headers = new Headers(options2.headers);
15159     this.url = options2.url || "";
15160     this._initBody(bodyInit);
15161   }
15162   Body.call(Response.prototype);
15163   Response.prototype.clone = function() {
15164     return new Response(this._bodyInit, {
15165       status: this.status,
15166       statusText: this.statusText,
15167       headers: new Headers(this.headers),
15168       url: this.url
15169     });
15170   };
15171   Response.error = function() {
15172     var response = new Response(null, { status: 0, statusText: "" });
15173     response.type = "error";
15174     return response;
15175   };
15176   var redirectStatuses = [301, 302, 303, 307, 308];
15177   Response.redirect = function(url, status) {
15178     if (redirectStatuses.indexOf(status) === -1) {
15179       throw new RangeError("Invalid status code");
15180     }
15181     return new Response(null, { status, headers: { location: url } });
15182   };
15183   var DOMException2 = global2.DOMException;
15184   try {
15185     new DOMException2();
15186   } catch (err) {
15187     DOMException2 = function(message, name) {
15188       this.message = message;
15189       this.name = name;
15190       var error = Error(message);
15191       this.stack = error.stack;
15192     };
15193     DOMException2.prototype = Object.create(Error.prototype);
15194     DOMException2.prototype.constructor = DOMException2;
15195   }
15196   function fetch2(input, init2) {
15197     return new Promise(function(resolve, reject) {
15198       var request3 = new Request(input, init2);
15199       if (request3.signal && request3.signal.aborted) {
15200         return reject(new DOMException2("Aborted", "AbortError"));
15201       }
15202       var xhr = new XMLHttpRequest();
15203       function abortXhr() {
15204         xhr.abort();
15205       }
15206       xhr.onload = function() {
15207         var options2 = {
15208           status: xhr.status,
15209           statusText: xhr.statusText,
15210           headers: parseHeaders(xhr.getAllResponseHeaders() || "")
15211         };
15212         options2.url = "responseURL" in xhr ? xhr.responseURL : options2.headers.get("X-Request-URL");
15213         var body = "response" in xhr ? xhr.response : xhr.responseText;
15214         setTimeout(function() {
15215           resolve(new Response(body, options2));
15216         }, 0);
15217       };
15218       xhr.onerror = function() {
15219         setTimeout(function() {
15220           reject(new TypeError("Network request failed"));
15221         }, 0);
15222       };
15223       xhr.ontimeout = function() {
15224         setTimeout(function() {
15225           reject(new TypeError("Network request failed"));
15226         }, 0);
15227       };
15228       xhr.onabort = function() {
15229         setTimeout(function() {
15230           reject(new DOMException2("Aborted", "AbortError"));
15231         }, 0);
15232       };
15233       function fixUrl(url) {
15234         try {
15235           return url === "" && global2.location.href ? global2.location.href : url;
15236         } catch (e) {
15237           return url;
15238         }
15239       }
15240       xhr.open(request3.method, fixUrl(request3.url), true);
15241       if (request3.credentials === "include") {
15242         xhr.withCredentials = true;
15243       } else if (request3.credentials === "omit") {
15244         xhr.withCredentials = false;
15245       }
15246       if ("responseType" in xhr) {
15247         if (support.blob) {
15248           xhr.responseType = "blob";
15249         } else if (support.arrayBuffer && request3.headers.get("Content-Type") && request3.headers.get("Content-Type").indexOf("application/octet-stream") !== -1) {
15250           xhr.responseType = "arraybuffer";
15251         }
15252       }
15253       if (init2 && typeof init2.headers === "object" && !(init2.headers instanceof Headers)) {
15254         Object.getOwnPropertyNames(init2.headers).forEach(function(name) {
15255           xhr.setRequestHeader(name, normalizeValue(init2.headers[name]));
15256         });
15257       } else {
15258         request3.headers.forEach(function(value, name) {
15259           xhr.setRequestHeader(name, value);
15260         });
15261       }
15262       if (request3.signal) {
15263         request3.signal.addEventListener("abort", abortXhr);
15264         xhr.onreadystatechange = function() {
15265           if (xhr.readyState === 4) {
15266             request3.signal.removeEventListener("abort", abortXhr);
15267           }
15268         };
15269       }
15270       xhr.send(typeof request3._bodyInit === "undefined" ? null : request3._bodyInit);
15271     });
15272   }
15273   fetch2.polyfill = true;
15274   if (!global2.fetch) {
15275     global2.fetch = fetch2;
15276     global2.Headers = Headers;
15277     global2.Request = Request;
15278     global2.Response = Response;
15279   }
15280
15281   // node_modules/abortcontroller-polyfill/dist/polyfill-patch-fetch.js
15282   (function(factory) {
15283     typeof define === "function" && define.amd ? define(factory) : factory();
15284   })(function() {
15285     "use strict";
15286     function _classCallCheck(instance, Constructor) {
15287       if (!(instance instanceof Constructor)) {
15288         throw new TypeError("Cannot call a class as a function");
15289       }
15290     }
15291     function _defineProperties(target, props) {
15292       for (var i2 = 0; i2 < props.length; i2++) {
15293         var descriptor = props[i2];
15294         descriptor.enumerable = descriptor.enumerable || false;
15295         descriptor.configurable = true;
15296         if ("value" in descriptor)
15297           descriptor.writable = true;
15298         Object.defineProperty(target, descriptor.key, descriptor);
15299       }
15300     }
15301     function _createClass(Constructor, protoProps, staticProps) {
15302       if (protoProps)
15303         _defineProperties(Constructor.prototype, protoProps);
15304       if (staticProps)
15305         _defineProperties(Constructor, staticProps);
15306       Object.defineProperty(Constructor, "prototype", {
15307         writable: false
15308       });
15309       return Constructor;
15310     }
15311     function _inherits(subClass, superClass) {
15312       if (typeof superClass !== "function" && superClass !== null) {
15313         throw new TypeError("Super expression must either be null or a function");
15314       }
15315       subClass.prototype = Object.create(superClass && superClass.prototype, {
15316         constructor: {
15317           value: subClass,
15318           writable: true,
15319           configurable: true
15320         }
15321       });
15322       Object.defineProperty(subClass, "prototype", {
15323         writable: false
15324       });
15325       if (superClass)
15326         _setPrototypeOf(subClass, superClass);
15327     }
15328     function _getPrototypeOf(o) {
15329       _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
15330         return o2.__proto__ || Object.getPrototypeOf(o2);
15331       };
15332       return _getPrototypeOf(o);
15333     }
15334     function _setPrototypeOf(o, p) {
15335       _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
15336         o2.__proto__ = p2;
15337         return o2;
15338       };
15339       return _setPrototypeOf(o, p);
15340     }
15341     function _isNativeReflectConstruct() {
15342       if (typeof Reflect === "undefined" || !Reflect.construct)
15343         return false;
15344       if (Reflect.construct.sham)
15345         return false;
15346       if (typeof Proxy === "function")
15347         return true;
15348       try {
15349         Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
15350         }));
15351         return true;
15352       } catch (e) {
15353         return false;
15354       }
15355     }
15356     function _assertThisInitialized(self2) {
15357       if (self2 === void 0) {
15358         throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
15359       }
15360       return self2;
15361     }
15362     function _possibleConstructorReturn(self2, call) {
15363       if (call && (typeof call === "object" || typeof call === "function")) {
15364         return call;
15365       } else if (call !== void 0) {
15366         throw new TypeError("Derived constructors may only return object or undefined");
15367       }
15368       return _assertThisInitialized(self2);
15369     }
15370     function _createSuper(Derived) {
15371       var hasNativeReflectConstruct = _isNativeReflectConstruct();
15372       return function _createSuperInternal() {
15373         var Super = _getPrototypeOf(Derived), result;
15374         if (hasNativeReflectConstruct) {
15375           var NewTarget = _getPrototypeOf(this).constructor;
15376           result = Reflect.construct(Super, arguments, NewTarget);
15377         } else {
15378           result = Super.apply(this, arguments);
15379         }
15380         return _possibleConstructorReturn(this, result);
15381       };
15382     }
15383     function _superPropBase(object, property) {
15384       while (!Object.prototype.hasOwnProperty.call(object, property)) {
15385         object = _getPrototypeOf(object);
15386         if (object === null)
15387           break;
15388       }
15389       return object;
15390     }
15391     function _get() {
15392       if (typeof Reflect !== "undefined" && Reflect.get) {
15393         _get = Reflect.get.bind();
15394       } else {
15395         _get = function _get2(target, property, receiver) {
15396           var base = _superPropBase(target, property);
15397           if (!base)
15398             return;
15399           var desc = Object.getOwnPropertyDescriptor(base, property);
15400           if (desc.get) {
15401             return desc.get.call(arguments.length < 3 ? target : receiver);
15402           }
15403           return desc.value;
15404         };
15405       }
15406       return _get.apply(this, arguments);
15407     }
15408     var Emitter = /* @__PURE__ */ function() {
15409       function Emitter2() {
15410         _classCallCheck(this, Emitter2);
15411         Object.defineProperty(this, "listeners", {
15412           value: {},
15413           writable: true,
15414           configurable: true
15415         });
15416       }
15417       _createClass(Emitter2, [{
15418         key: "addEventListener",
15419         value: function addEventListener(type2, callback, options2) {
15420           if (!(type2 in this.listeners)) {
15421             this.listeners[type2] = [];
15422           }
15423           this.listeners[type2].push({
15424             callback,
15425             options: options2
15426           });
15427         }
15428       }, {
15429         key: "removeEventListener",
15430         value: function removeEventListener(type2, callback) {
15431           if (!(type2 in this.listeners)) {
15432             return;
15433           }
15434           var stack = this.listeners[type2];
15435           for (var i2 = 0, l = stack.length; i2 < l; i2++) {
15436             if (stack[i2].callback === callback) {
15437               stack.splice(i2, 1);
15438               return;
15439             }
15440           }
15441         }
15442       }, {
15443         key: "dispatchEvent",
15444         value: function dispatchEvent2(event) {
15445           if (!(event.type in this.listeners)) {
15446             return;
15447           }
15448           var stack = this.listeners[event.type];
15449           var stackToCall = stack.slice();
15450           for (var i2 = 0, l = stackToCall.length; i2 < l; i2++) {
15451             var listener = stackToCall[i2];
15452             try {
15453               listener.callback.call(this, event);
15454             } catch (e) {
15455               Promise.resolve().then(function() {
15456                 throw e;
15457               });
15458             }
15459             if (listener.options && listener.options.once) {
15460               this.removeEventListener(event.type, listener.callback);
15461             }
15462           }
15463           return !event.defaultPrevented;
15464         }
15465       }]);
15466       return Emitter2;
15467     }();
15468     var AbortSignal = /* @__PURE__ */ function(_Emitter) {
15469       _inherits(AbortSignal2, _Emitter);
15470       var _super = _createSuper(AbortSignal2);
15471       function AbortSignal2() {
15472         var _this;
15473         _classCallCheck(this, AbortSignal2);
15474         _this = _super.call(this);
15475         if (!_this.listeners) {
15476           Emitter.call(_assertThisInitialized(_this));
15477         }
15478         Object.defineProperty(_assertThisInitialized(_this), "aborted", {
15479           value: false,
15480           writable: true,
15481           configurable: true
15482         });
15483         Object.defineProperty(_assertThisInitialized(_this), "onabort", {
15484           value: null,
15485           writable: true,
15486           configurable: true
15487         });
15488         Object.defineProperty(_assertThisInitialized(_this), "reason", {
15489           value: void 0,
15490           writable: true,
15491           configurable: true
15492         });
15493         return _this;
15494       }
15495       _createClass(AbortSignal2, [{
15496         key: "toString",
15497         value: function toString2() {
15498           return "[object AbortSignal]";
15499         }
15500       }, {
15501         key: "dispatchEvent",
15502         value: function dispatchEvent2(event) {
15503           if (event.type === "abort") {
15504             this.aborted = true;
15505             if (typeof this.onabort === "function") {
15506               this.onabort.call(this, event);
15507             }
15508           }
15509           _get(_getPrototypeOf(AbortSignal2.prototype), "dispatchEvent", this).call(this, event);
15510         }
15511       }]);
15512       return AbortSignal2;
15513     }(Emitter);
15514     var AbortController2 = /* @__PURE__ */ function() {
15515       function AbortController3() {
15516         _classCallCheck(this, AbortController3);
15517         Object.defineProperty(this, "signal", {
15518           value: new AbortSignal(),
15519           writable: true,
15520           configurable: true
15521         });
15522       }
15523       _createClass(AbortController3, [{
15524         key: "abort",
15525         value: function abort(reason) {
15526           var event;
15527           try {
15528             event = new Event("abort");
15529           } catch (e) {
15530             if (typeof document !== "undefined") {
15531               if (!document.createEvent) {
15532                 event = document.createEventObject();
15533                 event.type = "abort";
15534               } else {
15535                 event = document.createEvent("Event");
15536                 event.initEvent("abort", false, false);
15537               }
15538             } else {
15539               event = {
15540                 type: "abort",
15541                 bubbles: false,
15542                 cancelable: false
15543               };
15544             }
15545           }
15546           var signalReason = reason;
15547           if (signalReason === void 0) {
15548             if (typeof document === "undefined") {
15549               signalReason = new Error("This operation was aborted");
15550               signalReason.name = "AbortError";
15551             } else {
15552               try {
15553                 signalReason = new DOMException("signal is aborted without reason");
15554               } catch (err) {
15555                 signalReason = new Error("This operation was aborted");
15556                 signalReason.name = "AbortError";
15557               }
15558             }
15559           }
15560           this.signal.reason = signalReason;
15561           this.signal.dispatchEvent(event);
15562         }
15563       }, {
15564         key: "toString",
15565         value: function toString2() {
15566           return "[object AbortController]";
15567         }
15568       }]);
15569       return AbortController3;
15570     }();
15571     if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
15572       AbortController2.prototype[Symbol.toStringTag] = "AbortController";
15573       AbortSignal.prototype[Symbol.toStringTag] = "AbortSignal";
15574     }
15575     function polyfillNeeded(self2) {
15576       if (self2.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
15577         console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill");
15578         return true;
15579       }
15580       return typeof self2.Request === "function" && !self2.Request.prototype.hasOwnProperty("signal") || !self2.AbortController;
15581     }
15582     function abortableFetchDecorator(patchTargets) {
15583       if ("function" === typeof patchTargets) {
15584         patchTargets = {
15585           fetch: patchTargets
15586         };
15587       }
15588       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;
15589       if (!polyfillNeeded({
15590         fetch: fetch3,
15591         Request: NativeRequest,
15592         AbortController: NativeAbortController,
15593         __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL
15594       })) {
15595         return {
15596           fetch: fetch3,
15597           Request: Request2
15598         };
15599       }
15600       var Request2 = NativeRequest;
15601       if (Request2 && !Request2.prototype.hasOwnProperty("signal") || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
15602         Request2 = function Request3(input, init2) {
15603           var signal;
15604           if (init2 && init2.signal) {
15605             signal = init2.signal;
15606             delete init2.signal;
15607           }
15608           var request3 = new NativeRequest(input, init2);
15609           if (signal) {
15610             Object.defineProperty(request3, "signal", {
15611               writable: false,
15612               enumerable: false,
15613               configurable: true,
15614               value: signal
15615             });
15616           }
15617           return request3;
15618         };
15619         Request2.prototype = NativeRequest.prototype;
15620       }
15621       var realFetch = fetch3;
15622       var abortableFetch = function abortableFetch2(input, init2) {
15623         var signal = Request2 && Request2.prototype.isPrototypeOf(input) ? input.signal : init2 ? init2.signal : void 0;
15624         if (signal) {
15625           var abortError;
15626           try {
15627             abortError = new DOMException("Aborted", "AbortError");
15628           } catch (err) {
15629             abortError = new Error("Aborted");
15630             abortError.name = "AbortError";
15631           }
15632           if (signal.aborted) {
15633             return Promise.reject(abortError);
15634           }
15635           var cancellation = new Promise(function(_, reject) {
15636             signal.addEventListener("abort", function() {
15637               return reject(abortError);
15638             }, {
15639               once: true
15640             });
15641           });
15642           if (init2 && init2.signal) {
15643             delete init2.signal;
15644           }
15645           return Promise.race([cancellation, realFetch(input, init2)]);
15646         }
15647         return realFetch(input, init2);
15648       };
15649       return {
15650         fetch: abortableFetch,
15651         Request: Request2
15652       };
15653     }
15654     (function(self2) {
15655       if (!polyfillNeeded(self2)) {
15656         return;
15657       }
15658       if (!self2.fetch) {
15659         console.warn("fetch() is not available, cannot install abortcontroller-polyfill");
15660         return;
15661       }
15662       var _abortableFetch = abortableFetchDecorator(self2), fetch3 = _abortableFetch.fetch, Request2 = _abortableFetch.Request;
15663       self2.fetch = fetch3;
15664       self2.Request = Request2;
15665       Object.defineProperty(self2, "AbortController", {
15666         writable: true,
15667         enumerable: false,
15668         configurable: true,
15669         value: AbortController2
15670       });
15671       Object.defineProperty(self2, "AbortSignal", {
15672         writable: true,
15673         enumerable: false,
15674         configurable: true,
15675         value: AbortSignal
15676       });
15677     })(typeof self !== "undefined" ? self : global);
15678   });
15679
15680   // modules/index.js
15681   var modules_exports = {};
15682   __export(modules_exports, {
15683     LocationManager: () => LocationManager,
15684     QAItem: () => QAItem,
15685     actionAddEntity: () => actionAddEntity,
15686     actionAddMember: () => actionAddMember,
15687     actionAddMidpoint: () => actionAddMidpoint,
15688     actionAddVertex: () => actionAddVertex,
15689     actionChangeMember: () => actionChangeMember,
15690     actionChangePreset: () => actionChangePreset,
15691     actionChangeTags: () => actionChangeTags,
15692     actionCircularize: () => actionCircularize,
15693     actionConnect: () => actionConnect,
15694     actionCopyEntities: () => actionCopyEntities,
15695     actionDeleteMember: () => actionDeleteMember,
15696     actionDeleteMultiple: () => actionDeleteMultiple,
15697     actionDeleteNode: () => actionDeleteNode,
15698     actionDeleteRelation: () => actionDeleteRelation,
15699     actionDeleteWay: () => actionDeleteWay,
15700     actionDiscardTags: () => actionDiscardTags,
15701     actionDisconnect: () => actionDisconnect,
15702     actionExtract: () => actionExtract,
15703     actionJoin: () => actionJoin,
15704     actionMerge: () => actionMerge,
15705     actionMergeNodes: () => actionMergeNodes,
15706     actionMergePolygon: () => actionMergePolygon,
15707     actionMergeRemoteChanges: () => actionMergeRemoteChanges,
15708     actionMove: () => actionMove,
15709     actionMoveMember: () => actionMoveMember,
15710     actionMoveNode: () => actionMoveNode,
15711     actionNoop: () => actionNoop,
15712     actionOrthogonalize: () => actionOrthogonalize,
15713     actionReflect: () => actionReflect,
15714     actionRestrictTurn: () => actionRestrictTurn,
15715     actionReverse: () => actionReverse,
15716     actionRevert: () => actionRevert,
15717     actionRotate: () => actionRotate,
15718     actionScale: () => actionScale,
15719     actionSplit: () => actionSplit,
15720     actionStraightenNodes: () => actionStraightenNodes,
15721     actionStraightenWay: () => actionStraightenWay,
15722     actionUnrestrictTurn: () => actionUnrestrictTurn,
15723     actionUpgradeTags: () => actionUpgradeTags,
15724     behaviorAddWay: () => behaviorAddWay,
15725     behaviorBreathe: () => behaviorBreathe,
15726     behaviorDrag: () => behaviorDrag,
15727     behaviorDraw: () => behaviorDraw,
15728     behaviorDrawWay: () => behaviorDrawWay,
15729     behaviorEdit: () => behaviorEdit,
15730     behaviorHash: () => behaviorHash,
15731     behaviorHover: () => behaviorHover,
15732     behaviorLasso: () => behaviorLasso,
15733     behaviorOperation: () => behaviorOperation,
15734     behaviorPaste: () => behaviorPaste,
15735     behaviorSelect: () => behaviorSelect,
15736     coreContext: () => coreContext,
15737     coreDifference: () => coreDifference,
15738     coreFileFetcher: () => coreFileFetcher,
15739     coreGraph: () => coreGraph,
15740     coreHistory: () => coreHistory,
15741     coreLocalizer: () => coreLocalizer,
15742     coreTree: () => coreTree,
15743     coreUploader: () => coreUploader,
15744     coreValidator: () => coreValidator,
15745     d3: () => d3,
15746     debug: () => debug,
15747     fileFetcher: () => _mainFileFetcher,
15748     geoAngle: () => geoAngle,
15749     geoChooseEdge: () => geoChooseEdge,
15750     geoEdgeEqual: () => geoEdgeEqual,
15751     geoExtent: () => geoExtent,
15752     geoGetSmallestSurroundingRectangle: () => geoGetSmallestSurroundingRectangle,
15753     geoHasLineIntersections: () => geoHasLineIntersections,
15754     geoHasSelfIntersections: () => geoHasSelfIntersections,
15755     geoLatToMeters: () => geoLatToMeters,
15756     geoLineIntersection: () => geoLineIntersection,
15757     geoLonToMeters: () => geoLonToMeters,
15758     geoMetersToLat: () => geoMetersToLat,
15759     geoMetersToLon: () => geoMetersToLon,
15760     geoMetersToOffset: () => geoMetersToOffset,
15761     geoOffsetToMeters: () => geoOffsetToMeters,
15762     geoOrthoCalcScore: () => geoOrthoCalcScore,
15763     geoOrthoCanOrthogonalize: () => geoOrthoCanOrthogonalize,
15764     geoOrthoMaxOffsetAngle: () => geoOrthoMaxOffsetAngle,
15765     geoOrthoNormalizedDotProduct: () => geoOrthoNormalizedDotProduct,
15766     geoPathHasIntersections: () => geoPathHasIntersections,
15767     geoPathIntersections: () => geoPathIntersections,
15768     geoPathLength: () => geoPathLength,
15769     geoPointInPolygon: () => geoPointInPolygon,
15770     geoPolygonContainsPolygon: () => geoPolygonContainsPolygon,
15771     geoPolygonIntersectsPolygon: () => geoPolygonIntersectsPolygon,
15772     geoRawMercator: () => geoRawMercator,
15773     geoRotate: () => geoRotate,
15774     geoScaleToZoom: () => geoScaleToZoom,
15775     geoSphericalClosestNode: () => geoSphericalClosestNode,
15776     geoSphericalDistance: () => geoSphericalDistance,
15777     geoVecAdd: () => geoVecAdd,
15778     geoVecAngle: () => geoVecAngle,
15779     geoVecCross: () => geoVecCross,
15780     geoVecDot: () => geoVecDot,
15781     geoVecEqual: () => geoVecEqual,
15782     geoVecFloor: () => geoVecFloor,
15783     geoVecInterp: () => geoVecInterp,
15784     geoVecLength: () => geoVecLength,
15785     geoVecLengthSquare: () => geoVecLengthSquare,
15786     geoVecNormalize: () => geoVecNormalize,
15787     geoVecNormalizedDot: () => geoVecNormalizedDot,
15788     geoVecProject: () => geoVecProject,
15789     geoVecScale: () => geoVecScale,
15790     geoVecSubtract: () => geoVecSubtract,
15791     geoViewportEdge: () => geoViewportEdge,
15792     geoZoomToScale: () => geoZoomToScale,
15793     likelyRawNumberFormat: () => likelyRawNumberFormat,
15794     localizer: () => _mainLocalizer,
15795     locationManager: () => _sharedLocationManager,
15796     modeAddArea: () => modeAddArea,
15797     modeAddLine: () => modeAddLine,
15798     modeAddNote: () => modeAddNote,
15799     modeAddPoint: () => modeAddPoint,
15800     modeBrowse: () => modeBrowse,
15801     modeDragNode: () => modeDragNode,
15802     modeDragNote: () => modeDragNote,
15803     modeDrawArea: () => modeDrawArea,
15804     modeDrawLine: () => modeDrawLine,
15805     modeMove: () => modeMove,
15806     modeRotate: () => modeRotate,
15807     modeSave: () => modeSave,
15808     modeSelect: () => modeSelect,
15809     modeSelectData: () => modeSelectData,
15810     modeSelectError: () => modeSelectError,
15811     modeSelectNote: () => modeSelectNote,
15812     operationCircularize: () => operationCircularize,
15813     operationContinue: () => operationContinue,
15814     operationCopy: () => operationCopy,
15815     operationDelete: () => operationDelete,
15816     operationDisconnect: () => operationDisconnect,
15817     operationDowngrade: () => operationDowngrade,
15818     operationExtract: () => operationExtract,
15819     operationMerge: () => operationMerge,
15820     operationMove: () => operationMove,
15821     operationOrthogonalize: () => operationOrthogonalize,
15822     operationPaste: () => operationPaste,
15823     operationReflectLong: () => operationReflectLong,
15824     operationReflectShort: () => operationReflectShort,
15825     operationReverse: () => operationReverse,
15826     operationRotate: () => operationRotate,
15827     operationSplit: () => operationSplit,
15828     operationStraighten: () => operationStraighten,
15829     osmAreaKeys: () => osmAreaKeys,
15830     osmChangeset: () => osmChangeset,
15831     osmEntity: () => osmEntity,
15832     osmFlowingWaterwayTagValues: () => osmFlowingWaterwayTagValues,
15833     osmInferRestriction: () => osmInferRestriction,
15834     osmIntersection: () => osmIntersection,
15835     osmIsInterestingTag: () => osmIsInterestingTag,
15836     osmIsOldMultipolygonOuterMember: () => osmIsOldMultipolygonOuterMember,
15837     osmJoinWays: () => osmJoinWays,
15838     osmLanes: () => osmLanes,
15839     osmLifecyclePrefixes: () => osmLifecyclePrefixes,
15840     osmNode: () => osmNode,
15841     osmNodeGeometriesForTags: () => osmNodeGeometriesForTags,
15842     osmNote: () => osmNote,
15843     osmOldMultipolygonOuterMember: () => osmOldMultipolygonOuterMember,
15844     osmOldMultipolygonOuterMemberOfRelation: () => osmOldMultipolygonOuterMemberOfRelation,
15845     osmOneWayTags: () => osmOneWayTags,
15846     osmPavedTags: () => osmPavedTags,
15847     osmPointTags: () => osmPointTags,
15848     osmRailwayTrackTagValues: () => osmRailwayTrackTagValues,
15849     osmRelation: () => osmRelation,
15850     osmRemoveLifecyclePrefix: () => osmRemoveLifecyclePrefix,
15851     osmRoutableHighwayTagValues: () => osmRoutableHighwayTagValues,
15852     osmSetAreaKeys: () => osmSetAreaKeys,
15853     osmSetPointTags: () => osmSetPointTags,
15854     osmSetVertexTags: () => osmSetVertexTags,
15855     osmTagSuggestingArea: () => osmTagSuggestingArea,
15856     osmTurn: () => osmTurn,
15857     osmVertexTags: () => osmVertexTags,
15858     osmWay: () => osmWay,
15859     prefs: () => corePreferences,
15860     presetCategory: () => presetCategory,
15861     presetCollection: () => presetCollection,
15862     presetField: () => presetField,
15863     presetIndex: () => presetIndex,
15864     presetManager: () => _mainPresetIndex,
15865     presetPreset: () => presetPreset,
15866     rendererBackground: () => rendererBackground,
15867     rendererBackgroundSource: () => rendererBackgroundSource,
15868     rendererFeatures: () => rendererFeatures,
15869     rendererMap: () => rendererMap,
15870     rendererPhotos: () => rendererPhotos,
15871     rendererTileLayer: () => rendererTileLayer,
15872     serviceImproveOSM: () => improveOSM_default,
15873     serviceKartaview: () => kartaview_default,
15874     serviceKeepRight: () => keepRight_default,
15875     serviceMapRules: () => maprules_default,
15876     serviceMapillary: () => mapillary_default,
15877     serviceNominatim: () => nominatim_default,
15878     serviceNsi: () => nsi_default,
15879     serviceOsm: () => osm_default,
15880     serviceOsmWikibase: () => osm_wikibase_default,
15881     serviceOsmose: () => osmose_default,
15882     serviceStreetside: () => streetside_default,
15883     serviceTaginfo: () => taginfo_default,
15884     serviceVectorTile: () => vector_tile_default,
15885     serviceWikidata: () => wikidata_default,
15886     serviceWikipedia: () => wikipedia_default,
15887     services: () => services,
15888     svgAreas: () => svgAreas,
15889     svgData: () => svgData,
15890     svgDebug: () => svgDebug,
15891     svgDefs: () => svgDefs,
15892     svgGeolocate: () => svgGeolocate,
15893     svgIcon: () => svgIcon,
15894     svgKartaviewImages: () => svgKartaviewImages,
15895     svgKeepRight: () => svgKeepRight,
15896     svgLabels: () => svgLabels,
15897     svgLayers: () => svgLayers,
15898     svgLines: () => svgLines,
15899     svgMapillaryImages: () => svgMapillaryImages,
15900     svgMapillarySigns: () => svgMapillarySigns,
15901     svgMarkerSegments: () => svgMarkerSegments,
15902     svgMidpoints: () => svgMidpoints,
15903     svgNotes: () => svgNotes,
15904     svgOsm: () => svgOsm,
15905     svgPassiveVertex: () => svgPassiveVertex,
15906     svgPath: () => svgPath,
15907     svgPointTransform: () => svgPointTransform,
15908     svgPoints: () => svgPoints,
15909     svgRelationMemberTags: () => svgRelationMemberTags,
15910     svgSegmentWay: () => svgSegmentWay,
15911     svgStreetside: () => svgStreetside,
15912     svgTagClasses: () => svgTagClasses,
15913     svgTagPattern: () => svgTagPattern,
15914     svgTouch: () => svgTouch,
15915     svgTurns: () => svgTurns,
15916     svgVertices: () => svgVertices,
15917     t: () => _t,
15918     uiAccount: () => uiAccount,
15919     uiAttribution: () => uiAttribution,
15920     uiChangesetEditor: () => uiChangesetEditor,
15921     uiCmd: () => uiCmd,
15922     uiCombobox: () => uiCombobox,
15923     uiCommit: () => uiCommit,
15924     uiCommitWarnings: () => uiCommitWarnings,
15925     uiConfirm: () => uiConfirm,
15926     uiConflicts: () => uiConflicts,
15927     uiContributors: () => uiContributors,
15928     uiCurtain: () => uiCurtain,
15929     uiDataEditor: () => uiDataEditor,
15930     uiDataHeader: () => uiDataHeader,
15931     uiDisclosure: () => uiDisclosure,
15932     uiEditMenu: () => uiEditMenu,
15933     uiEntityEditor: () => uiEntityEditor,
15934     uiFeatureInfo: () => uiFeatureInfo,
15935     uiFeatureList: () => uiFeatureList,
15936     uiField: () => uiField,
15937     uiFieldAccess: () => uiFieldAccess,
15938     uiFieldAddress: () => uiFieldAddress,
15939     uiFieldCheck: () => uiFieldCheck,
15940     uiFieldColour: () => uiFieldText,
15941     uiFieldCombo: () => uiFieldCombo,
15942     uiFieldDefaultCheck: () => uiFieldCheck,
15943     uiFieldDirectionalCombo: () => uiFieldDirectionalCombo,
15944     uiFieldEmail: () => uiFieldText,
15945     uiFieldHelp: () => uiFieldHelp,
15946     uiFieldIdentifier: () => uiFieldText,
15947     uiFieldLanes: () => uiFieldLanes,
15948     uiFieldLocalized: () => uiFieldLocalized,
15949     uiFieldManyCombo: () => uiFieldCombo,
15950     uiFieldMultiCombo: () => uiFieldCombo,
15951     uiFieldNetworkCombo: () => uiFieldCombo,
15952     uiFieldNumber: () => uiFieldText,
15953     uiFieldOnewayCheck: () => uiFieldCheck,
15954     uiFieldRadio: () => uiFieldRadio,
15955     uiFieldRestrictions: () => uiFieldRestrictions,
15956     uiFieldRoadheight: () => uiFieldRoadheight,
15957     uiFieldRoadspeed: () => uiFieldRoadspeed,
15958     uiFieldSemiCombo: () => uiFieldCombo,
15959     uiFieldStructureRadio: () => uiFieldRadio,
15960     uiFieldTel: () => uiFieldText,
15961     uiFieldText: () => uiFieldText,
15962     uiFieldTextarea: () => uiFieldTextarea,
15963     uiFieldTypeCombo: () => uiFieldCombo,
15964     uiFieldUrl: () => uiFieldText,
15965     uiFieldWikidata: () => uiFieldWikidata,
15966     uiFieldWikipedia: () => uiFieldWikipedia,
15967     uiFields: () => uiFields,
15968     uiFlash: () => uiFlash,
15969     uiFormFields: () => uiFormFields,
15970     uiFullScreen: () => uiFullScreen,
15971     uiGeolocate: () => uiGeolocate,
15972     uiImproveOsmComments: () => uiImproveOsmComments,
15973     uiImproveOsmDetails: () => uiImproveOsmDetails,
15974     uiImproveOsmEditor: () => uiImproveOsmEditor,
15975     uiImproveOsmHeader: () => uiImproveOsmHeader,
15976     uiInfo: () => uiInfo,
15977     uiInfoPanels: () => uiInfoPanels,
15978     uiInit: () => uiInit,
15979     uiInspector: () => uiInspector,
15980     uiIntro: () => uiIntro,
15981     uiIssuesInfo: () => uiIssuesInfo,
15982     uiKeepRightDetails: () => uiKeepRightDetails,
15983     uiKeepRightEditor: () => uiKeepRightEditor,
15984     uiKeepRightHeader: () => uiKeepRightHeader,
15985     uiLasso: () => uiLasso,
15986     uiLengthIndicator: () => uiLengthIndicator,
15987     uiLoading: () => uiLoading,
15988     uiMapInMap: () => uiMapInMap,
15989     uiModal: () => uiModal,
15990     uiNoteComments: () => uiNoteComments,
15991     uiNoteEditor: () => uiNoteEditor,
15992     uiNoteHeader: () => uiNoteHeader,
15993     uiNoteReport: () => uiNoteReport,
15994     uiNotice: () => uiNotice,
15995     uiPaneBackground: () => uiPaneBackground,
15996     uiPaneHelp: () => uiPaneHelp,
15997     uiPaneIssues: () => uiPaneIssues,
15998     uiPaneMapData: () => uiPaneMapData,
15999     uiPanePreferences: () => uiPanePreferences,
16000     uiPanelBackground: () => uiPanelBackground,
16001     uiPanelHistory: () => uiPanelHistory,
16002     uiPanelLocation: () => uiPanelLocation,
16003     uiPanelMeasurement: () => uiPanelMeasurement,
16004     uiPopover: () => uiPopover,
16005     uiPresetIcon: () => uiPresetIcon,
16006     uiPresetList: () => uiPresetList,
16007     uiRestore: () => uiRestore,
16008     uiScale: () => uiScale,
16009     uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions,
16010     uiSectionBackgroundList: () => uiSectionBackgroundList,
16011     uiSectionBackgroundOffset: () => uiSectionBackgroundOffset,
16012     uiSectionChanges: () => uiSectionChanges,
16013     uiSectionDataLayers: () => uiSectionDataLayers,
16014     uiSectionEntityIssues: () => uiSectionEntityIssues,
16015     uiSectionFeatureType: () => uiSectionFeatureType,
16016     uiSectionMapFeatures: () => uiSectionMapFeatures,
16017     uiSectionMapStyleOptions: () => uiSectionMapStyleOptions,
16018     uiSectionOverlayList: () => uiSectionOverlayList,
16019     uiSectionPhotoOverlays: () => uiSectionPhotoOverlays,
16020     uiSectionPresetFields: () => uiSectionPresetFields,
16021     uiSectionPrivacy: () => uiSectionPrivacy,
16022     uiSectionRawMemberEditor: () => uiSectionRawMemberEditor,
16023     uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor,
16024     uiSectionRawTagEditor: () => uiSectionRawTagEditor,
16025     uiSectionSelectionList: () => uiSectionSelectionList,
16026     uiSectionValidationIssues: () => uiSectionValidationIssues,
16027     uiSectionValidationOptions: () => uiSectionValidationOptions,
16028     uiSectionValidationRules: () => uiSectionValidationRules,
16029     uiSectionValidationStatus: () => uiSectionValidationStatus,
16030     uiSettingsCustomBackground: () => uiSettingsCustomBackground,
16031     uiSettingsCustomData: () => uiSettingsCustomData,
16032     uiSidebar: () => uiSidebar,
16033     uiSourceSwitch: () => uiSourceSwitch,
16034     uiSpinner: () => uiSpinner,
16035     uiSplash: () => uiSplash,
16036     uiStatus: () => uiStatus,
16037     uiSuccess: () => uiSuccess,
16038     uiTagReference: () => uiTagReference,
16039     uiToggle: () => uiToggle,
16040     uiTooltip: () => uiTooltip,
16041     uiVersion: () => uiVersion,
16042     uiViewOnKeepRight: () => uiViewOnKeepRight,
16043     uiViewOnOSM: () => uiViewOnOSM,
16044     uiZoom: () => uiZoom,
16045     utilAesDecrypt: () => utilAesDecrypt,
16046     utilAesEncrypt: () => utilAesEncrypt,
16047     utilArrayChunk: () => utilArrayChunk,
16048     utilArrayDifference: () => utilArrayDifference,
16049     utilArrayFlatten: () => utilArrayFlatten,
16050     utilArrayGroupBy: () => utilArrayGroupBy,
16051     utilArrayIdentical: () => utilArrayIdentical,
16052     utilArrayIntersection: () => utilArrayIntersection,
16053     utilArrayUnion: () => utilArrayUnion,
16054     utilArrayUniq: () => utilArrayUniq,
16055     utilArrayUniqBy: () => utilArrayUniqBy,
16056     utilAsyncMap: () => utilAsyncMap,
16057     utilCleanOsmString: () => utilCleanOsmString,
16058     utilCleanTags: () => utilCleanTags,
16059     utilCombinedTags: () => utilCombinedTags,
16060     utilCompareIDs: () => utilCompareIDs,
16061     utilDeepMemberSelector: () => utilDeepMemberSelector,
16062     utilDetect: () => utilDetect,
16063     utilDisplayLabel: () => utilDisplayLabel,
16064     utilDisplayName: () => utilDisplayName,
16065     utilDisplayNameForPath: () => utilDisplayNameForPath,
16066     utilDisplayType: () => utilDisplayType,
16067     utilEditDistance: () => utilEditDistance,
16068     utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
16069     utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
16070     utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
16071     utilEntityRoot: () => utilEntityRoot,
16072     utilEntitySelector: () => utilEntitySelector,
16073     utilFastMouse: () => utilFastMouse,
16074     utilFunctor: () => utilFunctor,
16075     utilGetAllNodes: () => utilGetAllNodes,
16076     utilGetSetValue: () => utilGetSetValue,
16077     utilHashcode: () => utilHashcode,
16078     utilHighlightEntities: () => utilHighlightEntities,
16079     utilKeybinding: () => utilKeybinding,
16080     utilNoAuto: () => utilNoAuto,
16081     utilObjectOmit: () => utilObjectOmit,
16082     utilOldestID: () => utilOldestID,
16083     utilPrefixCSSProperty: () => utilPrefixCSSProperty,
16084     utilPrefixDOMProperty: () => utilPrefixDOMProperty,
16085     utilQsString: () => utilQsString,
16086     utilRebind: () => utilRebind,
16087     utilSafeClassName: () => utilSafeClassName,
16088     utilSessionMutex: () => utilSessionMutex,
16089     utilSetTransform: () => utilSetTransform,
16090     utilStringQs: () => utilStringQs,
16091     utilTagDiff: () => utilTagDiff,
16092     utilTagText: () => utilTagText,
16093     utilTiler: () => utilTiler,
16094     utilTotalExtent: () => utilTotalExtent,
16095     utilTriggerEvent: () => utilTriggerEvent,
16096     utilUnicodeCharsCount: () => utilUnicodeCharsCount,
16097     utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
16098     utilUniqueDomId: () => utilUniqueDomId,
16099     utilWrap: () => utilWrap,
16100     validationAlmostJunction: () => validationAlmostJunction,
16101     validationCloseNodes: () => validationCloseNodes,
16102     validationCrossingWays: () => validationCrossingWays,
16103     validationDisconnectedWay: () => validationDisconnectedWay,
16104     validationFormatting: () => validationFormatting,
16105     validationHelpRequest: () => validationHelpRequest,
16106     validationImpossibleOneway: () => validationImpossibleOneway,
16107     validationIncompatibleSource: () => validationIncompatibleSource,
16108     validationMaprules: () => validationMaprules,
16109     validationMismatchedGeometry: () => validationMismatchedGeometry,
16110     validationMissingRole: () => validationMissingRole,
16111     validationMissingTag: () => validationMissingTag,
16112     validationOutdatedTags: () => validationOutdatedTags,
16113     validationPrivateData: () => validationPrivateData,
16114     validationSuspiciousName: () => validationSuspiciousName,
16115     validationUnsquareWay: () => validationUnsquareWay
16116   });
16117
16118   // modules/actions/add_entity.js
16119   function actionAddEntity(way) {
16120     return function(graph) {
16121       return graph.replace(way);
16122     };
16123   }
16124
16125   // modules/actions/reverse.js
16126   function actionReverse(entityID, options2) {
16127     var ignoreKey = /^.*(_|:)?(description|name|note|website|ref|source|comment|watch|attribution)(_|:)?/;
16128     var numeric = /^([+\-]?)(?=[\d.])/;
16129     var directionKey = /direction$/;
16130     var turn_lanes = /^turn:lanes:?/;
16131     var keyReplacements = [
16132       [/:right$/, ":left"],
16133       [/:left$/, ":right"],
16134       [/:forward$/, ":backward"],
16135       [/:backward$/, ":forward"],
16136       [/:right:/, ":left:"],
16137       [/:left:/, ":right:"],
16138       [/:forward:/, ":backward:"],
16139       [/:backward:/, ":forward:"]
16140     ];
16141     var valueReplacements = {
16142       left: "right",
16143       right: "left",
16144       up: "down",
16145       down: "up",
16146       forward: "backward",
16147       backward: "forward",
16148       forwards: "backward",
16149       backwards: "forward"
16150     };
16151     var roleReplacements = {
16152       forward: "backward",
16153       backward: "forward",
16154       forwards: "backward",
16155       backwards: "forward"
16156     };
16157     var onewayReplacements = {
16158       yes: "-1",
16159       "1": "-1",
16160       "-1": "yes"
16161     };
16162     var compassReplacements = {
16163       N: "S",
16164       NNE: "SSW",
16165       NE: "SW",
16166       ENE: "WSW",
16167       E: "W",
16168       ESE: "WNW",
16169       SE: "NW",
16170       SSE: "NNW",
16171       S: "N",
16172       SSW: "NNE",
16173       SW: "NE",
16174       WSW: "ENE",
16175       W: "E",
16176       WNW: "ESE",
16177       NW: "SE",
16178       NNW: "SSE"
16179     };
16180     function reverseKey(key) {
16181       for (var i2 = 0; i2 < keyReplacements.length; ++i2) {
16182         var replacement = keyReplacements[i2];
16183         if (replacement[0].test(key)) {
16184           return key.replace(replacement[0], replacement[1]);
16185         }
16186       }
16187       return key;
16188     }
16189     function reverseValue(key, value, includeAbsolute) {
16190       if (ignoreKey.test(key))
16191         return value;
16192       if (turn_lanes.test(key)) {
16193         return value;
16194       } else if (key === "incline" && numeric.test(value)) {
16195         return value.replace(numeric, function(_, sign2) {
16196           return sign2 === "-" ? "" : "-";
16197         });
16198       } else if (options2 && options2.reverseOneway && key === "oneway") {
16199         return onewayReplacements[value] || value;
16200       } else if (includeAbsolute && directionKey.test(key)) {
16201         return value.split(";").map((value2) => {
16202           if (compassReplacements[value2])
16203             return compassReplacements[value2];
16204           var degrees3 = Number(value2);
16205           if (isFinite(degrees3)) {
16206             if (degrees3 < 180) {
16207               degrees3 += 180;
16208             } else {
16209               degrees3 -= 180;
16210             }
16211             return degrees3.toString();
16212           } else {
16213             return valueReplacements[value2] || value2;
16214           }
16215         }).join(";");
16216       }
16217       return valueReplacements[value] || value;
16218     }
16219     function reverseNodeTags(graph, nodeIDs) {
16220       for (var i2 = 0; i2 < nodeIDs.length; i2++) {
16221         var node = graph.hasEntity(nodeIDs[i2]);
16222         if (!node || !Object.keys(node.tags).length)
16223           continue;
16224         var tags = {};
16225         for (var key in node.tags) {
16226           tags[reverseKey(key)] = reverseValue(key, node.tags[key], node.id === entityID);
16227         }
16228         graph = graph.replace(node.update({ tags }));
16229       }
16230       return graph;
16231     }
16232     function reverseWay(graph, way) {
16233       var nodes = way.nodes.slice().reverse();
16234       var tags = {};
16235       var role;
16236       for (var key in way.tags) {
16237         tags[reverseKey(key)] = reverseValue(key, way.tags[key]);
16238       }
16239       graph.parentRelations(way).forEach(function(relation) {
16240         relation.members.forEach(function(member, index) {
16241           if (member.id === way.id && (role = roleReplacements[member.role])) {
16242             relation = relation.updateMember({ role }, index);
16243             graph = graph.replace(relation);
16244           }
16245         });
16246       });
16247       return reverseNodeTags(graph, nodes).replace(way.update({ nodes, tags }));
16248     }
16249     var action = function(graph) {
16250       var entity = graph.entity(entityID);
16251       if (entity.type === "way") {
16252         return reverseWay(graph, entity);
16253       }
16254       return reverseNodeTags(graph, [entityID]);
16255     };
16256     action.disabled = function(graph) {
16257       var entity = graph.hasEntity(entityID);
16258       if (!entity || entity.type === "way")
16259         return false;
16260       for (var key in entity.tags) {
16261         var value = entity.tags[key];
16262         if (reverseKey(key) !== key || reverseValue(key, value, true) !== value) {
16263           return false;
16264         }
16265       }
16266       return "nondirectional_node";
16267     };
16268     action.entityID = function() {
16269       return entityID;
16270     };
16271     return action;
16272   }
16273
16274   // modules/osm/tags.js
16275   function osmIsInterestingTag(key) {
16276     return key !== "attribution" && key !== "created_by" && key !== "source" && key !== "odbl" && key.indexOf("source:") !== 0 && key.indexOf("source_ref") !== 0 && // purposely exclude colon
16277     key.indexOf("tiger:") !== 0;
16278   }
16279   var osmLifecyclePrefixes = {
16280     // nonexistent, might be built
16281     proposed: true,
16282     planned: true,
16283     // under maintentance or between groundbreaking and opening
16284     construction: true,
16285     // existent but not functional
16286     disused: true,
16287     // dilapidated to nonexistent
16288     abandoned: true,
16289     was: true,
16290     // nonexistent, still may appear in imagery
16291     dismantled: true,
16292     razed: true,
16293     demolished: true,
16294     destroyed: true,
16295     removed: true,
16296     obliterated: true,
16297     // existent occasionally, e.g. stormwater drainage basin
16298     intermittent: true
16299   };
16300   function osmRemoveLifecyclePrefix(key) {
16301     const keySegments = key.split(":");
16302     if (keySegments.length === 1)
16303       return key;
16304     if (keySegments[0] in osmLifecyclePrefixes) {
16305       return key.slice(keySegments[0].length + 1);
16306     }
16307     return key;
16308   }
16309   var osmAreaKeys = {};
16310   function osmSetAreaKeys(value) {
16311     osmAreaKeys = value;
16312   }
16313   var osmAreaKeysExceptions = {
16314     highway: {
16315       elevator: true,
16316       rest_area: true,
16317       services: true
16318     },
16319     public_transport: {
16320       platform: true
16321     },
16322     railway: {
16323       platform: true,
16324       roundhouse: true,
16325       station: true,
16326       traverser: true,
16327       turntable: true,
16328       wash: true
16329     },
16330     traffic_calming: {
16331       island: true
16332     },
16333     waterway: {
16334       dam: true
16335     }
16336   };
16337   function osmTagSuggestingArea(tags) {
16338     if (tags.area === "yes")
16339       return { area: "yes" };
16340     if (tags.area === "no")
16341       return null;
16342     var returnTags = {};
16343     for (var realKey in tags) {
16344       const key = osmRemoveLifecyclePrefix(realKey);
16345       if (key in osmAreaKeys && !(tags[realKey] in osmAreaKeys[key])) {
16346         returnTags[realKey] = tags[realKey];
16347         return returnTags;
16348       }
16349       if (key in osmAreaKeysExceptions && tags[realKey] in osmAreaKeysExceptions[key]) {
16350         returnTags[realKey] = tags[realKey];
16351         return returnTags;
16352       }
16353     }
16354     return null;
16355   }
16356   var osmLineTags = {};
16357   function osmSetLineTags(value) {
16358     osmLineTags = value;
16359   }
16360   var osmPointTags = {};
16361   function osmSetPointTags(value) {
16362     osmPointTags = value;
16363   }
16364   var osmVertexTags = {};
16365   function osmSetVertexTags(value) {
16366     osmVertexTags = value;
16367   }
16368   function osmNodeGeometriesForTags(nodeTags) {
16369     var geometries = {};
16370     for (var key in nodeTags) {
16371       if (osmPointTags[key] && (osmPointTags[key]["*"] || osmPointTags[key][nodeTags[key]])) {
16372         geometries.point = true;
16373       }
16374       if (osmVertexTags[key] && (osmVertexTags[key]["*"] || osmVertexTags[key][nodeTags[key]])) {
16375         geometries.vertex = true;
16376       }
16377       if (geometries.point && geometries.vertex)
16378         break;
16379     }
16380     return geometries;
16381   }
16382   var osmOneWayTags = {
16383     "aerialway": {
16384       "chair_lift": true,
16385       "drag_lift": true,
16386       "j-bar": true,
16387       "magic_carpet": true,
16388       "mixed_lift": true,
16389       "platter": true,
16390       "rope_tow": true,
16391       "t-bar": true,
16392       "zip_line": true
16393     },
16394     "highway": {
16395       "motorway": true
16396     },
16397     "junction": {
16398       "circular": true,
16399       "roundabout": true
16400     },
16401     "man_made": {
16402       "goods_conveyor": true,
16403       "piste:halfpipe": true
16404     },
16405     "piste:type": {
16406       "downhill": true,
16407       "sled": true,
16408       "yes": true
16409     },
16410     "seamark:type": {
16411       "two-way_route": true,
16412       "recommended_traffic_lane": true,
16413       "separation_lane": true,
16414       "separation_roundabout": true
16415     },
16416     "waterway": {
16417       "canal": true,
16418       "ditch": true,
16419       "drain": true,
16420       "fish_pass": true,
16421       "pressurised": true,
16422       "river": true,
16423       "spillway": true,
16424       "stream": true,
16425       "tidal_channel": true
16426     }
16427   };
16428   var osmPavedTags = {
16429     "surface": {
16430       "paved": true,
16431       "asphalt": true,
16432       "concrete": true,
16433       "chipseal": true,
16434       "concrete:lanes": true,
16435       "concrete:plates": true
16436     },
16437     "tracktype": {
16438       "grade1": true
16439     }
16440   };
16441   var osmSemipavedTags = {
16442     "surface": {
16443       "cobblestone": true,
16444       "cobblestone:flattened": true,
16445       "unhewn_cobblestone": true,
16446       "sett": true,
16447       "paving_stones": true,
16448       "metal": true,
16449       "wood": true
16450     }
16451   };
16452   var osmRightSideIsInsideTags = {
16453     "natural": {
16454       "cliff": true,
16455       "coastline": "coastline"
16456     },
16457     "barrier": {
16458       "retaining_wall": true,
16459       "kerb": true,
16460       "guard_rail": true,
16461       "city_wall": true
16462     },
16463     "man_made": {
16464       "embankment": true,
16465       "quay": true
16466     },
16467     "waterway": {
16468       "weir": true
16469     }
16470   };
16471   var osmRoutableHighwayTagValues = {
16472     motorway: true,
16473     trunk: true,
16474     primary: true,
16475     secondary: true,
16476     tertiary: true,
16477     residential: true,
16478     motorway_link: true,
16479     trunk_link: true,
16480     primary_link: true,
16481     secondary_link: true,
16482     tertiary_link: true,
16483     unclassified: true,
16484     road: true,
16485     service: true,
16486     track: true,
16487     living_street: true,
16488     bus_guideway: true,
16489     path: true,
16490     footway: true,
16491     cycleway: true,
16492     bridleway: true,
16493     pedestrian: true,
16494     corridor: true,
16495     steps: true
16496   };
16497   var osmPathHighwayTagValues = {
16498     path: true,
16499     footway: true,
16500     cycleway: true,
16501     bridleway: true,
16502     pedestrian: true,
16503     corridor: true,
16504     steps: true
16505   };
16506   var osmRailwayTrackTagValues = {
16507     rail: true,
16508     light_rail: true,
16509     tram: true,
16510     subway: true,
16511     monorail: true,
16512     funicular: true,
16513     miniature: true,
16514     narrow_gauge: true,
16515     disused: true,
16516     preserved: true
16517   };
16518   var osmFlowingWaterwayTagValues = {
16519     canal: true,
16520     ditch: true,
16521     drain: true,
16522     fish_pass: true,
16523     river: true,
16524     stream: true,
16525     tidal_channel: true
16526   };
16527   var allowUpperCaseTagValues = /network|taxon|genus|species|brand|grape_variety|royal_cypher|listed_status|booth|rating|stars|:output|_hours|_times|_ref|manufacturer|country|target|brewery|cai_scale|traffic_sign/;
16528
16529   // node_modules/d3-array/src/ascending.js
16530   function ascending(a, b) {
16531     return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
16532   }
16533
16534   // node_modules/d3-array/src/descending.js
16535   function descending(a, b) {
16536     return a == null || b == null ? NaN : b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
16537   }
16538
16539   // node_modules/d3-array/src/bisector.js
16540   function bisector(f2) {
16541     let compare1, compare2, delta;
16542     if (f2.length !== 2) {
16543       compare1 = ascending;
16544       compare2 = (d, x) => ascending(f2(d), x);
16545       delta = (d, x) => f2(d) - x;
16546     } else {
16547       compare1 = f2 === ascending || f2 === descending ? f2 : zero;
16548       compare2 = f2;
16549       delta = f2;
16550     }
16551     function left(a, x, lo = 0, hi = a.length) {
16552       if (lo < hi) {
16553         if (compare1(x, x) !== 0)
16554           return hi;
16555         do {
16556           const mid = lo + hi >>> 1;
16557           if (compare2(a[mid], x) < 0)
16558             lo = mid + 1;
16559           else
16560             hi = mid;
16561         } while (lo < hi);
16562       }
16563       return lo;
16564     }
16565     function right(a, x, lo = 0, hi = a.length) {
16566       if (lo < hi) {
16567         if (compare1(x, x) !== 0)
16568           return hi;
16569         do {
16570           const mid = lo + hi >>> 1;
16571           if (compare2(a[mid], x) <= 0)
16572             lo = mid + 1;
16573           else
16574             hi = mid;
16575         } while (lo < hi);
16576       }
16577       return lo;
16578     }
16579     function center(a, x, lo = 0, hi = a.length) {
16580       const i2 = left(a, x, lo, hi - 1);
16581       return i2 > lo && delta(a[i2 - 1], x) > -delta(a[i2], x) ? i2 - 1 : i2;
16582     }
16583     return { left, center, right };
16584   }
16585   function zero() {
16586     return 0;
16587   }
16588
16589   // node_modules/d3-array/src/number.js
16590   function number(x) {
16591     return x === null ? NaN : +x;
16592   }
16593   function* numbers(values, valueof) {
16594     if (valueof === void 0) {
16595       for (let value of values) {
16596         if (value != null && (value = +value) >= value) {
16597           yield value;
16598         }
16599       }
16600     } else {
16601       let index = -1;
16602       for (let value of values) {
16603         if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
16604           yield value;
16605         }
16606       }
16607     }
16608   }
16609
16610   // node_modules/d3-array/src/bisect.js
16611   var ascendingBisect = bisector(ascending);
16612   var bisectRight = ascendingBisect.right;
16613   var bisectLeft = ascendingBisect.left;
16614   var bisectCenter = bisector(number).center;
16615   var bisect_default = bisectRight;
16616
16617   // node_modules/d3-array/src/fsum.js
16618   var Adder = class {
16619     constructor() {
16620       this._partials = new Float64Array(32);
16621       this._n = 0;
16622     }
16623     add(x) {
16624       const p = this._partials;
16625       let i2 = 0;
16626       for (let j2 = 0; j2 < this._n && j2 < 32; j2++) {
16627         const y = p[j2], hi = x + y, lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x);
16628         if (lo)
16629           p[i2++] = lo;
16630         x = hi;
16631       }
16632       p[i2] = x;
16633       this._n = i2 + 1;
16634       return this;
16635     }
16636     valueOf() {
16637       const p = this._partials;
16638       let n2 = this._n, x, y, lo, hi = 0;
16639       if (n2 > 0) {
16640         hi = p[--n2];
16641         while (n2 > 0) {
16642           x = hi;
16643           y = p[--n2];
16644           hi = x + y;
16645           lo = y - (hi - x);
16646           if (lo)
16647             break;
16648         }
16649         if (n2 > 0 && (lo < 0 && p[n2 - 1] < 0 || lo > 0 && p[n2 - 1] > 0)) {
16650           y = lo * 2;
16651           x = hi + y;
16652           if (y == x - hi)
16653             hi = x;
16654         }
16655       }
16656       return hi;
16657     }
16658   };
16659
16660   // node_modules/d3-array/src/sort.js
16661   function compareDefined(compare = ascending) {
16662     if (compare === ascending)
16663       return ascendingDefined;
16664     if (typeof compare !== "function")
16665       throw new TypeError("compare is not a function");
16666     return (a, b) => {
16667       const x = compare(a, b);
16668       if (x || x === 0)
16669         return x;
16670       return (compare(b, b) === 0) - (compare(a, a) === 0);
16671     };
16672   }
16673   function ascendingDefined(a, b) {
16674     return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0);
16675   }
16676
16677   // node_modules/d3-array/src/ticks.js
16678   var e10 = Math.sqrt(50);
16679   var e5 = Math.sqrt(10);
16680   var e2 = Math.sqrt(2);
16681   function ticks(start2, stop, count) {
16682     var reverse, i2 = -1, n2, ticks2, step;
16683     stop = +stop, start2 = +start2, count = +count;
16684     if (start2 === stop && count > 0)
16685       return [start2];
16686     if (reverse = stop < start2)
16687       n2 = start2, start2 = stop, stop = n2;
16688     if ((step = tickIncrement(start2, stop, count)) === 0 || !isFinite(step))
16689       return [];
16690     if (step > 0) {
16691       let r0 = Math.round(start2 / step), r1 = Math.round(stop / step);
16692       if (r0 * step < start2)
16693         ++r0;
16694       if (r1 * step > stop)
16695         --r1;
16696       ticks2 = new Array(n2 = r1 - r0 + 1);
16697       while (++i2 < n2)
16698         ticks2[i2] = (r0 + i2) * step;
16699     } else {
16700       step = -step;
16701       let r0 = Math.round(start2 * step), r1 = Math.round(stop * step);
16702       if (r0 / step < start2)
16703         ++r0;
16704       if (r1 / step > stop)
16705         --r1;
16706       ticks2 = new Array(n2 = r1 - r0 + 1);
16707       while (++i2 < n2)
16708         ticks2[i2] = (r0 + i2) / step;
16709     }
16710     if (reverse)
16711       ticks2.reverse();
16712     return ticks2;
16713   }
16714   function tickIncrement(start2, stop, count) {
16715     var step = (stop - start2) / Math.max(0, count), power = Math.floor(Math.log(step) / Math.LN10), error = step / Math.pow(10, power);
16716     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);
16717   }
16718   function tickStep(start2, stop, count) {
16719     var step0 = Math.abs(stop - start2) / Math.max(0, count), step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error = step0 / step1;
16720     if (error >= e10)
16721       step1 *= 10;
16722     else if (error >= e5)
16723       step1 *= 5;
16724     else if (error >= e2)
16725       step1 *= 2;
16726     return stop < start2 ? -step1 : step1;
16727   }
16728
16729   // node_modules/d3-array/src/max.js
16730   function max(values, valueof) {
16731     let max3;
16732     if (valueof === void 0) {
16733       for (const value of values) {
16734         if (value != null && (max3 < value || max3 === void 0 && value >= value)) {
16735           max3 = value;
16736         }
16737       }
16738     } else {
16739       let index = -1;
16740       for (let value of values) {
16741         if ((value = valueof(value, ++index, values)) != null && (max3 < value || max3 === void 0 && value >= value)) {
16742           max3 = value;
16743         }
16744       }
16745     }
16746     return max3;
16747   }
16748
16749   // node_modules/d3-array/src/min.js
16750   function min(values, valueof) {
16751     let min3;
16752     if (valueof === void 0) {
16753       for (const value of values) {
16754         if (value != null && (min3 > value || min3 === void 0 && value >= value)) {
16755           min3 = value;
16756         }
16757       }
16758     } else {
16759       let index = -1;
16760       for (let value of values) {
16761         if ((value = valueof(value, ++index, values)) != null && (min3 > value || min3 === void 0 && value >= value)) {
16762           min3 = value;
16763         }
16764       }
16765     }
16766     return min3;
16767   }
16768
16769   // node_modules/d3-array/src/quickselect.js
16770   function quickselect(array2, k, left = 0, right = array2.length - 1, compare) {
16771     compare = compare === void 0 ? ascendingDefined : compareDefined(compare);
16772     while (right > left) {
16773       if (right - left > 600) {
16774         const n2 = right - left + 1;
16775         const m = k - left + 1;
16776         const z = Math.log(n2);
16777         const s = 0.5 * Math.exp(2 * z / 3);
16778         const sd = 0.5 * Math.sqrt(z * s * (n2 - s) / n2) * (m - n2 / 2 < 0 ? -1 : 1);
16779         const newLeft = Math.max(left, Math.floor(k - m * s / n2 + sd));
16780         const newRight = Math.min(right, Math.floor(k + (n2 - m) * s / n2 + sd));
16781         quickselect(array2, k, newLeft, newRight, compare);
16782       }
16783       const t = array2[k];
16784       let i2 = left;
16785       let j2 = right;
16786       swap(array2, left, k);
16787       if (compare(array2[right], t) > 0)
16788         swap(array2, left, right);
16789       while (i2 < j2) {
16790         swap(array2, i2, j2), ++i2, --j2;
16791         while (compare(array2[i2], t) < 0)
16792           ++i2;
16793         while (compare(array2[j2], t) > 0)
16794           --j2;
16795       }
16796       if (compare(array2[left], t) === 0)
16797         swap(array2, left, j2);
16798       else
16799         ++j2, swap(array2, j2, right);
16800       if (j2 <= k)
16801         left = j2 + 1;
16802       if (k <= j2)
16803         right = j2 - 1;
16804     }
16805     return array2;
16806   }
16807   function swap(array2, i2, j2) {
16808     const t = array2[i2];
16809     array2[i2] = array2[j2];
16810     array2[j2] = t;
16811   }
16812
16813   // node_modules/d3-array/src/quantile.js
16814   function quantile(values, p, valueof) {
16815     values = Float64Array.from(numbers(values, valueof));
16816     if (!(n2 = values.length))
16817       return;
16818     if ((p = +p) <= 0 || n2 < 2)
16819       return min(values);
16820     if (p >= 1)
16821       return max(values);
16822     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));
16823     return value0 + (value1 - value0) * (i2 - i0);
16824   }
16825
16826   // node_modules/d3-array/src/median.js
16827   function median(values, valueof) {
16828     return quantile(values, 0.5, valueof);
16829   }
16830
16831   // node_modules/d3-array/src/merge.js
16832   function* flatten(arrays) {
16833     for (const array2 of arrays) {
16834       yield* array2;
16835     }
16836   }
16837   function merge(arrays) {
16838     return Array.from(flatten(arrays));
16839   }
16840
16841   // node_modules/d3-array/src/range.js
16842   function range(start2, stop, step) {
16843     start2 = +start2, stop = +stop, step = (n2 = arguments.length) < 2 ? (stop = start2, start2 = 0, 1) : n2 < 3 ? 1 : +step;
16844     var i2 = -1, n2 = Math.max(0, Math.ceil((stop - start2) / step)) | 0, range3 = new Array(n2);
16845     while (++i2 < n2) {
16846       range3[i2] = start2 + i2 * step;
16847     }
16848     return range3;
16849   }
16850
16851   // node_modules/d3-geo/src/math.js
16852   var epsilon = 1e-6;
16853   var epsilon2 = 1e-12;
16854   var pi = Math.PI;
16855   var halfPi = pi / 2;
16856   var quarterPi = pi / 4;
16857   var tau = pi * 2;
16858   var degrees = 180 / pi;
16859   var radians = pi / 180;
16860   var abs = Math.abs;
16861   var atan = Math.atan;
16862   var atan2 = Math.atan2;
16863   var cos = Math.cos;
16864   var exp = Math.exp;
16865   var log = Math.log;
16866   var sin = Math.sin;
16867   var sign = Math.sign || function(x) {
16868     return x > 0 ? 1 : x < 0 ? -1 : 0;
16869   };
16870   var sqrt = Math.sqrt;
16871   var tan = Math.tan;
16872   function acos(x) {
16873     return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
16874   }
16875   function asin(x) {
16876     return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x);
16877   }
16878
16879   // node_modules/d3-geo/src/noop.js
16880   function noop() {
16881   }
16882
16883   // node_modules/d3-geo/src/stream.js
16884   function streamGeometry(geometry, stream) {
16885     if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {
16886       streamGeometryType[geometry.type](geometry, stream);
16887     }
16888   }
16889   var streamObjectType = {
16890     Feature: function(object, stream) {
16891       streamGeometry(object.geometry, stream);
16892     },
16893     FeatureCollection: function(object, stream) {
16894       var features = object.features, i2 = -1, n2 = features.length;
16895       while (++i2 < n2)
16896         streamGeometry(features[i2].geometry, stream);
16897     }
16898   };
16899   var streamGeometryType = {
16900     Sphere: function(object, stream) {
16901       stream.sphere();
16902     },
16903     Point: function(object, stream) {
16904       object = object.coordinates;
16905       stream.point(object[0], object[1], object[2]);
16906     },
16907     MultiPoint: function(object, stream) {
16908       var coordinates = object.coordinates, i2 = -1, n2 = coordinates.length;
16909       while (++i2 < n2)
16910         object = coordinates[i2], stream.point(object[0], object[1], object[2]);
16911     },
16912     LineString: function(object, stream) {
16913       streamLine(object.coordinates, stream, 0);
16914     },
16915     MultiLineString: function(object, stream) {
16916       var coordinates = object.coordinates, i2 = -1, n2 = coordinates.length;
16917       while (++i2 < n2)
16918         streamLine(coordinates[i2], stream, 0);
16919     },
16920     Polygon: function(object, stream) {
16921       streamPolygon(object.coordinates, stream);
16922     },
16923     MultiPolygon: function(object, stream) {
16924       var coordinates = object.coordinates, i2 = -1, n2 = coordinates.length;
16925       while (++i2 < n2)
16926         streamPolygon(coordinates[i2], stream);
16927     },
16928     GeometryCollection: function(object, stream) {
16929       var geometries = object.geometries, i2 = -1, n2 = geometries.length;
16930       while (++i2 < n2)
16931         streamGeometry(geometries[i2], stream);
16932     }
16933   };
16934   function streamLine(coordinates, stream, closed) {
16935     var i2 = -1, n2 = coordinates.length - closed, coordinate;
16936     stream.lineStart();
16937     while (++i2 < n2)
16938       coordinate = coordinates[i2], stream.point(coordinate[0], coordinate[1], coordinate[2]);
16939     stream.lineEnd();
16940   }
16941   function streamPolygon(coordinates, stream) {
16942     var i2 = -1, n2 = coordinates.length;
16943     stream.polygonStart();
16944     while (++i2 < n2)
16945       streamLine(coordinates[i2], stream, 1);
16946     stream.polygonEnd();
16947   }
16948   function stream_default(object, stream) {
16949     if (object && streamObjectType.hasOwnProperty(object.type)) {
16950       streamObjectType[object.type](object, stream);
16951     } else {
16952       streamGeometry(object, stream);
16953     }
16954   }
16955
16956   // node_modules/d3-geo/src/area.js
16957   var areaRingSum = new Adder();
16958   var areaSum = new Adder();
16959   var lambda00;
16960   var phi00;
16961   var lambda0;
16962   var cosPhi0;
16963   var sinPhi0;
16964   var areaStream = {
16965     point: noop,
16966     lineStart: noop,
16967     lineEnd: noop,
16968     polygonStart: function() {
16969       areaRingSum = new Adder();
16970       areaStream.lineStart = areaRingStart;
16971       areaStream.lineEnd = areaRingEnd;
16972     },
16973     polygonEnd: function() {
16974       var areaRing = +areaRingSum;
16975       areaSum.add(areaRing < 0 ? tau + areaRing : areaRing);
16976       this.lineStart = this.lineEnd = this.point = noop;
16977     },
16978     sphere: function() {
16979       areaSum.add(tau);
16980     }
16981   };
16982   function areaRingStart() {
16983     areaStream.point = areaPointFirst;
16984   }
16985   function areaRingEnd() {
16986     areaPoint(lambda00, phi00);
16987   }
16988   function areaPointFirst(lambda, phi) {
16989     areaStream.point = areaPoint;
16990     lambda00 = lambda, phi00 = phi;
16991     lambda *= radians, phi *= radians;
16992     lambda0 = lambda, cosPhi0 = cos(phi = phi / 2 + quarterPi), sinPhi0 = sin(phi);
16993   }
16994   function areaPoint(lambda, phi) {
16995     lambda *= radians, phi *= radians;
16996     phi = phi / 2 + quarterPi;
16997     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);
16998     areaRingSum.add(atan2(v, u));
16999     lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;
17000   }
17001   function area_default(object) {
17002     areaSum = new Adder();
17003     stream_default(object, areaStream);
17004     return areaSum * 2;
17005   }
17006
17007   // node_modules/d3-geo/src/cartesian.js
17008   function spherical(cartesian2) {
17009     return [atan2(cartesian2[1], cartesian2[0]), asin(cartesian2[2])];
17010   }
17011   function cartesian(spherical2) {
17012     var lambda = spherical2[0], phi = spherical2[1], cosPhi = cos(phi);
17013     return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)];
17014   }
17015   function cartesianDot(a, b) {
17016     return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
17017   }
17018   function cartesianCross(a, b) {
17019     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]];
17020   }
17021   function cartesianAddInPlace(a, b) {
17022     a[0] += b[0], a[1] += b[1], a[2] += b[2];
17023   }
17024   function cartesianScale(vector, k) {
17025     return [vector[0] * k, vector[1] * k, vector[2] * k];
17026   }
17027   function cartesianNormalizeInPlace(d) {
17028     var l = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
17029     d[0] /= l, d[1] /= l, d[2] /= l;
17030   }
17031
17032   // node_modules/d3-geo/src/bounds.js
17033   var lambda02;
17034   var phi0;
17035   var lambda1;
17036   var phi1;
17037   var lambda2;
17038   var lambda002;
17039   var phi002;
17040   var p0;
17041   var deltaSum;
17042   var ranges;
17043   var range2;
17044   var boundsStream = {
17045     point: boundsPoint,
17046     lineStart: boundsLineStart,
17047     lineEnd: boundsLineEnd,
17048     polygonStart: function() {
17049       boundsStream.point = boundsRingPoint;
17050       boundsStream.lineStart = boundsRingStart;
17051       boundsStream.lineEnd = boundsRingEnd;
17052       deltaSum = new Adder();
17053       areaStream.polygonStart();
17054     },
17055     polygonEnd: function() {
17056       areaStream.polygonEnd();
17057       boundsStream.point = boundsPoint;
17058       boundsStream.lineStart = boundsLineStart;
17059       boundsStream.lineEnd = boundsLineEnd;
17060       if (areaRingSum < 0)
17061         lambda02 = -(lambda1 = 180), phi0 = -(phi1 = 90);
17062       else if (deltaSum > epsilon)
17063         phi1 = 90;
17064       else if (deltaSum < -epsilon)
17065         phi0 = -90;
17066       range2[0] = lambda02, range2[1] = lambda1;
17067     },
17068     sphere: function() {
17069       lambda02 = -(lambda1 = 180), phi0 = -(phi1 = 90);
17070     }
17071   };
17072   function boundsPoint(lambda, phi) {
17073     ranges.push(range2 = [lambda02 = lambda, lambda1 = lambda]);
17074     if (phi < phi0)
17075       phi0 = phi;
17076     if (phi > phi1)
17077       phi1 = phi;
17078   }
17079   function linePoint(lambda, phi) {
17080     var p = cartesian([lambda * radians, phi * radians]);
17081     if (p0) {
17082       var normal = cartesianCross(p0, p), equatorial = [normal[1], -normal[0], 0], inflection = cartesianCross(equatorial, normal);
17083       cartesianNormalizeInPlace(inflection);
17084       inflection = spherical(inflection);
17085       var delta = lambda - lambda2, sign2 = delta > 0 ? 1 : -1, lambdai = inflection[0] * degrees * sign2, phii, antimeridian = abs(delta) > 180;
17086       if (antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {
17087         phii = inflection[1] * degrees;
17088         if (phii > phi1)
17089           phi1 = phii;
17090       } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {
17091         phii = -inflection[1] * degrees;
17092         if (phii < phi0)
17093           phi0 = phii;
17094       } else {
17095         if (phi < phi0)
17096           phi0 = phi;
17097         if (phi > phi1)
17098           phi1 = phi;
17099       }
17100       if (antimeridian) {
17101         if (lambda < lambda2) {
17102           if (angle(lambda02, lambda) > angle(lambda02, lambda1))
17103             lambda1 = lambda;
17104         } else {
17105           if (angle(lambda, lambda1) > angle(lambda02, lambda1))
17106             lambda02 = lambda;
17107         }
17108       } else {
17109         if (lambda1 >= lambda02) {
17110           if (lambda < lambda02)
17111             lambda02 = lambda;
17112           if (lambda > lambda1)
17113             lambda1 = lambda;
17114         } else {
17115           if (lambda > lambda2) {
17116             if (angle(lambda02, lambda) > angle(lambda02, lambda1))
17117               lambda1 = lambda;
17118           } else {
17119             if (angle(lambda, lambda1) > angle(lambda02, lambda1))
17120               lambda02 = lambda;
17121           }
17122         }
17123       }
17124     } else {
17125       ranges.push(range2 = [lambda02 = lambda, lambda1 = lambda]);
17126     }
17127     if (phi < phi0)
17128       phi0 = phi;
17129     if (phi > phi1)
17130       phi1 = phi;
17131     p0 = p, lambda2 = lambda;
17132   }
17133   function boundsLineStart() {
17134     boundsStream.point = linePoint;
17135   }
17136   function boundsLineEnd() {
17137     range2[0] = lambda02, range2[1] = lambda1;
17138     boundsStream.point = boundsPoint;
17139     p0 = null;
17140   }
17141   function boundsRingPoint(lambda, phi) {
17142     if (p0) {
17143       var delta = lambda - lambda2;
17144       deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta);
17145     } else {
17146       lambda002 = lambda, phi002 = phi;
17147     }
17148     areaStream.point(lambda, phi);
17149     linePoint(lambda, phi);
17150   }
17151   function boundsRingStart() {
17152     areaStream.lineStart();
17153   }
17154   function boundsRingEnd() {
17155     boundsRingPoint(lambda002, phi002);
17156     areaStream.lineEnd();
17157     if (abs(deltaSum) > epsilon)
17158       lambda02 = -(lambda1 = 180);
17159     range2[0] = lambda02, range2[1] = lambda1;
17160     p0 = null;
17161   }
17162   function angle(lambda04, lambda12) {
17163     return (lambda12 -= lambda04) < 0 ? lambda12 + 360 : lambda12;
17164   }
17165   function rangeCompare(a, b) {
17166     return a[0] - b[0];
17167   }
17168   function rangeContains(range3, x) {
17169     return range3[0] <= range3[1] ? range3[0] <= x && x <= range3[1] : x < range3[0] || range3[1] < x;
17170   }
17171   function bounds_default(feature3) {
17172     var i2, n2, a, b, merged, deltaMax, delta;
17173     phi1 = lambda1 = -(lambda02 = phi0 = Infinity);
17174     ranges = [];
17175     stream_default(feature3, boundsStream);
17176     if (n2 = ranges.length) {
17177       ranges.sort(rangeCompare);
17178       for (i2 = 1, a = ranges[0], merged = [a]; i2 < n2; ++i2) {
17179         b = ranges[i2];
17180         if (rangeContains(a, b[0]) || rangeContains(a, b[1])) {
17181           if (angle(a[0], b[1]) > angle(a[0], a[1]))
17182             a[1] = b[1];
17183           if (angle(b[0], a[1]) > angle(a[0], a[1]))
17184             a[0] = b[0];
17185         } else {
17186           merged.push(a = b);
17187         }
17188       }
17189       for (deltaMax = -Infinity, n2 = merged.length - 1, i2 = 0, a = merged[n2]; i2 <= n2; a = b, ++i2) {
17190         b = merged[i2];
17191         if ((delta = angle(a[1], b[0])) > deltaMax)
17192           deltaMax = delta, lambda02 = b[0], lambda1 = a[1];
17193       }
17194     }
17195     ranges = range2 = null;
17196     return lambda02 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda02, phi0], [lambda1, phi1]];
17197   }
17198
17199   // node_modules/d3-geo/src/compose.js
17200   function compose_default(a, b) {
17201     function compose(x, y) {
17202       return x = a(x, y), b(x[0], x[1]);
17203     }
17204     if (a.invert && b.invert)
17205       compose.invert = function(x, y) {
17206         return x = b.invert(x, y), x && a.invert(x[0], x[1]);
17207       };
17208     return compose;
17209   }
17210
17211   // node_modules/d3-geo/src/rotation.js
17212   function rotationIdentity(lambda, phi) {
17213     return [abs(lambda) > pi ? lambda + Math.round(-lambda / tau) * tau : lambda, phi];
17214   }
17215   rotationIdentity.invert = rotationIdentity;
17216   function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {
17217     return (deltaLambda %= tau) ? deltaPhi || deltaGamma ? compose_default(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity;
17218   }
17219   function forwardRotationLambda(deltaLambda) {
17220     return function(lambda, phi) {
17221       return lambda += deltaLambda, [lambda > pi ? lambda - tau : lambda < -pi ? lambda + tau : lambda, phi];
17222     };
17223   }
17224   function rotationLambda(deltaLambda) {
17225     var rotation = forwardRotationLambda(deltaLambda);
17226     rotation.invert = forwardRotationLambda(-deltaLambda);
17227     return rotation;
17228   }
17229   function rotationPhiGamma(deltaPhi, deltaGamma) {
17230     var cosDeltaPhi = cos(deltaPhi), sinDeltaPhi = sin(deltaPhi), cosDeltaGamma = cos(deltaGamma), sinDeltaGamma = sin(deltaGamma);
17231     function rotation(lambda, phi) {
17232       var cosPhi = cos(phi), x = cos(lambda) * cosPhi, y = sin(lambda) * cosPhi, z = sin(phi), k = z * cosDeltaPhi + x * sinDeltaPhi;
17233       return [
17234         atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi),
17235         asin(k * cosDeltaGamma + y * sinDeltaGamma)
17236       ];
17237     }
17238     rotation.invert = function(lambda, phi) {
17239       var cosPhi = cos(phi), x = cos(lambda) * cosPhi, y = sin(lambda) * cosPhi, z = sin(phi), k = z * cosDeltaGamma - y * sinDeltaGamma;
17240       return [
17241         atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi),
17242         asin(k * cosDeltaPhi - x * sinDeltaPhi)
17243       ];
17244     };
17245     return rotation;
17246   }
17247   function rotation_default(rotate) {
17248     rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0);
17249     function forward(coordinates) {
17250       coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians);
17251       return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
17252     }
17253     forward.invert = function(coordinates) {
17254       coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians);
17255       return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
17256     };
17257     return forward;
17258   }
17259
17260   // node_modules/d3-geo/src/circle.js
17261   function circleStream(stream, radius, delta, direction, t0, t1) {
17262     if (!delta)
17263       return;
17264     var cosRadius = cos(radius), sinRadius = sin(radius), step = direction * delta;
17265     if (t0 == null) {
17266       t0 = radius + direction * tau;
17267       t1 = radius - step / 2;
17268     } else {
17269       t0 = circleRadius(cosRadius, t0);
17270       t1 = circleRadius(cosRadius, t1);
17271       if (direction > 0 ? t0 < t1 : t0 > t1)
17272         t0 += direction * tau;
17273     }
17274     for (var point2, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) {
17275       point2 = spherical([cosRadius, -sinRadius * cos(t), -sinRadius * sin(t)]);
17276       stream.point(point2[0], point2[1]);
17277     }
17278   }
17279   function circleRadius(cosRadius, point2) {
17280     point2 = cartesian(point2), point2[0] -= cosRadius;
17281     cartesianNormalizeInPlace(point2);
17282     var radius = acos(-point2[1]);
17283     return ((-point2[2] < 0 ? -radius : radius) + tau - epsilon) % tau;
17284   }
17285
17286   // node_modules/d3-geo/src/clip/buffer.js
17287   function buffer_default() {
17288     var lines = [], line;
17289     return {
17290       point: function(x, y, m) {
17291         line.push([x, y, m]);
17292       },
17293       lineStart: function() {
17294         lines.push(line = []);
17295       },
17296       lineEnd: noop,
17297       rejoin: function() {
17298         if (lines.length > 1)
17299           lines.push(lines.pop().concat(lines.shift()));
17300       },
17301       result: function() {
17302         var result = lines;
17303         lines = [];
17304         line = null;
17305         return result;
17306       }
17307     };
17308   }
17309
17310   // node_modules/d3-geo/src/pointEqual.js
17311   function pointEqual_default(a, b) {
17312     return abs(a[0] - b[0]) < epsilon && abs(a[1] - b[1]) < epsilon;
17313   }
17314
17315   // node_modules/d3-geo/src/clip/rejoin.js
17316   function Intersection(point2, points, other, entry) {
17317     this.x = point2;
17318     this.z = points;
17319     this.o = other;
17320     this.e = entry;
17321     this.v = false;
17322     this.n = this.p = null;
17323   }
17324   function rejoin_default(segments, compareIntersection2, startInside, interpolate, stream) {
17325     var subject = [], clip = [], i2, n2;
17326     segments.forEach(function(segment) {
17327       if ((n3 = segment.length - 1) <= 0)
17328         return;
17329       var n3, p02 = segment[0], p1 = segment[n3], x;
17330       if (pointEqual_default(p02, p1)) {
17331         if (!p02[2] && !p1[2]) {
17332           stream.lineStart();
17333           for (i2 = 0; i2 < n3; ++i2)
17334             stream.point((p02 = segment[i2])[0], p02[1]);
17335           stream.lineEnd();
17336           return;
17337         }
17338         p1[0] += 2 * epsilon;
17339       }
17340       subject.push(x = new Intersection(p02, segment, null, true));
17341       clip.push(x.o = new Intersection(p02, null, x, false));
17342       subject.push(x = new Intersection(p1, segment, null, false));
17343       clip.push(x.o = new Intersection(p1, null, x, true));
17344     });
17345     if (!subject.length)
17346       return;
17347     clip.sort(compareIntersection2);
17348     link(subject);
17349     link(clip);
17350     for (i2 = 0, n2 = clip.length; i2 < n2; ++i2) {
17351       clip[i2].e = startInside = !startInside;
17352     }
17353     var start2 = subject[0], points, point2;
17354     while (1) {
17355       var current = start2, isSubject = true;
17356       while (current.v)
17357         if ((current = current.n) === start2)
17358           return;
17359       points = current.z;
17360       stream.lineStart();
17361       do {
17362         current.v = current.o.v = true;
17363         if (current.e) {
17364           if (isSubject) {
17365             for (i2 = 0, n2 = points.length; i2 < n2; ++i2)
17366               stream.point((point2 = points[i2])[0], point2[1]);
17367           } else {
17368             interpolate(current.x, current.n.x, 1, stream);
17369           }
17370           current = current.n;
17371         } else {
17372           if (isSubject) {
17373             points = current.p.z;
17374             for (i2 = points.length - 1; i2 >= 0; --i2)
17375               stream.point((point2 = points[i2])[0], point2[1]);
17376           } else {
17377             interpolate(current.x, current.p.x, -1, stream);
17378           }
17379           current = current.p;
17380         }
17381         current = current.o;
17382         points = current.z;
17383         isSubject = !isSubject;
17384       } while (!current.v);
17385       stream.lineEnd();
17386     }
17387   }
17388   function link(array2) {
17389     if (!(n2 = array2.length))
17390       return;
17391     var n2, i2 = 0, a = array2[0], b;
17392     while (++i2 < n2) {
17393       a.n = b = array2[i2];
17394       b.p = a;
17395       a = b;
17396     }
17397     a.n = b = array2[0];
17398     b.p = a;
17399   }
17400
17401   // node_modules/d3-geo/src/polygonContains.js
17402   function longitude(point2) {
17403     return abs(point2[0]) <= pi ? point2[0] : sign(point2[0]) * ((abs(point2[0]) + pi) % tau - pi);
17404   }
17405   function polygonContains_default(polygon2, point2) {
17406     var lambda = longitude(point2), phi = point2[1], sinPhi = sin(phi), normal = [sin(lambda), -cos(lambda), 0], angle2 = 0, winding = 0;
17407     var sum = new Adder();
17408     if (sinPhi === 1)
17409       phi = halfPi + epsilon;
17410     else if (sinPhi === -1)
17411       phi = -halfPi - epsilon;
17412     for (var i2 = 0, n2 = polygon2.length; i2 < n2; ++i2) {
17413       if (!(m = (ring = polygon2[i2]).length))
17414         continue;
17415       var ring, m, point0 = ring[m - 1], lambda04 = longitude(point0), phi02 = point0[1] / 2 + quarterPi, sinPhi03 = sin(phi02), cosPhi03 = cos(phi02);
17416       for (var j2 = 0; j2 < m; ++j2, lambda04 = lambda12, sinPhi03 = sinPhi1, cosPhi03 = cosPhi1, point0 = point1) {
17417         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;
17418         sum.add(atan2(k * sign2 * sin(absDelta), cosPhi03 * cosPhi1 + k * cos(absDelta)));
17419         angle2 += antimeridian ? delta + sign2 * tau : delta;
17420         if (antimeridian ^ lambda04 >= lambda ^ lambda12 >= lambda) {
17421           var arc = cartesianCross(cartesian(point0), cartesian(point1));
17422           cartesianNormalizeInPlace(arc);
17423           var intersection = cartesianCross(normal, arc);
17424           cartesianNormalizeInPlace(intersection);
17425           var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]);
17426           if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {
17427             winding += antimeridian ^ delta >= 0 ? 1 : -1;
17428           }
17429         }
17430       }
17431     }
17432     return (angle2 < -epsilon || angle2 < epsilon && sum < -epsilon2) ^ winding & 1;
17433   }
17434
17435   // node_modules/d3-geo/src/clip/index.js
17436   function clip_default(pointVisible, clipLine, interpolate, start2) {
17437     return function(sink) {
17438       var line = clipLine(sink), ringBuffer = buffer_default(), ringSink = clipLine(ringBuffer), polygonStarted = false, polygon2, segments, ring;
17439       var clip = {
17440         point: point2,
17441         lineStart,
17442         lineEnd,
17443         polygonStart: function() {
17444           clip.point = pointRing;
17445           clip.lineStart = ringStart;
17446           clip.lineEnd = ringEnd;
17447           segments = [];
17448           polygon2 = [];
17449         },
17450         polygonEnd: function() {
17451           clip.point = point2;
17452           clip.lineStart = lineStart;
17453           clip.lineEnd = lineEnd;
17454           segments = merge(segments);
17455           var startInside = polygonContains_default(polygon2, start2);
17456           if (segments.length) {
17457             if (!polygonStarted)
17458               sink.polygonStart(), polygonStarted = true;
17459             rejoin_default(segments, compareIntersection, startInside, interpolate, sink);
17460           } else if (startInside) {
17461             if (!polygonStarted)
17462               sink.polygonStart(), polygonStarted = true;
17463             sink.lineStart();
17464             interpolate(null, null, 1, sink);
17465             sink.lineEnd();
17466           }
17467           if (polygonStarted)
17468             sink.polygonEnd(), polygonStarted = false;
17469           segments = polygon2 = null;
17470         },
17471         sphere: function() {
17472           sink.polygonStart();
17473           sink.lineStart();
17474           interpolate(null, null, 1, sink);
17475           sink.lineEnd();
17476           sink.polygonEnd();
17477         }
17478       };
17479       function point2(lambda, phi) {
17480         if (pointVisible(lambda, phi))
17481           sink.point(lambda, phi);
17482       }
17483       function pointLine(lambda, phi) {
17484         line.point(lambda, phi);
17485       }
17486       function lineStart() {
17487         clip.point = pointLine;
17488         line.lineStart();
17489       }
17490       function lineEnd() {
17491         clip.point = point2;
17492         line.lineEnd();
17493       }
17494       function pointRing(lambda, phi) {
17495         ring.push([lambda, phi]);
17496         ringSink.point(lambda, phi);
17497       }
17498       function ringStart() {
17499         ringSink.lineStart();
17500         ring = [];
17501       }
17502       function ringEnd() {
17503         pointRing(ring[0][0], ring[0][1]);
17504         ringSink.lineEnd();
17505         var clean2 = ringSink.clean(), ringSegments = ringBuffer.result(), i2, n2 = ringSegments.length, m, segment, point3;
17506         ring.pop();
17507         polygon2.push(ring);
17508         ring = null;
17509         if (!n2)
17510           return;
17511         if (clean2 & 1) {
17512           segment = ringSegments[0];
17513           if ((m = segment.length - 1) > 0) {
17514             if (!polygonStarted)
17515               sink.polygonStart(), polygonStarted = true;
17516             sink.lineStart();
17517             for (i2 = 0; i2 < m; ++i2)
17518               sink.point((point3 = segment[i2])[0], point3[1]);
17519             sink.lineEnd();
17520           }
17521           return;
17522         }
17523         if (n2 > 1 && clean2 & 2)
17524           ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
17525         segments.push(ringSegments.filter(validSegment));
17526       }
17527       return clip;
17528     };
17529   }
17530   function validSegment(segment) {
17531     return segment.length > 1;
17532   }
17533   function compareIntersection(a, b) {
17534     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]);
17535   }
17536
17537   // node_modules/d3-geo/src/clip/antimeridian.js
17538   var antimeridian_default = clip_default(
17539     function() {
17540       return true;
17541     },
17542     clipAntimeridianLine,
17543     clipAntimeridianInterpolate,
17544     [-pi, -halfPi]
17545   );
17546   function clipAntimeridianLine(stream) {
17547     var lambda04 = NaN, phi02 = NaN, sign0 = NaN, clean2;
17548     return {
17549       lineStart: function() {
17550         stream.lineStart();
17551         clean2 = 1;
17552       },
17553       point: function(lambda12, phi12) {
17554         var sign1 = lambda12 > 0 ? pi : -pi, delta = abs(lambda12 - lambda04);
17555         if (abs(delta - pi) < epsilon) {
17556           stream.point(lambda04, phi02 = (phi02 + phi12) / 2 > 0 ? halfPi : -halfPi);
17557           stream.point(sign0, phi02);
17558           stream.lineEnd();
17559           stream.lineStart();
17560           stream.point(sign1, phi02);
17561           stream.point(lambda12, phi02);
17562           clean2 = 0;
17563         } else if (sign0 !== sign1 && delta >= pi) {
17564           if (abs(lambda04 - sign0) < epsilon)
17565             lambda04 -= sign0 * epsilon;
17566           if (abs(lambda12 - sign1) < epsilon)
17567             lambda12 -= sign1 * epsilon;
17568           phi02 = clipAntimeridianIntersect(lambda04, phi02, lambda12, phi12);
17569           stream.point(sign0, phi02);
17570           stream.lineEnd();
17571           stream.lineStart();
17572           stream.point(sign1, phi02);
17573           clean2 = 0;
17574         }
17575         stream.point(lambda04 = lambda12, phi02 = phi12);
17576         sign0 = sign1;
17577       },
17578       lineEnd: function() {
17579         stream.lineEnd();
17580         lambda04 = phi02 = NaN;
17581       },
17582       clean: function() {
17583         return 2 - clean2;
17584       }
17585     };
17586   }
17587   function clipAntimeridianIntersect(lambda04, phi02, lambda12, phi12) {
17588     var cosPhi03, cosPhi1, sinLambda0Lambda1 = sin(lambda04 - lambda12);
17589     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;
17590   }
17591   function clipAntimeridianInterpolate(from, to, direction, stream) {
17592     var phi;
17593     if (from == null) {
17594       phi = direction * halfPi;
17595       stream.point(-pi, phi);
17596       stream.point(0, phi);
17597       stream.point(pi, phi);
17598       stream.point(pi, 0);
17599       stream.point(pi, -phi);
17600       stream.point(0, -phi);
17601       stream.point(-pi, -phi);
17602       stream.point(-pi, 0);
17603       stream.point(-pi, phi);
17604     } else if (abs(from[0] - to[0]) > epsilon) {
17605       var lambda = from[0] < to[0] ? pi : -pi;
17606       phi = direction * lambda / 2;
17607       stream.point(-lambda, phi);
17608       stream.point(0, phi);
17609       stream.point(lambda, phi);
17610     } else {
17611       stream.point(to[0], to[1]);
17612     }
17613   }
17614
17615   // node_modules/d3-geo/src/clip/circle.js
17616   function circle_default(radius) {
17617     var cr = cos(radius), delta = 6 * radians, smallRadius = cr > 0, notHemisphere = abs(cr) > epsilon;
17618     function interpolate(from, to, direction, stream) {
17619       circleStream(stream, radius, delta, direction, from, to);
17620     }
17621     function visible(lambda, phi) {
17622       return cos(lambda) * cos(phi) > cr;
17623     }
17624     function clipLine(stream) {
17625       var point0, c0, v0, v00, clean2;
17626       return {
17627         lineStart: function() {
17628           v00 = v0 = false;
17629           clean2 = 1;
17630         },
17631         point: function(lambda, phi) {
17632           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;
17633           if (!point0 && (v00 = v0 = v))
17634             stream.lineStart();
17635           if (v !== v0) {
17636             point2 = intersect2(point0, point1);
17637             if (!point2 || pointEqual_default(point0, point2) || pointEqual_default(point1, point2))
17638               point1[2] = 1;
17639           }
17640           if (v !== v0) {
17641             clean2 = 0;
17642             if (v) {
17643               stream.lineStart();
17644               point2 = intersect2(point1, point0);
17645               stream.point(point2[0], point2[1]);
17646             } else {
17647               point2 = intersect2(point0, point1);
17648               stream.point(point2[0], point2[1], 2);
17649               stream.lineEnd();
17650             }
17651             point0 = point2;
17652           } else if (notHemisphere && point0 && smallRadius ^ v) {
17653             var t;
17654             if (!(c & c0) && (t = intersect2(point1, point0, true))) {
17655               clean2 = 0;
17656               if (smallRadius) {
17657                 stream.lineStart();
17658                 stream.point(t[0][0], t[0][1]);
17659                 stream.point(t[1][0], t[1][1]);
17660                 stream.lineEnd();
17661               } else {
17662                 stream.point(t[1][0], t[1][1]);
17663                 stream.lineEnd();
17664                 stream.lineStart();
17665                 stream.point(t[0][0], t[0][1], 3);
17666               }
17667             }
17668           }
17669           if (v && (!point0 || !pointEqual_default(point0, point1))) {
17670             stream.point(point1[0], point1[1]);
17671           }
17672           point0 = point1, v0 = v, c0 = c;
17673         },
17674         lineEnd: function() {
17675           if (v0)
17676             stream.lineEnd();
17677           point0 = null;
17678         },
17679         // Rejoin first and last segments if there were intersections and the first
17680         // and last points were visible.
17681         clean: function() {
17682           return clean2 | (v00 && v0) << 1;
17683         }
17684       };
17685     }
17686     function intersect2(a, b, two) {
17687       var pa = cartesian(a), pb = cartesian(b);
17688       var n1 = [1, 0, 0], n2 = cartesianCross(pa, pb), n2n2 = cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2;
17689       if (!determinant)
17690         return !two && a;
17691       var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n2), A = cartesianScale(n1, c1), B = cartesianScale(n2, c2);
17692       cartesianAddInPlace(A, B);
17693       var u = n1xn2, w = cartesianDot(A, u), uu = cartesianDot(u, u), t2 = w * w - uu * (cartesianDot(A, A) - 1);
17694       if (t2 < 0)
17695         return;
17696       var t = sqrt(t2), q = cartesianScale(u, (-w - t) / uu);
17697       cartesianAddInPlace(q, A);
17698       q = spherical(q);
17699       if (!two)
17700         return q;
17701       var lambda04 = a[0], lambda12 = b[0], phi02 = a[1], phi12 = b[1], z;
17702       if (lambda12 < lambda04)
17703         z = lambda04, lambda04 = lambda12, lambda12 = z;
17704       var delta2 = lambda12 - lambda04, polar = abs(delta2 - pi) < epsilon, meridian = polar || delta2 < epsilon;
17705       if (!polar && phi12 < phi02)
17706         z = phi02, phi02 = phi12, phi12 = z;
17707       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)) {
17708         var q1 = cartesianScale(u, (-w + t) / uu);
17709         cartesianAddInPlace(q1, A);
17710         return [q, spherical(q1)];
17711       }
17712     }
17713     function code(lambda, phi) {
17714       var r = smallRadius ? radius : pi - radius, code2 = 0;
17715       if (lambda < -r)
17716         code2 |= 1;
17717       else if (lambda > r)
17718         code2 |= 2;
17719       if (phi < -r)
17720         code2 |= 4;
17721       else if (phi > r)
17722         code2 |= 8;
17723       return code2;
17724     }
17725     return clip_default(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]);
17726   }
17727
17728   // node_modules/d3-geo/src/clip/line.js
17729   function line_default(a, b, x05, y05, x12, y12) {
17730     var ax = a[0], ay = a[1], bx = b[0], by = b[1], t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r;
17731     r = x05 - ax;
17732     if (!dx && r > 0)
17733       return;
17734     r /= dx;
17735     if (dx < 0) {
17736       if (r < t0)
17737         return;
17738       if (r < t1)
17739         t1 = r;
17740     } else if (dx > 0) {
17741       if (r > t1)
17742         return;
17743       if (r > t0)
17744         t0 = r;
17745     }
17746     r = x12 - ax;
17747     if (!dx && r < 0)
17748       return;
17749     r /= dx;
17750     if (dx < 0) {
17751       if (r > t1)
17752         return;
17753       if (r > t0)
17754         t0 = r;
17755     } else if (dx > 0) {
17756       if (r < t0)
17757         return;
17758       if (r < t1)
17759         t1 = r;
17760     }
17761     r = y05 - ay;
17762     if (!dy && r > 0)
17763       return;
17764     r /= dy;
17765     if (dy < 0) {
17766       if (r < t0)
17767         return;
17768       if (r < t1)
17769         t1 = r;
17770     } else if (dy > 0) {
17771       if (r > t1)
17772         return;
17773       if (r > t0)
17774         t0 = r;
17775     }
17776     r = y12 - ay;
17777     if (!dy && r < 0)
17778       return;
17779     r /= dy;
17780     if (dy < 0) {
17781       if (r > t1)
17782         return;
17783       if (r > t0)
17784         t0 = r;
17785     } else if (dy > 0) {
17786       if (r < t0)
17787         return;
17788       if (r < t1)
17789         t1 = r;
17790     }
17791     if (t0 > 0)
17792       a[0] = ax + t0 * dx, a[1] = ay + t0 * dy;
17793     if (t1 < 1)
17794       b[0] = ax + t1 * dx, b[1] = ay + t1 * dy;
17795     return true;
17796   }
17797
17798   // node_modules/d3-geo/src/clip/rectangle.js
17799   var clipMax = 1e9;
17800   var clipMin = -clipMax;
17801   function clipRectangle(x05, y05, x12, y12) {
17802     function visible(x, y) {
17803       return x05 <= x && x <= x12 && y05 <= y && y <= y12;
17804     }
17805     function interpolate(from, to, direction, stream) {
17806       var a = 0, a1 = 0;
17807       if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) {
17808         do
17809           stream.point(a === 0 || a === 3 ? x05 : x12, a > 1 ? y12 : y05);
17810         while ((a = (a + direction + 4) % 4) !== a1);
17811       } else {
17812         stream.point(to[0], to[1]);
17813       }
17814     }
17815     function corner(p, direction) {
17816       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;
17817     }
17818     function compareIntersection2(a, b) {
17819       return comparePoint(a.x, b.x);
17820     }
17821     function comparePoint(a, b) {
17822       var ca = corner(a, 1), cb = corner(b, 1);
17823       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];
17824     }
17825     return function(stream) {
17826       var activeStream = stream, bufferStream = buffer_default(), segments, polygon2, ring, x__, y__, v__, x_, y_, v_, first, clean2;
17827       var clipStream = {
17828         point: point2,
17829         lineStart,
17830         lineEnd,
17831         polygonStart,
17832         polygonEnd
17833       };
17834       function point2(x, y) {
17835         if (visible(x, y))
17836           activeStream.point(x, y);
17837       }
17838       function polygonInside() {
17839         var winding = 0;
17840         for (var i2 = 0, n2 = polygon2.length; i2 < n2; ++i2) {
17841           for (var ring2 = polygon2[i2], j2 = 1, m = ring2.length, point3 = ring2[0], a0, a1, b0 = point3[0], b1 = point3[1]; j2 < m; ++j2) {
17842             a0 = b0, a1 = b1, point3 = ring2[j2], b0 = point3[0], b1 = point3[1];
17843             if (a1 <= y12) {
17844               if (b1 > y12 && (b0 - a0) * (y12 - a1) > (b1 - a1) * (x05 - a0))
17845                 ++winding;
17846             } else {
17847               if (b1 <= y12 && (b0 - a0) * (y12 - a1) < (b1 - a1) * (x05 - a0))
17848                 --winding;
17849             }
17850           }
17851         }
17852         return winding;
17853       }
17854       function polygonStart() {
17855         activeStream = bufferStream, segments = [], polygon2 = [], clean2 = true;
17856       }
17857       function polygonEnd() {
17858         var startInside = polygonInside(), cleanInside = clean2 && startInside, visible2 = (segments = merge(segments)).length;
17859         if (cleanInside || visible2) {
17860           stream.polygonStart();
17861           if (cleanInside) {
17862             stream.lineStart();
17863             interpolate(null, null, 1, stream);
17864             stream.lineEnd();
17865           }
17866           if (visible2) {
17867             rejoin_default(segments, compareIntersection2, startInside, interpolate, stream);
17868           }
17869           stream.polygonEnd();
17870         }
17871         activeStream = stream, segments = polygon2 = ring = null;
17872       }
17873       function lineStart() {
17874         clipStream.point = linePoint2;
17875         if (polygon2)
17876           polygon2.push(ring = []);
17877         first = true;
17878         v_ = false;
17879         x_ = y_ = NaN;
17880       }
17881       function lineEnd() {
17882         if (segments) {
17883           linePoint2(x__, y__);
17884           if (v__ && v_)
17885             bufferStream.rejoin();
17886           segments.push(bufferStream.result());
17887         }
17888         clipStream.point = point2;
17889         if (v_)
17890           activeStream.lineEnd();
17891       }
17892       function linePoint2(x, y) {
17893         var v = visible(x, y);
17894         if (polygon2)
17895           ring.push([x, y]);
17896         if (first) {
17897           x__ = x, y__ = y, v__ = v;
17898           first = false;
17899           if (v) {
17900             activeStream.lineStart();
17901             activeStream.point(x, y);
17902           }
17903         } else {
17904           if (v && v_)
17905             activeStream.point(x, y);
17906           else {
17907             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))];
17908             if (line_default(a, b, x05, y05, x12, y12)) {
17909               if (!v_) {
17910                 activeStream.lineStart();
17911                 activeStream.point(a[0], a[1]);
17912               }
17913               activeStream.point(b[0], b[1]);
17914               if (!v)
17915                 activeStream.lineEnd();
17916               clean2 = false;
17917             } else if (v) {
17918               activeStream.lineStart();
17919               activeStream.point(x, y);
17920               clean2 = false;
17921             }
17922           }
17923         }
17924         x_ = x, y_ = y, v_ = v;
17925       }
17926       return clipStream;
17927     };
17928   }
17929
17930   // node_modules/d3-geo/src/length.js
17931   var lengthSum;
17932   var lambda03;
17933   var sinPhi02;
17934   var cosPhi02;
17935   var lengthStream = {
17936     sphere: noop,
17937     point: noop,
17938     lineStart: lengthLineStart,
17939     lineEnd: noop,
17940     polygonStart: noop,
17941     polygonEnd: noop
17942   };
17943   function lengthLineStart() {
17944     lengthStream.point = lengthPointFirst;
17945     lengthStream.lineEnd = lengthLineEnd;
17946   }
17947   function lengthLineEnd() {
17948     lengthStream.point = lengthStream.lineEnd = noop;
17949   }
17950   function lengthPointFirst(lambda, phi) {
17951     lambda *= radians, phi *= radians;
17952     lambda03 = lambda, sinPhi02 = sin(phi), cosPhi02 = cos(phi);
17953     lengthStream.point = lengthPoint;
17954   }
17955   function lengthPoint(lambda, phi) {
17956     lambda *= radians, phi *= radians;
17957     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;
17958     lengthSum.add(atan2(sqrt(x * x + y * y), z));
17959     lambda03 = lambda, sinPhi02 = sinPhi, cosPhi02 = cosPhi;
17960   }
17961   function length_default(object) {
17962     lengthSum = new Adder();
17963     stream_default(object, lengthStream);
17964     return +lengthSum;
17965   }
17966
17967   // node_modules/d3-geo/src/identity.js
17968   var identity_default = (x) => x;
17969
17970   // node_modules/d3-geo/src/path/area.js
17971   var areaSum2 = new Adder();
17972   var areaRingSum2 = new Adder();
17973   var x00;
17974   var y00;
17975   var x0;
17976   var y0;
17977   var areaStream2 = {
17978     point: noop,
17979     lineStart: noop,
17980     lineEnd: noop,
17981     polygonStart: function() {
17982       areaStream2.lineStart = areaRingStart2;
17983       areaStream2.lineEnd = areaRingEnd2;
17984     },
17985     polygonEnd: function() {
17986       areaStream2.lineStart = areaStream2.lineEnd = areaStream2.point = noop;
17987       areaSum2.add(abs(areaRingSum2));
17988       areaRingSum2 = new Adder();
17989     },
17990     result: function() {
17991       var area = areaSum2 / 2;
17992       areaSum2 = new Adder();
17993       return area;
17994     }
17995   };
17996   function areaRingStart2() {
17997     areaStream2.point = areaPointFirst2;
17998   }
17999   function areaPointFirst2(x, y) {
18000     areaStream2.point = areaPoint2;
18001     x00 = x0 = x, y00 = y0 = y;
18002   }
18003   function areaPoint2(x, y) {
18004     areaRingSum2.add(y0 * x - x0 * y);
18005     x0 = x, y0 = y;
18006   }
18007   function areaRingEnd2() {
18008     areaPoint2(x00, y00);
18009   }
18010   var area_default2 = areaStream2;
18011
18012   // node_modules/d3-geo/src/path/bounds.js
18013   var x02 = Infinity;
18014   var y02 = x02;
18015   var x1 = -x02;
18016   var y1 = x1;
18017   var boundsStream2 = {
18018     point: boundsPoint2,
18019     lineStart: noop,
18020     lineEnd: noop,
18021     polygonStart: noop,
18022     polygonEnd: noop,
18023     result: function() {
18024       var bounds = [[x02, y02], [x1, y1]];
18025       x1 = y1 = -(y02 = x02 = Infinity);
18026       return bounds;
18027     }
18028   };
18029   function boundsPoint2(x, y) {
18030     if (x < x02)
18031       x02 = x;
18032     if (x > x1)
18033       x1 = x;
18034     if (y < y02)
18035       y02 = y;
18036     if (y > y1)
18037       y1 = y;
18038   }
18039   var bounds_default2 = boundsStream2;
18040
18041   // node_modules/d3-geo/src/path/centroid.js
18042   var X0 = 0;
18043   var Y0 = 0;
18044   var Z0 = 0;
18045   var X1 = 0;
18046   var Y1 = 0;
18047   var Z1 = 0;
18048   var X2 = 0;
18049   var Y2 = 0;
18050   var Z2 = 0;
18051   var x002;
18052   var y002;
18053   var x03;
18054   var y03;
18055   var centroidStream = {
18056     point: centroidPoint,
18057     lineStart: centroidLineStart,
18058     lineEnd: centroidLineEnd,
18059     polygonStart: function() {
18060       centroidStream.lineStart = centroidRingStart;
18061       centroidStream.lineEnd = centroidRingEnd;
18062     },
18063     polygonEnd: function() {
18064       centroidStream.point = centroidPoint;
18065       centroidStream.lineStart = centroidLineStart;
18066       centroidStream.lineEnd = centroidLineEnd;
18067     },
18068     result: function() {
18069       var centroid = Z2 ? [X2 / Z2, Y2 / Z2] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN];
18070       X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0;
18071       return centroid;
18072     }
18073   };
18074   function centroidPoint(x, y) {
18075     X0 += x;
18076     Y0 += y;
18077     ++Z0;
18078   }
18079   function centroidLineStart() {
18080     centroidStream.point = centroidPointFirstLine;
18081   }
18082   function centroidPointFirstLine(x, y) {
18083     centroidStream.point = centroidPointLine;
18084     centroidPoint(x03 = x, y03 = y);
18085   }
18086   function centroidPointLine(x, y) {
18087     var dx = x - x03, dy = y - y03, z = sqrt(dx * dx + dy * dy);
18088     X1 += z * (x03 + x) / 2;
18089     Y1 += z * (y03 + y) / 2;
18090     Z1 += z;
18091     centroidPoint(x03 = x, y03 = y);
18092   }
18093   function centroidLineEnd() {
18094     centroidStream.point = centroidPoint;
18095   }
18096   function centroidRingStart() {
18097     centroidStream.point = centroidPointFirstRing;
18098   }
18099   function centroidRingEnd() {
18100     centroidPointRing(x002, y002);
18101   }
18102   function centroidPointFirstRing(x, y) {
18103     centroidStream.point = centroidPointRing;
18104     centroidPoint(x002 = x03 = x, y002 = y03 = y);
18105   }
18106   function centroidPointRing(x, y) {
18107     var dx = x - x03, dy = y - y03, z = sqrt(dx * dx + dy * dy);
18108     X1 += z * (x03 + x) / 2;
18109     Y1 += z * (y03 + y) / 2;
18110     Z1 += z;
18111     z = y03 * x - x03 * y;
18112     X2 += z * (x03 + x);
18113     Y2 += z * (y03 + y);
18114     Z2 += z * 3;
18115     centroidPoint(x03 = x, y03 = y);
18116   }
18117   var centroid_default = centroidStream;
18118
18119   // node_modules/d3-geo/src/path/context.js
18120   function PathContext(context) {
18121     this._context = context;
18122   }
18123   PathContext.prototype = {
18124     _radius: 4.5,
18125     pointRadius: function(_) {
18126       return this._radius = _, this;
18127     },
18128     polygonStart: function() {
18129       this._line = 0;
18130     },
18131     polygonEnd: function() {
18132       this._line = NaN;
18133     },
18134     lineStart: function() {
18135       this._point = 0;
18136     },
18137     lineEnd: function() {
18138       if (this._line === 0)
18139         this._context.closePath();
18140       this._point = NaN;
18141     },
18142     point: function(x, y) {
18143       switch (this._point) {
18144         case 0: {
18145           this._context.moveTo(x, y);
18146           this._point = 1;
18147           break;
18148         }
18149         case 1: {
18150           this._context.lineTo(x, y);
18151           break;
18152         }
18153         default: {
18154           this._context.moveTo(x + this._radius, y);
18155           this._context.arc(x, y, this._radius, 0, tau);
18156           break;
18157         }
18158       }
18159     },
18160     result: noop
18161   };
18162
18163   // node_modules/d3-geo/src/path/measure.js
18164   var lengthSum2 = new Adder();
18165   var lengthRing;
18166   var x003;
18167   var y003;
18168   var x04;
18169   var y04;
18170   var lengthStream2 = {
18171     point: noop,
18172     lineStart: function() {
18173       lengthStream2.point = lengthPointFirst2;
18174     },
18175     lineEnd: function() {
18176       if (lengthRing)
18177         lengthPoint2(x003, y003);
18178       lengthStream2.point = noop;
18179     },
18180     polygonStart: function() {
18181       lengthRing = true;
18182     },
18183     polygonEnd: function() {
18184       lengthRing = null;
18185     },
18186     result: function() {
18187       var length = +lengthSum2;
18188       lengthSum2 = new Adder();
18189       return length;
18190     }
18191   };
18192   function lengthPointFirst2(x, y) {
18193     lengthStream2.point = lengthPoint2;
18194     x003 = x04 = x, y003 = y04 = y;
18195   }
18196   function lengthPoint2(x, y) {
18197     x04 -= x, y04 -= y;
18198     lengthSum2.add(sqrt(x04 * x04 + y04 * y04));
18199     x04 = x, y04 = y;
18200   }
18201   var measure_default = lengthStream2;
18202
18203   // node_modules/d3-geo/src/path/string.js
18204   function PathString() {
18205     this._string = [];
18206   }
18207   PathString.prototype = {
18208     _radius: 4.5,
18209     _circle: circle(4.5),
18210     pointRadius: function(_) {
18211       if ((_ = +_) !== this._radius)
18212         this._radius = _, this._circle = null;
18213       return this;
18214     },
18215     polygonStart: function() {
18216       this._line = 0;
18217     },
18218     polygonEnd: function() {
18219       this._line = NaN;
18220     },
18221     lineStart: function() {
18222       this._point = 0;
18223     },
18224     lineEnd: function() {
18225       if (this._line === 0)
18226         this._string.push("Z");
18227       this._point = NaN;
18228     },
18229     point: function(x, y) {
18230       switch (this._point) {
18231         case 0: {
18232           this._string.push("M", x, ",", y);
18233           this._point = 1;
18234           break;
18235         }
18236         case 1: {
18237           this._string.push("L", x, ",", y);
18238           break;
18239         }
18240         default: {
18241           if (this._circle == null)
18242             this._circle = circle(this._radius);
18243           this._string.push("M", x, ",", y, this._circle);
18244           break;
18245         }
18246       }
18247     },
18248     result: function() {
18249       if (this._string.length) {
18250         var result = this._string.join("");
18251         this._string = [];
18252         return result;
18253       } else {
18254         return null;
18255       }
18256     }
18257   };
18258   function circle(radius) {
18259     return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z";
18260   }
18261
18262   // node_modules/d3-geo/src/path/index.js
18263   function path_default(projection2, context) {
18264     var pointRadius = 4.5, projectionStream, contextStream;
18265     function path(object) {
18266       if (object) {
18267         if (typeof pointRadius === "function")
18268           contextStream.pointRadius(+pointRadius.apply(this, arguments));
18269         stream_default(object, projectionStream(contextStream));
18270       }
18271       return contextStream.result();
18272     }
18273     path.area = function(object) {
18274       stream_default(object, projectionStream(area_default2));
18275       return area_default2.result();
18276     };
18277     path.measure = function(object) {
18278       stream_default(object, projectionStream(measure_default));
18279       return measure_default.result();
18280     };
18281     path.bounds = function(object) {
18282       stream_default(object, projectionStream(bounds_default2));
18283       return bounds_default2.result();
18284     };
18285     path.centroid = function(object) {
18286       stream_default(object, projectionStream(centroid_default));
18287       return centroid_default.result();
18288     };
18289     path.projection = function(_) {
18290       return arguments.length ? (projectionStream = _ == null ? (projection2 = null, identity_default) : (projection2 = _).stream, path) : projection2;
18291     };
18292     path.context = function(_) {
18293       if (!arguments.length)
18294         return context;
18295       contextStream = _ == null ? (context = null, new PathString()) : new PathContext(context = _);
18296       if (typeof pointRadius !== "function")
18297         contextStream.pointRadius(pointRadius);
18298       return path;
18299     };
18300     path.pointRadius = function(_) {
18301       if (!arguments.length)
18302         return pointRadius;
18303       pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_);
18304       return path;
18305     };
18306     return path.projection(projection2).context(context);
18307   }
18308
18309   // node_modules/d3-geo/src/transform.js
18310   function transform_default(methods2) {
18311     return {
18312       stream: transformer(methods2)
18313     };
18314   }
18315   function transformer(methods2) {
18316     return function(stream) {
18317       var s = new TransformStream();
18318       for (var key in methods2)
18319         s[key] = methods2[key];
18320       s.stream = stream;
18321       return s;
18322     };
18323   }
18324   function TransformStream() {
18325   }
18326   TransformStream.prototype = {
18327     constructor: TransformStream,
18328     point: function(x, y) {
18329       this.stream.point(x, y);
18330     },
18331     sphere: function() {
18332       this.stream.sphere();
18333     },
18334     lineStart: function() {
18335       this.stream.lineStart();
18336     },
18337     lineEnd: function() {
18338       this.stream.lineEnd();
18339     },
18340     polygonStart: function() {
18341       this.stream.polygonStart();
18342     },
18343     polygonEnd: function() {
18344       this.stream.polygonEnd();
18345     }
18346   };
18347
18348   // node_modules/d3-geo/src/projection/fit.js
18349   function fit(projection2, fitBounds, object) {
18350     var clip = projection2.clipExtent && projection2.clipExtent();
18351     projection2.scale(150).translate([0, 0]);
18352     if (clip != null)
18353       projection2.clipExtent(null);
18354     stream_default(object, projection2.stream(bounds_default2));
18355     fitBounds(bounds_default2.result());
18356     if (clip != null)
18357       projection2.clipExtent(clip);
18358     return projection2;
18359   }
18360   function fitExtent(projection2, extent, object) {
18361     return fit(projection2, function(b) {
18362       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;
18363       projection2.scale(150 * k).translate([x, y]);
18364     }, object);
18365   }
18366   function fitSize(projection2, size, object) {
18367     return fitExtent(projection2, [[0, 0], size], object);
18368   }
18369   function fitWidth(projection2, width, object) {
18370     return fit(projection2, function(b) {
18371       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];
18372       projection2.scale(150 * k).translate([x, y]);
18373     }, object);
18374   }
18375   function fitHeight(projection2, height, object) {
18376     return fit(projection2, function(b) {
18377       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;
18378       projection2.scale(150 * k).translate([x, y]);
18379     }, object);
18380   }
18381
18382   // node_modules/d3-geo/src/projection/resample.js
18383   var maxDepth = 16;
18384   var cosMinDistance = cos(30 * radians);
18385   function resample_default(project, delta2) {
18386     return +delta2 ? resample(project, delta2) : resampleNone(project);
18387   }
18388   function resampleNone(project) {
18389     return transformer({
18390       point: function(x, y) {
18391         x = project(x, y);
18392         this.stream.point(x[0], x[1]);
18393       }
18394     });
18395   }
18396   function resample(project, delta2) {
18397     function resampleLineTo(x05, y05, lambda04, a0, b0, c0, x12, y12, lambda12, a1, b1, c1, depth, stream) {
18398       var dx = x12 - x05, dy = y12 - y05, d2 = dx * dx + dy * dy;
18399       if (d2 > 4 * delta2 && depth--) {
18400         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;
18401         if (dz * dz / d2 > delta2 || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {
18402           resampleLineTo(x05, y05, lambda04, a0, b0, c0, x2, y2, lambda22, a /= m, b /= m, c, depth, stream);
18403           stream.point(x2, y2);
18404           resampleLineTo(x2, y2, lambda22, a, b, c, x12, y12, lambda12, a1, b1, c1, depth, stream);
18405         }
18406       }
18407     }
18408     return function(stream) {
18409       var lambda003, x004, y004, a00, b00, c00, lambda04, x05, y05, a0, b0, c0;
18410       var resampleStream = {
18411         point: point2,
18412         lineStart,
18413         lineEnd,
18414         polygonStart: function() {
18415           stream.polygonStart();
18416           resampleStream.lineStart = ringStart;
18417         },
18418         polygonEnd: function() {
18419           stream.polygonEnd();
18420           resampleStream.lineStart = lineStart;
18421         }
18422       };
18423       function point2(x, y) {
18424         x = project(x, y);
18425         stream.point(x[0], x[1]);
18426       }
18427       function lineStart() {
18428         x05 = NaN;
18429         resampleStream.point = linePoint2;
18430         stream.lineStart();
18431       }
18432       function linePoint2(lambda, phi) {
18433         var c = cartesian([lambda, phi]), p = project(lambda, phi);
18434         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);
18435         stream.point(x05, y05);
18436       }
18437       function lineEnd() {
18438         resampleStream.point = point2;
18439         stream.lineEnd();
18440       }
18441       function ringStart() {
18442         lineStart();
18443         resampleStream.point = ringPoint;
18444         resampleStream.lineEnd = ringEnd;
18445       }
18446       function ringPoint(lambda, phi) {
18447         linePoint2(lambda003 = lambda, phi), x004 = x05, y004 = y05, a00 = a0, b00 = b0, c00 = c0;
18448         resampleStream.point = linePoint2;
18449       }
18450       function ringEnd() {
18451         resampleLineTo(x05, y05, lambda04, a0, b0, c0, x004, y004, lambda003, a00, b00, c00, maxDepth, stream);
18452         resampleStream.lineEnd = lineEnd;
18453         lineEnd();
18454       }
18455       return resampleStream;
18456     };
18457   }
18458
18459   // node_modules/d3-geo/src/projection/index.js
18460   var transformRadians = transformer({
18461     point: function(x, y) {
18462       this.stream.point(x * radians, y * radians);
18463     }
18464   });
18465   function transformRotate(rotate) {
18466     return transformer({
18467       point: function(x, y) {
18468         var r = rotate(x, y);
18469         return this.stream.point(r[0], r[1]);
18470       }
18471     });
18472   }
18473   function scaleTranslate(k, dx, dy, sx, sy) {
18474     function transform2(x, y) {
18475       x *= sx;
18476       y *= sy;
18477       return [dx + k * x, dy - k * y];
18478     }
18479     transform2.invert = function(x, y) {
18480       return [(x - dx) / k * sx, (dy - y) / k * sy];
18481     };
18482     return transform2;
18483   }
18484   function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) {
18485     if (!alpha)
18486       return scaleTranslate(k, dx, dy, sx, sy);
18487     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;
18488     function transform2(x, y) {
18489       x *= sx;
18490       y *= sy;
18491       return [a * x - b * y + dx, dy - b * x - a * y];
18492     }
18493     transform2.invert = function(x, y) {
18494       return [sx * (ai * x - bi * y + ci), sy * (fi - bi * x - ai * y)];
18495     };
18496     return transform2;
18497   }
18498   function projection(project) {
18499     return projectionMutator(function() {
18500       return project;
18501     })();
18502   }
18503   function projectionMutator(projectAt) {
18504     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;
18505     function projection2(point2) {
18506       return projectRotateTransform(point2[0] * radians, point2[1] * radians);
18507     }
18508     function invert(point2) {
18509       point2 = projectRotateTransform.invert(point2[0], point2[1]);
18510       return point2 && [point2[0] * degrees, point2[1] * degrees];
18511     }
18512     projection2.stream = function(stream) {
18513       return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));
18514     };
18515     projection2.preclip = function(_) {
18516       return arguments.length ? (preclip = _, theta = void 0, reset()) : preclip;
18517     };
18518     projection2.postclip = function(_) {
18519       return arguments.length ? (postclip = _, x05 = y05 = x12 = y12 = null, reset()) : postclip;
18520     };
18521     projection2.clipAngle = function(_) {
18522       return arguments.length ? (preclip = +_ ? circle_default(theta = _ * radians) : (theta = null, antimeridian_default), reset()) : theta * degrees;
18523     };
18524     projection2.clipExtent = function(_) {
18525       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]];
18526     };
18527     projection2.scale = function(_) {
18528       return arguments.length ? (k = +_, recenter()) : k;
18529     };
18530     projection2.translate = function(_) {
18531       return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y];
18532     };
18533     projection2.center = function(_) {
18534       return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];
18535     };
18536     projection2.rotate = function(_) {
18537       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];
18538     };
18539     projection2.angle = function(_) {
18540       return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees;
18541     };
18542     projection2.reflectX = function(_) {
18543       return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0;
18544     };
18545     projection2.reflectY = function(_) {
18546       return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0;
18547     };
18548     projection2.precision = function(_) {
18549       return arguments.length ? (projectResample = resample_default(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2);
18550     };
18551     projection2.fitExtent = function(extent, object) {
18552       return fitExtent(projection2, extent, object);
18553     };
18554     projection2.fitSize = function(size, object) {
18555       return fitSize(projection2, size, object);
18556     };
18557     projection2.fitWidth = function(width, object) {
18558       return fitWidth(projection2, width, object);
18559     };
18560     projection2.fitHeight = function(height, object) {
18561       return fitHeight(projection2, height, object);
18562     };
18563     function recenter() {
18564       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);
18565       rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);
18566       projectTransform = compose_default(project, transform2);
18567       projectRotateTransform = compose_default(rotate, projectTransform);
18568       projectResample = resample_default(projectTransform, delta2);
18569       return reset();
18570     }
18571     function reset() {
18572       cache = cacheStream = null;
18573       return projection2;
18574     }
18575     return function() {
18576       project = projectAt.apply(this, arguments);
18577       projection2.invert = project.invert && invert;
18578       return recenter();
18579     };
18580   }
18581
18582   // node_modules/d3-geo/src/projection/mercator.js
18583   function mercatorRaw(lambda, phi) {
18584     return [lambda, log(tan((halfPi + phi) / 2))];
18585   }
18586   mercatorRaw.invert = function(x, y) {
18587     return [x, 2 * atan(exp(y)) - halfPi];
18588   };
18589   function mercator_default() {
18590     return mercatorProjection(mercatorRaw).scale(961 / tau);
18591   }
18592   function mercatorProjection(project) {
18593     var m = projection(project), center = m.center, scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, x05 = null, y05, x12, y12;
18594     m.scale = function(_) {
18595       return arguments.length ? (scale(_), reclip()) : scale();
18596     };
18597     m.translate = function(_) {
18598       return arguments.length ? (translate(_), reclip()) : translate();
18599     };
18600     m.center = function(_) {
18601       return arguments.length ? (center(_), reclip()) : center();
18602     };
18603     m.clipExtent = function(_) {
18604       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]];
18605     };
18606     function reclip() {
18607       var k = pi * scale(), t = m(rotation_default(m.rotate()).invert([0, 0]));
18608       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)]]);
18609     }
18610     return reclip();
18611   }
18612
18613   // node_modules/d3-geo/src/projection/identity.js
18614   function identity_default2() {
18615     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({
18616       point: function(x, y) {
18617         var p = projection2([x, y]);
18618         this.stream.point(p[0], p[1]);
18619       }
18620     }), postclip = identity_default, cache, cacheStream;
18621     function reset() {
18622       kx = k * sx;
18623       ky = k * sy;
18624       cache = cacheStream = null;
18625       return projection2;
18626     }
18627     function projection2(p) {
18628       var x = p[0] * kx, y = p[1] * ky;
18629       if (alpha) {
18630         var t = y * ca - x * sa;
18631         x = x * ca + y * sa;
18632         y = t;
18633       }
18634       return [x + tx, y + ty];
18635     }
18636     projection2.invert = function(p) {
18637       var x = p[0] - tx, y = p[1] - ty;
18638       if (alpha) {
18639         var t = y * ca + x * sa;
18640         x = x * ca - y * sa;
18641         y = t;
18642       }
18643       return [x / kx, y / ky];
18644     };
18645     projection2.stream = function(stream) {
18646       return cache && cacheStream === stream ? cache : cache = transform2(postclip(cacheStream = stream));
18647     };
18648     projection2.postclip = function(_) {
18649       return arguments.length ? (postclip = _, x05 = y05 = x12 = y12 = null, reset()) : postclip;
18650     };
18651     projection2.clipExtent = function(_) {
18652       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]];
18653     };
18654     projection2.scale = function(_) {
18655       return arguments.length ? (k = +_, reset()) : k;
18656     };
18657     projection2.translate = function(_) {
18658       return arguments.length ? (tx = +_[0], ty = +_[1], reset()) : [tx, ty];
18659     };
18660     projection2.angle = function(_) {
18661       return arguments.length ? (alpha = _ % 360 * radians, sa = sin(alpha), ca = cos(alpha), reset()) : alpha * degrees;
18662     };
18663     projection2.reflectX = function(_) {
18664       return arguments.length ? (sx = _ ? -1 : 1, reset()) : sx < 0;
18665     };
18666     projection2.reflectY = function(_) {
18667       return arguments.length ? (sy = _ ? -1 : 1, reset()) : sy < 0;
18668     };
18669     projection2.fitExtent = function(extent, object) {
18670       return fitExtent(projection2, extent, object);
18671     };
18672     projection2.fitSize = function(size, object) {
18673       return fitSize(projection2, size, object);
18674     };
18675     projection2.fitWidth = function(width, object) {
18676       return fitWidth(projection2, width, object);
18677     };
18678     projection2.fitHeight = function(height, object) {
18679       return fitHeight(projection2, height, object);
18680     };
18681     return projection2;
18682   }
18683
18684   // modules/geo/geo.js
18685   var TAU = 2 * Math.PI;
18686   var EQUATORIAL_RADIUS = 6356752314245179e-9;
18687   var POLAR_RADIUS = 6378137;
18688   function geoLatToMeters(dLat) {
18689     return dLat * (TAU * POLAR_RADIUS / 360);
18690   }
18691   function geoLonToMeters(dLon, atLat) {
18692     return Math.abs(atLat) >= 90 ? 0 : dLon * (TAU * EQUATORIAL_RADIUS / 360) * Math.abs(Math.cos(atLat * (Math.PI / 180)));
18693   }
18694   function geoMetersToLat(m) {
18695     return m / (TAU * POLAR_RADIUS / 360);
18696   }
18697   function geoMetersToLon(m, atLat) {
18698     return Math.abs(atLat) >= 90 ? 0 : m / (TAU * EQUATORIAL_RADIUS / 360) / Math.abs(Math.cos(atLat * (Math.PI / 180)));
18699   }
18700   function geoMetersToOffset(meters, tileSize) {
18701     tileSize = tileSize || 256;
18702     return [
18703       meters[0] * tileSize / (TAU * EQUATORIAL_RADIUS),
18704       -meters[1] * tileSize / (TAU * POLAR_RADIUS)
18705     ];
18706   }
18707   function geoOffsetToMeters(offset, tileSize) {
18708     tileSize = tileSize || 256;
18709     return [
18710       offset[0] * TAU * EQUATORIAL_RADIUS / tileSize,
18711       -offset[1] * TAU * POLAR_RADIUS / tileSize
18712     ];
18713   }
18714   function geoSphericalDistance(a, b) {
18715     var x = geoLonToMeters(a[0] - b[0], (a[1] + b[1]) / 2);
18716     var y = geoLatToMeters(a[1] - b[1]);
18717     return Math.sqrt(x * x + y * y);
18718   }
18719   function geoScaleToZoom(k, tileSize) {
18720     tileSize = tileSize || 256;
18721     var log2ts = Math.log(tileSize) * Math.LOG2E;
18722     return Math.log(k * TAU) / Math.LN2 - log2ts;
18723   }
18724   function geoZoomToScale(z, tileSize) {
18725     tileSize = tileSize || 256;
18726     return tileSize * Math.pow(2, z) / TAU;
18727   }
18728   function geoSphericalClosestNode(nodes, point2) {
18729     var minDistance = Infinity, distance;
18730     var indexOfMin;
18731     for (var i2 in nodes) {
18732       distance = geoSphericalDistance(nodes[i2].loc, point2);
18733       if (distance < minDistance) {
18734         minDistance = distance;
18735         indexOfMin = i2;
18736       }
18737     }
18738     if (indexOfMin !== void 0) {
18739       return { index: indexOfMin, distance: minDistance, node: nodes[indexOfMin] };
18740     } else {
18741       return null;
18742     }
18743   }
18744
18745   // modules/geo/extent.js
18746   function geoExtent(min3, max3) {
18747     if (!(this instanceof geoExtent)) {
18748       return new geoExtent(min3, max3);
18749     } else if (min3 instanceof geoExtent) {
18750       return min3;
18751     } else if (min3 && min3.length === 2 && min3[0].length === 2 && min3[1].length === 2) {
18752       this[0] = min3[0];
18753       this[1] = min3[1];
18754     } else {
18755       this[0] = min3 || [Infinity, Infinity];
18756       this[1] = max3 || min3 || [-Infinity, -Infinity];
18757     }
18758   }
18759   geoExtent.prototype = new Array(2);
18760   Object.assign(geoExtent.prototype, {
18761     equals: function(obj) {
18762       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];
18763     },
18764     extend: function(obj) {
18765       if (!(obj instanceof geoExtent))
18766         obj = new geoExtent(obj);
18767       return geoExtent(
18768         [Math.min(obj[0][0], this[0][0]), Math.min(obj[0][1], this[0][1])],
18769         [Math.max(obj[1][0], this[1][0]), Math.max(obj[1][1], this[1][1])]
18770       );
18771     },
18772     _extend: function(extent) {
18773       this[0][0] = Math.min(extent[0][0], this[0][0]);
18774       this[0][1] = Math.min(extent[0][1], this[0][1]);
18775       this[1][0] = Math.max(extent[1][0], this[1][0]);
18776       this[1][1] = Math.max(extent[1][1], this[1][1]);
18777     },
18778     area: function() {
18779       return Math.abs((this[1][0] - this[0][0]) * (this[1][1] - this[0][1]));
18780     },
18781     center: function() {
18782       return [(this[0][0] + this[1][0]) / 2, (this[0][1] + this[1][1]) / 2];
18783     },
18784     rectangle: function() {
18785       return [this[0][0], this[0][1], this[1][0], this[1][1]];
18786     },
18787     bbox: function() {
18788       return { minX: this[0][0], minY: this[0][1], maxX: this[1][0], maxY: this[1][1] };
18789     },
18790     polygon: function() {
18791       return [
18792         [this[0][0], this[0][1]],
18793         [this[0][0], this[1][1]],
18794         [this[1][0], this[1][1]],
18795         [this[1][0], this[0][1]],
18796         [this[0][0], this[0][1]]
18797       ];
18798     },
18799     contains: function(obj) {
18800       if (!(obj instanceof geoExtent))
18801         obj = new geoExtent(obj);
18802       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];
18803     },
18804     intersects: function(obj) {
18805       if (!(obj instanceof geoExtent))
18806         obj = new geoExtent(obj);
18807       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];
18808     },
18809     intersection: function(obj) {
18810       if (!this.intersects(obj))
18811         return new geoExtent();
18812       return new geoExtent(
18813         [Math.max(obj[0][0], this[0][0]), Math.max(obj[0][1], this[0][1])],
18814         [Math.min(obj[1][0], this[1][0]), Math.min(obj[1][1], this[1][1])]
18815       );
18816     },
18817     percentContainedIn: function(obj) {
18818       if (!(obj instanceof geoExtent))
18819         obj = new geoExtent(obj);
18820       var a1 = this.intersection(obj).area();
18821       var a2 = this.area();
18822       if (a1 === Infinity || a2 === Infinity) {
18823         return 0;
18824       } else if (a1 === 0 || a2 === 0) {
18825         if (obj.contains(this)) {
18826           return 1;
18827         }
18828         return 0;
18829       } else {
18830         return a1 / a2;
18831       }
18832     },
18833     padByMeters: function(meters) {
18834       var dLat = geoMetersToLat(meters);
18835       var dLon = geoMetersToLon(meters, this.center()[1]);
18836       return geoExtent(
18837         [this[0][0] - dLon, this[0][1] - dLat],
18838         [this[1][0] + dLon, this[1][1] + dLat]
18839       );
18840     },
18841     toParam: function() {
18842       return this.rectangle().join(",");
18843     }
18844   });
18845
18846   // node_modules/d3-polygon/src/area.js
18847   function area_default3(polygon2) {
18848     var i2 = -1, n2 = polygon2.length, a, b = polygon2[n2 - 1], area = 0;
18849     while (++i2 < n2) {
18850       a = b;
18851       b = polygon2[i2];
18852       area += a[1] * b[0] - a[0] * b[1];
18853     }
18854     return area / 2;
18855   }
18856
18857   // node_modules/d3-polygon/src/centroid.js
18858   function centroid_default2(polygon2) {
18859     var i2 = -1, n2 = polygon2.length, x = 0, y = 0, a, b = polygon2[n2 - 1], c, k = 0;
18860     while (++i2 < n2) {
18861       a = b;
18862       b = polygon2[i2];
18863       k += c = a[0] * b[1] - b[0] * a[1];
18864       x += (a[0] + b[0]) * c;
18865       y += (a[1] + b[1]) * c;
18866     }
18867     return k *= 3, [x / k, y / k];
18868   }
18869
18870   // node_modules/d3-polygon/src/cross.js
18871   function cross_default(a, b, c) {
18872     return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);
18873   }
18874
18875   // node_modules/d3-polygon/src/hull.js
18876   function lexicographicOrder(a, b) {
18877     return a[0] - b[0] || a[1] - b[1];
18878   }
18879   function computeUpperHullIndexes(points) {
18880     const n2 = points.length, indexes = [0, 1];
18881     let size = 2, i2;
18882     for (i2 = 2; i2 < n2; ++i2) {
18883       while (size > 1 && cross_default(points[indexes[size - 2]], points[indexes[size - 1]], points[i2]) <= 0)
18884         --size;
18885       indexes[size++] = i2;
18886     }
18887     return indexes.slice(0, size);
18888   }
18889   function hull_default(points) {
18890     if ((n2 = points.length) < 3)
18891       return null;
18892     var i2, n2, sortedPoints = new Array(n2), flippedPoints = new Array(n2);
18893     for (i2 = 0; i2 < n2; ++i2)
18894       sortedPoints[i2] = [+points[i2][0], +points[i2][1], i2];
18895     sortedPoints.sort(lexicographicOrder);
18896     for (i2 = 0; i2 < n2; ++i2)
18897       flippedPoints[i2] = [sortedPoints[i2][0], -sortedPoints[i2][1]];
18898     var upperIndexes = computeUpperHullIndexes(sortedPoints), lowerIndexes = computeUpperHullIndexes(flippedPoints);
18899     var skipLeft = lowerIndexes[0] === upperIndexes[0], skipRight = lowerIndexes[lowerIndexes.length - 1] === upperIndexes[upperIndexes.length - 1], hull = [];
18900     for (i2 = upperIndexes.length - 1; i2 >= 0; --i2)
18901       hull.push(points[sortedPoints[upperIndexes[i2]][2]]);
18902     for (i2 = +skipLeft; i2 < lowerIndexes.length - skipRight; ++i2)
18903       hull.push(points[sortedPoints[lowerIndexes[i2]][2]]);
18904     return hull;
18905   }
18906
18907   // modules/geo/vector.js
18908   function geoVecEqual(a, b, epsilon3) {
18909     if (epsilon3) {
18910       return Math.abs(a[0] - b[0]) <= epsilon3 && Math.abs(a[1] - b[1]) <= epsilon3;
18911     } else {
18912       return a[0] === b[0] && a[1] === b[1];
18913     }
18914   }
18915   function geoVecAdd(a, b) {
18916     return [a[0] + b[0], a[1] + b[1]];
18917   }
18918   function geoVecSubtract(a, b) {
18919     return [a[0] - b[0], a[1] - b[1]];
18920   }
18921   function geoVecScale(a, mag) {
18922     return [a[0] * mag, a[1] * mag];
18923   }
18924   function geoVecFloor(a) {
18925     return [Math.floor(a[0]), Math.floor(a[1])];
18926   }
18927   function geoVecInterp(a, b, t) {
18928     return [
18929       a[0] + (b[0] - a[0]) * t,
18930       a[1] + (b[1] - a[1]) * t
18931     ];
18932   }
18933   function geoVecLength(a, b) {
18934     return Math.sqrt(geoVecLengthSquare(a, b));
18935   }
18936   function geoVecLengthSquare(a, b) {
18937     b = b || [0, 0];
18938     var x = a[0] - b[0];
18939     var y = a[1] - b[1];
18940     return x * x + y * y;
18941   }
18942   function geoVecNormalize(a) {
18943     var length = Math.sqrt(a[0] * a[0] + a[1] * a[1]);
18944     if (length !== 0) {
18945       return geoVecScale(a, 1 / length);
18946     }
18947     return [0, 0];
18948   }
18949   function geoVecAngle(a, b) {
18950     return Math.atan2(b[1] - a[1], b[0] - a[0]);
18951   }
18952   function geoVecDot(a, b, origin) {
18953     origin = origin || [0, 0];
18954     var p = geoVecSubtract(a, origin);
18955     var q = geoVecSubtract(b, origin);
18956     return p[0] * q[0] + p[1] * q[1];
18957   }
18958   function geoVecNormalizedDot(a, b, origin) {
18959     origin = origin || [0, 0];
18960     var p = geoVecNormalize(geoVecSubtract(a, origin));
18961     var q = geoVecNormalize(geoVecSubtract(b, origin));
18962     return geoVecDot(p, q);
18963   }
18964   function geoVecCross(a, b, origin) {
18965     origin = origin || [0, 0];
18966     var p = geoVecSubtract(a, origin);
18967     var q = geoVecSubtract(b, origin);
18968     return p[0] * q[1] - p[1] * q[0];
18969   }
18970   function geoVecProject(a, points) {
18971     var min3 = Infinity;
18972     var idx;
18973     var target;
18974     for (var i2 = 0; i2 < points.length - 1; i2++) {
18975       var o = points[i2];
18976       var s = geoVecSubtract(points[i2 + 1], o);
18977       var v = geoVecSubtract(a, o);
18978       var proj = geoVecDot(v, s) / geoVecDot(s, s);
18979       var p;
18980       if (proj < 0) {
18981         p = o;
18982       } else if (proj > 1) {
18983         p = points[i2 + 1];
18984       } else {
18985         p = [o[0] + proj * s[0], o[1] + proj * s[1]];
18986       }
18987       var dist = geoVecLength(p, a);
18988       if (dist < min3) {
18989         min3 = dist;
18990         idx = i2 + 1;
18991         target = p;
18992       }
18993     }
18994     if (idx !== void 0) {
18995       return { index: idx, distance: min3, target };
18996     } else {
18997       return null;
18998     }
18999   }
19000
19001   // modules/geo/geom.js
19002   function geoAngle(a, b, projection2) {
19003     return geoVecAngle(projection2(a.loc), projection2(b.loc));
19004   }
19005   function geoEdgeEqual(a, b) {
19006     return a[0] === b[0] && a[1] === b[1] || a[0] === b[1] && a[1] === b[0];
19007   }
19008   function geoRotate(points, angle2, around) {
19009     return points.map(function(point2) {
19010       var radial = geoVecSubtract(point2, around);
19011       return [
19012         radial[0] * Math.cos(angle2) - radial[1] * Math.sin(angle2) + around[0],
19013         radial[0] * Math.sin(angle2) + radial[1] * Math.cos(angle2) + around[1]
19014       ];
19015     });
19016   }
19017   function geoChooseEdge(nodes, point2, projection2, activeID) {
19018     var dist = geoVecLength;
19019     var points = nodes.map(function(n2) {
19020       return projection2(n2.loc);
19021     });
19022     var ids = nodes.map(function(n2) {
19023       return n2.id;
19024     });
19025     var min3 = Infinity;
19026     var idx;
19027     var loc;
19028     for (var i2 = 0; i2 < points.length - 1; i2++) {
19029       if (ids[i2] === activeID || ids[i2 + 1] === activeID)
19030         continue;
19031       var o = points[i2];
19032       var s = geoVecSubtract(points[i2 + 1], o);
19033       var v = geoVecSubtract(point2, o);
19034       var proj = geoVecDot(v, s) / geoVecDot(s, s);
19035       var p;
19036       if (proj < 0) {
19037         p = o;
19038       } else if (proj > 1) {
19039         p = points[i2 + 1];
19040       } else {
19041         p = [o[0] + proj * s[0], o[1] + proj * s[1]];
19042       }
19043       var d = dist(p, point2);
19044       if (d < min3) {
19045         min3 = d;
19046         idx = i2 + 1;
19047         loc = projection2.invert(p);
19048       }
19049     }
19050     if (idx !== void 0) {
19051       return { index: idx, distance: min3, loc };
19052     } else {
19053       return null;
19054     }
19055   }
19056   function geoHasLineIntersections(activeNodes, inactiveNodes, activeID) {
19057     var actives = [];
19058     var inactives = [];
19059     var j2, k, n1, n2, segment;
19060     for (j2 = 0; j2 < activeNodes.length - 1; j2++) {
19061       n1 = activeNodes[j2];
19062       n2 = activeNodes[j2 + 1];
19063       segment = [n1.loc, n2.loc];
19064       if (n1.id === activeID || n2.id === activeID) {
19065         actives.push(segment);
19066       }
19067     }
19068     for (j2 = 0; j2 < inactiveNodes.length - 1; j2++) {
19069       n1 = inactiveNodes[j2];
19070       n2 = inactiveNodes[j2 + 1];
19071       segment = [n1.loc, n2.loc];
19072       inactives.push(segment);
19073     }
19074     for (j2 = 0; j2 < actives.length; j2++) {
19075       for (k = 0; k < inactives.length; k++) {
19076         var p = actives[j2];
19077         var q = inactives[k];
19078         var hit = geoLineIntersection(p, q);
19079         if (hit) {
19080           return true;
19081         }
19082       }
19083     }
19084     return false;
19085   }
19086   function geoHasSelfIntersections(nodes, activeID) {
19087     var actives = [];
19088     var inactives = [];
19089     var j2, k;
19090     for (j2 = 0; j2 < nodes.length - 1; j2++) {
19091       var n1 = nodes[j2];
19092       var n2 = nodes[j2 + 1];
19093       var segment = [n1.loc, n2.loc];
19094       if (n1.id === activeID || n2.id === activeID) {
19095         actives.push(segment);
19096       } else {
19097         inactives.push(segment);
19098       }
19099     }
19100     for (j2 = 0; j2 < actives.length; j2++) {
19101       for (k = 0; k < inactives.length; k++) {
19102         var p = actives[j2];
19103         var q = inactives[k];
19104         if (geoVecEqual(p[1], q[0]) || geoVecEqual(p[0], q[1]) || geoVecEqual(p[0], q[0]) || geoVecEqual(p[1], q[1])) {
19105           continue;
19106         }
19107         var hit = geoLineIntersection(p, q);
19108         if (hit) {
19109           var epsilon3 = 1e-8;
19110           if (geoVecEqual(p[1], hit, epsilon3) || geoVecEqual(p[0], hit, epsilon3) || geoVecEqual(q[1], hit, epsilon3) || geoVecEqual(q[0], hit, epsilon3)) {
19111             continue;
19112           } else {
19113             return true;
19114           }
19115         }
19116       }
19117     }
19118     return false;
19119   }
19120   function geoLineIntersection(a, b) {
19121     var p = [a[0][0], a[0][1]];
19122     var p2 = [a[1][0], a[1][1]];
19123     var q = [b[0][0], b[0][1]];
19124     var q2 = [b[1][0], b[1][1]];
19125     var r = geoVecSubtract(p2, p);
19126     var s = geoVecSubtract(q2, q);
19127     var uNumerator = geoVecCross(geoVecSubtract(q, p), r);
19128     var denominator = geoVecCross(r, s);
19129     if (uNumerator && denominator) {
19130       var u = uNumerator / denominator;
19131       var t = geoVecCross(geoVecSubtract(q, p), s) / denominator;
19132       if (t >= 0 && t <= 1 && u >= 0 && u <= 1) {
19133         return geoVecInterp(p, p2, t);
19134       }
19135     }
19136     return null;
19137   }
19138   function geoPathIntersections(path1, path2) {
19139     var intersections = [];
19140     for (var i2 = 0; i2 < path1.length - 1; i2++) {
19141       for (var j2 = 0; j2 < path2.length - 1; j2++) {
19142         var a = [path1[i2], path1[i2 + 1]];
19143         var b = [path2[j2], path2[j2 + 1]];
19144         var hit = geoLineIntersection(a, b);
19145         if (hit) {
19146           intersections.push(hit);
19147         }
19148       }
19149     }
19150     return intersections;
19151   }
19152   function geoPathHasIntersections(path1, path2) {
19153     for (var i2 = 0; i2 < path1.length - 1; i2++) {
19154       for (var j2 = 0; j2 < path2.length - 1; j2++) {
19155         var a = [path1[i2], path1[i2 + 1]];
19156         var b = [path2[j2], path2[j2 + 1]];
19157         var hit = geoLineIntersection(a, b);
19158         if (hit) {
19159           return true;
19160         }
19161       }
19162     }
19163     return false;
19164   }
19165   function geoPointInPolygon(point2, polygon2) {
19166     var x = point2[0];
19167     var y = point2[1];
19168     var inside = false;
19169     for (var i2 = 0, j2 = polygon2.length - 1; i2 < polygon2.length; j2 = i2++) {
19170       var xi = polygon2[i2][0];
19171       var yi = polygon2[i2][1];
19172       var xj = polygon2[j2][0];
19173       var yj = polygon2[j2][1];
19174       var intersect2 = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
19175       if (intersect2)
19176         inside = !inside;
19177     }
19178     return inside;
19179   }
19180   function geoPolygonContainsPolygon(outer, inner) {
19181     return inner.every(function(point2) {
19182       return geoPointInPolygon(point2, outer);
19183     });
19184   }
19185   function geoPolygonIntersectsPolygon(outer, inner, checkSegments) {
19186     function testPoints(outer2, inner2) {
19187       return inner2.some(function(point2) {
19188         return geoPointInPolygon(point2, outer2);
19189       });
19190     }
19191     return testPoints(outer, inner) || !!checkSegments && geoPathHasIntersections(outer, inner);
19192   }
19193   function geoGetSmallestSurroundingRectangle(points) {
19194     var hull = hull_default(points);
19195     var centroid = centroid_default2(hull);
19196     var minArea = Infinity;
19197     var ssrExtent = [];
19198     var ssrAngle = 0;
19199     var c1 = hull[0];
19200     for (var i2 = 0; i2 <= hull.length - 1; i2++) {
19201       var c2 = i2 === hull.length - 1 ? hull[0] : hull[i2 + 1];
19202       var angle2 = Math.atan2(c2[1] - c1[1], c2[0] - c1[0]);
19203       var poly = geoRotate(hull, -angle2, centroid);
19204       var extent = poly.reduce(function(extent2, point2) {
19205         return extent2.extend(geoExtent(point2));
19206       }, geoExtent());
19207       var area = extent.area();
19208       if (area < minArea) {
19209         minArea = area;
19210         ssrExtent = extent;
19211         ssrAngle = angle2;
19212       }
19213       c1 = c2;
19214     }
19215     return {
19216       poly: geoRotate(ssrExtent.polygon(), ssrAngle, centroid),
19217       angle: ssrAngle
19218     };
19219   }
19220   function geoPathLength(path) {
19221     var length = 0;
19222     for (var i2 = 0; i2 < path.length - 1; i2++) {
19223       length += geoVecLength(path[i2], path[i2 + 1]);
19224     }
19225     return length;
19226   }
19227   function geoViewportEdge(point2, dimensions) {
19228     var pad2 = [80, 20, 50, 20];
19229     var x = 0;
19230     var y = 0;
19231     if (point2[0] > dimensions[0] - pad2[1]) {
19232       x = -10;
19233     }
19234     if (point2[0] < pad2[3]) {
19235       x = 10;
19236     }
19237     if (point2[1] > dimensions[1] - pad2[2]) {
19238       y = -10;
19239     }
19240     if (point2[1] < pad2[0]) {
19241       y = 10;
19242     }
19243     if (x || y) {
19244       return [x, y];
19245     } else {
19246       return null;
19247     }
19248   }
19249
19250   // node_modules/d3-dispatch/src/dispatch.js
19251   var noop2 = { value: () => {
19252   } };
19253   function dispatch() {
19254     for (var i2 = 0, n2 = arguments.length, _ = {}, t; i2 < n2; ++i2) {
19255       if (!(t = arguments[i2] + "") || t in _ || /[\s.]/.test(t))
19256         throw new Error("illegal type: " + t);
19257       _[t] = [];
19258     }
19259     return new Dispatch(_);
19260   }
19261   function Dispatch(_) {
19262     this._ = _;
19263   }
19264   function parseTypenames(typenames, types) {
19265     return typenames.trim().split(/^|\s+/).map(function(t) {
19266       var name = "", i2 = t.indexOf(".");
19267       if (i2 >= 0)
19268         name = t.slice(i2 + 1), t = t.slice(0, i2);
19269       if (t && !types.hasOwnProperty(t))
19270         throw new Error("unknown type: " + t);
19271       return { type: t, name };
19272     });
19273   }
19274   Dispatch.prototype = dispatch.prototype = {
19275     constructor: Dispatch,
19276     on: function(typename, callback) {
19277       var _ = this._, T = parseTypenames(typename + "", _), t, i2 = -1, n2 = T.length;
19278       if (arguments.length < 2) {
19279         while (++i2 < n2)
19280           if ((t = (typename = T[i2]).type) && (t = get(_[t], typename.name)))
19281             return t;
19282         return;
19283       }
19284       if (callback != null && typeof callback !== "function")
19285         throw new Error("invalid callback: " + callback);
19286       while (++i2 < n2) {
19287         if (t = (typename = T[i2]).type)
19288           _[t] = set(_[t], typename.name, callback);
19289         else if (callback == null)
19290           for (t in _)
19291             _[t] = set(_[t], typename.name, null);
19292       }
19293       return this;
19294     },
19295     copy: function() {
19296       var copy2 = {}, _ = this._;
19297       for (var t in _)
19298         copy2[t] = _[t].slice();
19299       return new Dispatch(copy2);
19300     },
19301     call: function(type2, that) {
19302       if ((n2 = arguments.length - 2) > 0)
19303         for (var args = new Array(n2), i2 = 0, n2, t; i2 < n2; ++i2)
19304           args[i2] = arguments[i2 + 2];
19305       if (!this._.hasOwnProperty(type2))
19306         throw new Error("unknown type: " + type2);
19307       for (t = this._[type2], i2 = 0, n2 = t.length; i2 < n2; ++i2)
19308         t[i2].value.apply(that, args);
19309     },
19310     apply: function(type2, that, args) {
19311       if (!this._.hasOwnProperty(type2))
19312         throw new Error("unknown type: " + type2);
19313       for (var t = this._[type2], i2 = 0, n2 = t.length; i2 < n2; ++i2)
19314         t[i2].value.apply(that, args);
19315     }
19316   };
19317   function get(type2, name) {
19318     for (var i2 = 0, n2 = type2.length, c; i2 < n2; ++i2) {
19319       if ((c = type2[i2]).name === name) {
19320         return c.value;
19321       }
19322     }
19323   }
19324   function set(type2, name, callback) {
19325     for (var i2 = 0, n2 = type2.length; i2 < n2; ++i2) {
19326       if (type2[i2].name === name) {
19327         type2[i2] = noop2, type2 = type2.slice(0, i2).concat(type2.slice(i2 + 1));
19328         break;
19329       }
19330     }
19331     if (callback != null)
19332       type2.push({ name, value: callback });
19333     return type2;
19334   }
19335   var dispatch_default = dispatch;
19336
19337   // node_modules/d3-selection/src/namespaces.js
19338   var xhtml = "http://www.w3.org/1999/xhtml";
19339   var namespaces_default = {
19340     svg: "http://www.w3.org/2000/svg",
19341     xhtml,
19342     xlink: "http://www.w3.org/1999/xlink",
19343     xml: "http://www.w3.org/XML/1998/namespace",
19344     xmlns: "http://www.w3.org/2000/xmlns/"
19345   };
19346
19347   // node_modules/d3-selection/src/namespace.js
19348   function namespace_default(name) {
19349     var prefix = name += "", i2 = prefix.indexOf(":");
19350     if (i2 >= 0 && (prefix = name.slice(0, i2)) !== "xmlns")
19351       name = name.slice(i2 + 1);
19352     return namespaces_default.hasOwnProperty(prefix) ? { space: namespaces_default[prefix], local: name } : name;
19353   }
19354
19355   // node_modules/d3-selection/src/creator.js
19356   function creatorInherit(name) {
19357     return function() {
19358       var document2 = this.ownerDocument, uri = this.namespaceURI;
19359       return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name) : document2.createElementNS(uri, name);
19360     };
19361   }
19362   function creatorFixed(fullname) {
19363     return function() {
19364       return this.ownerDocument.createElementNS(fullname.space, fullname.local);
19365     };
19366   }
19367   function creator_default(name) {
19368     var fullname = namespace_default(name);
19369     return (fullname.local ? creatorFixed : creatorInherit)(fullname);
19370   }
19371
19372   // node_modules/d3-selection/src/selector.js
19373   function none() {
19374   }
19375   function selector_default(selector) {
19376     return selector == null ? none : function() {
19377       return this.querySelector(selector);
19378     };
19379   }
19380
19381   // node_modules/d3-selection/src/selection/select.js
19382   function select_default(select) {
19383     if (typeof select !== "function")
19384       select = selector_default(select);
19385     for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
19386       for (var group = groups[j2], n2 = group.length, subgroup = subgroups[j2] = new Array(n2), node, subnode, i2 = 0; i2 < n2; ++i2) {
19387         if ((node = group[i2]) && (subnode = select.call(node, node.__data__, i2, group))) {
19388           if ("__data__" in node)
19389             subnode.__data__ = node.__data__;
19390           subgroup[i2] = subnode;
19391         }
19392       }
19393     }
19394     return new Selection(subgroups, this._parents);
19395   }
19396
19397   // node_modules/d3-selection/src/array.js
19398   function array(x) {
19399     return x == null ? [] : Array.isArray(x) ? x : Array.from(x);
19400   }
19401
19402   // node_modules/d3-selection/src/selectorAll.js
19403   function empty() {
19404     return [];
19405   }
19406   function selectorAll_default(selector) {
19407     return selector == null ? empty : function() {
19408       return this.querySelectorAll(selector);
19409     };
19410   }
19411
19412   // node_modules/d3-selection/src/selection/selectAll.js
19413   function arrayAll(select) {
19414     return function() {
19415       return array(select.apply(this, arguments));
19416     };
19417   }
19418   function selectAll_default(select) {
19419     if (typeof select === "function")
19420       select = arrayAll(select);
19421     else
19422       select = selectorAll_default(select);
19423     for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j2 = 0; j2 < m; ++j2) {
19424       for (var group = groups[j2], n2 = group.length, node, i2 = 0; i2 < n2; ++i2) {
19425         if (node = group[i2]) {
19426           subgroups.push(select.call(node, node.__data__, i2, group));
19427           parents.push(node);
19428         }
19429       }
19430     }
19431     return new Selection(subgroups, parents);
19432   }
19433
19434   // node_modules/d3-selection/src/matcher.js
19435   function matcher_default(selector) {
19436     return function() {
19437       return this.matches(selector);
19438     };
19439   }
19440   function childMatcher(selector) {
19441     return function(node) {
19442       return node.matches(selector);
19443     };
19444   }
19445
19446   // node_modules/d3-selection/src/selection/selectChild.js
19447   var find = Array.prototype.find;
19448   function childFind(match) {
19449     return function() {
19450       return find.call(this.children, match);
19451     };
19452   }
19453   function childFirst() {
19454     return this.firstElementChild;
19455   }
19456   function selectChild_default(match) {
19457     return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match)));
19458   }
19459
19460   // node_modules/d3-selection/src/selection/selectChildren.js
19461   var filter = Array.prototype.filter;
19462   function children() {
19463     return Array.from(this.children);
19464   }
19465   function childrenFilter(match) {
19466     return function() {
19467       return filter.call(this.children, match);
19468     };
19469   }
19470   function selectChildren_default(match) {
19471     return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match)));
19472   }
19473
19474   // node_modules/d3-selection/src/selection/filter.js
19475   function filter_default(match) {
19476     if (typeof match !== "function")
19477       match = matcher_default(match);
19478     for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
19479       for (var group = groups[j2], n2 = group.length, subgroup = subgroups[j2] = [], node, i2 = 0; i2 < n2; ++i2) {
19480         if ((node = group[i2]) && match.call(node, node.__data__, i2, group)) {
19481           subgroup.push(node);
19482         }
19483       }
19484     }
19485     return new Selection(subgroups, this._parents);
19486   }
19487
19488   // node_modules/d3-selection/src/selection/sparse.js
19489   function sparse_default(update) {
19490     return new Array(update.length);
19491   }
19492
19493   // node_modules/d3-selection/src/selection/enter.js
19494   function enter_default() {
19495     return new Selection(this._enter || this._groups.map(sparse_default), this._parents);
19496   }
19497   function EnterNode(parent, datum2) {
19498     this.ownerDocument = parent.ownerDocument;
19499     this.namespaceURI = parent.namespaceURI;
19500     this._next = null;
19501     this._parent = parent;
19502     this.__data__ = datum2;
19503   }
19504   EnterNode.prototype = {
19505     constructor: EnterNode,
19506     appendChild: function(child) {
19507       return this._parent.insertBefore(child, this._next);
19508     },
19509     insertBefore: function(child, next) {
19510       return this._parent.insertBefore(child, next);
19511     },
19512     querySelector: function(selector) {
19513       return this._parent.querySelector(selector);
19514     },
19515     querySelectorAll: function(selector) {
19516       return this._parent.querySelectorAll(selector);
19517     }
19518   };
19519
19520   // node_modules/d3-selection/src/constant.js
19521   function constant_default(x) {
19522     return function() {
19523       return x;
19524     };
19525   }
19526
19527   // node_modules/d3-selection/src/selection/data.js
19528   function bindIndex(parent, group, enter, update, exit, data) {
19529     var i2 = 0, node, groupLength = group.length, dataLength = data.length;
19530     for (; i2 < dataLength; ++i2) {
19531       if (node = group[i2]) {
19532         node.__data__ = data[i2];
19533         update[i2] = node;
19534       } else {
19535         enter[i2] = new EnterNode(parent, data[i2]);
19536       }
19537     }
19538     for (; i2 < groupLength; ++i2) {
19539       if (node = group[i2]) {
19540         exit[i2] = node;
19541       }
19542     }
19543   }
19544   function bindKey(parent, group, enter, update, exit, data, key) {
19545     var i2, node, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue;
19546     for (i2 = 0; i2 < groupLength; ++i2) {
19547       if (node = group[i2]) {
19548         keyValues[i2] = keyValue = key.call(node, node.__data__, i2, group) + "";
19549         if (nodeByKeyValue.has(keyValue)) {
19550           exit[i2] = node;
19551         } else {
19552           nodeByKeyValue.set(keyValue, node);
19553         }
19554       }
19555     }
19556     for (i2 = 0; i2 < dataLength; ++i2) {
19557       keyValue = key.call(parent, data[i2], i2, data) + "";
19558       if (node = nodeByKeyValue.get(keyValue)) {
19559         update[i2] = node;
19560         node.__data__ = data[i2];
19561         nodeByKeyValue.delete(keyValue);
19562       } else {
19563         enter[i2] = new EnterNode(parent, data[i2]);
19564       }
19565     }
19566     for (i2 = 0; i2 < groupLength; ++i2) {
19567       if ((node = group[i2]) && nodeByKeyValue.get(keyValues[i2]) === node) {
19568         exit[i2] = node;
19569       }
19570     }
19571   }
19572   function datum(node) {
19573     return node.__data__;
19574   }
19575   function data_default(value, key) {
19576     if (!arguments.length)
19577       return Array.from(this, datum);
19578     var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups;
19579     if (typeof value !== "function")
19580       value = constant_default(value);
19581     for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j2 = 0; j2 < m; ++j2) {
19582       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);
19583       bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
19584       for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
19585         if (previous = enterGroup[i0]) {
19586           if (i0 >= i1)
19587             i1 = i0 + 1;
19588           while (!(next = updateGroup[i1]) && ++i1 < dataLength)
19589             ;
19590           previous._next = next || null;
19591         }
19592       }
19593     }
19594     update = new Selection(update, parents);
19595     update._enter = enter;
19596     update._exit = exit;
19597     return update;
19598   }
19599   function arraylike(data) {
19600     return typeof data === "object" && "length" in data ? data : Array.from(data);
19601   }
19602
19603   // node_modules/d3-selection/src/selection/exit.js
19604   function exit_default() {
19605     return new Selection(this._exit || this._groups.map(sparse_default), this._parents);
19606   }
19607
19608   // node_modules/d3-selection/src/selection/join.js
19609   function join_default(onenter, onupdate, onexit) {
19610     var enter = this.enter(), update = this, exit = this.exit();
19611     if (typeof onenter === "function") {
19612       enter = onenter(enter);
19613       if (enter)
19614         enter = enter.selection();
19615     } else {
19616       enter = enter.append(onenter + "");
19617     }
19618     if (onupdate != null) {
19619       update = onupdate(update);
19620       if (update)
19621         update = update.selection();
19622     }
19623     if (onexit == null)
19624       exit.remove();
19625     else
19626       onexit(exit);
19627     return enter && update ? enter.merge(update).order() : update;
19628   }
19629
19630   // node_modules/d3-selection/src/selection/merge.js
19631   function merge_default(context) {
19632     var selection2 = context.selection ? context.selection() : context;
19633     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) {
19634       for (var group0 = groups0[j2], group1 = groups1[j2], n2 = group0.length, merge2 = merges[j2] = new Array(n2), node, i2 = 0; i2 < n2; ++i2) {
19635         if (node = group0[i2] || group1[i2]) {
19636           merge2[i2] = node;
19637         }
19638       }
19639     }
19640     for (; j2 < m0; ++j2) {
19641       merges[j2] = groups0[j2];
19642     }
19643     return new Selection(merges, this._parents);
19644   }
19645
19646   // node_modules/d3-selection/src/selection/order.js
19647   function order_default() {
19648     for (var groups = this._groups, j2 = -1, m = groups.length; ++j2 < m; ) {
19649       for (var group = groups[j2], i2 = group.length - 1, next = group[i2], node; --i2 >= 0; ) {
19650         if (node = group[i2]) {
19651           if (next && node.compareDocumentPosition(next) ^ 4)
19652             next.parentNode.insertBefore(node, next);
19653           next = node;
19654         }
19655       }
19656     }
19657     return this;
19658   }
19659
19660   // node_modules/d3-selection/src/selection/sort.js
19661   function sort_default(compare) {
19662     if (!compare)
19663       compare = ascending2;
19664     function compareNode(a, b) {
19665       return a && b ? compare(a.__data__, b.__data__) : !a - !b;
19666     }
19667     for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
19668       for (var group = groups[j2], n2 = group.length, sortgroup = sortgroups[j2] = new Array(n2), node, i2 = 0; i2 < n2; ++i2) {
19669         if (node = group[i2]) {
19670           sortgroup[i2] = node;
19671         }
19672       }
19673       sortgroup.sort(compareNode);
19674     }
19675     return new Selection(sortgroups, this._parents).order();
19676   }
19677   function ascending2(a, b) {
19678     return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
19679   }
19680
19681   // node_modules/d3-selection/src/selection/call.js
19682   function call_default() {
19683     var callback = arguments[0];
19684     arguments[0] = this;
19685     callback.apply(null, arguments);
19686     return this;
19687   }
19688
19689   // node_modules/d3-selection/src/selection/nodes.js
19690   function nodes_default() {
19691     return Array.from(this);
19692   }
19693
19694   // node_modules/d3-selection/src/selection/node.js
19695   function node_default() {
19696     for (var groups = this._groups, j2 = 0, m = groups.length; j2 < m; ++j2) {
19697       for (var group = groups[j2], i2 = 0, n2 = group.length; i2 < n2; ++i2) {
19698         var node = group[i2];
19699         if (node)
19700           return node;
19701       }
19702     }
19703     return null;
19704   }
19705
19706   // node_modules/d3-selection/src/selection/size.js
19707   function size_default() {
19708     let size = 0;
19709     for (const node of this)
19710       ++size;
19711     return size;
19712   }
19713
19714   // node_modules/d3-selection/src/selection/empty.js
19715   function empty_default() {
19716     return !this.node();
19717   }
19718
19719   // node_modules/d3-selection/src/selection/each.js
19720   function each_default(callback) {
19721     for (var groups = this._groups, j2 = 0, m = groups.length; j2 < m; ++j2) {
19722       for (var group = groups[j2], i2 = 0, n2 = group.length, node; i2 < n2; ++i2) {
19723         if (node = group[i2])
19724           callback.call(node, node.__data__, i2, group);
19725       }
19726     }
19727     return this;
19728   }
19729
19730   // node_modules/d3-selection/src/selection/attr.js
19731   function attrRemove(name) {
19732     return function() {
19733       this.removeAttribute(name);
19734     };
19735   }
19736   function attrRemoveNS(fullname) {
19737     return function() {
19738       this.removeAttributeNS(fullname.space, fullname.local);
19739     };
19740   }
19741   function attrConstant(name, value) {
19742     return function() {
19743       this.setAttribute(name, value);
19744     };
19745   }
19746   function attrConstantNS(fullname, value) {
19747     return function() {
19748       this.setAttributeNS(fullname.space, fullname.local, value);
19749     };
19750   }
19751   function attrFunction(name, value) {
19752     return function() {
19753       var v = value.apply(this, arguments);
19754       if (v == null)
19755         this.removeAttribute(name);
19756       else
19757         this.setAttribute(name, v);
19758     };
19759   }
19760   function attrFunctionNS(fullname, value) {
19761     return function() {
19762       var v = value.apply(this, arguments);
19763       if (v == null)
19764         this.removeAttributeNS(fullname.space, fullname.local);
19765       else
19766         this.setAttributeNS(fullname.space, fullname.local, v);
19767     };
19768   }
19769   function attr_default(name, value) {
19770     var fullname = namespace_default(name);
19771     if (arguments.length < 2) {
19772       var node = this.node();
19773       return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname);
19774     }
19775     return this.each((value == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value));
19776   }
19777
19778   // node_modules/d3-selection/src/window.js
19779   function window_default(node) {
19780     return node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView;
19781   }
19782
19783   // node_modules/d3-selection/src/selection/style.js
19784   function styleRemove(name) {
19785     return function() {
19786       this.style.removeProperty(name);
19787     };
19788   }
19789   function styleConstant(name, value, priority) {
19790     return function() {
19791       this.style.setProperty(name, value, priority);
19792     };
19793   }
19794   function styleFunction(name, value, priority) {
19795     return function() {
19796       var v = value.apply(this, arguments);
19797       if (v == null)
19798         this.style.removeProperty(name);
19799       else
19800         this.style.setProperty(name, v, priority);
19801     };
19802   }
19803   function style_default(name, value, priority) {
19804     return arguments.length > 1 ? this.each((value == null ? styleRemove : typeof value === "function" ? styleFunction : styleConstant)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name);
19805   }
19806   function styleValue(node, name) {
19807     return node.style.getPropertyValue(name) || window_default(node).getComputedStyle(node, null).getPropertyValue(name);
19808   }
19809
19810   // node_modules/d3-selection/src/selection/property.js
19811   function propertyRemove(name) {
19812     return function() {
19813       delete this[name];
19814     };
19815   }
19816   function propertyConstant(name, value) {
19817     return function() {
19818       this[name] = value;
19819     };
19820   }
19821   function propertyFunction(name, value) {
19822     return function() {
19823       var v = value.apply(this, arguments);
19824       if (v == null)
19825         delete this[name];
19826       else
19827         this[name] = v;
19828     };
19829   }
19830   function property_default(name, value) {
19831     return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name];
19832   }
19833
19834   // node_modules/d3-selection/src/selection/classed.js
19835   function classArray(string) {
19836     return string.trim().split(/^|\s+/);
19837   }
19838   function classList(node) {
19839     return node.classList || new ClassList(node);
19840   }
19841   function ClassList(node) {
19842     this._node = node;
19843     this._names = classArray(node.getAttribute("class") || "");
19844   }
19845   ClassList.prototype = {
19846     add: function(name) {
19847       var i2 = this._names.indexOf(name);
19848       if (i2 < 0) {
19849         this._names.push(name);
19850         this._node.setAttribute("class", this._names.join(" "));
19851       }
19852     },
19853     remove: function(name) {
19854       var i2 = this._names.indexOf(name);
19855       if (i2 >= 0) {
19856         this._names.splice(i2, 1);
19857         this._node.setAttribute("class", this._names.join(" "));
19858       }
19859     },
19860     contains: function(name) {
19861       return this._names.indexOf(name) >= 0;
19862     }
19863   };
19864   function classedAdd(node, names) {
19865     var list = classList(node), i2 = -1, n2 = names.length;
19866     while (++i2 < n2)
19867       list.add(names[i2]);
19868   }
19869   function classedRemove(node, names) {
19870     var list = classList(node), i2 = -1, n2 = names.length;
19871     while (++i2 < n2)
19872       list.remove(names[i2]);
19873   }
19874   function classedTrue(names) {
19875     return function() {
19876       classedAdd(this, names);
19877     };
19878   }
19879   function classedFalse(names) {
19880     return function() {
19881       classedRemove(this, names);
19882     };
19883   }
19884   function classedFunction(names, value) {
19885     return function() {
19886       (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
19887     };
19888   }
19889   function classed_default(name, value) {
19890     var names = classArray(name + "");
19891     if (arguments.length < 2) {
19892       var list = classList(this.node()), i2 = -1, n2 = names.length;
19893       while (++i2 < n2)
19894         if (!list.contains(names[i2]))
19895           return false;
19896       return true;
19897     }
19898     return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value));
19899   }
19900
19901   // node_modules/d3-selection/src/selection/text.js
19902   function textRemove() {
19903     this.textContent = "";
19904   }
19905   function textConstant(value) {
19906     return function() {
19907       this.textContent = value;
19908     };
19909   }
19910   function textFunction(value) {
19911     return function() {
19912       var v = value.apply(this, arguments);
19913       this.textContent = v == null ? "" : v;
19914     };
19915   }
19916   function text_default(value) {
19917     return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent;
19918   }
19919
19920   // node_modules/d3-selection/src/selection/html.js
19921   function htmlRemove() {
19922     this.innerHTML = "";
19923   }
19924   function htmlConstant(value) {
19925     return function() {
19926       this.innerHTML = value;
19927     };
19928   }
19929   function htmlFunction(value) {
19930     return function() {
19931       var v = value.apply(this, arguments);
19932       this.innerHTML = v == null ? "" : v;
19933     };
19934   }
19935   function html_default(value) {
19936     return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML;
19937   }
19938
19939   // node_modules/d3-selection/src/selection/raise.js
19940   function raise() {
19941     if (this.nextSibling)
19942       this.parentNode.appendChild(this);
19943   }
19944   function raise_default() {
19945     return this.each(raise);
19946   }
19947
19948   // node_modules/d3-selection/src/selection/lower.js
19949   function lower() {
19950     if (this.previousSibling)
19951       this.parentNode.insertBefore(this, this.parentNode.firstChild);
19952   }
19953   function lower_default() {
19954     return this.each(lower);
19955   }
19956
19957   // node_modules/d3-selection/src/selection/append.js
19958   function append_default(name) {
19959     var create2 = typeof name === "function" ? name : creator_default(name);
19960     return this.select(function() {
19961       return this.appendChild(create2.apply(this, arguments));
19962     });
19963   }
19964
19965   // node_modules/d3-selection/src/selection/insert.js
19966   function constantNull() {
19967     return null;
19968   }
19969   function insert_default(name, before) {
19970     var create2 = typeof name === "function" ? name : creator_default(name), select = before == null ? constantNull : typeof before === "function" ? before : selector_default(before);
19971     return this.select(function() {
19972       return this.insertBefore(create2.apply(this, arguments), select.apply(this, arguments) || null);
19973     });
19974   }
19975
19976   // node_modules/d3-selection/src/selection/remove.js
19977   function remove() {
19978     var parent = this.parentNode;
19979     if (parent)
19980       parent.removeChild(this);
19981   }
19982   function remove_default() {
19983     return this.each(remove);
19984   }
19985
19986   // node_modules/d3-selection/src/selection/clone.js
19987   function selection_cloneShallow() {
19988     var clone = this.cloneNode(false), parent = this.parentNode;
19989     return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
19990   }
19991   function selection_cloneDeep() {
19992     var clone = this.cloneNode(true), parent = this.parentNode;
19993     return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
19994   }
19995   function clone_default(deep) {
19996     return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
19997   }
19998
19999   // node_modules/d3-selection/src/selection/datum.js
20000   function datum_default(value) {
20001     return arguments.length ? this.property("__data__", value) : this.node().__data__;
20002   }
20003
20004   // node_modules/d3-selection/src/selection/on.js
20005   function contextListener(listener) {
20006     return function(event) {
20007       listener.call(this, event, this.__data__);
20008     };
20009   }
20010   function parseTypenames2(typenames) {
20011     return typenames.trim().split(/^|\s+/).map(function(t) {
20012       var name = "", i2 = t.indexOf(".");
20013       if (i2 >= 0)
20014         name = t.slice(i2 + 1), t = t.slice(0, i2);
20015       return { type: t, name };
20016     });
20017   }
20018   function onRemove(typename) {
20019     return function() {
20020       var on = this.__on;
20021       if (!on)
20022         return;
20023       for (var j2 = 0, i2 = -1, m = on.length, o; j2 < m; ++j2) {
20024         if (o = on[j2], (!typename.type || o.type === typename.type) && o.name === typename.name) {
20025           this.removeEventListener(o.type, o.listener, o.options);
20026         } else {
20027           on[++i2] = o;
20028         }
20029       }
20030       if (++i2)
20031         on.length = i2;
20032       else
20033         delete this.__on;
20034     };
20035   }
20036   function onAdd(typename, value, options2) {
20037     return function() {
20038       var on = this.__on, o, listener = contextListener(value);
20039       if (on)
20040         for (var j2 = 0, m = on.length; j2 < m; ++j2) {
20041           if ((o = on[j2]).type === typename.type && o.name === typename.name) {
20042             this.removeEventListener(o.type, o.listener, o.options);
20043             this.addEventListener(o.type, o.listener = listener, o.options = options2);
20044             o.value = value;
20045             return;
20046           }
20047         }
20048       this.addEventListener(typename.type, listener, options2);
20049       o = { type: typename.type, name: typename.name, value, listener, options: options2 };
20050       if (!on)
20051         this.__on = [o];
20052       else
20053         on.push(o);
20054     };
20055   }
20056   function on_default(typename, value, options2) {
20057     var typenames = parseTypenames2(typename + ""), i2, n2 = typenames.length, t;
20058     if (arguments.length < 2) {
20059       var on = this.node().__on;
20060       if (on)
20061         for (var j2 = 0, m = on.length, o; j2 < m; ++j2) {
20062           for (i2 = 0, o = on[j2]; i2 < n2; ++i2) {
20063             if ((t = typenames[i2]).type === o.type && t.name === o.name) {
20064               return o.value;
20065             }
20066           }
20067         }
20068       return;
20069     }
20070     on = value ? onAdd : onRemove;
20071     for (i2 = 0; i2 < n2; ++i2)
20072       this.each(on(typenames[i2], value, options2));
20073     return this;
20074   }
20075
20076   // node_modules/d3-selection/src/selection/dispatch.js
20077   function dispatchEvent(node, type2, params) {
20078     var window2 = window_default(node), event = window2.CustomEvent;
20079     if (typeof event === "function") {
20080       event = new event(type2, params);
20081     } else {
20082       event = window2.document.createEvent("Event");
20083       if (params)
20084         event.initEvent(type2, params.bubbles, params.cancelable), event.detail = params.detail;
20085       else
20086         event.initEvent(type2, false, false);
20087     }
20088     node.dispatchEvent(event);
20089   }
20090   function dispatchConstant(type2, params) {
20091     return function() {
20092       return dispatchEvent(this, type2, params);
20093     };
20094   }
20095   function dispatchFunction(type2, params) {
20096     return function() {
20097       return dispatchEvent(this, type2, params.apply(this, arguments));
20098     };
20099   }
20100   function dispatch_default2(type2, params) {
20101     return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type2, params));
20102   }
20103
20104   // node_modules/d3-selection/src/selection/iterator.js
20105   function* iterator_default() {
20106     for (var groups = this._groups, j2 = 0, m = groups.length; j2 < m; ++j2) {
20107       for (var group = groups[j2], i2 = 0, n2 = group.length, node; i2 < n2; ++i2) {
20108         if (node = group[i2])
20109           yield node;
20110       }
20111     }
20112   }
20113
20114   // node_modules/d3-selection/src/selection/index.js
20115   var root = [null];
20116   function Selection(groups, parents) {
20117     this._groups = groups;
20118     this._parents = parents;
20119   }
20120   function selection() {
20121     return new Selection([[document.documentElement]], root);
20122   }
20123   function selection_selection() {
20124     return this;
20125   }
20126   Selection.prototype = selection.prototype = {
20127     constructor: Selection,
20128     select: select_default,
20129     selectAll: selectAll_default,
20130     selectChild: selectChild_default,
20131     selectChildren: selectChildren_default,
20132     filter: filter_default,
20133     data: data_default,
20134     enter: enter_default,
20135     exit: exit_default,
20136     join: join_default,
20137     merge: merge_default,
20138     selection: selection_selection,
20139     order: order_default,
20140     sort: sort_default,
20141     call: call_default,
20142     nodes: nodes_default,
20143     node: node_default,
20144     size: size_default,
20145     empty: empty_default,
20146     each: each_default,
20147     attr: attr_default,
20148     style: style_default,
20149     property: property_default,
20150     classed: classed_default,
20151     text: text_default,
20152     html: html_default,
20153     raise: raise_default,
20154     lower: lower_default,
20155     append: append_default,
20156     insert: insert_default,
20157     remove: remove_default,
20158     clone: clone_default,
20159     datum: datum_default,
20160     on: on_default,
20161     dispatch: dispatch_default2,
20162     [Symbol.iterator]: iterator_default
20163   };
20164   var selection_default = selection;
20165
20166   // node_modules/d3-selection/src/select.js
20167   function select_default2(selector) {
20168     return typeof selector === "string" ? new Selection([[document.querySelector(selector)]], [document.documentElement]) : new Selection([[selector]], root);
20169   }
20170
20171   // node_modules/d3-selection/src/sourceEvent.js
20172   function sourceEvent_default(event) {
20173     let sourceEvent;
20174     while (sourceEvent = event.sourceEvent)
20175       event = sourceEvent;
20176     return event;
20177   }
20178
20179   // node_modules/d3-selection/src/pointer.js
20180   function pointer_default(event, node) {
20181     event = sourceEvent_default(event);
20182     if (node === void 0)
20183       node = event.currentTarget;
20184     if (node) {
20185       var svg2 = node.ownerSVGElement || node;
20186       if (svg2.createSVGPoint) {
20187         var point2 = svg2.createSVGPoint();
20188         point2.x = event.clientX, point2.y = event.clientY;
20189         point2 = point2.matrixTransform(node.getScreenCTM().inverse());
20190         return [point2.x, point2.y];
20191       }
20192       if (node.getBoundingClientRect) {
20193         var rect = node.getBoundingClientRect();
20194         return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
20195       }
20196     }
20197     return [event.pageX, event.pageY];
20198   }
20199
20200   // node_modules/d3-selection/src/selectAll.js
20201   function selectAll_default2(selector) {
20202     return typeof selector === "string" ? new Selection([document.querySelectorAll(selector)], [document.documentElement]) : new Selection([array(selector)], root);
20203   }
20204
20205   // node_modules/d3-drag/src/noevent.js
20206   var nonpassive = { passive: false };
20207   var nonpassivecapture = { capture: true, passive: false };
20208   function nopropagation(event) {
20209     event.stopImmediatePropagation();
20210   }
20211   function noevent_default(event) {
20212     event.preventDefault();
20213     event.stopImmediatePropagation();
20214   }
20215
20216   // node_modules/d3-drag/src/nodrag.js
20217   function nodrag_default(view) {
20218     var root3 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", noevent_default, nonpassivecapture);
20219     if ("onselectstart" in root3) {
20220       selection2.on("selectstart.drag", noevent_default, nonpassivecapture);
20221     } else {
20222       root3.__noselect = root3.style.MozUserSelect;
20223       root3.style.MozUserSelect = "none";
20224     }
20225   }
20226   function yesdrag(view, noclick) {
20227     var root3 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", null);
20228     if (noclick) {
20229       selection2.on("click.drag", noevent_default, nonpassivecapture);
20230       setTimeout(function() {
20231         selection2.on("click.drag", null);
20232       }, 0);
20233     }
20234     if ("onselectstart" in root3) {
20235       selection2.on("selectstart.drag", null);
20236     } else {
20237       root3.style.MozUserSelect = root3.__noselect;
20238       delete root3.__noselect;
20239     }
20240   }
20241
20242   // node_modules/d3-drag/src/constant.js
20243   var constant_default2 = (x) => () => x;
20244
20245   // node_modules/d3-drag/src/event.js
20246   function DragEvent(type2, {
20247     sourceEvent,
20248     subject,
20249     target,
20250     identifier,
20251     active,
20252     x,
20253     y,
20254     dx,
20255     dy,
20256     dispatch: dispatch10
20257   }) {
20258     Object.defineProperties(this, {
20259       type: { value: type2, enumerable: true, configurable: true },
20260       sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
20261       subject: { value: subject, enumerable: true, configurable: true },
20262       target: { value: target, enumerable: true, configurable: true },
20263       identifier: { value: identifier, enumerable: true, configurable: true },
20264       active: { value: active, enumerable: true, configurable: true },
20265       x: { value: x, enumerable: true, configurable: true },
20266       y: { value: y, enumerable: true, configurable: true },
20267       dx: { value: dx, enumerable: true, configurable: true },
20268       dy: { value: dy, enumerable: true, configurable: true },
20269       _: { value: dispatch10 }
20270     });
20271   }
20272   DragEvent.prototype.on = function() {
20273     var value = this._.on.apply(this._, arguments);
20274     return value === this._ ? this : value;
20275   };
20276
20277   // node_modules/d3-drag/src/drag.js
20278   function defaultFilter(event) {
20279     return !event.ctrlKey && !event.button;
20280   }
20281   function defaultContainer() {
20282     return this.parentNode;
20283   }
20284   function defaultSubject(event, d) {
20285     return d == null ? { x: event.x, y: event.y } : d;
20286   }
20287   function defaultTouchable() {
20288     return navigator.maxTouchPoints || "ontouchstart" in this;
20289   }
20290   function drag_default() {
20291     var filter2 = defaultFilter, container = defaultContainer, subject = defaultSubject, touchable = defaultTouchable, gestures = {}, listeners = dispatch_default("start", "drag", "end"), active = 0, mousedownx, mousedowny, mousemoving, touchending, clickDistance2 = 0;
20292     function drag(selection2) {
20293       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)");
20294     }
20295     function mousedowned(event, d) {
20296       if (touchending || !filter2.call(this, event, d))
20297         return;
20298       var gesture = beforestart(this, container.call(this, event, d), event, d, "mouse");
20299       if (!gesture)
20300         return;
20301       select_default2(event.view).on("mousemove.drag", mousemoved, nonpassivecapture).on("mouseup.drag", mouseupped, nonpassivecapture);
20302       nodrag_default(event.view);
20303       nopropagation(event);
20304       mousemoving = false;
20305       mousedownx = event.clientX;
20306       mousedowny = event.clientY;
20307       gesture("start", event);
20308     }
20309     function mousemoved(event) {
20310       noevent_default(event);
20311       if (!mousemoving) {
20312         var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;
20313         mousemoving = dx * dx + dy * dy > clickDistance2;
20314       }
20315       gestures.mouse("drag", event);
20316     }
20317     function mouseupped(event) {
20318       select_default2(event.view).on("mousemove.drag mouseup.drag", null);
20319       yesdrag(event.view, mousemoving);
20320       noevent_default(event);
20321       gestures.mouse("end", event);
20322     }
20323     function touchstarted(event, d) {
20324       if (!filter2.call(this, event, d))
20325         return;
20326       var touches = event.changedTouches, c = container.call(this, event, d), n2 = touches.length, i2, gesture;
20327       for (i2 = 0; i2 < n2; ++i2) {
20328         if (gesture = beforestart(this, c, event, d, touches[i2].identifier, touches[i2])) {
20329           nopropagation(event);
20330           gesture("start", event, touches[i2]);
20331         }
20332       }
20333     }
20334     function touchmoved(event) {
20335       var touches = event.changedTouches, n2 = touches.length, i2, gesture;
20336       for (i2 = 0; i2 < n2; ++i2) {
20337         if (gesture = gestures[touches[i2].identifier]) {
20338           noevent_default(event);
20339           gesture("drag", event, touches[i2]);
20340         }
20341       }
20342     }
20343     function touchended(event) {
20344       var touches = event.changedTouches, n2 = touches.length, i2, gesture;
20345       if (touchending)
20346         clearTimeout(touchending);
20347       touchending = setTimeout(function() {
20348         touchending = null;
20349       }, 500);
20350       for (i2 = 0; i2 < n2; ++i2) {
20351         if (gesture = gestures[touches[i2].identifier]) {
20352           nopropagation(event);
20353           gesture("end", event, touches[i2]);
20354         }
20355       }
20356     }
20357     function beforestart(that, container2, event, d, identifier, touch) {
20358       var dispatch10 = listeners.copy(), p = pointer_default(touch || event, container2), dx, dy, s;
20359       if ((s = subject.call(that, new DragEvent("beforestart", {
20360         sourceEvent: event,
20361         target: drag,
20362         identifier,
20363         active,
20364         x: p[0],
20365         y: p[1],
20366         dx: 0,
20367         dy: 0,
20368         dispatch: dispatch10
20369       }), d)) == null)
20370         return;
20371       dx = s.x - p[0] || 0;
20372       dy = s.y - p[1] || 0;
20373       return function gesture(type2, event2, touch2) {
20374         var p02 = p, n2;
20375         switch (type2) {
20376           case "start":
20377             gestures[identifier] = gesture, n2 = active++;
20378             break;
20379           case "end":
20380             delete gestures[identifier], --active;
20381           case "drag":
20382             p = pointer_default(touch2 || event2, container2), n2 = active;
20383             break;
20384         }
20385         dispatch10.call(
20386           type2,
20387           that,
20388           new DragEvent(type2, {
20389             sourceEvent: event2,
20390             subject: s,
20391             target: drag,
20392             identifier,
20393             active: n2,
20394             x: p[0] + dx,
20395             y: p[1] + dy,
20396             dx: p[0] - p02[0],
20397             dy: p[1] - p02[1],
20398             dispatch: dispatch10
20399           }),
20400           d
20401         );
20402       };
20403     }
20404     drag.filter = function(_) {
20405       return arguments.length ? (filter2 = typeof _ === "function" ? _ : constant_default2(!!_), drag) : filter2;
20406     };
20407     drag.container = function(_) {
20408       return arguments.length ? (container = typeof _ === "function" ? _ : constant_default2(_), drag) : container;
20409     };
20410     drag.subject = function(_) {
20411       return arguments.length ? (subject = typeof _ === "function" ? _ : constant_default2(_), drag) : subject;
20412     };
20413     drag.touchable = function(_) {
20414       return arguments.length ? (touchable = typeof _ === "function" ? _ : constant_default2(!!_), drag) : touchable;
20415     };
20416     drag.on = function() {
20417       var value = listeners.on.apply(listeners, arguments);
20418       return value === listeners ? drag : value;
20419     };
20420     drag.clickDistance = function(_) {
20421       return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);
20422     };
20423     return drag;
20424   }
20425
20426   // node_modules/d3-color/src/define.js
20427   function define_default(constructor, factory, prototype) {
20428     constructor.prototype = factory.prototype = prototype;
20429     prototype.constructor = constructor;
20430   }
20431   function extend(parent, definition) {
20432     var prototype = Object.create(parent.prototype);
20433     for (var key in definition)
20434       prototype[key] = definition[key];
20435     return prototype;
20436   }
20437
20438   // node_modules/d3-color/src/color.js
20439   function Color() {
20440   }
20441   var darker = 0.7;
20442   var brighter = 1 / darker;
20443   var reI = "\\s*([+-]?\\d+)\\s*";
20444   var reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*";
20445   var reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
20446   var reHex = /^#([0-9a-f]{3,8})$/;
20447   var reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`);
20448   var reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`);
20449   var reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`);
20450   var reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`);
20451   var reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`);
20452   var reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
20453   var named = {
20454     aliceblue: 15792383,
20455     antiquewhite: 16444375,
20456     aqua: 65535,
20457     aquamarine: 8388564,
20458     azure: 15794175,
20459     beige: 16119260,
20460     bisque: 16770244,
20461     black: 0,
20462     blanchedalmond: 16772045,
20463     blue: 255,
20464     blueviolet: 9055202,
20465     brown: 10824234,
20466     burlywood: 14596231,
20467     cadetblue: 6266528,
20468     chartreuse: 8388352,
20469     chocolate: 13789470,
20470     coral: 16744272,
20471     cornflowerblue: 6591981,
20472     cornsilk: 16775388,
20473     crimson: 14423100,
20474     cyan: 65535,
20475     darkblue: 139,
20476     darkcyan: 35723,
20477     darkgoldenrod: 12092939,
20478     darkgray: 11119017,
20479     darkgreen: 25600,
20480     darkgrey: 11119017,
20481     darkkhaki: 12433259,
20482     darkmagenta: 9109643,
20483     darkolivegreen: 5597999,
20484     darkorange: 16747520,
20485     darkorchid: 10040012,
20486     darkred: 9109504,
20487     darksalmon: 15308410,
20488     darkseagreen: 9419919,
20489     darkslateblue: 4734347,
20490     darkslategray: 3100495,
20491     darkslategrey: 3100495,
20492     darkturquoise: 52945,
20493     darkviolet: 9699539,
20494     deeppink: 16716947,
20495     deepskyblue: 49151,
20496     dimgray: 6908265,
20497     dimgrey: 6908265,
20498     dodgerblue: 2003199,
20499     firebrick: 11674146,
20500     floralwhite: 16775920,
20501     forestgreen: 2263842,
20502     fuchsia: 16711935,
20503     gainsboro: 14474460,
20504     ghostwhite: 16316671,
20505     gold: 16766720,
20506     goldenrod: 14329120,
20507     gray: 8421504,
20508     green: 32768,
20509     greenyellow: 11403055,
20510     grey: 8421504,
20511     honeydew: 15794160,
20512     hotpink: 16738740,
20513     indianred: 13458524,
20514     indigo: 4915330,
20515     ivory: 16777200,
20516     khaki: 15787660,
20517     lavender: 15132410,
20518     lavenderblush: 16773365,
20519     lawngreen: 8190976,
20520     lemonchiffon: 16775885,
20521     lightblue: 11393254,
20522     lightcoral: 15761536,
20523     lightcyan: 14745599,
20524     lightgoldenrodyellow: 16448210,
20525     lightgray: 13882323,
20526     lightgreen: 9498256,
20527     lightgrey: 13882323,
20528     lightpink: 16758465,
20529     lightsalmon: 16752762,
20530     lightseagreen: 2142890,
20531     lightskyblue: 8900346,
20532     lightslategray: 7833753,
20533     lightslategrey: 7833753,
20534     lightsteelblue: 11584734,
20535     lightyellow: 16777184,
20536     lime: 65280,
20537     limegreen: 3329330,
20538     linen: 16445670,
20539     magenta: 16711935,
20540     maroon: 8388608,
20541     mediumaquamarine: 6737322,
20542     mediumblue: 205,
20543     mediumorchid: 12211667,
20544     mediumpurple: 9662683,
20545     mediumseagreen: 3978097,
20546     mediumslateblue: 8087790,
20547     mediumspringgreen: 64154,
20548     mediumturquoise: 4772300,
20549     mediumvioletred: 13047173,
20550     midnightblue: 1644912,
20551     mintcream: 16121850,
20552     mistyrose: 16770273,
20553     moccasin: 16770229,
20554     navajowhite: 16768685,
20555     navy: 128,
20556     oldlace: 16643558,
20557     olive: 8421376,
20558     olivedrab: 7048739,
20559     orange: 16753920,
20560     orangered: 16729344,
20561     orchid: 14315734,
20562     palegoldenrod: 15657130,
20563     palegreen: 10025880,
20564     paleturquoise: 11529966,
20565     palevioletred: 14381203,
20566     papayawhip: 16773077,
20567     peachpuff: 16767673,
20568     peru: 13468991,
20569     pink: 16761035,
20570     plum: 14524637,
20571     powderblue: 11591910,
20572     purple: 8388736,
20573     rebeccapurple: 6697881,
20574     red: 16711680,
20575     rosybrown: 12357519,
20576     royalblue: 4286945,
20577     saddlebrown: 9127187,
20578     salmon: 16416882,
20579     sandybrown: 16032864,
20580     seagreen: 3050327,
20581     seashell: 16774638,
20582     sienna: 10506797,
20583     silver: 12632256,
20584     skyblue: 8900331,
20585     slateblue: 6970061,
20586     slategray: 7372944,
20587     slategrey: 7372944,
20588     snow: 16775930,
20589     springgreen: 65407,
20590     steelblue: 4620980,
20591     tan: 13808780,
20592     teal: 32896,
20593     thistle: 14204888,
20594     tomato: 16737095,
20595     turquoise: 4251856,
20596     violet: 15631086,
20597     wheat: 16113331,
20598     white: 16777215,
20599     whitesmoke: 16119285,
20600     yellow: 16776960,
20601     yellowgreen: 10145074
20602   };
20603   define_default(Color, color, {
20604     copy(channels) {
20605       return Object.assign(new this.constructor(), this, channels);
20606     },
20607     displayable() {
20608       return this.rgb().displayable();
20609     },
20610     hex: color_formatHex,
20611     // Deprecated! Use color.formatHex.
20612     formatHex: color_formatHex,
20613     formatHex8: color_formatHex8,
20614     formatHsl: color_formatHsl,
20615     formatRgb: color_formatRgb,
20616     toString: color_formatRgb
20617   });
20618   function color_formatHex() {
20619     return this.rgb().formatHex();
20620   }
20621   function color_formatHex8() {
20622     return this.rgb().formatHex8();
20623   }
20624   function color_formatHsl() {
20625     return hslConvert(this).formatHsl();
20626   }
20627   function color_formatRgb() {
20628     return this.rgb().formatRgb();
20629   }
20630   function color(format2) {
20631     var m, l;
20632     format2 = (format2 + "").trim().toLowerCase();
20633     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;
20634   }
20635   function rgbn(n2) {
20636     return new Rgb(n2 >> 16 & 255, n2 >> 8 & 255, n2 & 255, 1);
20637   }
20638   function rgba(r, g, b, a) {
20639     if (a <= 0)
20640       r = g = b = NaN;
20641     return new Rgb(r, g, b, a);
20642   }
20643   function rgbConvert(o) {
20644     if (!(o instanceof Color))
20645       o = color(o);
20646     if (!o)
20647       return new Rgb();
20648     o = o.rgb();
20649     return new Rgb(o.r, o.g, o.b, o.opacity);
20650   }
20651   function rgb(r, g, b, opacity) {
20652     return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
20653   }
20654   function Rgb(r, g, b, opacity) {
20655     this.r = +r;
20656     this.g = +g;
20657     this.b = +b;
20658     this.opacity = +opacity;
20659   }
20660   define_default(Rgb, rgb, extend(Color, {
20661     brighter(k) {
20662       k = k == null ? brighter : Math.pow(brighter, k);
20663       return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
20664     },
20665     darker(k) {
20666       k = k == null ? darker : Math.pow(darker, k);
20667       return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
20668     },
20669     rgb() {
20670       return this;
20671     },
20672     clamp() {
20673       return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
20674     },
20675     displayable() {
20676       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);
20677     },
20678     hex: rgb_formatHex,
20679     // Deprecated! Use color.formatHex.
20680     formatHex: rgb_formatHex,
20681     formatHex8: rgb_formatHex8,
20682     formatRgb: rgb_formatRgb,
20683     toString: rgb_formatRgb
20684   }));
20685   function rgb_formatHex() {
20686     return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
20687   }
20688   function rgb_formatHex8() {
20689     return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
20690   }
20691   function rgb_formatRgb() {
20692     const a = clampa(this.opacity);
20693     return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
20694   }
20695   function clampa(opacity) {
20696     return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
20697   }
20698   function clampi(value) {
20699     return Math.max(0, Math.min(255, Math.round(value) || 0));
20700   }
20701   function hex(value) {
20702     value = clampi(value);
20703     return (value < 16 ? "0" : "") + value.toString(16);
20704   }
20705   function hsla(h, s, l, a) {
20706     if (a <= 0)
20707       h = s = l = NaN;
20708     else if (l <= 0 || l >= 1)
20709       h = s = NaN;
20710     else if (s <= 0)
20711       h = NaN;
20712     return new Hsl(h, s, l, a);
20713   }
20714   function hslConvert(o) {
20715     if (o instanceof Hsl)
20716       return new Hsl(o.h, o.s, o.l, o.opacity);
20717     if (!(o instanceof Color))
20718       o = color(o);
20719     if (!o)
20720       return new Hsl();
20721     if (o instanceof Hsl)
20722       return o;
20723     o = o.rgb();
20724     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;
20725     if (s) {
20726       if (r === max3)
20727         h = (g - b) / s + (g < b) * 6;
20728       else if (g === max3)
20729         h = (b - r) / s + 2;
20730       else
20731         h = (r - g) / s + 4;
20732       s /= l < 0.5 ? max3 + min3 : 2 - max3 - min3;
20733       h *= 60;
20734     } else {
20735       s = l > 0 && l < 1 ? 0 : h;
20736     }
20737     return new Hsl(h, s, l, o.opacity);
20738   }
20739   function hsl(h, s, l, opacity) {
20740     return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
20741   }
20742   function Hsl(h, s, l, opacity) {
20743     this.h = +h;
20744     this.s = +s;
20745     this.l = +l;
20746     this.opacity = +opacity;
20747   }
20748   define_default(Hsl, hsl, extend(Color, {
20749     brighter(k) {
20750       k = k == null ? brighter : Math.pow(brighter, k);
20751       return new Hsl(this.h, this.s, this.l * k, this.opacity);
20752     },
20753     darker(k) {
20754       k = k == null ? darker : Math.pow(darker, k);
20755       return new Hsl(this.h, this.s, this.l * k, this.opacity);
20756     },
20757     rgb() {
20758       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;
20759       return new Rgb(
20760         hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
20761         hsl2rgb(h, m1, m2),
20762         hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
20763         this.opacity
20764       );
20765     },
20766     clamp() {
20767       return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
20768     },
20769     displayable() {
20770       return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
20771     },
20772     formatHsl() {
20773       const a = clampa(this.opacity);
20774       return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
20775     }
20776   }));
20777   function clamph(value) {
20778     value = (value || 0) % 360;
20779     return value < 0 ? value + 360 : value;
20780   }
20781   function clampt(value) {
20782     return Math.max(0, Math.min(1, value || 0));
20783   }
20784   function hsl2rgb(h, m1, m2) {
20785     return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
20786   }
20787
20788   // node_modules/d3-interpolate/src/basis.js
20789   function basis(t1, v0, v1, v2, v3) {
20790     var t2 = t1 * t1, t3 = t2 * t1;
20791     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;
20792   }
20793   function basis_default(values) {
20794     var n2 = values.length - 1;
20795     return function(t) {
20796       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;
20797       return basis((t - i2 / n2) * n2, v0, v1, v2, v3);
20798     };
20799   }
20800
20801   // node_modules/d3-interpolate/src/basisClosed.js
20802   function basisClosed_default(values) {
20803     var n2 = values.length;
20804     return function(t) {
20805       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];
20806       return basis((t - i2 / n2) * n2, v0, v1, v2, v3);
20807     };
20808   }
20809
20810   // node_modules/d3-interpolate/src/constant.js
20811   var constant_default3 = (x) => () => x;
20812
20813   // node_modules/d3-interpolate/src/color.js
20814   function linear(a, d) {
20815     return function(t) {
20816       return a + t * d;
20817     };
20818   }
20819   function exponential(a, b, y) {
20820     return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
20821       return Math.pow(a + t * b, y);
20822     };
20823   }
20824   function gamma(y) {
20825     return (y = +y) === 1 ? nogamma : function(a, b) {
20826       return b - a ? exponential(a, b, y) : constant_default3(isNaN(a) ? b : a);
20827     };
20828   }
20829   function nogamma(a, b) {
20830     var d = b - a;
20831     return d ? linear(a, d) : constant_default3(isNaN(a) ? b : a);
20832   }
20833
20834   // node_modules/d3-interpolate/src/rgb.js
20835   var rgb_default = function rgbGamma(y) {
20836     var color2 = gamma(y);
20837     function rgb2(start2, end) {
20838       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);
20839       return function(t) {
20840         start2.r = r(t);
20841         start2.g = g(t);
20842         start2.b = b(t);
20843         start2.opacity = opacity(t);
20844         return start2 + "";
20845       };
20846     }
20847     rgb2.gamma = rgbGamma;
20848     return rgb2;
20849   }(1);
20850   function rgbSpline(spline) {
20851     return function(colors) {
20852       var n2 = colors.length, r = new Array(n2), g = new Array(n2), b = new Array(n2), i2, color2;
20853       for (i2 = 0; i2 < n2; ++i2) {
20854         color2 = rgb(colors[i2]);
20855         r[i2] = color2.r || 0;
20856         g[i2] = color2.g || 0;
20857         b[i2] = color2.b || 0;
20858       }
20859       r = spline(r);
20860       g = spline(g);
20861       b = spline(b);
20862       color2.opacity = 1;
20863       return function(t) {
20864         color2.r = r(t);
20865         color2.g = g(t);
20866         color2.b = b(t);
20867         return color2 + "";
20868       };
20869     };
20870   }
20871   var rgbBasis = rgbSpline(basis_default);
20872   var rgbBasisClosed = rgbSpline(basisClosed_default);
20873
20874   // node_modules/d3-interpolate/src/numberArray.js
20875   function numberArray_default(a, b) {
20876     if (!b)
20877       b = [];
20878     var n2 = a ? Math.min(b.length, a.length) : 0, c = b.slice(), i2;
20879     return function(t) {
20880       for (i2 = 0; i2 < n2; ++i2)
20881         c[i2] = a[i2] * (1 - t) + b[i2] * t;
20882       return c;
20883     };
20884   }
20885   function isNumberArray(x) {
20886     return ArrayBuffer.isView(x) && !(x instanceof DataView);
20887   }
20888
20889   // node_modules/d3-interpolate/src/array.js
20890   function genericArray(a, b) {
20891     var nb = b ? b.length : 0, na = a ? Math.min(nb, a.length) : 0, x = new Array(na), c = new Array(nb), i2;
20892     for (i2 = 0; i2 < na; ++i2)
20893       x[i2] = value_default(a[i2], b[i2]);
20894     for (; i2 < nb; ++i2)
20895       c[i2] = b[i2];
20896     return function(t) {
20897       for (i2 = 0; i2 < na; ++i2)
20898         c[i2] = x[i2](t);
20899       return c;
20900     };
20901   }
20902
20903   // node_modules/d3-interpolate/src/date.js
20904   function date_default(a, b) {
20905     var d = /* @__PURE__ */ new Date();
20906     return a = +a, b = +b, function(t) {
20907       return d.setTime(a * (1 - t) + b * t), d;
20908     };
20909   }
20910
20911   // node_modules/d3-interpolate/src/number.js
20912   function number_default(a, b) {
20913     return a = +a, b = +b, function(t) {
20914       return a * (1 - t) + b * t;
20915     };
20916   }
20917
20918   // node_modules/d3-interpolate/src/object.js
20919   function object_default(a, b) {
20920     var i2 = {}, c = {}, k;
20921     if (a === null || typeof a !== "object")
20922       a = {};
20923     if (b === null || typeof b !== "object")
20924       b = {};
20925     for (k in b) {
20926       if (k in a) {
20927         i2[k] = value_default(a[k], b[k]);
20928       } else {
20929         c[k] = b[k];
20930       }
20931     }
20932     return function(t) {
20933       for (k in i2)
20934         c[k] = i2[k](t);
20935       return c;
20936     };
20937   }
20938
20939   // node_modules/d3-interpolate/src/string.js
20940   var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
20941   var reB = new RegExp(reA.source, "g");
20942   function zero2(b) {
20943     return function() {
20944       return b;
20945     };
20946   }
20947   function one(b) {
20948     return function(t) {
20949       return b(t) + "";
20950     };
20951   }
20952   function string_default(a, b) {
20953     var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i2 = -1, s = [], q = [];
20954     a = a + "", b = b + "";
20955     while ((am = reA.exec(a)) && (bm = reB.exec(b))) {
20956       if ((bs = bm.index) > bi) {
20957         bs = b.slice(bi, bs);
20958         if (s[i2])
20959           s[i2] += bs;
20960         else
20961           s[++i2] = bs;
20962       }
20963       if ((am = am[0]) === (bm = bm[0])) {
20964         if (s[i2])
20965           s[i2] += bm;
20966         else
20967           s[++i2] = bm;
20968       } else {
20969         s[++i2] = null;
20970         q.push({ i: i2, x: number_default(am, bm) });
20971       }
20972       bi = reB.lastIndex;
20973     }
20974     if (bi < b.length) {
20975       bs = b.slice(bi);
20976       if (s[i2])
20977         s[i2] += bs;
20978       else
20979         s[++i2] = bs;
20980     }
20981     return s.length < 2 ? q[0] ? one(q[0].x) : zero2(b) : (b = q.length, function(t) {
20982       for (var i3 = 0, o; i3 < b; ++i3)
20983         s[(o = q[i3]).i] = o.x(t);
20984       return s.join("");
20985     });
20986   }
20987
20988   // node_modules/d3-interpolate/src/value.js
20989   function value_default(a, b) {
20990     var t = typeof b, c;
20991     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);
20992   }
20993
20994   // node_modules/d3-interpolate/src/round.js
20995   function round_default(a, b) {
20996     return a = +a, b = +b, function(t) {
20997       return Math.round(a * (1 - t) + b * t);
20998     };
20999   }
21000
21001   // node_modules/d3-interpolate/src/transform/decompose.js
21002   var degrees2 = 180 / Math.PI;
21003   var identity = {
21004     translateX: 0,
21005     translateY: 0,
21006     rotate: 0,
21007     skewX: 0,
21008     scaleX: 1,
21009     scaleY: 1
21010   };
21011   function decompose_default(a, b, c, d, e, f2) {
21012     var scaleX, scaleY, skewX;
21013     if (scaleX = Math.sqrt(a * a + b * b))
21014       a /= scaleX, b /= scaleX;
21015     if (skewX = a * c + b * d)
21016       c -= a * skewX, d -= b * skewX;
21017     if (scaleY = Math.sqrt(c * c + d * d))
21018       c /= scaleY, d /= scaleY, skewX /= scaleY;
21019     if (a * d < b * c)
21020       a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
21021     return {
21022       translateX: e,
21023       translateY: f2,
21024       rotate: Math.atan2(b, a) * degrees2,
21025       skewX: Math.atan(skewX) * degrees2,
21026       scaleX,
21027       scaleY
21028     };
21029   }
21030
21031   // node_modules/d3-interpolate/src/transform/parse.js
21032   var svgNode;
21033   function parseCss(value) {
21034     const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
21035     return m.isIdentity ? identity : decompose_default(m.a, m.b, m.c, m.d, m.e, m.f);
21036   }
21037   function parseSvg(value) {
21038     if (value == null)
21039       return identity;
21040     if (!svgNode)
21041       svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
21042     svgNode.setAttribute("transform", value);
21043     if (!(value = svgNode.transform.baseVal.consolidate()))
21044       return identity;
21045     value = value.matrix;
21046     return decompose_default(value.a, value.b, value.c, value.d, value.e, value.f);
21047   }
21048
21049   // node_modules/d3-interpolate/src/transform/index.js
21050   function interpolateTransform(parse, pxComma, pxParen, degParen) {
21051     function pop(s) {
21052       return s.length ? s.pop() + " " : "";
21053     }
21054     function translate(xa, ya, xb, yb, s, q) {
21055       if (xa !== xb || ya !== yb) {
21056         var i2 = s.push("translate(", null, pxComma, null, pxParen);
21057         q.push({ i: i2 - 4, x: number_default(xa, xb) }, { i: i2 - 2, x: number_default(ya, yb) });
21058       } else if (xb || yb) {
21059         s.push("translate(" + xb + pxComma + yb + pxParen);
21060       }
21061     }
21062     function rotate(a, b, s, q) {
21063       if (a !== b) {
21064         if (a - b > 180)
21065           b += 360;
21066         else if (b - a > 180)
21067           a += 360;
21068         q.push({ i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: number_default(a, b) });
21069       } else if (b) {
21070         s.push(pop(s) + "rotate(" + b + degParen);
21071       }
21072     }
21073     function skewX(a, b, s, q) {
21074       if (a !== b) {
21075         q.push({ i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: number_default(a, b) });
21076       } else if (b) {
21077         s.push(pop(s) + "skewX(" + b + degParen);
21078       }
21079     }
21080     function scale(xa, ya, xb, yb, s, q) {
21081       if (xa !== xb || ya !== yb) {
21082         var i2 = s.push(pop(s) + "scale(", null, ",", null, ")");
21083         q.push({ i: i2 - 4, x: number_default(xa, xb) }, { i: i2 - 2, x: number_default(ya, yb) });
21084       } else if (xb !== 1 || yb !== 1) {
21085         s.push(pop(s) + "scale(" + xb + "," + yb + ")");
21086       }
21087     }
21088     return function(a, b) {
21089       var s = [], q = [];
21090       a = parse(a), b = parse(b);
21091       translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
21092       rotate(a.rotate, b.rotate, s, q);
21093       skewX(a.skewX, b.skewX, s, q);
21094       scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
21095       a = b = null;
21096       return function(t) {
21097         var i2 = -1, n2 = q.length, o;
21098         while (++i2 < n2)
21099           s[(o = q[i2]).i] = o.x(t);
21100         return s.join("");
21101       };
21102     };
21103   }
21104   var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
21105   var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
21106
21107   // node_modules/d3-interpolate/src/zoom.js
21108   var epsilon22 = 1e-12;
21109   function cosh(x) {
21110     return ((x = Math.exp(x)) + 1 / x) / 2;
21111   }
21112   function sinh(x) {
21113     return ((x = Math.exp(x)) - 1 / x) / 2;
21114   }
21115   function tanh(x) {
21116     return ((x = Math.exp(2 * x)) - 1) / (x + 1);
21117   }
21118   var zoom_default = function zoomRho(rho, rho2, rho4) {
21119     function zoom(p02, p1) {
21120       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;
21121       if (d2 < epsilon22) {
21122         S = Math.log(w1 / w0) / rho;
21123         i2 = function(t) {
21124           return [
21125             ux0 + t * dx,
21126             uy0 + t * dy,
21127             w0 * Math.exp(rho * t * S)
21128           ];
21129         };
21130       } else {
21131         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);
21132         S = (r1 - r0) / rho;
21133         i2 = function(t) {
21134           var s = t * S, coshr0 = cosh(r0), u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
21135           return [
21136             ux0 + u * dx,
21137             uy0 + u * dy,
21138             w0 * coshr0 / cosh(rho * s + r0)
21139           ];
21140         };
21141       }
21142       i2.duration = S * 1e3 * rho / Math.SQRT2;
21143       return i2;
21144     }
21145     zoom.rho = function(_) {
21146       var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2;
21147       return zoomRho(_1, _2, _4);
21148     };
21149     return zoom;
21150   }(Math.SQRT2, 2, 4);
21151
21152   // node_modules/d3-interpolate/src/quantize.js
21153   function quantize_default(interpolator, n2) {
21154     var samples = new Array(n2);
21155     for (var i2 = 0; i2 < n2; ++i2)
21156       samples[i2] = interpolator(i2 / (n2 - 1));
21157     return samples;
21158   }
21159
21160   // node_modules/d3-timer/src/timer.js
21161   var frame = 0;
21162   var timeout = 0;
21163   var interval = 0;
21164   var pokeDelay = 1e3;
21165   var taskHead;
21166   var taskTail;
21167   var clockLast = 0;
21168   var clockNow = 0;
21169   var clockSkew = 0;
21170   var clock = typeof performance === "object" && performance.now ? performance : Date;
21171   var setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f2) {
21172     setTimeout(f2, 17);
21173   };
21174   function now() {
21175     return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
21176   }
21177   function clearNow() {
21178     clockNow = 0;
21179   }
21180   function Timer() {
21181     this._call = this._time = this._next = null;
21182   }
21183   Timer.prototype = timer.prototype = {
21184     constructor: Timer,
21185     restart: function(callback, delay, time) {
21186       if (typeof callback !== "function")
21187         throw new TypeError("callback is not a function");
21188       time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
21189       if (!this._next && taskTail !== this) {
21190         if (taskTail)
21191           taskTail._next = this;
21192         else
21193           taskHead = this;
21194         taskTail = this;
21195       }
21196       this._call = callback;
21197       this._time = time;
21198       sleep();
21199     },
21200     stop: function() {
21201       if (this._call) {
21202         this._call = null;
21203         this._time = Infinity;
21204         sleep();
21205       }
21206     }
21207   };
21208   function timer(callback, delay, time) {
21209     var t = new Timer();
21210     t.restart(callback, delay, time);
21211     return t;
21212   }
21213   function timerFlush() {
21214     now();
21215     ++frame;
21216     var t = taskHead, e;
21217     while (t) {
21218       if ((e = clockNow - t._time) >= 0)
21219         t._call.call(void 0, e);
21220       t = t._next;
21221     }
21222     --frame;
21223   }
21224   function wake() {
21225     clockNow = (clockLast = clock.now()) + clockSkew;
21226     frame = timeout = 0;
21227     try {
21228       timerFlush();
21229     } finally {
21230       frame = 0;
21231       nap();
21232       clockNow = 0;
21233     }
21234   }
21235   function poke() {
21236     var now3 = clock.now(), delay = now3 - clockLast;
21237     if (delay > pokeDelay)
21238       clockSkew -= delay, clockLast = now3;
21239   }
21240   function nap() {
21241     var t0, t1 = taskHead, t2, time = Infinity;
21242     while (t1) {
21243       if (t1._call) {
21244         if (time > t1._time)
21245           time = t1._time;
21246         t0 = t1, t1 = t1._next;
21247       } else {
21248         t2 = t1._next, t1._next = null;
21249         t1 = t0 ? t0._next = t2 : taskHead = t2;
21250       }
21251     }
21252     taskTail = t0;
21253     sleep(time);
21254   }
21255   function sleep(time) {
21256     if (frame)
21257       return;
21258     if (timeout)
21259       timeout = clearTimeout(timeout);
21260     var delay = time - clockNow;
21261     if (delay > 24) {
21262       if (time < Infinity)
21263         timeout = setTimeout(wake, time - clock.now() - clockSkew);
21264       if (interval)
21265         interval = clearInterval(interval);
21266     } else {
21267       if (!interval)
21268         clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
21269       frame = 1, setFrame(wake);
21270     }
21271   }
21272
21273   // node_modules/d3-timer/src/timeout.js
21274   function timeout_default(callback, delay, time) {
21275     var t = new Timer();
21276     delay = delay == null ? 0 : +delay;
21277     t.restart((elapsed) => {
21278       t.stop();
21279       callback(elapsed + delay);
21280     }, delay, time);
21281     return t;
21282   }
21283
21284   // node_modules/d3-transition/src/transition/schedule.js
21285   var emptyOn = dispatch_default("start", "end", "cancel", "interrupt");
21286   var emptyTween = [];
21287   var CREATED = 0;
21288   var SCHEDULED = 1;
21289   var STARTING = 2;
21290   var STARTED = 3;
21291   var RUNNING = 4;
21292   var ENDING = 5;
21293   var ENDED = 6;
21294   function schedule_default(node, name, id2, index, group, timing) {
21295     var schedules = node.__transition;
21296     if (!schedules)
21297       node.__transition = {};
21298     else if (id2 in schedules)
21299       return;
21300     create(node, id2, {
21301       name,
21302       index,
21303       // For context during callback.
21304       group,
21305       // For context during callback.
21306       on: emptyOn,
21307       tween: emptyTween,
21308       time: timing.time,
21309       delay: timing.delay,
21310       duration: timing.duration,
21311       ease: timing.ease,
21312       timer: null,
21313       state: CREATED
21314     });
21315   }
21316   function init(node, id2) {
21317     var schedule = get2(node, id2);
21318     if (schedule.state > CREATED)
21319       throw new Error("too late; already scheduled");
21320     return schedule;
21321   }
21322   function set2(node, id2) {
21323     var schedule = get2(node, id2);
21324     if (schedule.state > STARTED)
21325       throw new Error("too late; already running");
21326     return schedule;
21327   }
21328   function get2(node, id2) {
21329     var schedule = node.__transition;
21330     if (!schedule || !(schedule = schedule[id2]))
21331       throw new Error("transition not found");
21332     return schedule;
21333   }
21334   function create(node, id2, self2) {
21335     var schedules = node.__transition, tween;
21336     schedules[id2] = self2;
21337     self2.timer = timer(schedule, 0, self2.time);
21338     function schedule(elapsed) {
21339       self2.state = SCHEDULED;
21340       self2.timer.restart(start2, self2.delay, self2.time);
21341       if (self2.delay <= elapsed)
21342         start2(elapsed - self2.delay);
21343     }
21344     function start2(elapsed) {
21345       var i2, j2, n2, o;
21346       if (self2.state !== SCHEDULED)
21347         return stop();
21348       for (i2 in schedules) {
21349         o = schedules[i2];
21350         if (o.name !== self2.name)
21351           continue;
21352         if (o.state === STARTED)
21353           return timeout_default(start2);
21354         if (o.state === RUNNING) {
21355           o.state = ENDED;
21356           o.timer.stop();
21357           o.on.call("interrupt", node, node.__data__, o.index, o.group);
21358           delete schedules[i2];
21359         } else if (+i2 < id2) {
21360           o.state = ENDED;
21361           o.timer.stop();
21362           o.on.call("cancel", node, node.__data__, o.index, o.group);
21363           delete schedules[i2];
21364         }
21365       }
21366       timeout_default(function() {
21367         if (self2.state === STARTED) {
21368           self2.state = RUNNING;
21369           self2.timer.restart(tick, self2.delay, self2.time);
21370           tick(elapsed);
21371         }
21372       });
21373       self2.state = STARTING;
21374       self2.on.call("start", node, node.__data__, self2.index, self2.group);
21375       if (self2.state !== STARTING)
21376         return;
21377       self2.state = STARTED;
21378       tween = new Array(n2 = self2.tween.length);
21379       for (i2 = 0, j2 = -1; i2 < n2; ++i2) {
21380         if (o = self2.tween[i2].value.call(node, node.__data__, self2.index, self2.group)) {
21381           tween[++j2] = o;
21382         }
21383       }
21384       tween.length = j2 + 1;
21385     }
21386     function tick(elapsed) {
21387       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;
21388       while (++i2 < n2) {
21389         tween[i2].call(node, t);
21390       }
21391       if (self2.state === ENDING) {
21392         self2.on.call("end", node, node.__data__, self2.index, self2.group);
21393         stop();
21394       }
21395     }
21396     function stop() {
21397       self2.state = ENDED;
21398       self2.timer.stop();
21399       delete schedules[id2];
21400       for (var i2 in schedules)
21401         return;
21402       delete node.__transition;
21403     }
21404   }
21405
21406   // node_modules/d3-transition/src/interrupt.js
21407   function interrupt_default(node, name) {
21408     var schedules = node.__transition, schedule, active, empty2 = true, i2;
21409     if (!schedules)
21410       return;
21411     name = name == null ? null : name + "";
21412     for (i2 in schedules) {
21413       if ((schedule = schedules[i2]).name !== name) {
21414         empty2 = false;
21415         continue;
21416       }
21417       active = schedule.state > STARTING && schedule.state < ENDING;
21418       schedule.state = ENDED;
21419       schedule.timer.stop();
21420       schedule.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule.index, schedule.group);
21421       delete schedules[i2];
21422     }
21423     if (empty2)
21424       delete node.__transition;
21425   }
21426
21427   // node_modules/d3-transition/src/selection/interrupt.js
21428   function interrupt_default2(name) {
21429     return this.each(function() {
21430       interrupt_default(this, name);
21431     });
21432   }
21433
21434   // node_modules/d3-transition/src/transition/tween.js
21435   function tweenRemove(id2, name) {
21436     var tween0, tween1;
21437     return function() {
21438       var schedule = set2(this, id2), tween = schedule.tween;
21439       if (tween !== tween0) {
21440         tween1 = tween0 = tween;
21441         for (var i2 = 0, n2 = tween1.length; i2 < n2; ++i2) {
21442           if (tween1[i2].name === name) {
21443             tween1 = tween1.slice();
21444             tween1.splice(i2, 1);
21445             break;
21446           }
21447         }
21448       }
21449       schedule.tween = tween1;
21450     };
21451   }
21452   function tweenFunction(id2, name, value) {
21453     var tween0, tween1;
21454     if (typeof value !== "function")
21455       throw new Error();
21456     return function() {
21457       var schedule = set2(this, id2), tween = schedule.tween;
21458       if (tween !== tween0) {
21459         tween1 = (tween0 = tween).slice();
21460         for (var t = { name, value }, i2 = 0, n2 = tween1.length; i2 < n2; ++i2) {
21461           if (tween1[i2].name === name) {
21462             tween1[i2] = t;
21463             break;
21464           }
21465         }
21466         if (i2 === n2)
21467           tween1.push(t);
21468       }
21469       schedule.tween = tween1;
21470     };
21471   }
21472   function tween_default(name, value) {
21473     var id2 = this._id;
21474     name += "";
21475     if (arguments.length < 2) {
21476       var tween = get2(this.node(), id2).tween;
21477       for (var i2 = 0, n2 = tween.length, t; i2 < n2; ++i2) {
21478         if ((t = tween[i2]).name === name) {
21479           return t.value;
21480         }
21481       }
21482       return null;
21483     }
21484     return this.each((value == null ? tweenRemove : tweenFunction)(id2, name, value));
21485   }
21486   function tweenValue(transition2, name, value) {
21487     var id2 = transition2._id;
21488     transition2.each(function() {
21489       var schedule = set2(this, id2);
21490       (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
21491     });
21492     return function(node) {
21493       return get2(node, id2).value[name];
21494     };
21495   }
21496
21497   // node_modules/d3-transition/src/transition/interpolate.js
21498   function interpolate_default(a, b) {
21499     var c;
21500     return (typeof b === "number" ? number_default : b instanceof color ? rgb_default : (c = color(b)) ? (b = c, rgb_default) : string_default)(a, b);
21501   }
21502
21503   // node_modules/d3-transition/src/transition/attr.js
21504   function attrRemove2(name) {
21505     return function() {
21506       this.removeAttribute(name);
21507     };
21508   }
21509   function attrRemoveNS2(fullname) {
21510     return function() {
21511       this.removeAttributeNS(fullname.space, fullname.local);
21512     };
21513   }
21514   function attrConstant2(name, interpolate, value1) {
21515     var string00, string1 = value1 + "", interpolate0;
21516     return function() {
21517       var string0 = this.getAttribute(name);
21518       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
21519     };
21520   }
21521   function attrConstantNS2(fullname, interpolate, value1) {
21522     var string00, string1 = value1 + "", interpolate0;
21523     return function() {
21524       var string0 = this.getAttributeNS(fullname.space, fullname.local);
21525       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
21526     };
21527   }
21528   function attrFunction2(name, interpolate, value) {
21529     var string00, string10, interpolate0;
21530     return function() {
21531       var string0, value1 = value(this), string1;
21532       if (value1 == null)
21533         return void this.removeAttribute(name);
21534       string0 = this.getAttribute(name);
21535       string1 = value1 + "";
21536       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
21537     };
21538   }
21539   function attrFunctionNS2(fullname, interpolate, value) {
21540     var string00, string10, interpolate0;
21541     return function() {
21542       var string0, value1 = value(this), string1;
21543       if (value1 == null)
21544         return void this.removeAttributeNS(fullname.space, fullname.local);
21545       string0 = this.getAttributeNS(fullname.space, fullname.local);
21546       string1 = value1 + "";
21547       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
21548     };
21549   }
21550   function attr_default2(name, value) {
21551     var fullname = namespace_default(name), i2 = fullname === "transform" ? interpolateTransformSvg : interpolate_default;
21552     return this.attrTween(name, typeof value === "function" ? (fullname.local ? attrFunctionNS2 : attrFunction2)(fullname, i2, tweenValue(this, "attr." + name, value)) : value == null ? (fullname.local ? attrRemoveNS2 : attrRemove2)(fullname) : (fullname.local ? attrConstantNS2 : attrConstant2)(fullname, i2, value));
21553   }
21554
21555   // node_modules/d3-transition/src/transition/attrTween.js
21556   function attrInterpolate(name, i2) {
21557     return function(t) {
21558       this.setAttribute(name, i2.call(this, t));
21559     };
21560   }
21561   function attrInterpolateNS(fullname, i2) {
21562     return function(t) {
21563       this.setAttributeNS(fullname.space, fullname.local, i2.call(this, t));
21564     };
21565   }
21566   function attrTweenNS(fullname, value) {
21567     var t0, i0;
21568     function tween() {
21569       var i2 = value.apply(this, arguments);
21570       if (i2 !== i0)
21571         t0 = (i0 = i2) && attrInterpolateNS(fullname, i2);
21572       return t0;
21573     }
21574     tween._value = value;
21575     return tween;
21576   }
21577   function attrTween(name, value) {
21578     var t0, i0;
21579     function tween() {
21580       var i2 = value.apply(this, arguments);
21581       if (i2 !== i0)
21582         t0 = (i0 = i2) && attrInterpolate(name, i2);
21583       return t0;
21584     }
21585     tween._value = value;
21586     return tween;
21587   }
21588   function attrTween_default(name, value) {
21589     var key = "attr." + name;
21590     if (arguments.length < 2)
21591       return (key = this.tween(key)) && key._value;
21592     if (value == null)
21593       return this.tween(key, null);
21594     if (typeof value !== "function")
21595       throw new Error();
21596     var fullname = namespace_default(name);
21597     return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
21598   }
21599
21600   // node_modules/d3-transition/src/transition/delay.js
21601   function delayFunction(id2, value) {
21602     return function() {
21603       init(this, id2).delay = +value.apply(this, arguments);
21604     };
21605   }
21606   function delayConstant(id2, value) {
21607     return value = +value, function() {
21608       init(this, id2).delay = value;
21609     };
21610   }
21611   function delay_default(value) {
21612     var id2 = this._id;
21613     return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id2, value)) : get2(this.node(), id2).delay;
21614   }
21615
21616   // node_modules/d3-transition/src/transition/duration.js
21617   function durationFunction(id2, value) {
21618     return function() {
21619       set2(this, id2).duration = +value.apply(this, arguments);
21620     };
21621   }
21622   function durationConstant(id2, value) {
21623     return value = +value, function() {
21624       set2(this, id2).duration = value;
21625     };
21626   }
21627   function duration_default(value) {
21628     var id2 = this._id;
21629     return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id2, value)) : get2(this.node(), id2).duration;
21630   }
21631
21632   // node_modules/d3-transition/src/transition/ease.js
21633   function easeConstant(id2, value) {
21634     if (typeof value !== "function")
21635       throw new Error();
21636     return function() {
21637       set2(this, id2).ease = value;
21638     };
21639   }
21640   function ease_default(value) {
21641     var id2 = this._id;
21642     return arguments.length ? this.each(easeConstant(id2, value)) : get2(this.node(), id2).ease;
21643   }
21644
21645   // node_modules/d3-transition/src/transition/easeVarying.js
21646   function easeVarying(id2, value) {
21647     return function() {
21648       var v = value.apply(this, arguments);
21649       if (typeof v !== "function")
21650         throw new Error();
21651       set2(this, id2).ease = v;
21652     };
21653   }
21654   function easeVarying_default(value) {
21655     if (typeof value !== "function")
21656       throw new Error();
21657     return this.each(easeVarying(this._id, value));
21658   }
21659
21660   // node_modules/d3-transition/src/transition/filter.js
21661   function filter_default2(match) {
21662     if (typeof match !== "function")
21663       match = matcher_default(match);
21664     for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
21665       for (var group = groups[j2], n2 = group.length, subgroup = subgroups[j2] = [], node, i2 = 0; i2 < n2; ++i2) {
21666         if ((node = group[i2]) && match.call(node, node.__data__, i2, group)) {
21667           subgroup.push(node);
21668         }
21669       }
21670     }
21671     return new Transition(subgroups, this._parents, this._name, this._id);
21672   }
21673
21674   // node_modules/d3-transition/src/transition/merge.js
21675   function merge_default2(transition2) {
21676     if (transition2._id !== this._id)
21677       throw new Error();
21678     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) {
21679       for (var group0 = groups0[j2], group1 = groups1[j2], n2 = group0.length, merge2 = merges[j2] = new Array(n2), node, i2 = 0; i2 < n2; ++i2) {
21680         if (node = group0[i2] || group1[i2]) {
21681           merge2[i2] = node;
21682         }
21683       }
21684     }
21685     for (; j2 < m0; ++j2) {
21686       merges[j2] = groups0[j2];
21687     }
21688     return new Transition(merges, this._parents, this._name, this._id);
21689   }
21690
21691   // node_modules/d3-transition/src/transition/on.js
21692   function start(name) {
21693     return (name + "").trim().split(/^|\s+/).every(function(t) {
21694       var i2 = t.indexOf(".");
21695       if (i2 >= 0)
21696         t = t.slice(0, i2);
21697       return !t || t === "start";
21698     });
21699   }
21700   function onFunction(id2, name, listener) {
21701     var on0, on1, sit = start(name) ? init : set2;
21702     return function() {
21703       var schedule = sit(this, id2), on = schedule.on;
21704       if (on !== on0)
21705         (on1 = (on0 = on).copy()).on(name, listener);
21706       schedule.on = on1;
21707     };
21708   }
21709   function on_default2(name, listener) {
21710     var id2 = this._id;
21711     return arguments.length < 2 ? get2(this.node(), id2).on.on(name) : this.each(onFunction(id2, name, listener));
21712   }
21713
21714   // node_modules/d3-transition/src/transition/remove.js
21715   function removeFunction(id2) {
21716     return function() {
21717       var parent = this.parentNode;
21718       for (var i2 in this.__transition)
21719         if (+i2 !== id2)
21720           return;
21721       if (parent)
21722         parent.removeChild(this);
21723     };
21724   }
21725   function remove_default2() {
21726     return this.on("end.remove", removeFunction(this._id));
21727   }
21728
21729   // node_modules/d3-transition/src/transition/select.js
21730   function select_default3(select) {
21731     var name = this._name, id2 = this._id;
21732     if (typeof select !== "function")
21733       select = selector_default(select);
21734     for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
21735       for (var group = groups[j2], n2 = group.length, subgroup = subgroups[j2] = new Array(n2), node, subnode, i2 = 0; i2 < n2; ++i2) {
21736         if ((node = group[i2]) && (subnode = select.call(node, node.__data__, i2, group))) {
21737           if ("__data__" in node)
21738             subnode.__data__ = node.__data__;
21739           subgroup[i2] = subnode;
21740           schedule_default(subgroup[i2], name, id2, i2, subgroup, get2(node, id2));
21741         }
21742       }
21743     }
21744     return new Transition(subgroups, this._parents, name, id2);
21745   }
21746
21747   // node_modules/d3-transition/src/transition/selectAll.js
21748   function selectAll_default3(select) {
21749     var name = this._name, id2 = this._id;
21750     if (typeof select !== "function")
21751       select = selectorAll_default(select);
21752     for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j2 = 0; j2 < m; ++j2) {
21753       for (var group = groups[j2], n2 = group.length, node, i2 = 0; i2 < n2; ++i2) {
21754         if (node = group[i2]) {
21755           for (var children2 = select.call(node, node.__data__, i2, group), child, inherit2 = get2(node, id2), k = 0, l = children2.length; k < l; ++k) {
21756             if (child = children2[k]) {
21757               schedule_default(child, name, id2, k, children2, inherit2);
21758             }
21759           }
21760           subgroups.push(children2);
21761           parents.push(node);
21762         }
21763       }
21764     }
21765     return new Transition(subgroups, parents, name, id2);
21766   }
21767
21768   // node_modules/d3-transition/src/transition/selection.js
21769   var Selection2 = selection_default.prototype.constructor;
21770   function selection_default2() {
21771     return new Selection2(this._groups, this._parents);
21772   }
21773
21774   // node_modules/d3-transition/src/transition/style.js
21775   function styleNull(name, interpolate) {
21776     var string00, string10, interpolate0;
21777     return function() {
21778       var string0 = styleValue(this, name), string1 = (this.style.removeProperty(name), styleValue(this, name));
21779       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : interpolate0 = interpolate(string00 = string0, string10 = string1);
21780     };
21781   }
21782   function styleRemove2(name) {
21783     return function() {
21784       this.style.removeProperty(name);
21785     };
21786   }
21787   function styleConstant2(name, interpolate, value1) {
21788     var string00, string1 = value1 + "", interpolate0;
21789     return function() {
21790       var string0 = styleValue(this, name);
21791       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
21792     };
21793   }
21794   function styleFunction2(name, interpolate, value) {
21795     var string00, string10, interpolate0;
21796     return function() {
21797       var string0 = styleValue(this, name), value1 = value(this), string1 = value1 + "";
21798       if (value1 == null)
21799         string1 = value1 = (this.style.removeProperty(name), styleValue(this, name));
21800       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
21801     };
21802   }
21803   function styleMaybeRemove(id2, name) {
21804     var on0, on1, listener0, key = "style." + name, event = "end." + key, remove2;
21805     return function() {
21806       var schedule = set2(this, id2), on = schedule.on, listener = schedule.value[key] == null ? remove2 || (remove2 = styleRemove2(name)) : void 0;
21807       if (on !== on0 || listener0 !== listener)
21808         (on1 = (on0 = on).copy()).on(event, listener0 = listener);
21809       schedule.on = on1;
21810     };
21811   }
21812   function style_default2(name, value, priority) {
21813     var i2 = (name += "") === "transform" ? interpolateTransformCss : interpolate_default;
21814     return value == null ? this.styleTween(name, styleNull(name, i2)).on("end.style." + name, styleRemove2(name)) : typeof value === "function" ? this.styleTween(name, styleFunction2(name, i2, tweenValue(this, "style." + name, value))).each(styleMaybeRemove(this._id, name)) : this.styleTween(name, styleConstant2(name, i2, value), priority).on("end.style." + name, null);
21815   }
21816
21817   // node_modules/d3-transition/src/transition/styleTween.js
21818   function styleInterpolate(name, i2, priority) {
21819     return function(t) {
21820       this.style.setProperty(name, i2.call(this, t), priority);
21821     };
21822   }
21823   function styleTween(name, value, priority) {
21824     var t, i0;
21825     function tween() {
21826       var i2 = value.apply(this, arguments);
21827       if (i2 !== i0)
21828         t = (i0 = i2) && styleInterpolate(name, i2, priority);
21829       return t;
21830     }
21831     tween._value = value;
21832     return tween;
21833   }
21834   function styleTween_default(name, value, priority) {
21835     var key = "style." + (name += "");
21836     if (arguments.length < 2)
21837       return (key = this.tween(key)) && key._value;
21838     if (value == null)
21839       return this.tween(key, null);
21840     if (typeof value !== "function")
21841       throw new Error();
21842     return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
21843   }
21844
21845   // node_modules/d3-transition/src/transition/text.js
21846   function textConstant2(value) {
21847     return function() {
21848       this.textContent = value;
21849     };
21850   }
21851   function textFunction2(value) {
21852     return function() {
21853       var value1 = value(this);
21854       this.textContent = value1 == null ? "" : value1;
21855     };
21856   }
21857   function text_default2(value) {
21858     return this.tween("text", typeof value === "function" ? textFunction2(tweenValue(this, "text", value)) : textConstant2(value == null ? "" : value + ""));
21859   }
21860
21861   // node_modules/d3-transition/src/transition/textTween.js
21862   function textInterpolate(i2) {
21863     return function(t) {
21864       this.textContent = i2.call(this, t);
21865     };
21866   }
21867   function textTween(value) {
21868     var t0, i0;
21869     function tween() {
21870       var i2 = value.apply(this, arguments);
21871       if (i2 !== i0)
21872         t0 = (i0 = i2) && textInterpolate(i2);
21873       return t0;
21874     }
21875     tween._value = value;
21876     return tween;
21877   }
21878   function textTween_default(value) {
21879     var key = "text";
21880     if (arguments.length < 1)
21881       return (key = this.tween(key)) && key._value;
21882     if (value == null)
21883       return this.tween(key, null);
21884     if (typeof value !== "function")
21885       throw new Error();
21886     return this.tween(key, textTween(value));
21887   }
21888
21889   // node_modules/d3-transition/src/transition/transition.js
21890   function transition_default() {
21891     var name = this._name, id0 = this._id, id1 = newId();
21892     for (var groups = this._groups, m = groups.length, j2 = 0; j2 < m; ++j2) {
21893       for (var group = groups[j2], n2 = group.length, node, i2 = 0; i2 < n2; ++i2) {
21894         if (node = group[i2]) {
21895           var inherit2 = get2(node, id0);
21896           schedule_default(node, name, id1, i2, group, {
21897             time: inherit2.time + inherit2.delay + inherit2.duration,
21898             delay: 0,
21899             duration: inherit2.duration,
21900             ease: inherit2.ease
21901           });
21902         }
21903       }
21904     }
21905     return new Transition(groups, this._parents, name, id1);
21906   }
21907
21908   // node_modules/d3-transition/src/transition/end.js
21909   function end_default() {
21910     var on0, on1, that = this, id2 = that._id, size = that.size();
21911     return new Promise(function(resolve, reject) {
21912       var cancel = { value: reject }, end = { value: function() {
21913         if (--size === 0)
21914           resolve();
21915       } };
21916       that.each(function() {
21917         var schedule = set2(this, id2), on = schedule.on;
21918         if (on !== on0) {
21919           on1 = (on0 = on).copy();
21920           on1._.cancel.push(cancel);
21921           on1._.interrupt.push(cancel);
21922           on1._.end.push(end);
21923         }
21924         schedule.on = on1;
21925       });
21926       if (size === 0)
21927         resolve();
21928     });
21929   }
21930
21931   // node_modules/d3-transition/src/transition/index.js
21932   var id = 0;
21933   function Transition(groups, parents, name, id2) {
21934     this._groups = groups;
21935     this._parents = parents;
21936     this._name = name;
21937     this._id = id2;
21938   }
21939   function transition(name) {
21940     return selection_default().transition(name);
21941   }
21942   function newId() {
21943     return ++id;
21944   }
21945   var selection_prototype = selection_default.prototype;
21946   Transition.prototype = transition.prototype = {
21947     constructor: Transition,
21948     select: select_default3,
21949     selectAll: selectAll_default3,
21950     selectChild: selection_prototype.selectChild,
21951     selectChildren: selection_prototype.selectChildren,
21952     filter: filter_default2,
21953     merge: merge_default2,
21954     selection: selection_default2,
21955     transition: transition_default,
21956     call: selection_prototype.call,
21957     nodes: selection_prototype.nodes,
21958     node: selection_prototype.node,
21959     size: selection_prototype.size,
21960     empty: selection_prototype.empty,
21961     each: selection_prototype.each,
21962     on: on_default2,
21963     attr: attr_default2,
21964     attrTween: attrTween_default,
21965     style: style_default2,
21966     styleTween: styleTween_default,
21967     text: text_default2,
21968     textTween: textTween_default,
21969     remove: remove_default2,
21970     tween: tween_default,
21971     delay: delay_default,
21972     duration: duration_default,
21973     ease: ease_default,
21974     easeVarying: easeVarying_default,
21975     end: end_default,
21976     [Symbol.iterator]: selection_prototype[Symbol.iterator]
21977   };
21978
21979   // node_modules/d3-ease/src/linear.js
21980   var linear2 = (t) => +t;
21981
21982   // node_modules/d3-ease/src/cubic.js
21983   function cubicInOut(t) {
21984     return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
21985   }
21986
21987   // node_modules/d3-transition/src/selection/transition.js
21988   var defaultTiming = {
21989     time: null,
21990     // Set on use.
21991     delay: 0,
21992     duration: 250,
21993     ease: cubicInOut
21994   };
21995   function inherit(node, id2) {
21996     var timing;
21997     while (!(timing = node.__transition) || !(timing = timing[id2])) {
21998       if (!(node = node.parentNode)) {
21999         throw new Error(`transition ${id2} not found`);
22000       }
22001     }
22002     return timing;
22003   }
22004   function transition_default2(name) {
22005     var id2, timing;
22006     if (name instanceof Transition) {
22007       id2 = name._id, name = name._name;
22008     } else {
22009       id2 = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
22010     }
22011     for (var groups = this._groups, m = groups.length, j2 = 0; j2 < m; ++j2) {
22012       for (var group = groups[j2], n2 = group.length, node, i2 = 0; i2 < n2; ++i2) {
22013         if (node = group[i2]) {
22014           schedule_default(node, name, id2, i2, group, timing || inherit(node, id2));
22015         }
22016       }
22017     }
22018     return new Transition(groups, this._parents, name, id2);
22019   }
22020
22021   // node_modules/d3-transition/src/selection/index.js
22022   selection_default.prototype.interrupt = interrupt_default2;
22023   selection_default.prototype.transition = transition_default2;
22024
22025   // node_modules/d3-zoom/src/constant.js
22026   var constant_default4 = (x) => () => x;
22027
22028   // node_modules/d3-zoom/src/event.js
22029   function ZoomEvent(type2, {
22030     sourceEvent,
22031     target,
22032     transform: transform2,
22033     dispatch: dispatch10
22034   }) {
22035     Object.defineProperties(this, {
22036       type: { value: type2, enumerable: true, configurable: true },
22037       sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
22038       target: { value: target, enumerable: true, configurable: true },
22039       transform: { value: transform2, enumerable: true, configurable: true },
22040       _: { value: dispatch10 }
22041     });
22042   }
22043
22044   // node_modules/d3-zoom/src/transform.js
22045   function Transform(k, x, y) {
22046     this.k = k;
22047     this.x = x;
22048     this.y = y;
22049   }
22050   Transform.prototype = {
22051     constructor: Transform,
22052     scale: function(k) {
22053       return k === 1 ? this : new Transform(this.k * k, this.x, this.y);
22054     },
22055     translate: function(x, y) {
22056       return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);
22057     },
22058     apply: function(point2) {
22059       return [point2[0] * this.k + this.x, point2[1] * this.k + this.y];
22060     },
22061     applyX: function(x) {
22062       return x * this.k + this.x;
22063     },
22064     applyY: function(y) {
22065       return y * this.k + this.y;
22066     },
22067     invert: function(location) {
22068       return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
22069     },
22070     invertX: function(x) {
22071       return (x - this.x) / this.k;
22072     },
22073     invertY: function(y) {
22074       return (y - this.y) / this.k;
22075     },
22076     rescaleX: function(x) {
22077       return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));
22078     },
22079     rescaleY: function(y) {
22080       return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));
22081     },
22082     toString: function() {
22083       return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
22084     }
22085   };
22086   var identity2 = new Transform(1, 0, 0);
22087   transform.prototype = Transform.prototype;
22088   function transform(node) {
22089     while (!node.__zoom)
22090       if (!(node = node.parentNode))
22091         return identity2;
22092     return node.__zoom;
22093   }
22094
22095   // node_modules/d3-zoom/src/noevent.js
22096   function nopropagation2(event) {
22097     event.stopImmediatePropagation();
22098   }
22099   function noevent_default2(event) {
22100     event.preventDefault();
22101     event.stopImmediatePropagation();
22102   }
22103
22104   // node_modules/d3-zoom/src/zoom.js
22105   function defaultFilter2(event) {
22106     return (!event.ctrlKey || event.type === "wheel") && !event.button;
22107   }
22108   function defaultExtent() {
22109     var e = this;
22110     if (e instanceof SVGElement) {
22111       e = e.ownerSVGElement || e;
22112       if (e.hasAttribute("viewBox")) {
22113         e = e.viewBox.baseVal;
22114         return [[e.x, e.y], [e.x + e.width, e.y + e.height]];
22115       }
22116       return [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]];
22117     }
22118     return [[0, 0], [e.clientWidth, e.clientHeight]];
22119   }
22120   function defaultTransform() {
22121     return this.__zoom || identity2;
22122   }
22123   function defaultWheelDelta(event) {
22124     return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 2e-3) * (event.ctrlKey ? 10 : 1);
22125   }
22126   function defaultTouchable2() {
22127     return navigator.maxTouchPoints || "ontouchstart" in this;
22128   }
22129   function defaultConstrain(transform2, extent, translateExtent) {
22130     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];
22131     return transform2.translate(
22132       dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
22133       dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
22134     );
22135   }
22136   function zoom_default2() {
22137     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;
22138     function zoom(selection2) {
22139       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)");
22140     }
22141     zoom.transform = function(collection, transform2, point2, event) {
22142       var selection2 = collection.selection ? collection.selection() : collection;
22143       selection2.property("__zoom", defaultTransform);
22144       if (collection !== selection2) {
22145         schedule(collection, transform2, point2, event);
22146       } else {
22147         selection2.interrupt().each(function() {
22148           gesture(this, arguments).event(event).start().zoom(null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end();
22149         });
22150       }
22151     };
22152     zoom.scaleBy = function(selection2, k, p, event) {
22153       zoom.scaleTo(selection2, function() {
22154         var k0 = this.__zoom.k, k1 = typeof k === "function" ? k.apply(this, arguments) : k;
22155         return k0 * k1;
22156       }, p, event);
22157     };
22158     zoom.scaleTo = function(selection2, k, p, event) {
22159       zoom.transform(selection2, function() {
22160         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;
22161         return constrain(translate(scale(t0, k1), p02, p1), e, translateExtent);
22162       }, p, event);
22163     };
22164     zoom.translateBy = function(selection2, x, y, event) {
22165       zoom.transform(selection2, function() {
22166         return constrain(this.__zoom.translate(
22167           typeof x === "function" ? x.apply(this, arguments) : x,
22168           typeof y === "function" ? y.apply(this, arguments) : y
22169         ), extent.apply(this, arguments), translateExtent);
22170       }, null, event);
22171     };
22172     zoom.translateTo = function(selection2, x, y, p, event) {
22173       zoom.transform(selection2, function() {
22174         var e = extent.apply(this, arguments), t = this.__zoom, p02 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p;
22175         return constrain(identity2.translate(p02[0], p02[1]).scale(t.k).translate(
22176           typeof x === "function" ? -x.apply(this, arguments) : -x,
22177           typeof y === "function" ? -y.apply(this, arguments) : -y
22178         ), e, translateExtent);
22179       }, p, event);
22180     };
22181     function scale(transform2, k) {
22182       k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));
22183       return k === transform2.k ? transform2 : new Transform(k, transform2.x, transform2.y);
22184     }
22185     function translate(transform2, p02, p1) {
22186       var x = p02[0] - p1[0] * transform2.k, y = p02[1] - p1[1] * transform2.k;
22187       return x === transform2.x && y === transform2.y ? transform2 : new Transform(transform2.k, x, y);
22188     }
22189     function centroid(extent2) {
22190       return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
22191     }
22192     function schedule(transition2, transform2, point2, event) {
22193       transition2.on("start.zoom", function() {
22194         gesture(this, arguments).event(event).start();
22195       }).on("interrupt.zoom end.zoom", function() {
22196         gesture(this, arguments).event(event).end();
22197       }).tween("zoom", function() {
22198         var that = this, args = arguments, g = gesture(that, args).event(event), e = extent.apply(that, args), p = point2 == null ? centroid(e) : typeof point2 === "function" ? point2.apply(that, args) : point2, 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));
22199         return function(t) {
22200           if (t === 1)
22201             t = b;
22202           else {
22203             var l = i2(t), k = w / l[2];
22204             t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k);
22205           }
22206           g.zoom(null, t);
22207         };
22208       });
22209     }
22210     function gesture(that, args, clean2) {
22211       return !clean2 && that.__zooming || new Gesture(that, args);
22212     }
22213     function Gesture(that, args) {
22214       this.that = that;
22215       this.args = args;
22216       this.active = 0;
22217       this.sourceEvent = null;
22218       this.extent = extent.apply(that, args);
22219       this.taps = 0;
22220     }
22221     Gesture.prototype = {
22222       event: function(event) {
22223         if (event)
22224           this.sourceEvent = event;
22225         return this;
22226       },
22227       start: function() {
22228         if (++this.active === 1) {
22229           this.that.__zooming = this;
22230           this.emit("start");
22231         }
22232         return this;
22233       },
22234       zoom: function(key, transform2) {
22235         if (this.mouse && key !== "mouse")
22236           this.mouse[1] = transform2.invert(this.mouse[0]);
22237         if (this.touch0 && key !== "touch")
22238           this.touch0[1] = transform2.invert(this.touch0[0]);
22239         if (this.touch1 && key !== "touch")
22240           this.touch1[1] = transform2.invert(this.touch1[0]);
22241         this.that.__zoom = transform2;
22242         this.emit("zoom");
22243         return this;
22244       },
22245       end: function() {
22246         if (--this.active === 0) {
22247           delete this.that.__zooming;
22248           this.emit("end");
22249         }
22250         return this;
22251       },
22252       emit: function(type2) {
22253         var d = select_default2(this.that).datum();
22254         listeners.call(
22255           type2,
22256           this.that,
22257           new ZoomEvent(type2, {
22258             sourceEvent: this.sourceEvent,
22259             target: zoom,
22260             type: type2,
22261             transform: this.that.__zoom,
22262             dispatch: listeners
22263           }),
22264           d
22265         );
22266       }
22267     };
22268     function wheeled(event, ...args) {
22269       if (!filter2.apply(this, arguments))
22270         return;
22271       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);
22272       if (g.wheel) {
22273         if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {
22274           g.mouse[1] = t.invert(g.mouse[0] = p);
22275         }
22276         clearTimeout(g.wheel);
22277       } else if (t.k === k)
22278         return;
22279       else {
22280         g.mouse = [p, t.invert(p)];
22281         interrupt_default(this);
22282         g.start();
22283       }
22284       noevent_default2(event);
22285       g.wheel = setTimeout(wheelidled, wheelDelay);
22286       g.zoom("mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
22287       function wheelidled() {
22288         g.wheel = null;
22289         g.end();
22290       }
22291     }
22292     function mousedowned(event, ...args) {
22293       if (touchending || !filter2.apply(this, arguments))
22294         return;
22295       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;
22296       nodrag_default(event.view);
22297       nopropagation2(event);
22298       g.mouse = [p, this.__zoom.invert(p)];
22299       interrupt_default(this);
22300       g.start();
22301       function mousemoved(event2) {
22302         noevent_default2(event2);
22303         if (!g.moved) {
22304           var dx = event2.clientX - x05, dy = event2.clientY - y05;
22305           g.moved = dx * dx + dy * dy > clickDistance2;
22306         }
22307         g.event(event2).zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] = pointer_default(event2, currentTarget), g.mouse[1]), g.extent, translateExtent));
22308       }
22309       function mouseupped(event2) {
22310         v.on("mousemove.zoom mouseup.zoom", null);
22311         yesdrag(event2.view, g.moved);
22312         noevent_default2(event2);
22313         g.event(event2).end();
22314       }
22315     }
22316     function dblclicked(event, ...args) {
22317       if (!filter2.apply(this, arguments))
22318         return;
22319       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);
22320       noevent_default2(event);
22321       if (duration > 0)
22322         select_default2(this).transition().duration(duration).call(schedule, t1, p02, event);
22323       else
22324         select_default2(this).call(zoom.transform, t1, p02, event);
22325     }
22326     function touchstarted(event, ...args) {
22327       if (!filter2.apply(this, arguments))
22328         return;
22329       var touches = event.touches, n2 = touches.length, g = gesture(this, args, event.changedTouches.length === n2).event(event), started, i2, t, p;
22330       nopropagation2(event);
22331       for (i2 = 0; i2 < n2; ++i2) {
22332         t = touches[i2], p = pointer_default(t, this);
22333         p = [p, this.__zoom.invert(p), t.identifier];
22334         if (!g.touch0)
22335           g.touch0 = p, started = true, g.taps = 1 + !!touchstarting;
22336         else if (!g.touch1 && g.touch0[2] !== p[2])
22337           g.touch1 = p, g.taps = 0;
22338       }
22339       if (touchstarting)
22340         touchstarting = clearTimeout(touchstarting);
22341       if (started) {
22342         if (g.taps < 2)
22343           touchfirst = p[0], touchstarting = setTimeout(function() {
22344             touchstarting = null;
22345           }, touchDelay);
22346         interrupt_default(this);
22347         g.start();
22348       }
22349     }
22350     function touchmoved(event, ...args) {
22351       if (!this.__zooming)
22352         return;
22353       var g = gesture(this, args).event(event), touches = event.changedTouches, n2 = touches.length, i2, t, p, l;
22354       noevent_default2(event);
22355       for (i2 = 0; i2 < n2; ++i2) {
22356         t = touches[i2], p = pointer_default(t, this);
22357         if (g.touch0 && g.touch0[2] === t.identifier)
22358           g.touch0[0] = p;
22359         else if (g.touch1 && g.touch1[2] === t.identifier)
22360           g.touch1[0] = p;
22361       }
22362       t = g.that.__zoom;
22363       if (g.touch1) {
22364         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;
22365         t = scale(t, Math.sqrt(dp / dl));
22366         p = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
22367         l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
22368       } else if (g.touch0)
22369         p = g.touch0[0], l = g.touch0[1];
22370       else
22371         return;
22372       g.zoom("touch", constrain(translate(t, p, l), g.extent, translateExtent));
22373     }
22374     function touchended(event, ...args) {
22375       if (!this.__zooming)
22376         return;
22377       var g = gesture(this, args).event(event), touches = event.changedTouches, n2 = touches.length, i2, t;
22378       nopropagation2(event);
22379       if (touchending)
22380         clearTimeout(touchending);
22381       touchending = setTimeout(function() {
22382         touchending = null;
22383       }, touchDelay);
22384       for (i2 = 0; i2 < n2; ++i2) {
22385         t = touches[i2];
22386         if (g.touch0 && g.touch0[2] === t.identifier)
22387           delete g.touch0;
22388         else if (g.touch1 && g.touch1[2] === t.identifier)
22389           delete g.touch1;
22390       }
22391       if (g.touch1 && !g.touch0)
22392         g.touch0 = g.touch1, delete g.touch1;
22393       if (g.touch0)
22394         g.touch0[1] = this.__zoom.invert(g.touch0[0]);
22395       else {
22396         g.end();
22397         if (g.taps === 2) {
22398           t = pointer_default(t, this);
22399           if (Math.hypot(touchfirst[0] - t[0], touchfirst[1] - t[1]) < tapDistance) {
22400             var p = select_default2(this).on("dblclick.zoom");
22401             if (p)
22402               p.apply(this, arguments);
22403           }
22404         }
22405       }
22406     }
22407     zoom.wheelDelta = function(_) {
22408       return arguments.length ? (wheelDelta = typeof _ === "function" ? _ : constant_default4(+_), zoom) : wheelDelta;
22409     };
22410     zoom.filter = function(_) {
22411       return arguments.length ? (filter2 = typeof _ === "function" ? _ : constant_default4(!!_), zoom) : filter2;
22412     };
22413     zoom.touchable = function(_) {
22414       return arguments.length ? (touchable = typeof _ === "function" ? _ : constant_default4(!!_), zoom) : touchable;
22415     };
22416     zoom.extent = function(_) {
22417       return arguments.length ? (extent = typeof _ === "function" ? _ : constant_default4([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
22418     };
22419     zoom.scaleExtent = function(_) {
22420       return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];
22421     };
22422     zoom.translateExtent = function(_) {
22423       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]]];
22424     };
22425     zoom.constrain = function(_) {
22426       return arguments.length ? (constrain = _, zoom) : constrain;
22427     };
22428     zoom.duration = function(_) {
22429       return arguments.length ? (duration = +_, zoom) : duration;
22430     };
22431     zoom.interpolate = function(_) {
22432       return arguments.length ? (interpolate = _, zoom) : interpolate;
22433     };
22434     zoom.on = function() {
22435       var value = listeners.on.apply(listeners, arguments);
22436       return value === listeners ? zoom : value;
22437     };
22438     zoom.clickDistance = function(_) {
22439       return arguments.length ? (clickDistance2 = (_ = +_) * _, zoom) : Math.sqrt(clickDistance2);
22440     };
22441     zoom.tapDistance = function(_) {
22442       return arguments.length ? (tapDistance = +_, zoom) : tapDistance;
22443     };
22444     return zoom;
22445   }
22446
22447   // modules/geo/raw_mercator.js
22448   function geoRawMercator() {
22449     var project = mercatorRaw;
22450     var k = 512 / Math.PI;
22451     var x = 0;
22452     var y = 0;
22453     var clipExtent = [[0, 0], [0, 0]];
22454     function projection2(point2) {
22455       point2 = project(point2[0] * Math.PI / 180, point2[1] * Math.PI / 180);
22456       return [point2[0] * k + x, y - point2[1] * k];
22457     }
22458     projection2.invert = function(point2) {
22459       point2 = project.invert((point2[0] - x) / k, (y - point2[1]) / k);
22460       return point2 && [point2[0] * 180 / Math.PI, point2[1] * 180 / Math.PI];
22461     };
22462     projection2.scale = function(_) {
22463       if (!arguments.length)
22464         return k;
22465       k = +_;
22466       return projection2;
22467     };
22468     projection2.translate = function(_) {
22469       if (!arguments.length)
22470         return [x, y];
22471       x = +_[0];
22472       y = +_[1];
22473       return projection2;
22474     };
22475     projection2.clipExtent = function(_) {
22476       if (!arguments.length)
22477         return clipExtent;
22478       clipExtent = _;
22479       return projection2;
22480     };
22481     projection2.transform = function(obj) {
22482       if (!arguments.length)
22483         return identity2.translate(x, y).scale(k);
22484       x = +obj.x;
22485       y = +obj.y;
22486       k = +obj.k;
22487       return projection2;
22488     };
22489     projection2.stream = transform_default({
22490       point: function(x2, y2) {
22491         var vec = projection2([x2, y2]);
22492         this.stream.point(vec[0], vec[1]);
22493       }
22494     }).stream;
22495     return projection2;
22496   }
22497
22498   // modules/geo/ortho.js
22499   function geoOrthoNormalizedDotProduct(a, b, origin) {
22500     if (geoVecEqual(origin, a) || geoVecEqual(origin, b)) {
22501       return 1;
22502     }
22503     return geoVecNormalizedDot(a, b, origin);
22504   }
22505   function geoOrthoFilterDotProduct(dotp, epsilon3, lowerThreshold, upperThreshold, allowStraightAngles) {
22506     var val = Math.abs(dotp);
22507     if (val < epsilon3) {
22508       return 0;
22509     } else if (allowStraightAngles && Math.abs(val - 1) < epsilon3) {
22510       return 0;
22511     } else if (val < lowerThreshold || val > upperThreshold) {
22512       return dotp;
22513     } else {
22514       return null;
22515     }
22516   }
22517   function geoOrthoCalcScore(points, isClosed, epsilon3, threshold) {
22518     var score = 0;
22519     var first = isClosed ? 0 : 1;
22520     var last = isClosed ? points.length : points.length - 1;
22521     var coords = points.map(function(p) {
22522       return p.coord;
22523     });
22524     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
22525     var upperThreshold = Math.cos(threshold * Math.PI / 180);
22526     for (var i2 = first; i2 < last; i2++) {
22527       var a = coords[(i2 - 1 + coords.length) % coords.length];
22528       var origin = coords[i2];
22529       var b = coords[(i2 + 1) % coords.length];
22530       var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a, b, origin), epsilon3, lowerThreshold, upperThreshold);
22531       if (dotp === null)
22532         continue;
22533       score = score + 2 * Math.min(Math.abs(dotp - 1), Math.min(Math.abs(dotp), Math.abs(dotp + 1)));
22534     }
22535     return score;
22536   }
22537   function geoOrthoMaxOffsetAngle(coords, isClosed, lessThan) {
22538     var max3 = -Infinity;
22539     var first = isClosed ? 0 : 1;
22540     var last = isClosed ? coords.length : coords.length - 1;
22541     for (var i2 = first; i2 < last; i2++) {
22542       var a = coords[(i2 - 1 + coords.length) % coords.length];
22543       var origin = coords[i2];
22544       var b = coords[(i2 + 1) % coords.length];
22545       var normalizedDotP = geoOrthoNormalizedDotProduct(a, b, origin);
22546       var angle2 = Math.acos(Math.abs(normalizedDotP)) * 180 / Math.PI;
22547       if (angle2 > 45)
22548         angle2 = 90 - angle2;
22549       if (angle2 >= lessThan)
22550         continue;
22551       if (angle2 > max3)
22552         max3 = angle2;
22553     }
22554     if (max3 === -Infinity)
22555       return null;
22556     return max3;
22557   }
22558   function geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles) {
22559     var score = null;
22560     var first = isClosed ? 0 : 1;
22561     var last = isClosed ? coords.length : coords.length - 1;
22562     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
22563     var upperThreshold = Math.cos(threshold * Math.PI / 180);
22564     for (var i2 = first; i2 < last; i2++) {
22565       var a = coords[(i2 - 1 + coords.length) % coords.length];
22566       var origin = coords[i2];
22567       var b = coords[(i2 + 1) % coords.length];
22568       var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a, b, origin), epsilon3, lowerThreshold, upperThreshold, allowStraightAngles);
22569       if (dotp === null)
22570         continue;
22571       if (Math.abs(dotp) > 0)
22572         return 1;
22573       score = 0;
22574     }
22575     return score;
22576   }
22577
22578   // modules/util/array.js
22579   function utilArrayIdentical(a, b) {
22580     if (a === b)
22581       return true;
22582     var i2 = a.length;
22583     if (i2 !== b.length)
22584       return false;
22585     while (i2--) {
22586       if (a[i2] !== b[i2])
22587         return false;
22588     }
22589     return true;
22590   }
22591   function utilArrayDifference(a, b) {
22592     var other = new Set(b);
22593     return Array.from(new Set(a)).filter(function(v) {
22594       return !other.has(v);
22595     });
22596   }
22597   function utilArrayIntersection(a, b) {
22598     var other = new Set(b);
22599     return Array.from(new Set(a)).filter(function(v) {
22600       return other.has(v);
22601     });
22602   }
22603   function utilArrayUnion(a, b) {
22604     var result = new Set(a);
22605     b.forEach(function(v) {
22606       result.add(v);
22607     });
22608     return Array.from(result);
22609   }
22610   function utilArrayUniq(a) {
22611     return Array.from(new Set(a));
22612   }
22613   function utilArrayChunk(a, chunkSize) {
22614     if (!chunkSize || chunkSize < 0)
22615       return [a.slice()];
22616     var result = new Array(Math.ceil(a.length / chunkSize));
22617     return Array.from(result, function(item, i2) {
22618       return a.slice(i2 * chunkSize, i2 * chunkSize + chunkSize);
22619     });
22620   }
22621   function utilArrayFlatten(a) {
22622     return a.reduce(function(acc, val) {
22623       return acc.concat(val);
22624     }, []);
22625   }
22626   function utilArrayGroupBy(a, key) {
22627     return a.reduce(function(acc, item) {
22628       var group = typeof key === "function" ? key(item) : item[key];
22629       (acc[group] = acc[group] || []).push(item);
22630       return acc;
22631     }, {});
22632   }
22633   function utilArrayUniqBy(a, key) {
22634     var seen = /* @__PURE__ */ new Set();
22635     return a.reduce(function(acc, item) {
22636       var val = typeof key === "function" ? key(item) : item[key];
22637       if (val && !seen.has(val)) {
22638         seen.add(val);
22639         acc.push(item);
22640       }
22641       return acc;
22642     }, []);
22643   }
22644
22645   // modules/util/util.js
22646   var import_diacritics = __toESM(require_diacritics());
22647
22648   // modules/util/svg_paths_rtl_fix.js
22649   var import_alif_toolkit = __toESM(require_lib());
22650   var rtlRegex = /[\u0590-\u05FF\u0600-\u06FF\u0750-\u07BF\u08A0–\u08BF]/;
22651   function fixRTLTextForSvg(inputText) {
22652     var ret = "", rtlBuffer = [];
22653     var arabicRegex = /[\u0600-\u06FF]/g;
22654     var arabicDiacritics = /[\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06ED]/g;
22655     var arabicMath = /[\u0660-\u066C\u06F0-\u06F9]+/g;
22656     var thaanaVowel = /[\u07A6-\u07B0]/;
22657     var hebrewSign = /[\u0591-\u05bd\u05bf\u05c1-\u05c5\u05c7]/;
22658     if (arabicRegex.test(inputText)) {
22659       inputText = (0, import_alif_toolkit.WordShaper)(inputText);
22660     }
22661     for (var n2 = 0; n2 < inputText.length; n2++) {
22662       var c = inputText[n2];
22663       if (arabicMath.test(c)) {
22664         ret += rtlBuffer.reverse().join("");
22665         rtlBuffer = [c];
22666       } else {
22667         if (rtlBuffer.length && arabicMath.test(rtlBuffer[rtlBuffer.length - 1])) {
22668           ret += rtlBuffer.reverse().join("");
22669           rtlBuffer = [];
22670         }
22671         if ((thaanaVowel.test(c) || hebrewSign.test(c) || arabicDiacritics.test(c)) && rtlBuffer.length) {
22672           rtlBuffer[rtlBuffer.length - 1] += c;
22673         } else if (rtlRegex.test(c) || c.charCodeAt(0) >= 64336 && c.charCodeAt(0) <= 65023 || c.charCodeAt(0) >= 65136 && c.charCodeAt(0) <= 65279) {
22674           rtlBuffer.push(c);
22675         } else if (c === " " && rtlBuffer.length) {
22676           rtlBuffer = [rtlBuffer.reverse().join("") + " "];
22677         } else {
22678           ret += rtlBuffer.reverse().join("") + c;
22679           rtlBuffer = [];
22680         }
22681       }
22682     }
22683     ret += rtlBuffer.reverse().join("");
22684     return ret;
22685   }
22686
22687   // modules/core/preferences.js
22688   var _storage;
22689   try {
22690     _storage = localStorage;
22691   } catch (e) {
22692   }
22693   _storage = _storage || (() => {
22694     let s = {};
22695     return {
22696       getItem: (k) => s[k],
22697       setItem: (k, v) => s[k] = v,
22698       removeItem: (k) => delete s[k]
22699     };
22700   })();
22701   var _listeners = {};
22702   function corePreferences(k, v) {
22703     try {
22704       if (v === void 0)
22705         return _storage.getItem(k);
22706       else if (v === null)
22707         _storage.removeItem(k);
22708       else
22709         _storage.setItem(k, v);
22710       if (_listeners[k]) {
22711         _listeners[k].forEach((handler) => handler(v));
22712       }
22713       return true;
22714     } catch (e) {
22715       if (typeof console !== "undefined") {
22716         console.error("localStorage quota exceeded");
22717       }
22718       return false;
22719     }
22720   }
22721   corePreferences.onChange = function(k, handler) {
22722     _listeners[k] = _listeners[k] || [];
22723     _listeners[k].push(handler);
22724   };
22725
22726   // modules/core/file_fetcher.js
22727   var import_vparse = __toESM(require_vparse());
22728
22729   // config/id.js
22730   var presetsCdnUrl = "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@{presets_version}/";
22731   var ociCdnUrl = "https://cdn.jsdelivr.net/npm/osm-community-index@{version}/";
22732   var wmfSitematrixCdnUrl = "https://cdn.jsdelivr.net/npm/wmf-sitematrix@{version}/";
22733   var nsiCdnUrl = "https://cdn.jsdelivr.net/npm/name-suggestion-index@{version}/";
22734   var defaultOsmApiConnections = {
22735     live: {
22736       url: "https://www.openstreetmap.org",
22737       client_id: "0tmNTmd0Jo1dQp4AUmMBLtGiD9YpMuXzHefitcuVStc",
22738       client_secret: "BTlNrNxIPitHdL4sP2clHw5KLoee9aKkA7dQbc0Bj7Q"
22739     },
22740     dev: {
22741       url: "https://api06.dev.openstreetmap.org",
22742       client_id: "Ee1wWJ6UlpERbF6BfTNOpwn0R8k_06mvMXdDUkeHMgw",
22743       client_secret: "OnfWFC-JkZNHyYdr_viNn_h_RTZXRslKcUxllOXqf5g"
22744     }
22745   };
22746   var osmApiConnections = [];
22747   if (false) {
22748     osmApiConnections.push({
22749       url: null,
22750       client_id: null,
22751       client_secret: null
22752     });
22753   } else if (false) {
22754     osmApiConnections.push(defaultOsmApiConnections[null]);
22755   } else {
22756     osmApiConnections.push(defaultOsmApiConnections.live);
22757     osmApiConnections.push(defaultOsmApiConnections.dev);
22758   }
22759   var taginfoApiUrl = "https://taginfo.openstreetmap.org/api/4/";
22760   var nominatimApiUrl = "https://nominatim.openstreetmap.org/";
22761
22762   // package.json
22763   var package_default = {
22764     name: "iD",
22765     version: "2.26.1",
22766     description: "A friendly editor for OpenStreetMap",
22767     main: "dist/iD.min.js",
22768     repository: "github:openstreetmap/iD",
22769     homepage: "https://github.com/openstreetmap/iD",
22770     bugs: "https://github.com/openstreetmap/iD/issues",
22771     keywords: [
22772       "editor",
22773       "openstreetmap"
22774     ],
22775     license: "ISC",
22776     scripts: {
22777       all: "run-s clean build dist",
22778       build: "run-s build:css build:data build:js",
22779       "build:css": "node scripts/build_css.js",
22780       "build:data": "shx mkdir -p dist/data && node scripts/build_data.js",
22781       "build:stats": "node config/esbuild.config.mjs --stats && esbuild-visualizer --metadata dist/esbuild.json --exclude *.png --filename docs/statistics.html && shx rm dist/esbuild.json",
22782       "build:js": "node config/esbuild.config.mjs",
22783       "build:js:watch": "node config/esbuild.config.mjs --watch",
22784       clean: "shx rm -f dist/esbuild.json dist/*.js dist/*.map dist/*.css dist/img/*.svg",
22785       dist: "run-p dist:**",
22786       "dist:mapillary": "shx mkdir -p dist/mapillary-js && shx cp -R node_modules/mapillary-js/dist/* dist/mapillary-js/",
22787       "dist:pannellum": "shx mkdir -p dist/pannellum-streetside && shx cp -R node_modules/pannellum/build/* dist/pannellum-streetside/",
22788       "dist:min": "node config/esbuild.config.min.mjs",
22789       "dist:svg:iD": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "iD-%s" --symbol-sprite dist/img/iD-sprite.svg "svg/iD-sprite/**/*.svg"',
22790       "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',
22791       "dist:svg:fa": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/fa-sprite.svg svg/fontawesome/*.svg",
22792       "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',
22793       "dist:svg:mapillary:signs": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/mapillary-sprite.svg node_modules/mapillary_sprite_source/package_signs/*.svg",
22794       "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",
22795       "dist:svg:roentgen": 'svg-sprite --shape-id-generator "roentgen-%s" --shape-dim-width 16 --shape-dim-height 16 --symbol --symbol-dest . --symbol-sprite dist/img/roentgen-sprite.svg svg/roentgen/*.svg',
22796       "dist:svg:temaki": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "temaki-%s" --symbol-sprite dist/img/temaki-sprite.svg node_modules/@rapideditor/temaki/icons/*.svg',
22797       imagery: "node scripts/update_imagery.js",
22798       lint: "eslint config scripts test/spec modules --ext js,mjs",
22799       "lint:fix": "eslint scripts test/spec modules --fix",
22800       start: "run-s start:watch",
22801       "start:single-build": "run-p build:js start:server",
22802       "start:watch": "run-p build:js:watch start:server",
22803       "start:server": "node scripts/server.js",
22804       test: "npm-run-all -s lint build test:spec",
22805       "test:spec": "karma start config/karma.conf.js",
22806       translations: "node scripts/update_locales.js"
22807     },
22808     dependencies: {
22809       "@rapideditor/country-coder": "~5.2.0",
22810       "@rapideditor/location-conflation": "~1.2.0",
22811       "@mapbox/geojson-area": "^0.2.2",
22812       "@mapbox/sexagesimal": "1.2.0",
22813       "@mapbox/vector-tile": "^1.3.1",
22814       "@tmcw/togeojson": "^5.6.2",
22815       "@turf/bbox": "^6.0.0",
22816       "@turf/bbox-clip": "^6.0.0",
22817       "abortcontroller-polyfill": "^1.7.5",
22818       "aes-js": "^3.1.2",
22819       "alif-toolkit": "^1.2.9",
22820       "core-js-bundle": "^3.31.1",
22821       diacritics: "1.3.0",
22822       "fast-deep-equal": "~3.1.1",
22823       "fast-json-stable-stringify": "2.1.0",
22824       "lodash-es": "~4.17.15",
22825       marked: "~5.1.1",
22826       "node-diff3": "~3.1.0",
22827       "osm-auth": "~2.1.0",
22828       pannellum: "2.5.6",
22829       pbf: "^3.2.1",
22830       "polygon-clipping": "~0.15.1",
22831       rbush: "3.0.1",
22832       "whatwg-fetch": "^3.4.1",
22833       "which-polygon": "2.2.1"
22834     },
22835     devDependencies: {
22836       "@fortawesome/fontawesome-svg-core": "~6.4.0",
22837       "@fortawesome/free-brands-svg-icons": "~6.4.0",
22838       "@fortawesome/free-regular-svg-icons": "~6.4.0",
22839       "@fortawesome/free-solid-svg-icons": "~6.4.0",
22840       "@rapideditor/temaki": "~5.4.0",
22841       "@mapbox/maki": "^8.0.1",
22842       "@openstreetmap/id-tagging-schema": "^6.3.0",
22843       "@transifex/api": "^5.4.0",
22844       autoprefixer: "^10.4.14",
22845       chai: "^4.3.7",
22846       chalk: "^4.1.2",
22847       "cldr-core": "^43.0.0",
22848       "cldr-localenames-full": "^43.1.0",
22849       "concat-files": "^0.1.1",
22850       d3: "~7.8.5",
22851       dotenv: "^16.3.1",
22852       "editor-layer-index": "github:osmlab/editor-layer-index#gh-pages",
22853       esbuild: "^0.18.11",
22854       "esbuild-visualizer": "^0.4.1",
22855       eslint: "^8.44.0",
22856       "fetch-mock": "^9.11.0",
22857       gaze: "^1.1.3",
22858       glob: "^10.3.3",
22859       happen: "^0.3.2",
22860       "js-yaml": "^4.0.0",
22861       "json-stringify-pretty-compact": "^3.0.0",
22862       karma: "^6.4.2",
22863       "karma-chrome-launcher": "^3.2.0",
22864       "karma-coverage": "2.1.1",
22865       "karma-mocha": "^2.0.1",
22866       "karma-remap-istanbul": "^0.6.0",
22867       mapillary_sprite_source: "^1.8.0",
22868       "mapillary-js": "4.1.1",
22869       minimist: "^1.2.8",
22870       mocha: "^10.2.0",
22871       "name-suggestion-index": "~6.0",
22872       "node-fetch": "^2.6.11",
22873       "npm-run-all": "^4.0.0",
22874       "osm-community-index": "~5.5.3",
22875       postcss: "^8.4.25",
22876       "postcss-selector-prepend": "^0.5.0",
22877       shelljs: "^0.8.0",
22878       shx: "^0.3.0",
22879       sinon: "^11.1.2",
22880       "sinon-chai": "^3.7.0",
22881       smash: "0.0",
22882       "static-server": "^2.2.1",
22883       "svg-sprite": "2.0.2",
22884       vparse: "~1.1.0"
22885     },
22886     engines: {
22887       node: ">=16.14"
22888     },
22889     browserslist: [
22890       "> 0.2%, last 6 major versions, Firefox ESR, maintained node versions"
22891     ]
22892   };
22893
22894   // modules/core/file_fetcher.js
22895   var _mainFileFetcher = coreFileFetcher();
22896   function coreFileFetcher() {
22897     const ociVersion = package_default.dependencies["osm-community-index"] || package_default.devDependencies["osm-community-index"];
22898     const v = (0, import_vparse.default)(ociVersion);
22899     const ociVersionMinor = `${v.major}.${v.minor}`;
22900     const presetsVersion = package_default.devDependencies["@openstreetmap/id-tagging-schema"];
22901     let _this = {};
22902     let _inflight4 = {};
22903     let _fileMap = {
22904       "address_formats": "data/address_formats.min.json",
22905       "imagery": "data/imagery.min.json",
22906       "intro_graph": "data/intro_graph.min.json",
22907       "keepRight": "data/keepRight.min.json",
22908       "languages": "data/languages.min.json",
22909       "locales": "locales/index.min.json",
22910       "phone_formats": "data/phone_formats.min.json",
22911       "qa_data": "data/qa_data.min.json",
22912       "shortcuts": "data/shortcuts.min.json",
22913       "territory_languages": "data/territory_languages.min.json",
22914       "oci_defaults": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/defaults.min.json",
22915       "oci_features": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/featureCollection.min.json",
22916       "oci_resources": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/resources.min.json",
22917       "presets_package": presetsCdnUrl.replace("{presets_version}", presetsVersion) + "package.json",
22918       "deprecated": presetsCdnUrl + "dist/deprecated.min.json",
22919       "discarded": presetsCdnUrl + "dist/discarded.min.json",
22920       "preset_categories": presetsCdnUrl + "dist/preset_categories.min.json",
22921       "preset_defaults": presetsCdnUrl + "dist/preset_defaults.min.json",
22922       "preset_fields": presetsCdnUrl + "dist/fields.min.json",
22923       "preset_presets": presetsCdnUrl + "dist/presets.min.json",
22924       "wmf_sitematrix": wmfSitematrixCdnUrl.replace("{version}", "0.1") + "wikipedia.min.json"
22925     };
22926     let _cachedData = {};
22927     _this.cache = () => _cachedData;
22928     _this.get = (which) => {
22929       if (_cachedData[which]) {
22930         return Promise.resolve(_cachedData[which]);
22931       }
22932       const file = _fileMap[which];
22933       const url = file && _this.asset(file);
22934       if (!url) {
22935         return Promise.reject(`Unknown data file for "${which}"`);
22936       }
22937       if (url.includes("{presets_version}")) {
22938         return _this.get("presets_package").then((result) => {
22939           const presetsVersion2 = result.version;
22940           return getUrl(url.replace("{presets_version}", presetsVersion2), which);
22941         });
22942       } else {
22943         return getUrl(url);
22944       }
22945     };
22946     function getUrl(url, which) {
22947       let prom = _inflight4[url];
22948       if (!prom) {
22949         _inflight4[url] = prom = fetch(url).then((response) => {
22950           if (!response.ok || !response.json) {
22951             throw new Error(response.status + " " + response.statusText);
22952           }
22953           if (response.status === 204 || response.status === 205)
22954             return;
22955           return response.json();
22956         }).then((result) => {
22957           delete _inflight4[url];
22958           if (!result) {
22959             throw new Error(`No data loaded for "${which}"`);
22960           }
22961           _cachedData[which] = result;
22962           return result;
22963         }).catch((err) => {
22964           delete _inflight4[url];
22965           throw err;
22966         });
22967       }
22968       return prom;
22969     }
22970     _this.fileMap = function(val) {
22971       if (!arguments.length)
22972         return _fileMap;
22973       _fileMap = val;
22974       return _this;
22975     };
22976     let _assetPath = "";
22977     _this.assetPath = function(val) {
22978       if (!arguments.length)
22979         return _assetPath;
22980       _assetPath = val;
22981       return _this;
22982     };
22983     let _assetMap = {};
22984     _this.assetMap = function(val) {
22985       if (!arguments.length)
22986         return _assetMap;
22987       _assetMap = val;
22988       return _this;
22989     };
22990     _this.asset = (val) => {
22991       if (/^http(s)?:\/\//i.test(val))
22992         return val;
22993       const filename = _assetPath + val;
22994       return _assetMap[filename] || filename;
22995     };
22996     return _this;
22997   }
22998
22999   // node_modules/@rapideditor/country-coder/dist/country-coder.mjs
23000   var import_which_polygon = __toESM(require_which_polygon(), 1);
23001   var borders_default = { type: "FeatureCollection", features: [
23002     { 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]]]] } },
23003     { 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]]]] } },
23004     { 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]]]] } },
23005     { 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]]]] } },
23006     { 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]]]] } },
23007     { 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]]]] } },
23008     { 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]]]] } },
23009     { 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]]]] } },
23010     { 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]]]] } },
23011     { 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]]]] } },
23012     { 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]]]] } },
23013     { 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]]]] } },
23014     { 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]]]] } },
23015     { 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]]]] } },
23016     { 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]]]] } },
23017     { 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]]]] } },
23018     { 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]]]] } },
23019     { 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]]]] } },
23020     { 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]]]] } },
23021     { type: "Feature", properties: { wikidata: "Q12837", nameEn: "Iberia", level: "sharedLandform" }, geometry: null },
23022     { 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]]]] } },
23023     { 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]]]] } },
23024     { type: "Feature", properties: { wikidata: "Q22890", nameEn: "Ireland", level: "sharedLandform" }, geometry: null },
23025     { type: "Feature", properties: { wikidata: "Q23666", nameEn: "Great Britain", country: "GB", level: "sharedLandform" }, geometry: null },
23026     { 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]]]] } },
23027     { 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]]]] } },
23028     { 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]]]] } },
23029     { 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]]]] } },
23030     { 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]]]] } },
23031     { 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]]]] } },
23032     { 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]]]] } },
23033     { 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]]]] } },
23034     { 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]]]] } },
23035     { 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]]]] } },
23036     { 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]]]] } },
23037     { 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]]]] } },
23038     { type: "Feature", properties: { wikidata: "Q35657", nameEn: "US States", country: "US", level: "subcountryGroup" }, geometry: null },
23039     { type: "Feature", properties: { wikidata: "Q36117", nameEn: "Borneo", level: "sharedLandform" }, geometry: null },
23040     { 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]]]] } },
23041     { type: "Feature", properties: { wikidata: "Q37362", nameEn: "Akrotiri and Dhekelia", aliases: ["SBA"], country: "GB" }, geometry: null },
23042     { 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]]]] } },
23043     { 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]]]] } },
23044     { 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]]]] } },
23045     { 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]]]] } },
23046     { 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]]]] } },
23047     { 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]]]] } },
23048     { type: "Feature", properties: { wikidata: "Q46395", nameEn: "British Overseas Territories", aliases: ["BOTS", "UKOTS"], country: "GB", level: "subcountryGroup" }, geometry: null },
23049     { 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]]]] } },
23050     { 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]]]] } },
23051     { 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]]]] } },
23052     { 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]]]] } },
23053     { type: "Feature", properties: { wikidata: "Q105472", nameEn: "Macaronesia", level: "sharedLandform" }, geometry: null },
23054     { 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]]]] } },
23055     { 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]]]] } },
23056     { 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]]]] } },
23057     { 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]]]] } },
23058     { 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]]]] } },
23059     { 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]]]] } },
23060     { 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]]]] } },
23061     { 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]]]] } },
23062     { 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]]]] } },
23063     { 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]]]] } },
23064     { type: "Feature", properties: { wikidata: "Q153732", nameEn: "Mariana Islands", level: "sharedLandform" }, geometry: null },
23065     { 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]]]] } },
23066     { 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]]]] } },
23067     { type: "Feature", properties: { wikidata: "Q185086", nameEn: "Crown Dependencies", country: "GB", level: "subcountryGroup" }, geometry: null },
23068     { 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]]]] } },
23069     { type: "Feature", properties: { wikidata: "Q191011", nameEn: "Plazas de soberan\xEDa", country: "ES" }, geometry: null },
23070     { 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]]]] } },
23071     { 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]]]] } },
23072     { 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]]]] } },
23073     { 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]]]] } },
23074     { 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]]]] } },
23075     { type: "Feature", properties: { wikidata: "Q644636", nameEn: "Cyprus", level: "sharedLandform" }, geometry: null },
23076     { type: "Feature", properties: { wikidata: "Q851132", nameEn: "New Zealand Outlying Islands", country: "NZ", level: "subcountryGroup" }, geometry: null },
23077     { 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]]]] } },
23078     { 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]]]] } },
23079     { 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]]]] } },
23080     { 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]]]] } },
23081     { type: "Feature", properties: { wikidata: "Q1352230", nameEn: "US Territories", country: "US", level: "subcountryGroup" }, geometry: null },
23082     { type: "Feature", properties: { wikidata: "Q1451600", nameEn: "Overseas Countries and Territories of the EU", aliases: ["OCT"], level: "subunion" }, geometry: null },
23083     { 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]]]] } },
23084     { 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]]]] } },
23085     { 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]]]] } },
23086     { 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]]]] } },
23087     { 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]]]] } },
23088     { 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]]]] } },
23089     { 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]]]] } },
23090     { 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]]]] } },
23091     { type: "Feature", properties: { wikidata: "Q2914565", nameEn: "Autonomous Regions of Portugal", country: "PT", level: "subcountryGroup" }, geometry: null },
23092     { 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]]]] } },
23093     { 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]]]] } },
23094     { type: "Feature", properties: { wikidata: "Q3320166", nameEn: "Outermost Regions of the EU", aliases: ["OMR"], level: "subunion" }, geometry: null },
23095     { type: "Feature", properties: { wikidata: "Q3336843", nameEn: "Countries of the United Kingdom", aliases: ["GB-UKM"], country: "GB", level: "subcountryGroup" }, geometry: null },
23096     { 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]]]] } },
23097     { 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]]]] } },
23098     { 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]]]] } },
23099     { 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]]]] } },
23100     { 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]]]] } },
23101     { 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]]]] } },
23102     { type: "Feature", properties: { m49: "001", wikidata: "Q2", nameEn: "World", aliases: ["Earth", "Planet"], level: "world" }, geometry: null },
23103     { type: "Feature", properties: { m49: "002", wikidata: "Q15", nameEn: "Africa", level: "region" }, geometry: null },
23104     { type: "Feature", properties: { m49: "003", wikidata: "Q49", nameEn: "North America", level: "subregion" }, geometry: null },
23105     { type: "Feature", properties: { m49: "005", wikidata: "Q18", nameEn: "South America", level: "intermediateRegion" }, geometry: null },
23106     { type: "Feature", properties: { m49: "009", wikidata: "Q538", nameEn: "Oceania", level: "region" }, geometry: null },
23107     { type: "Feature", properties: { m49: "011", wikidata: "Q4412", nameEn: "Western Africa", level: "intermediateRegion" }, geometry: null },
23108     { type: "Feature", properties: { m49: "013", wikidata: "Q27611", nameEn: "Central America", level: "intermediateRegion" }, geometry: null },
23109     { type: "Feature", properties: { m49: "014", wikidata: "Q27407", nameEn: "Eastern Africa", level: "intermediateRegion" }, geometry: null },
23110     { type: "Feature", properties: { m49: "015", wikidata: "Q27381", nameEn: "Northern Africa", level: "subregion" }, geometry: null },
23111     { type: "Feature", properties: { m49: "017", wikidata: "Q27433", nameEn: "Middle Africa", level: "intermediateRegion" }, geometry: null },
23112     { type: "Feature", properties: { m49: "018", wikidata: "Q27394", nameEn: "Southern Africa", level: "intermediateRegion" }, geometry: null },
23113     { type: "Feature", properties: { m49: "019", wikidata: "Q828", nameEn: "Americas", level: "region" }, geometry: null },
23114     { type: "Feature", properties: { m49: "021", wikidata: "Q2017699", nameEn: "Northern America", level: "subregion" }, geometry: null },
23115     { type: "Feature", properties: { m49: "029", wikidata: "Q664609", nameEn: "Caribbean", level: "intermediateRegion" }, geometry: null },
23116     { type: "Feature", properties: { m49: "030", wikidata: "Q27231", nameEn: "Eastern Asia", level: "subregion" }, geometry: null },
23117     { type: "Feature", properties: { m49: "034", wikidata: "Q771405", nameEn: "Southern Asia", level: "subregion" }, geometry: null },
23118     { type: "Feature", properties: { m49: "035", wikidata: "Q11708", nameEn: "South-eastern Asia", level: "subregion" }, geometry: null },
23119     { type: "Feature", properties: { m49: "039", wikidata: "Q27449", nameEn: "Southern Europe", level: "subregion" }, geometry: null },
23120     { type: "Feature", properties: { m49: "053", wikidata: "Q45256", nameEn: "Australia and New Zealand", aliases: ["Australasia"], level: "subregion" }, geometry: null },
23121     { type: "Feature", properties: { m49: "054", wikidata: "Q37394", nameEn: "Melanesia", level: "subregion" }, geometry: null },
23122     { type: "Feature", properties: { m49: "057", wikidata: "Q3359409", nameEn: "Micronesia", level: "subregion" }, geometry: null },
23123     { type: "Feature", properties: { m49: "061", wikidata: "Q35942", nameEn: "Polynesia", level: "subregion" }, geometry: null },
23124     { type: "Feature", properties: { m49: "142", wikidata: "Q48", nameEn: "Asia", level: "region" }, geometry: null },
23125     { type: "Feature", properties: { m49: "143", wikidata: "Q27275", nameEn: "Central Asia", level: "subregion" }, geometry: null },
23126     { type: "Feature", properties: { m49: "145", wikidata: "Q27293", nameEn: "Western Asia", level: "subregion" }, geometry: null },
23127     { type: "Feature", properties: { m49: "150", wikidata: "Q46", nameEn: "Europe", level: "region" }, geometry: null },
23128     { type: "Feature", properties: { m49: "151", wikidata: "Q27468", nameEn: "Eastern Europe", level: "subregion" }, geometry: null },
23129     { type: "Feature", properties: { m49: "154", wikidata: "Q27479", nameEn: "Northern Europe", level: "subregion" }, geometry: null },
23130     { type: "Feature", properties: { m49: "155", wikidata: "Q27496", nameEn: "Western Europe", level: "subregion" }, geometry: null },
23131     { type: "Feature", properties: { m49: "202", wikidata: "Q132959", nameEn: "Sub-Saharan Africa", level: "subregion" }, geometry: null },
23132     { type: "Feature", properties: { m49: "419", wikidata: "Q72829598", nameEn: "Latin America and the Caribbean", level: "subregion" }, geometry: null },
23133     { 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]]]] } },
23134     { type: "Feature", properties: { m49: "830", wikidata: "Q42314", nameEn: "Channel Islands", level: "intermediateRegion" }, geometry: null },
23135     { 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]]]] } },
23136     { 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]]]] } },
23137     { 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]]]] } },
23138     { 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]]]] } },
23139     { 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]]]] } },
23140     { 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]]]] } },
23141     { 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]]]] } },
23142     { 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]]]] } },
23143     { 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]]]] } },
23144     { 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]]]] } },
23145     { 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]]]] } },
23146     { 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]]]] } },
23147     { 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]]]] } },
23148     { type: "Feature", properties: { iso1A2: "AU", iso1A3: "AUS", iso1N3: "036", wikidata: "Q408", nameEn: "Australia" }, geometry: null },
23149     { 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]]]] } },
23150     { 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]]]] } },
23151     { 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]]]] } },
23152     { 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]]]] } },
23153     { 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]]]] } },
23154     { 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]]]] } },
23155     { 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]]]] } },
23156     { 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]]]] } },
23157     { 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]]]] } },
23158     { 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]]]] } },
23159     { 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]]]] } },
23160     { 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]]]] } },
23161     { 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]]]] } },
23162     { 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]]]] } },
23163     { 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]]]] } },
23164     { 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]]]] } },
23165     { type: "Feature", properties: { iso1A2: "BQ", iso1A3: "BES", iso1N3: "535", wikidata: "Q27561", nameEn: "Caribbean Netherlands", country: "NL" }, geometry: null },
23166     { 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]]]] } },
23167     { 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]]]] } },
23168     { 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]]]] } },
23169     { 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]]]] } },
23170     { 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]]]] } },
23171     { 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]]]] } },
23172     { 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]]]] } },
23173     { 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]]]] } },
23174     { 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]]]] } },
23175     { 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]]]] } },
23176     { 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]]]] } },
23177     { 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]]]] } },
23178     { type: "Feature", 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.35512, 47.57014], [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]]]] }, properties: { iso1A2: "CH", iso1A3: "CHE", iso1N3: "756", wikidata: "Q39", nameEn: "Switzerland", groups: ["155", "150", "UN"], callingCodes: ["41"] } },
23179     { 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]]]] } },
23180     { 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]]]] } },
23181     { 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]]]] } },
23182     { 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]]]] } },
23183     { type: "Feature", properties: { iso1A2: "CN", iso1A3: "CHN", iso1N3: "156", wikidata: "Q148", nameEn: "People's Republic of China" }, geometry: null },
23184     { 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]]]] } },
23185     { 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]]]] } },
23186     { 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]]]] } },
23187     { 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]]]] } },
23188     { 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]]]] } },
23189     { 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]]]] } },
23190     { 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]]]] } },
23191     { 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]]]] } },
23192     { 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]]]] } },
23193     { 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]]]] } },
23194     { 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]]]] } },
23195     { 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]]]] } },
23196     { type: "Feature", properties: { iso1A2: "DK", iso1A3: "DNK", iso1N3: "208", wikidata: "Q756617", nameEn: "Kingdom of Denmark" }, geometry: null },
23197     { 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]]]] } },
23198     { 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]]]] } },
23199     { 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]]]] } },
23200     { type: "Feature", properties: { iso1A2: "EA", wikidata: "Q28868874", nameEn: "Ceuta, Melilla", country: "ES", level: "territory", isoStatus: "excRes" }, geometry: null },
23201     { type: "Feature", properties: { iso1A2: "EC", iso1A3: "ECU", iso1N3: "218", wikidata: "Q736", nameEn: "Ecuador" }, geometry: null },
23202     { 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]]]] } },
23203     { 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]]]] } },
23204     { 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]]]] } },
23205     { 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]]]] } },
23206     { type: "Feature", properties: { iso1A2: "ES", iso1A3: "ESP", iso1N3: "724", wikidata: "Q29", nameEn: "Spain" }, geometry: null },
23207     { 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]]]] } },
23208     { type: "Feature", properties: { iso1A2: "EU", iso1A3: "EUE", wikidata: "Q458", nameEn: "European Union", level: "union", isoStatus: "excRes" }, geometry: null },
23209     { type: "Feature", properties: { iso1A2: "FI", iso1A3: "FIN", iso1N3: "246", wikidata: "Q33", nameEn: "Finland", aliases: ["SF"] }, geometry: null },
23210     { 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]]]] } },
23211     { 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]]]] } },
23212     { 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]]]] } },
23213     { 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]]]] } },
23214     { type: "Feature", properties: { iso1A2: "FR", iso1A3: "FRA", iso1N3: "250", wikidata: "Q142", nameEn: "France" }, geometry: null },
23215     { 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]]]] } },
23216     { 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]]]] } },
23217     { type: "Feature", properties: { iso1A2: "GB", iso1A3: "GBR", iso1N3: "826", wikidata: "Q145", ccTLD: ".uk", nameEn: "United Kingdom", aliases: ["UK"] }, geometry: null },
23218     { 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]]]] } },
23219     { 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]]]] } },
23220     { 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]]]] } },
23221     { type: "Feature", properties: { iso1A2: "GG", iso1A3: "GGY", iso1N3: "831", wikidata: "Q25230", nameEn: "Bailiwick of Guernsey", country: "GB" }, geometry: null },
23222     { 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]]]] } },
23223     { 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]]]] } },
23224     { 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]]]] } },
23225     { 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]]]] } },
23226     { 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]]]] } },
23227     { 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]]]] } },
23228     { 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]]]] } },
23229     { 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]]]] } },
23230     { 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]]]] } },
23231     { 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]]]] } },
23232     { 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]]]] } },
23233     { 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]]]] } },
23234     { 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]]]] } },
23235     { 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]]]] } },
23236     { 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]]]] } },
23237     { 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]]]] } },
23238     { 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]]]] } },
23239     { 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]]]] } },
23240     { 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]]]] } },
23241     { 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]]]] } },
23242     { type: "Feature", properties: { iso1A2: "ID", iso1A3: "IDN", iso1N3: "360", wikidata: "Q252", nameEn: "Indonesia", aliases: ["RI"] }, geometry: null },
23243     { type: "Feature", 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], [-11.75, 54], [-11, 51], [-6.03913, 51.13217], [-5.37267, 53.63269], [-6.26218, 54.09785]]]] }, properties: { iso1A2: "IE", iso1A3: "IRL", iso1N3: "372", wikidata: "Q27", nameEn: "Republic of Ireland", groups: ["EU", "Q22890", "154", "150", "UN"], driveSide: "left", callingCodes: ["353"] } },
23244     { 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]]]] } },
23245     { 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]]]] } },
23246     { type: "Feature", properties: { iso1A2: "IN", iso1A3: "IND", iso1N3: "356", wikidata: "Q668", nameEn: "India" }, geometry: null },
23247     { type: "Feature", properties: { iso1A2: "IO", iso1A3: "IOT", iso1N3: "086", wikidata: "Q43448", nameEn: "British Indian Ocean Territory", country: "GB" }, geometry: null },
23248     { 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]]]] } },
23249     { 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]]]] } },
23250     { 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]]]] } },
23251     { 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]]]] } },
23252     { 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]]]] } },
23253     { 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]]]] } },
23254     { 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]]]] } },
23255     { 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]]]] } },
23256     { 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]]]] } },
23257     { 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]]]] } },
23258     { 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]]]] } },
23259     { 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]]]] } },
23260     { 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]]]] } },
23261     { 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]]]] } },
23262     { 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]]]] } },
23263     { 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]]]] } },
23264     { 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]]]] } },
23265     { 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]]]] } },
23266     { 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]]]] } },
23267     { 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]]]] } },
23268     { 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]]]] } },
23269     { 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]]]] } },
23270     { 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]]]] } },
23271     { 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]]]] } },
23272     { 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]]]] } },
23273     { 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]]]] } },
23274     { 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]]]] } },
23275     { 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]]]] } },
23276     { 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]]]] } },
23277     { 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]]]] } },
23278     { 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]]]] } },
23279     { 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]]]] } },
23280     { 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]]]] } },
23281     { 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]]]] } },
23282     { 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]]]] } },
23283     { 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]]]] } },
23284     { 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]]]] } },
23285     { 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]]]] } },
23286     { 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]]]] } },
23287     { 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]]]] } },
23288     { 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]]]] } },
23289     { 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]]]] } },
23290     { 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]]]] } },
23291     { 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]]]] } },
23292     { 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]]]] } },
23293     { 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]]]] } },
23294     { 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]]]] } },
23295     { 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]]]] } },
23296     { 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]]]] } },
23297     { 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]]]] } },
23298     { 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]]]] } },
23299     { type: "Feature", properties: { iso1A2: "MY", iso1A3: "MYS", iso1N3: "458", wikidata: "Q833", nameEn: "Malaysia" }, geometry: null },
23300     { 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]]]] } },
23301     { 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]]]] } },
23302     { 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]]]] } },
23303     { 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]]]] } },
23304     { 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]]]] } },
23305     { 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]]]] } },
23306     { 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]]]] } },
23307     { type: "Feature", properties: { iso1A2: "NL", iso1A3: "NLD", iso1N3: "528", wikidata: "Q29999", nameEn: "Kingdom of the Netherlands" }, geometry: null },
23308     { type: "Feature", properties: { iso1A2: "NO", iso1A3: "NOR", iso1N3: "578", wikidata: "Q20", nameEn: "Norway" }, geometry: null },
23309     { 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]]]] } },
23310     { 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]]]] } },
23311     { 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]]]] } },
23312     { type: "Feature", properties: { iso1A2: "NZ", iso1A3: "NZL", iso1N3: "554", wikidata: "Q664", nameEn: "New Zealand" }, geometry: null },
23313     { 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]]]] } },
23314     { 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]]]] } },
23315     { 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]]]] } },
23316     { 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]]]] } },
23317     { 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]]]] } },
23318     { 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]]]] } },
23319     { 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]]]] } },
23320     { 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]]]] } },
23321     { 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]]]] } },
23322     { 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]]]] } },
23323     { 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]]]] } },
23324     { type: "Feature", properties: { iso1A2: "PS", iso1A3: "PSE", iso1N3: "275", wikidata: "Q219060", nameEn: "Palestine" }, geometry: null },
23325     { type: "Feature", properties: { iso1A2: "PT", iso1A3: "PRT", iso1N3: "620", wikidata: "Q45", nameEn: "Portugal" }, geometry: null },
23326     { 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]]]] } },
23327     { 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]]]] } },
23328     { 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]]]] } },
23329     { 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]]]] } },
23330     { 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]]]] } },
23331     { 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]]]] } },
23332     { type: "Feature", properties: { iso1A2: "RU", iso1A3: "RUS", iso1N3: "643", wikidata: "Q159", nameEn: "Russia" }, geometry: null },
23333     { 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]]]] } },
23334     { 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]]]] } },
23335     { 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]]]] } },
23336     { 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]]]] } },
23337     { 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]]]] } },
23338     { 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]]]] } },
23339     { 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]]]] } },
23340     { type: "Feature", properties: { iso1A2: "SH", iso1A3: "SHN", iso1N3: "654", wikidata: "Q192184", nameEn: "Saint Helena, Ascension and Tristan da Cunha", country: "GB" }, geometry: null },
23341     { 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]]]] } },
23342     { type: "Feature", properties: { iso1A2: "SJ", iso1A3: "SJM", iso1N3: "744", wikidata: "Q842829", nameEn: "Svalbard and Jan Mayen", country: "NO" }, geometry: null },
23343     { 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]]]] } },
23344     { 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]]]] } },
23345     { 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]]]] } },
23346     { 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]]]] } },
23347     { 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]]]] } },
23348     { 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]]]] } },
23349     { 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]]]] } },
23350     { 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]]]] } },
23351     { 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]]]] } },
23352     { 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]]]] } },
23353     { 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]]]] } },
23354     { 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]]]] } },
23355     { 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]]]] } },
23356     { 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]]]] } },
23357     { 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]]]] } },
23358     { type: "Feature", properties: { iso1A2: "TF", iso1A3: "ATF", iso1N3: "260", wikidata: "Q129003", nameEn: "French Southern Territories", country: "FR", groups: ["EU", "UN"] }, geometry: null },
23359     { 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]]]] } },
23360     { 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]]]] } },
23361     { 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]]]] } },
23362     { 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]]]] } },
23363     { 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]]]] } },
23364     { 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]]]] } },
23365     { 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]]]] } },
23366     { 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]]]] } },
23367     { 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]]]] } },
23368     { 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]]]] } },
23369     { 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]]]] } },
23370     { 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]]]] } },
23371     { 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]]]] } },
23372     { 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]]]] } },
23373     { 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]]]] } },
23374     { type: "Feature", properties: { iso1A2: "UM", iso1A3: "UMI", iso1N3: "581", wikidata: "Q16645", nameEn: "United States Minor Outlying Islands", country: "US" }, geometry: null },
23375     { type: "Feature", properties: { iso1A2: "UN", wikidata: "Q1065", nameEn: "United Nations", level: "unitedNations", isoStatus: "excRes" }, geometry: null },
23376     { type: "Feature", properties: { iso1A2: "US", iso1A3: "USA", iso1N3: "840", wikidata: "Q30", nameEn: "United States of America" }, geometry: null },
23377     { 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]]]] } },
23378     { 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]]]] } },
23379     { 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]]]] } },
23380     { 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]]]] } },
23381     { 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]]]] } },
23382     { 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]]]] } },
23383     { 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]]]] } },
23384     { 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]]]] } },
23385     { 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]]]] } },
23386     { 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]]]] } },
23387     { 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]]]] } },
23388     { 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]]]] } },
23389     { 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]]]] } },
23390     { 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]]]] } },
23391     { 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]]]] } },
23392     { 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]]]] } },
23393     { 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]]]] } }
23394   ] };
23395   var borders = borders_default;
23396   var whichPolygonGetter = {};
23397   var featuresByCode = {};
23398   var idFilterRegex = /(?=(?!^(and|the|of|el|la|de)$))(\b(and|the|of|el|la|de)\b)|[-_ .,'()&[\]/]/gi;
23399   function canonicalID(id2) {
23400     const s = id2 || "";
23401     if (s.charAt(0) === ".") {
23402       return s.toUpperCase();
23403     } else {
23404       return s.replace(idFilterRegex, "").toUpperCase();
23405     }
23406   }
23407   var levels = [
23408     "subterritory",
23409     "territory",
23410     "subcountryGroup",
23411     "country",
23412     "sharedLandform",
23413     "intermediateRegion",
23414     "subregion",
23415     "region",
23416     "subunion",
23417     "union",
23418     "unitedNations",
23419     "world"
23420   ];
23421   loadDerivedDataAndCaches(borders);
23422   function loadDerivedDataAndCaches(borders2) {
23423     const identifierProps = ["iso1A2", "iso1A3", "m49", "wikidata", "emojiFlag", "ccTLD", "nameEn"];
23424     let geometryFeatures = [];
23425     borders2.features.forEach((feature22) => {
23426       feature22.properties.id = feature22.properties.iso1A2 || feature22.properties.m49 || feature22.properties.wikidata;
23427       loadM49(feature22);
23428       loadTLD(feature22);
23429       loadIsoStatus(feature22);
23430       loadLevel(feature22);
23431       loadGroups(feature22);
23432       loadFlag(feature22);
23433       cacheFeatureByIDs(feature22);
23434       if (feature22.geometry)
23435         geometryFeatures.push(feature22);
23436     });
23437     borders2.features.forEach((feature22) => {
23438       feature22.properties.groups = feature22.properties.groups.map((groupID) => {
23439         return featuresByCode[groupID].properties.id;
23440       });
23441       loadMembersForGroupsOf(feature22);
23442     });
23443     borders2.features.forEach((feature22) => {
23444       loadRoadSpeedUnit(feature22);
23445       loadRoadHeightUnit(feature22);
23446       loadDriveSide(feature22);
23447       loadCallingCodes(feature22);
23448       loadGroupGroups(feature22);
23449     });
23450     borders2.features.forEach((feature22) => {
23451       feature22.properties.groups.sort((groupID1, groupID2) => {
23452         return levels.indexOf(featuresByCode[groupID1].properties.level) - levels.indexOf(featuresByCode[groupID2].properties.level);
23453       });
23454       if (feature22.properties.members)
23455         feature22.properties.members.sort((id1, id2) => {
23456           const diff = levels.indexOf(featuresByCode[id1].properties.level) - levels.indexOf(featuresByCode[id2].properties.level);
23457           if (diff === 0) {
23458             return borders2.features.indexOf(featuresByCode[id1]) - borders2.features.indexOf(featuresByCode[id2]);
23459           }
23460           return diff;
23461         });
23462     });
23463     const geometryOnlyCollection = {
23464       type: "FeatureCollection",
23465       features: geometryFeatures
23466     };
23467     whichPolygonGetter = (0, import_which_polygon.default)(geometryOnlyCollection);
23468     function loadGroups(feature22) {
23469       const props = feature22.properties;
23470       if (!props.groups) {
23471         props.groups = [];
23472       }
23473       if (feature22.geometry && props.country) {
23474         props.groups.push(props.country);
23475       }
23476       if (props.m49 !== "001") {
23477         props.groups.push("001");
23478       }
23479     }
23480     function loadM49(feature22) {
23481       const props = feature22.properties;
23482       if (!props.m49 && props.iso1N3) {
23483         props.m49 = props.iso1N3;
23484       }
23485     }
23486     function loadTLD(feature22) {
23487       const props = feature22.properties;
23488       if (props.level === "unitedNations")
23489         return;
23490       if (!props.ccTLD && props.iso1A2) {
23491         props.ccTLD = "." + props.iso1A2.toLowerCase();
23492       }
23493     }
23494     function loadIsoStatus(feature22) {
23495       const props = feature22.properties;
23496       if (!props.isoStatus && props.iso1A2) {
23497         props.isoStatus = "official";
23498       }
23499     }
23500     function loadLevel(feature22) {
23501       const props = feature22.properties;
23502       if (props.level)
23503         return;
23504       if (!props.country) {
23505         props.level = "country";
23506       } else if (!props.iso1A2 || props.isoStatus === "official") {
23507         props.level = "territory";
23508       } else {
23509         props.level = "subterritory";
23510       }
23511     }
23512     function loadGroupGroups(feature22) {
23513       const props = feature22.properties;
23514       if (feature22.geometry || !props.members)
23515         return;
23516       const featureLevelIndex = levels.indexOf(props.level);
23517       let sharedGroups = [];
23518       props.members.forEach((memberID, index) => {
23519         const member = featuresByCode[memberID];
23520         const memberGroups = member.properties.groups.filter((groupID) => {
23521           return groupID !== feature22.properties.id && featureLevelIndex < levels.indexOf(featuresByCode[groupID].properties.level);
23522         });
23523         if (index === 0) {
23524           sharedGroups = memberGroups;
23525         } else {
23526           sharedGroups = sharedGroups.filter((groupID) => memberGroups.indexOf(groupID) !== -1);
23527         }
23528       });
23529       props.groups = props.groups.concat(
23530         sharedGroups.filter((groupID) => props.groups.indexOf(groupID) === -1)
23531       );
23532       sharedGroups.forEach((groupID) => {
23533         const groupFeature = featuresByCode[groupID];
23534         if (groupFeature.properties.members.indexOf(props.id) === -1) {
23535           groupFeature.properties.members.push(props.id);
23536         }
23537       });
23538     }
23539     function loadRoadSpeedUnit(feature22) {
23540       const props = feature22.properties;
23541       if (feature22.geometry) {
23542         if (!props.roadSpeedUnit)
23543           props.roadSpeedUnit = "km/h";
23544       } else if (props.members) {
23545         const vals = Array.from(
23546           new Set(
23547             props.members.map((id2) => {
23548               const member = featuresByCode[id2];
23549               if (member.geometry)
23550                 return member.properties.roadSpeedUnit || "km/h";
23551             }).filter(Boolean)
23552           )
23553         );
23554         if (vals.length === 1)
23555           props.roadSpeedUnit = vals[0];
23556       }
23557     }
23558     function loadRoadHeightUnit(feature22) {
23559       const props = feature22.properties;
23560       if (feature22.geometry) {
23561         if (!props.roadHeightUnit)
23562           props.roadHeightUnit = "m";
23563       } else if (props.members) {
23564         const vals = Array.from(
23565           new Set(
23566             props.members.map((id2) => {
23567               const member = featuresByCode[id2];
23568               if (member.geometry)
23569                 return member.properties.roadHeightUnit || "m";
23570             }).filter(Boolean)
23571           )
23572         );
23573         if (vals.length === 1)
23574           props.roadHeightUnit = vals[0];
23575       }
23576     }
23577     function loadDriveSide(feature22) {
23578       const props = feature22.properties;
23579       if (feature22.geometry) {
23580         if (!props.driveSide)
23581           props.driveSide = "right";
23582       } else if (props.members) {
23583         const vals = Array.from(
23584           new Set(
23585             props.members.map((id2) => {
23586               const member = featuresByCode[id2];
23587               if (member.geometry)
23588                 return member.properties.driveSide || "right";
23589             }).filter(Boolean)
23590           )
23591         );
23592         if (vals.length === 1)
23593           props.driveSide = vals[0];
23594       }
23595     }
23596     function loadCallingCodes(feature22) {
23597       const props = feature22.properties;
23598       if (!feature22.geometry && props.members) {
23599         props.callingCodes = Array.from(
23600           new Set(
23601             props.members.reduce((array2, id2) => {
23602               const member = featuresByCode[id2];
23603               if (member.geometry && member.properties.callingCodes) {
23604                 return array2.concat(member.properties.callingCodes);
23605               }
23606               return array2;
23607             }, [])
23608           )
23609         );
23610       }
23611     }
23612     function loadFlag(feature22) {
23613       if (!feature22.properties.iso1A2)
23614         return;
23615       const flag = feature22.properties.iso1A2.replace(/./g, function(char) {
23616         return String.fromCodePoint(char.charCodeAt(0) + 127397);
23617       });
23618       feature22.properties.emojiFlag = flag;
23619     }
23620     function loadMembersForGroupsOf(feature22) {
23621       feature22.properties.groups.forEach((groupID) => {
23622         const groupFeature = featuresByCode[groupID];
23623         if (!groupFeature.properties.members) {
23624           groupFeature.properties.members = [];
23625         }
23626         groupFeature.properties.members.push(feature22.properties.id);
23627       });
23628     }
23629     function cacheFeatureByIDs(feature22) {
23630       let ids = [];
23631       identifierProps.forEach((prop) => {
23632         const id2 = feature22.properties[prop];
23633         if (id2)
23634           ids.push(id2);
23635       });
23636       (feature22.properties.aliases || []).forEach((alias) => {
23637         ids.push(alias);
23638       });
23639       ids.forEach((id2) => {
23640         let cid = canonicalID(id2);
23641         featuresByCode[cid] = feature22;
23642       });
23643     }
23644   }
23645   function locArray(loc) {
23646     if (Array.isArray(loc)) {
23647       return loc;
23648     } else if (loc.coordinates) {
23649       return loc.coordinates;
23650     }
23651     return loc.geometry.coordinates;
23652   }
23653   function smallestFeature(loc) {
23654     const query = locArray(loc);
23655     const featureProperties = whichPolygonGetter(query);
23656     if (!featureProperties)
23657       return null;
23658     return featuresByCode[featureProperties.id];
23659   }
23660   function countryFeature(loc) {
23661     const feature22 = smallestFeature(loc);
23662     if (!feature22)
23663       return null;
23664     const countryCode = feature22.properties.country || feature22.properties.iso1A2;
23665     return featuresByCode[countryCode] || null;
23666   }
23667   var defaultOpts = {
23668     level: void 0,
23669     maxLevel: void 0,
23670     withProp: void 0
23671   };
23672   function featureForLoc(loc, opts) {
23673     const targetLevel = opts.level || "country";
23674     const maxLevel = opts.maxLevel || "world";
23675     const withProp = opts.withProp;
23676     const targetLevelIndex = levels.indexOf(targetLevel);
23677     if (targetLevelIndex === -1)
23678       return null;
23679     const maxLevelIndex = levels.indexOf(maxLevel);
23680     if (maxLevelIndex === -1)
23681       return null;
23682     if (maxLevelIndex < targetLevelIndex)
23683       return null;
23684     if (targetLevel === "country") {
23685       const fastFeature = countryFeature(loc);
23686       if (fastFeature) {
23687         if (!withProp || fastFeature.properties[withProp]) {
23688           return fastFeature;
23689         }
23690       }
23691     }
23692     const features = featuresContaining(loc);
23693     const match = features.find((feature22) => {
23694       let levelIndex = levels.indexOf(feature22.properties.level);
23695       if (feature22.properties.level === targetLevel || // if no feature exists at the target level, return the first feature at the next level up
23696       levelIndex > targetLevelIndex && levelIndex <= maxLevelIndex) {
23697         if (!withProp || feature22.properties[withProp]) {
23698           return feature22;
23699         }
23700       }
23701       return false;
23702     });
23703     return match || null;
23704   }
23705   function featureForID(id2) {
23706     let stringID;
23707     if (typeof id2 === "number") {
23708       stringID = id2.toString();
23709       if (stringID.length === 1) {
23710         stringID = "00" + stringID;
23711       } else if (stringID.length === 2) {
23712         stringID = "0" + stringID;
23713       }
23714     } else {
23715       stringID = canonicalID(id2);
23716     }
23717     return featuresByCode[stringID] || null;
23718   }
23719   function smallestFeaturesForBbox(bbox2) {
23720     return whichPolygonGetter.bbox(bbox2).map((props) => featuresByCode[props.id]);
23721   }
23722   function smallestOrMatchingFeature(query) {
23723     if (typeof query === "object") {
23724       return smallestFeature(query);
23725     }
23726     return featureForID(query);
23727   }
23728   function feature(query, opts = defaultOpts) {
23729     if (typeof query === "object") {
23730       return featureForLoc(query, opts);
23731     }
23732     return featureForID(query);
23733   }
23734   function iso1A2Code(query, opts = defaultOpts) {
23735     opts.withProp = "iso1A2";
23736     const match = feature(query, opts);
23737     if (!match)
23738       return null;
23739     return match.properties.iso1A2 || null;
23740   }
23741   function featuresContaining(query, strict) {
23742     let matchingFeatures;
23743     if (Array.isArray(query) && query.length === 4) {
23744       matchingFeatures = smallestFeaturesForBbox(query);
23745     } else {
23746       const smallestOrMatching = smallestOrMatchingFeature(query);
23747       matchingFeatures = smallestOrMatching ? [smallestOrMatching] : [];
23748     }
23749     if (!matchingFeatures.length)
23750       return [];
23751     let returnFeatures;
23752     if (!strict || typeof query === "object") {
23753       returnFeatures = matchingFeatures.slice();
23754     } else {
23755       returnFeatures = [];
23756     }
23757     matchingFeatures.forEach((feature22) => {
23758       const properties = feature22.properties;
23759       properties.groups.forEach((groupID) => {
23760         const groupFeature = featuresByCode[groupID];
23761         if (returnFeatures.indexOf(groupFeature) === -1) {
23762           returnFeatures.push(groupFeature);
23763         }
23764       });
23765     });
23766     return returnFeatures;
23767   }
23768   function featuresIn(id2, strict) {
23769     const feature22 = featureForID(id2);
23770     if (!feature22)
23771       return [];
23772     let features = [];
23773     if (!strict) {
23774       features.push(feature22);
23775     }
23776     const properties = feature22.properties;
23777     (properties.members || []).forEach((memberID) => {
23778       features.push(featuresByCode[memberID]);
23779     });
23780     return features;
23781   }
23782   function aggregateFeature(id2) {
23783     const features = featuresIn(id2, false);
23784     if (features.length === 0)
23785       return null;
23786     let aggregateCoordinates = [];
23787     features.forEach((feature22) => {
23788       if (feature22.geometry && feature22.geometry.type === "MultiPolygon" && feature22.geometry.coordinates) {
23789         aggregateCoordinates = aggregateCoordinates.concat(feature22.geometry.coordinates);
23790       }
23791     });
23792     return {
23793       type: "Feature",
23794       properties: features[0].properties,
23795       geometry: {
23796         type: "MultiPolygon",
23797         coordinates: aggregateCoordinates
23798       }
23799     };
23800   }
23801   function roadSpeedUnit(query) {
23802     const feature22 = smallestOrMatchingFeature(query);
23803     return feature22 && feature22.properties.roadSpeedUnit || null;
23804   }
23805   function roadHeightUnit(query) {
23806     const feature22 = smallestOrMatchingFeature(query);
23807     return feature22 && feature22.properties.roadHeightUnit || null;
23808   }
23809
23810   // node_modules/@rapideditor/location-conflation/index.mjs
23811   var import_geojson_area = __toESM(require_geojson_area(), 1);
23812   var import_circle_to_polygon = __toESM(require_circle_to_polygon(), 1);
23813   var import_polygon_clipping = __toESM(require_polygon_clipping_umd(), 1);
23814   var import_geojson_precision = __toESM(require_geojson_precision(), 1);
23815   var import_json_stringify_pretty_compact = __toESM(require_json_stringify_pretty_compact(), 1);
23816   var location_conflation_default = class {
23817     // constructor
23818     //
23819     // `fc`  Optional FeatureCollection of known features
23820     //
23821     // Optionally pass a GeoJSON FeatureCollection of known features which we can refer to later.
23822     // Each feature must have a filename-like `id`, for example: `something.geojson`
23823     //
23824     // {
23825     //   "type": "FeatureCollection"
23826     //   "features": [
23827     //     {
23828     //       "type": "Feature",
23829     //       "id": "philly_metro.geojson",
23830     //       "properties": { … },
23831     //       "geometry": { … }
23832     //     }
23833     //   ]
23834     // }
23835     constructor(fc) {
23836       this._cache = {};
23837       this._strict = true;
23838       if (fc && fc.type === "FeatureCollection" && Array.isArray(fc.features)) {
23839         fc.features.forEach((feature3) => {
23840           feature3.properties = feature3.properties || {};
23841           let props = feature3.properties;
23842           let id2 = feature3.id || props.id;
23843           if (!id2 || !/^\S+\.geojson$/i.test(id2))
23844             return;
23845           id2 = id2.toLowerCase();
23846           feature3.id = id2;
23847           props.id = id2;
23848           if (!props.area) {
23849             const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
23850             props.area = Number(area.toFixed(2));
23851           }
23852           this._cache[id2] = feature3;
23853         });
23854       }
23855       let world = _cloneDeep(feature("Q2"));
23856       world.geometry = {
23857         type: "Polygon",
23858         coordinates: [[[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]]]
23859       };
23860       world.id = "Q2";
23861       world.properties.id = "Q2";
23862       world.properties.area = import_geojson_area.default.geometry(world.geometry) / 1e6;
23863       this._cache.Q2 = world;
23864     }
23865     // validateLocation
23866     // `location`  The location to validate
23867     //
23868     // Pass a `location` value to validate
23869     //
23870     // Returns a result like:
23871     //   {
23872     //     type:     'point', 'geojson', or 'countrycoder'
23873     //     location:  the queried location
23874     //     id:        the stable identifier for the feature
23875     //   }
23876     // or `null` if the location is invalid
23877     //
23878     validateLocation(location) {
23879       if (Array.isArray(location) && (location.length === 2 || location.length === 3)) {
23880         const lon = location[0];
23881         const lat = location[1];
23882         const radius = location[2];
23883         if (Number.isFinite(lon) && lon >= -180 && lon <= 180 && Number.isFinite(lat) && lat >= -90 && lat <= 90 && (location.length === 2 || Number.isFinite(radius) && radius > 0)) {
23884           const id2 = "[" + location.toString() + "]";
23885           return { type: "point", location, id: id2 };
23886         }
23887       } else if (typeof location === "string" && /^\S+\.geojson$/i.test(location)) {
23888         const id2 = location.toLowerCase();
23889         if (this._cache[id2]) {
23890           return { type: "geojson", location, id: id2 };
23891         }
23892       } else if (typeof location === "string" || typeof location === "number") {
23893         const feature3 = feature(location);
23894         if (feature3) {
23895           const id2 = feature3.properties.wikidata;
23896           return { type: "countrycoder", location, id: id2 };
23897         }
23898       }
23899       if (this._strict) {
23900         throw new Error(`validateLocation:  Invalid location: "${location}".`);
23901       } else {
23902         return null;
23903       }
23904     }
23905     // resolveLocation
23906     // `location`  The location to resolve
23907     //
23908     // Pass a `location` value to resolve
23909     //
23910     // Returns a result like:
23911     //   {
23912     //     type:      'point', 'geojson', or 'countrycoder'
23913     //     location:  the queried location
23914     //     id:        a stable identifier for the feature
23915     //     feature:   the resolved GeoJSON feature
23916     //   }
23917     //  or `null` if the location is invalid
23918     //
23919     resolveLocation(location) {
23920       const valid = this.validateLocation(location);
23921       if (!valid)
23922         return null;
23923       const id2 = valid.id;
23924       if (this._cache[id2]) {
23925         return Object.assign(valid, { feature: this._cache[id2] });
23926       }
23927       if (valid.type === "point") {
23928         const lon = location[0];
23929         const lat = location[1];
23930         const radius = location[2] || 25;
23931         const EDGES = 10;
23932         const PRECISION = 3;
23933         const area = Math.PI * radius * radius;
23934         const feature3 = this._cache[id2] = (0, import_geojson_precision.default)({
23935           type: "Feature",
23936           id: id2,
23937           properties: { id: id2, area: Number(area.toFixed(2)) },
23938           geometry: (0, import_circle_to_polygon.default)([lon, lat], radius * 1e3, EDGES)
23939           // km to m
23940         }, PRECISION);
23941         return Object.assign(valid, { feature: feature3 });
23942       } else if (valid.type === "geojson") {
23943       } else if (valid.type === "countrycoder") {
23944         let feature3 = _cloneDeep(feature(id2));
23945         let props = feature3.properties;
23946         if (Array.isArray(props.members)) {
23947           let aggregate = aggregateFeature(id2);
23948           aggregate.geometry.coordinates = _clip([aggregate], "UNION").geometry.coordinates;
23949           feature3.geometry = aggregate.geometry;
23950         }
23951         if (!props.area) {
23952           const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
23953           props.area = Number(area.toFixed(2));
23954         }
23955         feature3.id = id2;
23956         props.id = id2;
23957         this._cache[id2] = feature3;
23958         return Object.assign(valid, { feature: feature3 });
23959       }
23960       if (this._strict) {
23961         throw new Error(`resolveLocation:  Couldn't resolve location "${location}".`);
23962       } else {
23963         return null;
23964       }
23965     }
23966     // validateLocationSet
23967     // `locationSet`  the locationSet to validate
23968     //
23969     // Pass a locationSet Object to validate like:
23970     //   {
23971     //     include: [ Array of locations ],
23972     //     exclude: [ Array of locations ]
23973     //   }
23974     //
23975     // Returns a result like:
23976     //   {
23977     //     type:         'locationset'
23978     //     locationSet:  the queried locationSet
23979     //     id:           the stable identifier for the feature
23980     //   }
23981     // or `null` if the locationSet is invalid
23982     //
23983     validateLocationSet(locationSet) {
23984       locationSet = locationSet || {};
23985       const validator = this.validateLocation.bind(this);
23986       let include = (locationSet.include || []).map(validator).filter(Boolean);
23987       let exclude = (locationSet.exclude || []).map(validator).filter(Boolean);
23988       if (!include.length) {
23989         if (this._strict) {
23990           throw new Error(`validateLocationSet:  LocationSet includes nothing.`);
23991         } else {
23992           locationSet.include = ["Q2"];
23993           include = [{ type: "countrycoder", location: "Q2", id: "Q2" }];
23994         }
23995       }
23996       include.sort(_sortLocations);
23997       let id2 = "+[" + include.map((d) => d.id).join(",") + "]";
23998       if (exclude.length) {
23999         exclude.sort(_sortLocations);
24000         id2 += "-[" + exclude.map((d) => d.id).join(",") + "]";
24001       }
24002       return { type: "locationset", locationSet, id: id2 };
24003     }
24004     // resolveLocationSet
24005     // `locationSet`  the locationSet to resolve
24006     //
24007     // Pass a locationSet Object to validate like:
24008     //   {
24009     //     include: [ Array of locations ],
24010     //     exclude: [ Array of locations ]
24011     //   }
24012     //
24013     // Returns a result like:
24014     //   {
24015     //     type:         'locationset'
24016     //     locationSet:  the queried locationSet
24017     //     id:           the stable identifier for the feature
24018     //     feature:      the resolved GeoJSON feature
24019     //   }
24020     // or `null` if the locationSet is invalid
24021     //
24022     resolveLocationSet(locationSet) {
24023       locationSet = locationSet || {};
24024       const valid = this.validateLocationSet(locationSet);
24025       if (!valid)
24026         return null;
24027       const id2 = valid.id;
24028       if (this._cache[id2]) {
24029         return Object.assign(valid, { feature: this._cache[id2] });
24030       }
24031       const resolver = this.resolveLocation.bind(this);
24032       const includes = (locationSet.include || []).map(resolver).filter(Boolean);
24033       const excludes = (locationSet.exclude || []).map(resolver).filter(Boolean);
24034       if (includes.length === 1 && excludes.length === 0) {
24035         return Object.assign(valid, { feature: includes[0].feature });
24036       }
24037       const includeGeoJSON = _clip(includes.map((d) => d.feature), "UNION");
24038       const excludeGeoJSON = _clip(excludes.map((d) => d.feature), "UNION");
24039       let resultGeoJSON = excludeGeoJSON ? _clip([includeGeoJSON, excludeGeoJSON], "DIFFERENCE") : includeGeoJSON;
24040       const area = import_geojson_area.default.geometry(resultGeoJSON.geometry) / 1e6;
24041       resultGeoJSON.id = id2;
24042       resultGeoJSON.properties = { id: id2, area: Number(area.toFixed(2)) };
24043       this._cache[id2] = resultGeoJSON;
24044       return Object.assign(valid, { feature: resultGeoJSON });
24045     }
24046     // strict
24047     //
24048     strict(val) {
24049       if (val === void 0) {
24050         return this._strict;
24051       } else {
24052         this._strict = val;
24053         return this;
24054       }
24055     }
24056     // cache
24057     // convenience method to access the internal cache
24058     cache() {
24059       return this._cache;
24060     }
24061     // stringify
24062     // convenience method to prettyStringify the given object
24063     stringify(obj, options2) {
24064       return (0, import_json_stringify_pretty_compact.default)(obj, options2);
24065     }
24066   };
24067   function _clip(features, which) {
24068     if (!Array.isArray(features) || !features.length)
24069       return null;
24070     const fn = { UNION: import_polygon_clipping.default.union, DIFFERENCE: import_polygon_clipping.default.difference }[which];
24071     const args = features.map((feature3) => feature3.geometry.coordinates);
24072     const coords = fn.apply(null, args);
24073     return {
24074       type: "Feature",
24075       properties: {},
24076       geometry: {
24077         type: whichType(coords),
24078         coordinates: coords
24079       }
24080     };
24081     function whichType(coords2) {
24082       const a = Array.isArray(coords2);
24083       const b = a && Array.isArray(coords2[0]);
24084       const c = b && Array.isArray(coords2[0][0]);
24085       const d = c && Array.isArray(coords2[0][0][0]);
24086       return d ? "MultiPolygon" : "Polygon";
24087     }
24088   }
24089   function _cloneDeep(obj) {
24090     return JSON.parse(JSON.stringify(obj));
24091   }
24092   function _sortLocations(a, b) {
24093     const rank = { countrycoder: 1, geojson: 2, point: 3 };
24094     const aRank = rank[a.type];
24095     const bRank = rank[b.type];
24096     return aRank > bRank ? 1 : aRank < bRank ? -1 : a.id.localeCompare(b.id);
24097   }
24098
24099   // modules/core/LocationManager.js
24100   var import_which_polygon2 = __toESM(require_which_polygon());
24101   var import_geojson_area2 = __toESM(require_geojson_area());
24102   var _loco = new location_conflation_default();
24103   var LocationManager = class {
24104     /**
24105      * @constructor
24106      */
24107     constructor() {
24108       this._wp = null;
24109       this._resolved = /* @__PURE__ */ new Map();
24110       this._knownLocationSets = /* @__PURE__ */ new Map();
24111       this._locationIncludedIn = /* @__PURE__ */ new Map();
24112       this._locationExcludedIn = /* @__PURE__ */ new Map();
24113       const world = { locationSet: { include: ["Q2"] } };
24114       this._resolveLocationSet(world);
24115       this._rebuildIndex();
24116     }
24117     /**
24118      * _validateLocationSet
24119      * Pass an Object with a `locationSet` property.
24120      * Validates the `locationSet` and sets a `locationSetID` property on the object.
24121      * To avoid so much computation we only resolve the include and exclude regions, but not the locationSet itself.
24122      *
24123      * Use `_resolveLocationSet()` instead if you need to resolve geojson of locationSet, for example to render it.
24124      * Note: You need to call `_rebuildIndex()` after you're all finished validating the locationSets.
24125      *
24126      * @param  `obj`  Object to check, it should have `locationSet` property
24127      */
24128     _validateLocationSet(obj) {
24129       if (obj.locationSetID)
24130         return;
24131       try {
24132         let locationSet = obj.locationSet;
24133         if (!locationSet) {
24134           throw new Error("object missing locationSet property");
24135         }
24136         if (!locationSet.include) {
24137           locationSet.include = ["Q2"];
24138         }
24139         const locationSetID = _loco.validateLocationSet(locationSet).id;
24140         obj.locationSetID = locationSetID;
24141         if (this._knownLocationSets.has(locationSetID))
24142           return;
24143         let area = 0;
24144         (locationSet.include || []).forEach((location) => {
24145           const locationID = _loco.validateLocation(location).id;
24146           let geojson = this._resolved.get(locationID);
24147           if (!geojson) {
24148             geojson = _loco.resolveLocation(location).feature;
24149             this._resolved.set(locationID, geojson);
24150           }
24151           area += geojson.properties.area;
24152           let s = this._locationIncludedIn.get(locationID);
24153           if (!s) {
24154             s = /* @__PURE__ */ new Set();
24155             this._locationIncludedIn.set(locationID, s);
24156           }
24157           s.add(locationSetID);
24158         });
24159         (locationSet.exclude || []).forEach((location) => {
24160           const locationID = _loco.validateLocation(location).id;
24161           let geojson = this._resolved.get(locationID);
24162           if (!geojson) {
24163             geojson = _loco.resolveLocation(location).feature;
24164             this._resolved.set(locationID, geojson);
24165           }
24166           area -= geojson.properties.area;
24167           let s = this._locationExcludedIn.get(locationID);
24168           if (!s) {
24169             s = /* @__PURE__ */ new Set();
24170             this._locationExcludedIn.set(locationID, s);
24171           }
24172           s.add(locationSetID);
24173         });
24174         this._knownLocationSets.set(locationSetID, area);
24175       } catch (err) {
24176         obj.locationSet = { include: ["Q2"] };
24177         obj.locationSetID = "+[Q2]";
24178       }
24179     }
24180     /**
24181      * _resolveLocationSet
24182      * Does everything that `_validateLocationSet()` does, but then "resolves" the locationSet into GeoJSON.
24183      * This step is a bit more computationally expensive, so really only needed if you intend to render the shape.
24184      *
24185      * Note: You need to call `_rebuildIndex()` after you're all finished validating the locationSets.
24186      *
24187      * @param  `obj`  Object to check, it should have `locationSet` property
24188      */
24189     _resolveLocationSet(obj) {
24190       this._validateLocationSet(obj);
24191       if (this._resolved.has(obj.locationSetID))
24192         return;
24193       try {
24194         const result = _loco.resolveLocationSet(obj.locationSet);
24195         const locationSetID = result.id;
24196         obj.locationSetID = locationSetID;
24197         if (!result.feature.geometry.coordinates.length || !result.feature.properties.area) {
24198           throw new Error(`locationSet ${locationSetID} resolves to an empty feature.`);
24199         }
24200         let geojson = JSON.parse(JSON.stringify(result.feature));
24201         geojson.id = locationSetID;
24202         geojson.properties.id = locationSetID;
24203         this._resolved.set(locationSetID, geojson);
24204       } catch (err) {
24205         obj.locationSet = { include: ["Q2"] };
24206         obj.locationSetID = "+[Q2]";
24207       }
24208     }
24209     /**
24210      * _rebuildIndex
24211      * Rebuilds the whichPolygon index with whatever features have been resolved into GeoJSON.
24212      */
24213     _rebuildIndex() {
24214       this._wp = (0, import_which_polygon2.default)({ features: [...this._resolved.values()] });
24215     }
24216     /**
24217      * mergeCustomGeoJSON
24218      * Accepts a FeatureCollection-like object containing custom locations
24219      * Each feature must have a filename-like `id`, for example: `something.geojson`
24220      * {
24221      *   "type": "FeatureCollection"
24222      *   "features": [
24223      *     {
24224      *       "type": "Feature",
24225      *       "id": "philly_metro.geojson",
24226      *       "properties": { … },
24227      *       "geometry": { … }
24228      *     }
24229      *   ]
24230      * }
24231      *
24232      * @param  `fc`  FeatureCollection-like Object containing custom locations
24233      */
24234     mergeCustomGeoJSON(fc) {
24235       if (!fc || fc.type !== "FeatureCollection" || !Array.isArray(fc.features))
24236         return;
24237       fc.features.forEach((feature3) => {
24238         feature3.properties = feature3.properties || {};
24239         let props = feature3.properties;
24240         let id2 = feature3.id || props.id;
24241         if (!id2 || !/^\S+\.geojson$/i.test(id2))
24242           return;
24243         id2 = id2.toLowerCase();
24244         feature3.id = id2;
24245         props.id = id2;
24246         if (!props.area) {
24247           const area = import_geojson_area2.default.geometry(feature3.geometry) / 1e6;
24248           props.area = Number(area.toFixed(2));
24249         }
24250         _loco._cache[id2] = feature3;
24251       });
24252     }
24253     /**
24254      * mergeLocationSets
24255      * Accepts an Array of Objects containing `locationSet` properties:
24256      * [
24257      *  { id: 'preset1', locationSet: {…} },
24258      *  { id: 'preset2', locationSet: {…} },
24259      *  …
24260      * ]
24261      * After validating, the Objects will be decorated with a `locationSetID` property:
24262      * [
24263      *  { id: 'preset1', locationSet: {…}, locationSetID: '+[Q2]' },
24264      *  { id: 'preset2', locationSet: {…}, locationSetID: '+[Q30]' },
24265      *  …
24266      * ]
24267      *
24268      * @param  `objects`  Objects to check - they should have `locationSet` property
24269      * @return  Promise resolved true (this function used to be slow/async, now it's faster and sync)
24270      */
24271     mergeLocationSets(objects) {
24272       if (!Array.isArray(objects))
24273         return Promise.reject("nothing to do");
24274       objects.forEach((obj) => this._validateLocationSet(obj));
24275       this._rebuildIndex();
24276       return Promise.resolve(objects);
24277     }
24278     /**
24279      * locationSetID
24280      * Returns a locationSetID for a given locationSet (fallback to `+[Q2]`, world)
24281      * (The locationSet doesn't necessarily need to be resolved to compute its `id`)
24282      *
24283      * @param  `locationSet`  A locationSet Object, e.g. `{ include: ['us'] }`
24284      * @return  String locationSetID, e.g. `+[Q30]`
24285      */
24286     locationSetID(locationSet) {
24287       let locationSetID;
24288       try {
24289         locationSetID = _loco.validateLocationSet(locationSet).id;
24290       } catch (err) {
24291         locationSetID = "+[Q2]";
24292       }
24293       return locationSetID;
24294     }
24295     /**
24296      * feature
24297      * Returns the resolved GeoJSON feature for a given locationSetID (fallback to 'world')
24298      * A GeoJSON feature:
24299      * {
24300      *   type: 'Feature',
24301      *   id: '+[Q30]',
24302      *   properties: { id: '+[Q30]', area: 21817019.17, … },
24303      *   geometry: { … }
24304      * }
24305      *
24306      * @param  `locationSetID`  String identifier, e.g. `+[Q30]`
24307      * @return  GeoJSON object (fallback to world)
24308      */
24309     feature(locationSetID = "+[Q2]") {
24310       const feature3 = this._resolved.get(locationSetID);
24311       return feature3 || this._resolved.get("+[Q2]");
24312     }
24313     /**
24314      * locationSetsAt
24315      * Find all the locationSets valid at the given location.
24316      * Results include the area (in km²) to facilitate sorting.
24317      *
24318      * Object of locationSetIDs to areas (in km²)
24319      * {
24320      *   "+[Q2]": 511207893.3958111,
24321      *   "+[Q30]": 21817019.17,
24322      *   "+[new_jersey.geojson]": 22390.77,
24323      *   …
24324      * }
24325      *
24326      * @param  `loc`  `[lon,lat]` location to query, e.g. `[-74.4813, 40.7967]`
24327      * @return  Object of locationSetIDs valid at given location
24328      */
24329     locationSetsAt(loc) {
24330       let result = {};
24331       const hits = this._wp(loc, true) || [];
24332       const thiz = this;
24333       hits.forEach((prop) => {
24334         if (prop.id[0] !== "+")
24335           return;
24336         const locationSetID = prop.id;
24337         const area = thiz._knownLocationSets.get(locationSetID);
24338         if (area) {
24339           result[locationSetID] = area;
24340         }
24341       });
24342       hits.forEach((prop) => {
24343         if (prop.id[0] === "+")
24344           return;
24345         const locationID = prop.id;
24346         const included = thiz._locationIncludedIn.get(locationID);
24347         (included || []).forEach((locationSetID) => {
24348           const area = thiz._knownLocationSets.get(locationSetID);
24349           if (area) {
24350             result[locationSetID] = area;
24351           }
24352         });
24353       });
24354       hits.forEach((prop) => {
24355         if (prop.id[0] === "+")
24356           return;
24357         const locationID = prop.id;
24358         const excluded = thiz._locationExcludedIn.get(locationID);
24359         (excluded || []).forEach((locationSetID) => {
24360           delete result[locationSetID];
24361         });
24362       });
24363       return result;
24364     }
24365     // Direct access to the location-conflation resolver
24366     loco() {
24367       return _loco;
24368     }
24369   };
24370   var _sharedLocationManager = new LocationManager();
24371
24372   // node_modules/lodash-es/_freeGlobal.js
24373   var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
24374   var freeGlobal_default = freeGlobal;
24375
24376   // node_modules/lodash-es/_root.js
24377   var freeSelf = typeof self == "object" && self && self.Object === Object && self;
24378   var root2 = freeGlobal_default || freeSelf || Function("return this")();
24379   var root_default = root2;
24380
24381   // node_modules/lodash-es/_Symbol.js
24382   var Symbol2 = root_default.Symbol;
24383   var Symbol_default = Symbol2;
24384
24385   // node_modules/lodash-es/_getRawTag.js
24386   var objectProto = Object.prototype;
24387   var hasOwnProperty = objectProto.hasOwnProperty;
24388   var nativeObjectToString = objectProto.toString;
24389   var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
24390   function getRawTag(value) {
24391     var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
24392     try {
24393       value[symToStringTag] = void 0;
24394       var unmasked = true;
24395     } catch (e) {
24396     }
24397     var result = nativeObjectToString.call(value);
24398     if (unmasked) {
24399       if (isOwn) {
24400         value[symToStringTag] = tag;
24401       } else {
24402         delete value[symToStringTag];
24403       }
24404     }
24405     return result;
24406   }
24407   var getRawTag_default = getRawTag;
24408
24409   // node_modules/lodash-es/_objectToString.js
24410   var objectProto2 = Object.prototype;
24411   var nativeObjectToString2 = objectProto2.toString;
24412   function objectToString(value) {
24413     return nativeObjectToString2.call(value);
24414   }
24415   var objectToString_default = objectToString;
24416
24417   // node_modules/lodash-es/_baseGetTag.js
24418   var nullTag = "[object Null]";
24419   var undefinedTag = "[object Undefined]";
24420   var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
24421   function baseGetTag(value) {
24422     if (value == null) {
24423       return value === void 0 ? undefinedTag : nullTag;
24424     }
24425     return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value);
24426   }
24427   var baseGetTag_default = baseGetTag;
24428
24429   // node_modules/lodash-es/isObjectLike.js
24430   function isObjectLike(value) {
24431     return value != null && typeof value == "object";
24432   }
24433   var isObjectLike_default = isObjectLike;
24434
24435   // node_modules/lodash-es/isSymbol.js
24436   var symbolTag = "[object Symbol]";
24437   function isSymbol(value) {
24438     return typeof value == "symbol" || isObjectLike_default(value) && baseGetTag_default(value) == symbolTag;
24439   }
24440   var isSymbol_default = isSymbol;
24441
24442   // node_modules/lodash-es/_arrayMap.js
24443   function arrayMap(array2, iteratee) {
24444     var index = -1, length = array2 == null ? 0 : array2.length, result = Array(length);
24445     while (++index < length) {
24446       result[index] = iteratee(array2[index], index, array2);
24447     }
24448     return result;
24449   }
24450   var arrayMap_default = arrayMap;
24451
24452   // node_modules/lodash-es/isArray.js
24453   var isArray = Array.isArray;
24454   var isArray_default = isArray;
24455
24456   // node_modules/lodash-es/_baseToString.js
24457   var INFINITY = 1 / 0;
24458   var symbolProto = Symbol_default ? Symbol_default.prototype : void 0;
24459   var symbolToString = symbolProto ? symbolProto.toString : void 0;
24460   function baseToString(value) {
24461     if (typeof value == "string") {
24462       return value;
24463     }
24464     if (isArray_default(value)) {
24465       return arrayMap_default(value, baseToString) + "";
24466     }
24467     if (isSymbol_default(value)) {
24468       return symbolToString ? symbolToString.call(value) : "";
24469     }
24470     var result = value + "";
24471     return result == "0" && 1 / value == -INFINITY ? "-0" : result;
24472   }
24473   var baseToString_default = baseToString;
24474
24475   // node_modules/lodash-es/_trimmedEndIndex.js
24476   var reWhitespace = /\s/;
24477   function trimmedEndIndex(string) {
24478     var index = string.length;
24479     while (index-- && reWhitespace.test(string.charAt(index))) {
24480     }
24481     return index;
24482   }
24483   var trimmedEndIndex_default = trimmedEndIndex;
24484
24485   // node_modules/lodash-es/_baseTrim.js
24486   var reTrimStart = /^\s+/;
24487   function baseTrim(string) {
24488     return string ? string.slice(0, trimmedEndIndex_default(string) + 1).replace(reTrimStart, "") : string;
24489   }
24490   var baseTrim_default = baseTrim;
24491
24492   // node_modules/lodash-es/isObject.js
24493   function isObject(value) {
24494     var type2 = typeof value;
24495     return value != null && (type2 == "object" || type2 == "function");
24496   }
24497   var isObject_default = isObject;
24498
24499   // node_modules/lodash-es/toNumber.js
24500   var NAN = 0 / 0;
24501   var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
24502   var reIsBinary = /^0b[01]+$/i;
24503   var reIsOctal = /^0o[0-7]+$/i;
24504   var freeParseInt = parseInt;
24505   function toNumber(value) {
24506     if (typeof value == "number") {
24507       return value;
24508     }
24509     if (isSymbol_default(value)) {
24510       return NAN;
24511     }
24512     if (isObject_default(value)) {
24513       var other = typeof value.valueOf == "function" ? value.valueOf() : value;
24514       value = isObject_default(other) ? other + "" : other;
24515     }
24516     if (typeof value != "string") {
24517       return value === 0 ? value : +value;
24518     }
24519     value = baseTrim_default(value);
24520     var isBinary = reIsBinary.test(value);
24521     return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
24522   }
24523   var toNumber_default = toNumber;
24524
24525   // node_modules/lodash-es/isFunction.js
24526   var asyncTag = "[object AsyncFunction]";
24527   var funcTag = "[object Function]";
24528   var genTag = "[object GeneratorFunction]";
24529   var proxyTag = "[object Proxy]";
24530   function isFunction(value) {
24531     if (!isObject_default(value)) {
24532       return false;
24533     }
24534     var tag = baseGetTag_default(value);
24535     return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
24536   }
24537   var isFunction_default = isFunction;
24538
24539   // node_modules/lodash-es/_coreJsData.js
24540   var coreJsData = root_default["__core-js_shared__"];
24541   var coreJsData_default = coreJsData;
24542
24543   // node_modules/lodash-es/_isMasked.js
24544   var maskSrcKey = function() {
24545     var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || "");
24546     return uid ? "Symbol(src)_1." + uid : "";
24547   }();
24548   function isMasked(func) {
24549     return !!maskSrcKey && maskSrcKey in func;
24550   }
24551   var isMasked_default = isMasked;
24552
24553   // node_modules/lodash-es/_toSource.js
24554   var funcProto = Function.prototype;
24555   var funcToString = funcProto.toString;
24556   function toSource(func) {
24557     if (func != null) {
24558       try {
24559         return funcToString.call(func);
24560       } catch (e) {
24561       }
24562       try {
24563         return func + "";
24564       } catch (e) {
24565       }
24566     }
24567     return "";
24568   }
24569   var toSource_default = toSource;
24570
24571   // node_modules/lodash-es/_baseIsNative.js
24572   var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
24573   var reIsHostCtor = /^\[object .+?Constructor\]$/;
24574   var funcProto2 = Function.prototype;
24575   var objectProto3 = Object.prototype;
24576   var funcToString2 = funcProto2.toString;
24577   var hasOwnProperty2 = objectProto3.hasOwnProperty;
24578   var reIsNative = RegExp(
24579     "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
24580   );
24581   function baseIsNative(value) {
24582     if (!isObject_default(value) || isMasked_default(value)) {
24583       return false;
24584     }
24585     var pattern = isFunction_default(value) ? reIsNative : reIsHostCtor;
24586     return pattern.test(toSource_default(value));
24587   }
24588   var baseIsNative_default = baseIsNative;
24589
24590   // node_modules/lodash-es/_getValue.js
24591   function getValue(object, key) {
24592     return object == null ? void 0 : object[key];
24593   }
24594   var getValue_default = getValue;
24595
24596   // node_modules/lodash-es/_getNative.js
24597   function getNative(object, key) {
24598     var value = getValue_default(object, key);
24599     return baseIsNative_default(value) ? value : void 0;
24600   }
24601   var getNative_default = getNative;
24602
24603   // node_modules/lodash-es/_WeakMap.js
24604   var WeakMap = getNative_default(root_default, "WeakMap");
24605   var WeakMap_default = WeakMap;
24606
24607   // node_modules/lodash-es/_isIndex.js
24608   var MAX_SAFE_INTEGER = 9007199254740991;
24609   var reIsUint = /^(?:0|[1-9]\d*)$/;
24610   function isIndex(value, length) {
24611     var type2 = typeof value;
24612     length = length == null ? MAX_SAFE_INTEGER : length;
24613     return !!length && (type2 == "number" || type2 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
24614   }
24615   var isIndex_default = isIndex;
24616
24617   // node_modules/lodash-es/eq.js
24618   function eq(value, other) {
24619     return value === other || value !== value && other !== other;
24620   }
24621   var eq_default = eq;
24622
24623   // node_modules/lodash-es/isLength.js
24624   var MAX_SAFE_INTEGER2 = 9007199254740991;
24625   function isLength(value) {
24626     return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER2;
24627   }
24628   var isLength_default = isLength;
24629
24630   // node_modules/lodash-es/isArrayLike.js
24631   function isArrayLike(value) {
24632     return value != null && isLength_default(value.length) && !isFunction_default(value);
24633   }
24634   var isArrayLike_default = isArrayLike;
24635
24636   // node_modules/lodash-es/_isPrototype.js
24637   var objectProto4 = Object.prototype;
24638   function isPrototype(value) {
24639     var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto4;
24640     return value === proto;
24641   }
24642   var isPrototype_default = isPrototype;
24643
24644   // node_modules/lodash-es/_baseTimes.js
24645   function baseTimes(n2, iteratee) {
24646     var index = -1, result = Array(n2);
24647     while (++index < n2) {
24648       result[index] = iteratee(index);
24649     }
24650     return result;
24651   }
24652   var baseTimes_default = baseTimes;
24653
24654   // node_modules/lodash-es/_baseIsArguments.js
24655   var argsTag = "[object Arguments]";
24656   function baseIsArguments(value) {
24657     return isObjectLike_default(value) && baseGetTag_default(value) == argsTag;
24658   }
24659   var baseIsArguments_default = baseIsArguments;
24660
24661   // node_modules/lodash-es/isArguments.js
24662   var objectProto5 = Object.prototype;
24663   var hasOwnProperty3 = objectProto5.hasOwnProperty;
24664   var propertyIsEnumerable = objectProto5.propertyIsEnumerable;
24665   var isArguments = baseIsArguments_default(function() {
24666     return arguments;
24667   }()) ? baseIsArguments_default : function(value) {
24668     return isObjectLike_default(value) && hasOwnProperty3.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
24669   };
24670   var isArguments_default = isArguments;
24671
24672   // node_modules/lodash-es/stubFalse.js
24673   function stubFalse() {
24674     return false;
24675   }
24676   var stubFalse_default = stubFalse;
24677
24678   // node_modules/lodash-es/isBuffer.js
24679   var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
24680   var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
24681   var moduleExports = freeModule && freeModule.exports === freeExports;
24682   var Buffer2 = moduleExports ? root_default.Buffer : void 0;
24683   var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
24684   var isBuffer = nativeIsBuffer || stubFalse_default;
24685   var isBuffer_default = isBuffer;
24686
24687   // node_modules/lodash-es/_baseIsTypedArray.js
24688   var argsTag2 = "[object Arguments]";
24689   var arrayTag = "[object Array]";
24690   var boolTag = "[object Boolean]";
24691   var dateTag = "[object Date]";
24692   var errorTag = "[object Error]";
24693   var funcTag2 = "[object Function]";
24694   var mapTag = "[object Map]";
24695   var numberTag = "[object Number]";
24696   var objectTag = "[object Object]";
24697   var regexpTag = "[object RegExp]";
24698   var setTag = "[object Set]";
24699   var stringTag = "[object String]";
24700   var weakMapTag = "[object WeakMap]";
24701   var arrayBufferTag = "[object ArrayBuffer]";
24702   var dataViewTag = "[object DataView]";
24703   var float32Tag = "[object Float32Array]";
24704   var float64Tag = "[object Float64Array]";
24705   var int8Tag = "[object Int8Array]";
24706   var int16Tag = "[object Int16Array]";
24707   var int32Tag = "[object Int32Array]";
24708   var uint8Tag = "[object Uint8Array]";
24709   var uint8ClampedTag = "[object Uint8ClampedArray]";
24710   var uint16Tag = "[object Uint16Array]";
24711   var uint32Tag = "[object Uint32Array]";
24712   var typedArrayTags = {};
24713   typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
24714   typedArrayTags[argsTag2] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag2] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
24715   function baseIsTypedArray(value) {
24716     return isObjectLike_default(value) && isLength_default(value.length) && !!typedArrayTags[baseGetTag_default(value)];
24717   }
24718   var baseIsTypedArray_default = baseIsTypedArray;
24719
24720   // node_modules/lodash-es/_baseUnary.js
24721   function baseUnary(func) {
24722     return function(value) {
24723       return func(value);
24724     };
24725   }
24726   var baseUnary_default = baseUnary;
24727
24728   // node_modules/lodash-es/_nodeUtil.js
24729   var freeExports2 = typeof exports == "object" && exports && !exports.nodeType && exports;
24730   var freeModule2 = freeExports2 && typeof module == "object" && module && !module.nodeType && module;
24731   var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
24732   var freeProcess = moduleExports2 && freeGlobal_default.process;
24733   var nodeUtil = function() {
24734     try {
24735       var types = freeModule2 && freeModule2.require && freeModule2.require("util").types;
24736       if (types) {
24737         return types;
24738       }
24739       return freeProcess && freeProcess.binding && freeProcess.binding("util");
24740     } catch (e) {
24741     }
24742   }();
24743   var nodeUtil_default = nodeUtil;
24744
24745   // node_modules/lodash-es/isTypedArray.js
24746   var nodeIsTypedArray = nodeUtil_default && nodeUtil_default.isTypedArray;
24747   var isTypedArray = nodeIsTypedArray ? baseUnary_default(nodeIsTypedArray) : baseIsTypedArray_default;
24748   var isTypedArray_default = isTypedArray;
24749
24750   // node_modules/lodash-es/_arrayLikeKeys.js
24751   var objectProto6 = Object.prototype;
24752   var hasOwnProperty4 = objectProto6.hasOwnProperty;
24753   function arrayLikeKeys(value, inherited) {
24754     var isArr = isArray_default(value), isArg = !isArr && isArguments_default(value), isBuff = !isArr && !isArg && isBuffer_default(value), isType = !isArr && !isArg && !isBuff && isTypedArray_default(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes_default(value.length, String) : [], length = result.length;
24755     for (var key in value) {
24756       if ((inherited || hasOwnProperty4.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
24757       (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
24758       isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
24759       isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
24760       isIndex_default(key, length)))) {
24761         result.push(key);
24762       }
24763     }
24764     return result;
24765   }
24766   var arrayLikeKeys_default = arrayLikeKeys;
24767
24768   // node_modules/lodash-es/_overArg.js
24769   function overArg(func, transform2) {
24770     return function(arg) {
24771       return func(transform2(arg));
24772     };
24773   }
24774   var overArg_default = overArg;
24775
24776   // node_modules/lodash-es/_nativeKeys.js
24777   var nativeKeys = overArg_default(Object.keys, Object);
24778   var nativeKeys_default = nativeKeys;
24779
24780   // node_modules/lodash-es/_baseKeys.js
24781   var objectProto7 = Object.prototype;
24782   var hasOwnProperty5 = objectProto7.hasOwnProperty;
24783   function baseKeys(object) {
24784     if (!isPrototype_default(object)) {
24785       return nativeKeys_default(object);
24786     }
24787     var result = [];
24788     for (var key in Object(object)) {
24789       if (hasOwnProperty5.call(object, key) && key != "constructor") {
24790         result.push(key);
24791       }
24792     }
24793     return result;
24794   }
24795   var baseKeys_default = baseKeys;
24796
24797   // node_modules/lodash-es/keys.js
24798   function keys(object) {
24799     return isArrayLike_default(object) ? arrayLikeKeys_default(object) : baseKeys_default(object);
24800   }
24801   var keys_default = keys;
24802
24803   // node_modules/lodash-es/_nativeCreate.js
24804   var nativeCreate = getNative_default(Object, "create");
24805   var nativeCreate_default = nativeCreate;
24806
24807   // node_modules/lodash-es/_hashClear.js
24808   function hashClear() {
24809     this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {};
24810     this.size = 0;
24811   }
24812   var hashClear_default = hashClear;
24813
24814   // node_modules/lodash-es/_hashDelete.js
24815   function hashDelete(key) {
24816     var result = this.has(key) && delete this.__data__[key];
24817     this.size -= result ? 1 : 0;
24818     return result;
24819   }
24820   var hashDelete_default = hashDelete;
24821
24822   // node_modules/lodash-es/_hashGet.js
24823   var HASH_UNDEFINED = "__lodash_hash_undefined__";
24824   var objectProto8 = Object.prototype;
24825   var hasOwnProperty6 = objectProto8.hasOwnProperty;
24826   function hashGet(key) {
24827     var data = this.__data__;
24828     if (nativeCreate_default) {
24829       var result = data[key];
24830       return result === HASH_UNDEFINED ? void 0 : result;
24831     }
24832     return hasOwnProperty6.call(data, key) ? data[key] : void 0;
24833   }
24834   var hashGet_default = hashGet;
24835
24836   // node_modules/lodash-es/_hashHas.js
24837   var objectProto9 = Object.prototype;
24838   var hasOwnProperty7 = objectProto9.hasOwnProperty;
24839   function hashHas(key) {
24840     var data = this.__data__;
24841     return nativeCreate_default ? data[key] !== void 0 : hasOwnProperty7.call(data, key);
24842   }
24843   var hashHas_default = hashHas;
24844
24845   // node_modules/lodash-es/_hashSet.js
24846   var HASH_UNDEFINED2 = "__lodash_hash_undefined__";
24847   function hashSet(key, value) {
24848     var data = this.__data__;
24849     this.size += this.has(key) ? 0 : 1;
24850     data[key] = nativeCreate_default && value === void 0 ? HASH_UNDEFINED2 : value;
24851     return this;
24852   }
24853   var hashSet_default = hashSet;
24854
24855   // node_modules/lodash-es/_Hash.js
24856   function Hash(entries) {
24857     var index = -1, length = entries == null ? 0 : entries.length;
24858     this.clear();
24859     while (++index < length) {
24860       var entry = entries[index];
24861       this.set(entry[0], entry[1]);
24862     }
24863   }
24864   Hash.prototype.clear = hashClear_default;
24865   Hash.prototype["delete"] = hashDelete_default;
24866   Hash.prototype.get = hashGet_default;
24867   Hash.prototype.has = hashHas_default;
24868   Hash.prototype.set = hashSet_default;
24869   var Hash_default = Hash;
24870
24871   // node_modules/lodash-es/_listCacheClear.js
24872   function listCacheClear() {
24873     this.__data__ = [];
24874     this.size = 0;
24875   }
24876   var listCacheClear_default = listCacheClear;
24877
24878   // node_modules/lodash-es/_assocIndexOf.js
24879   function assocIndexOf(array2, key) {
24880     var length = array2.length;
24881     while (length--) {
24882       if (eq_default(array2[length][0], key)) {
24883         return length;
24884       }
24885     }
24886     return -1;
24887   }
24888   var assocIndexOf_default = assocIndexOf;
24889
24890   // node_modules/lodash-es/_listCacheDelete.js
24891   var arrayProto = Array.prototype;
24892   var splice = arrayProto.splice;
24893   function listCacheDelete(key) {
24894     var data = this.__data__, index = assocIndexOf_default(data, key);
24895     if (index < 0) {
24896       return false;
24897     }
24898     var lastIndex = data.length - 1;
24899     if (index == lastIndex) {
24900       data.pop();
24901     } else {
24902       splice.call(data, index, 1);
24903     }
24904     --this.size;
24905     return true;
24906   }
24907   var listCacheDelete_default = listCacheDelete;
24908
24909   // node_modules/lodash-es/_listCacheGet.js
24910   function listCacheGet(key) {
24911     var data = this.__data__, index = assocIndexOf_default(data, key);
24912     return index < 0 ? void 0 : data[index][1];
24913   }
24914   var listCacheGet_default = listCacheGet;
24915
24916   // node_modules/lodash-es/_listCacheHas.js
24917   function listCacheHas(key) {
24918     return assocIndexOf_default(this.__data__, key) > -1;
24919   }
24920   var listCacheHas_default = listCacheHas;
24921
24922   // node_modules/lodash-es/_listCacheSet.js
24923   function listCacheSet(key, value) {
24924     var data = this.__data__, index = assocIndexOf_default(data, key);
24925     if (index < 0) {
24926       ++this.size;
24927       data.push([key, value]);
24928     } else {
24929       data[index][1] = value;
24930     }
24931     return this;
24932   }
24933   var listCacheSet_default = listCacheSet;
24934
24935   // node_modules/lodash-es/_ListCache.js
24936   function ListCache(entries) {
24937     var index = -1, length = entries == null ? 0 : entries.length;
24938     this.clear();
24939     while (++index < length) {
24940       var entry = entries[index];
24941       this.set(entry[0], entry[1]);
24942     }
24943   }
24944   ListCache.prototype.clear = listCacheClear_default;
24945   ListCache.prototype["delete"] = listCacheDelete_default;
24946   ListCache.prototype.get = listCacheGet_default;
24947   ListCache.prototype.has = listCacheHas_default;
24948   ListCache.prototype.set = listCacheSet_default;
24949   var ListCache_default = ListCache;
24950
24951   // node_modules/lodash-es/_Map.js
24952   var Map2 = getNative_default(root_default, "Map");
24953   var Map_default = Map2;
24954
24955   // node_modules/lodash-es/_mapCacheClear.js
24956   function mapCacheClear() {
24957     this.size = 0;
24958     this.__data__ = {
24959       "hash": new Hash_default(),
24960       "map": new (Map_default || ListCache_default)(),
24961       "string": new Hash_default()
24962     };
24963   }
24964   var mapCacheClear_default = mapCacheClear;
24965
24966   // node_modules/lodash-es/_isKeyable.js
24967   function isKeyable(value) {
24968     var type2 = typeof value;
24969     return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
24970   }
24971   var isKeyable_default = isKeyable;
24972
24973   // node_modules/lodash-es/_getMapData.js
24974   function getMapData(map2, key) {
24975     var data = map2.__data__;
24976     return isKeyable_default(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
24977   }
24978   var getMapData_default = getMapData;
24979
24980   // node_modules/lodash-es/_mapCacheDelete.js
24981   function mapCacheDelete(key) {
24982     var result = getMapData_default(this, key)["delete"](key);
24983     this.size -= result ? 1 : 0;
24984     return result;
24985   }
24986   var mapCacheDelete_default = mapCacheDelete;
24987
24988   // node_modules/lodash-es/_mapCacheGet.js
24989   function mapCacheGet(key) {
24990     return getMapData_default(this, key).get(key);
24991   }
24992   var mapCacheGet_default = mapCacheGet;
24993
24994   // node_modules/lodash-es/_mapCacheHas.js
24995   function mapCacheHas(key) {
24996     return getMapData_default(this, key).has(key);
24997   }
24998   var mapCacheHas_default = mapCacheHas;
24999
25000   // node_modules/lodash-es/_mapCacheSet.js
25001   function mapCacheSet(key, value) {
25002     var data = getMapData_default(this, key), size = data.size;
25003     data.set(key, value);
25004     this.size += data.size == size ? 0 : 1;
25005     return this;
25006   }
25007   var mapCacheSet_default = mapCacheSet;
25008
25009   // node_modules/lodash-es/_MapCache.js
25010   function MapCache(entries) {
25011     var index = -1, length = entries == null ? 0 : entries.length;
25012     this.clear();
25013     while (++index < length) {
25014       var entry = entries[index];
25015       this.set(entry[0], entry[1]);
25016     }
25017   }
25018   MapCache.prototype.clear = mapCacheClear_default;
25019   MapCache.prototype["delete"] = mapCacheDelete_default;
25020   MapCache.prototype.get = mapCacheGet_default;
25021   MapCache.prototype.has = mapCacheHas_default;
25022   MapCache.prototype.set = mapCacheSet_default;
25023   var MapCache_default = MapCache;
25024
25025   // node_modules/lodash-es/toString.js
25026   function toString(value) {
25027     return value == null ? "" : baseToString_default(value);
25028   }
25029   var toString_default = toString;
25030
25031   // node_modules/lodash-es/_arrayPush.js
25032   function arrayPush(array2, values) {
25033     var index = -1, length = values.length, offset = array2.length;
25034     while (++index < length) {
25035       array2[offset + index] = values[index];
25036     }
25037     return array2;
25038   }
25039   var arrayPush_default = arrayPush;
25040
25041   // node_modules/lodash-es/_basePropertyOf.js
25042   function basePropertyOf(object) {
25043     return function(key) {
25044       return object == null ? void 0 : object[key];
25045     };
25046   }
25047   var basePropertyOf_default = basePropertyOf;
25048
25049   // node_modules/lodash-es/_stackClear.js
25050   function stackClear() {
25051     this.__data__ = new ListCache_default();
25052     this.size = 0;
25053   }
25054   var stackClear_default = stackClear;
25055
25056   // node_modules/lodash-es/_stackDelete.js
25057   function stackDelete(key) {
25058     var data = this.__data__, result = data["delete"](key);
25059     this.size = data.size;
25060     return result;
25061   }
25062   var stackDelete_default = stackDelete;
25063
25064   // node_modules/lodash-es/_stackGet.js
25065   function stackGet(key) {
25066     return this.__data__.get(key);
25067   }
25068   var stackGet_default = stackGet;
25069
25070   // node_modules/lodash-es/_stackHas.js
25071   function stackHas(key) {
25072     return this.__data__.has(key);
25073   }
25074   var stackHas_default = stackHas;
25075
25076   // node_modules/lodash-es/_stackSet.js
25077   var LARGE_ARRAY_SIZE = 200;
25078   function stackSet(key, value) {
25079     var data = this.__data__;
25080     if (data instanceof ListCache_default) {
25081       var pairs = data.__data__;
25082       if (!Map_default || pairs.length < LARGE_ARRAY_SIZE - 1) {
25083         pairs.push([key, value]);
25084         this.size = ++data.size;
25085         return this;
25086       }
25087       data = this.__data__ = new MapCache_default(pairs);
25088     }
25089     data.set(key, value);
25090     this.size = data.size;
25091     return this;
25092   }
25093   var stackSet_default = stackSet;
25094
25095   // node_modules/lodash-es/_Stack.js
25096   function Stack(entries) {
25097     var data = this.__data__ = new ListCache_default(entries);
25098     this.size = data.size;
25099   }
25100   Stack.prototype.clear = stackClear_default;
25101   Stack.prototype["delete"] = stackDelete_default;
25102   Stack.prototype.get = stackGet_default;
25103   Stack.prototype.has = stackHas_default;
25104   Stack.prototype.set = stackSet_default;
25105   var Stack_default = Stack;
25106
25107   // node_modules/lodash-es/_arrayFilter.js
25108   function arrayFilter(array2, predicate) {
25109     var index = -1, length = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
25110     while (++index < length) {
25111       var value = array2[index];
25112       if (predicate(value, index, array2)) {
25113         result[resIndex++] = value;
25114       }
25115     }
25116     return result;
25117   }
25118   var arrayFilter_default = arrayFilter;
25119
25120   // node_modules/lodash-es/stubArray.js
25121   function stubArray() {
25122     return [];
25123   }
25124   var stubArray_default = stubArray;
25125
25126   // node_modules/lodash-es/_getSymbols.js
25127   var objectProto10 = Object.prototype;
25128   var propertyIsEnumerable2 = objectProto10.propertyIsEnumerable;
25129   var nativeGetSymbols = Object.getOwnPropertySymbols;
25130   var getSymbols = !nativeGetSymbols ? stubArray_default : function(object) {
25131     if (object == null) {
25132       return [];
25133     }
25134     object = Object(object);
25135     return arrayFilter_default(nativeGetSymbols(object), function(symbol) {
25136       return propertyIsEnumerable2.call(object, symbol);
25137     });
25138   };
25139   var getSymbols_default = getSymbols;
25140
25141   // node_modules/lodash-es/_baseGetAllKeys.js
25142   function baseGetAllKeys(object, keysFunc, symbolsFunc) {
25143     var result = keysFunc(object);
25144     return isArray_default(object) ? result : arrayPush_default(result, symbolsFunc(object));
25145   }
25146   var baseGetAllKeys_default = baseGetAllKeys;
25147
25148   // node_modules/lodash-es/_getAllKeys.js
25149   function getAllKeys(object) {
25150     return baseGetAllKeys_default(object, keys_default, getSymbols_default);
25151   }
25152   var getAllKeys_default = getAllKeys;
25153
25154   // node_modules/lodash-es/_DataView.js
25155   var DataView2 = getNative_default(root_default, "DataView");
25156   var DataView_default = DataView2;
25157
25158   // node_modules/lodash-es/_Promise.js
25159   var Promise2 = getNative_default(root_default, "Promise");
25160   var Promise_default = Promise2;
25161
25162   // node_modules/lodash-es/_Set.js
25163   var Set2 = getNative_default(root_default, "Set");
25164   var Set_default = Set2;
25165
25166   // node_modules/lodash-es/_getTag.js
25167   var mapTag2 = "[object Map]";
25168   var objectTag2 = "[object Object]";
25169   var promiseTag = "[object Promise]";
25170   var setTag2 = "[object Set]";
25171   var weakMapTag2 = "[object WeakMap]";
25172   var dataViewTag2 = "[object DataView]";
25173   var dataViewCtorString = toSource_default(DataView_default);
25174   var mapCtorString = toSource_default(Map_default);
25175   var promiseCtorString = toSource_default(Promise_default);
25176   var setCtorString = toSource_default(Set_default);
25177   var weakMapCtorString = toSource_default(WeakMap_default);
25178   var getTag = baseGetTag_default;
25179   if (DataView_default && getTag(new DataView_default(new ArrayBuffer(1))) != dataViewTag2 || Map_default && getTag(new Map_default()) != mapTag2 || Promise_default && getTag(Promise_default.resolve()) != promiseTag || Set_default && getTag(new Set_default()) != setTag2 || WeakMap_default && getTag(new WeakMap_default()) != weakMapTag2) {
25180     getTag = function(value) {
25181       var result = baseGetTag_default(value), Ctor = result == objectTag2 ? value.constructor : void 0, ctorString = Ctor ? toSource_default(Ctor) : "";
25182       if (ctorString) {
25183         switch (ctorString) {
25184           case dataViewCtorString:
25185             return dataViewTag2;
25186           case mapCtorString:
25187             return mapTag2;
25188           case promiseCtorString:
25189             return promiseTag;
25190           case setCtorString:
25191             return setTag2;
25192           case weakMapCtorString:
25193             return weakMapTag2;
25194         }
25195       }
25196       return result;
25197     };
25198   }
25199   var getTag_default = getTag;
25200
25201   // node_modules/lodash-es/_Uint8Array.js
25202   var Uint8Array2 = root_default.Uint8Array;
25203   var Uint8Array_default = Uint8Array2;
25204
25205   // node_modules/lodash-es/_setCacheAdd.js
25206   var HASH_UNDEFINED3 = "__lodash_hash_undefined__";
25207   function setCacheAdd(value) {
25208     this.__data__.set(value, HASH_UNDEFINED3);
25209     return this;
25210   }
25211   var setCacheAdd_default = setCacheAdd;
25212
25213   // node_modules/lodash-es/_setCacheHas.js
25214   function setCacheHas(value) {
25215     return this.__data__.has(value);
25216   }
25217   var setCacheHas_default = setCacheHas;
25218
25219   // node_modules/lodash-es/_SetCache.js
25220   function SetCache(values) {
25221     var index = -1, length = values == null ? 0 : values.length;
25222     this.__data__ = new MapCache_default();
25223     while (++index < length) {
25224       this.add(values[index]);
25225     }
25226   }
25227   SetCache.prototype.add = SetCache.prototype.push = setCacheAdd_default;
25228   SetCache.prototype.has = setCacheHas_default;
25229   var SetCache_default = SetCache;
25230
25231   // node_modules/lodash-es/_arraySome.js
25232   function arraySome(array2, predicate) {
25233     var index = -1, length = array2 == null ? 0 : array2.length;
25234     while (++index < length) {
25235       if (predicate(array2[index], index, array2)) {
25236         return true;
25237       }
25238     }
25239     return false;
25240   }
25241   var arraySome_default = arraySome;
25242
25243   // node_modules/lodash-es/_cacheHas.js
25244   function cacheHas(cache, key) {
25245     return cache.has(key);
25246   }
25247   var cacheHas_default = cacheHas;
25248
25249   // node_modules/lodash-es/_equalArrays.js
25250   var COMPARE_PARTIAL_FLAG = 1;
25251   var COMPARE_UNORDERED_FLAG = 2;
25252   function equalArrays(array2, other, bitmask, customizer, equalFunc, stack) {
25253     var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array2.length, othLength = other.length;
25254     if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
25255       return false;
25256     }
25257     var arrStacked = stack.get(array2);
25258     var othStacked = stack.get(other);
25259     if (arrStacked && othStacked) {
25260       return arrStacked == other && othStacked == array2;
25261     }
25262     var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache_default() : void 0;
25263     stack.set(array2, other);
25264     stack.set(other, array2);
25265     while (++index < arrLength) {
25266       var arrValue = array2[index], othValue = other[index];
25267       if (customizer) {
25268         var compared = isPartial ? customizer(othValue, arrValue, index, other, array2, stack) : customizer(arrValue, othValue, index, array2, other, stack);
25269       }
25270       if (compared !== void 0) {
25271         if (compared) {
25272           continue;
25273         }
25274         result = false;
25275         break;
25276       }
25277       if (seen) {
25278         if (!arraySome_default(other, function(othValue2, othIndex) {
25279           if (!cacheHas_default(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
25280             return seen.push(othIndex);
25281           }
25282         })) {
25283           result = false;
25284           break;
25285         }
25286       } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
25287         result = false;
25288         break;
25289       }
25290     }
25291     stack["delete"](array2);
25292     stack["delete"](other);
25293     return result;
25294   }
25295   var equalArrays_default = equalArrays;
25296
25297   // node_modules/lodash-es/_mapToArray.js
25298   function mapToArray(map2) {
25299     var index = -1, result = Array(map2.size);
25300     map2.forEach(function(value, key) {
25301       result[++index] = [key, value];
25302     });
25303     return result;
25304   }
25305   var mapToArray_default = mapToArray;
25306
25307   // node_modules/lodash-es/_setToArray.js
25308   function setToArray(set3) {
25309     var index = -1, result = Array(set3.size);
25310     set3.forEach(function(value) {
25311       result[++index] = value;
25312     });
25313     return result;
25314   }
25315   var setToArray_default = setToArray;
25316
25317   // node_modules/lodash-es/_equalByTag.js
25318   var COMPARE_PARTIAL_FLAG2 = 1;
25319   var COMPARE_UNORDERED_FLAG2 = 2;
25320   var boolTag2 = "[object Boolean]";
25321   var dateTag2 = "[object Date]";
25322   var errorTag2 = "[object Error]";
25323   var mapTag3 = "[object Map]";
25324   var numberTag2 = "[object Number]";
25325   var regexpTag2 = "[object RegExp]";
25326   var setTag3 = "[object Set]";
25327   var stringTag2 = "[object String]";
25328   var symbolTag2 = "[object Symbol]";
25329   var arrayBufferTag2 = "[object ArrayBuffer]";
25330   var dataViewTag3 = "[object DataView]";
25331   var symbolProto2 = Symbol_default ? Symbol_default.prototype : void 0;
25332   var symbolValueOf = symbolProto2 ? symbolProto2.valueOf : void 0;
25333   function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
25334     switch (tag) {
25335       case dataViewTag3:
25336         if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
25337           return false;
25338         }
25339         object = object.buffer;
25340         other = other.buffer;
25341       case arrayBufferTag2:
25342         if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array_default(object), new Uint8Array_default(other))) {
25343           return false;
25344         }
25345         return true;
25346       case boolTag2:
25347       case dateTag2:
25348       case numberTag2:
25349         return eq_default(+object, +other);
25350       case errorTag2:
25351         return object.name == other.name && object.message == other.message;
25352       case regexpTag2:
25353       case stringTag2:
25354         return object == other + "";
25355       case mapTag3:
25356         var convert = mapToArray_default;
25357       case setTag3:
25358         var isPartial = bitmask & COMPARE_PARTIAL_FLAG2;
25359         convert || (convert = setToArray_default);
25360         if (object.size != other.size && !isPartial) {
25361           return false;
25362         }
25363         var stacked = stack.get(object);
25364         if (stacked) {
25365           return stacked == other;
25366         }
25367         bitmask |= COMPARE_UNORDERED_FLAG2;
25368         stack.set(object, other);
25369         var result = equalArrays_default(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
25370         stack["delete"](object);
25371         return result;
25372       case symbolTag2:
25373         if (symbolValueOf) {
25374           return symbolValueOf.call(object) == symbolValueOf.call(other);
25375         }
25376     }
25377     return false;
25378   }
25379   var equalByTag_default = equalByTag;
25380
25381   // node_modules/lodash-es/_equalObjects.js
25382   var COMPARE_PARTIAL_FLAG3 = 1;
25383   var objectProto11 = Object.prototype;
25384   var hasOwnProperty8 = objectProto11.hasOwnProperty;
25385   function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
25386     var isPartial = bitmask & COMPARE_PARTIAL_FLAG3, objProps = getAllKeys_default(object), objLength = objProps.length, othProps = getAllKeys_default(other), othLength = othProps.length;
25387     if (objLength != othLength && !isPartial) {
25388       return false;
25389     }
25390     var index = objLength;
25391     while (index--) {
25392       var key = objProps[index];
25393       if (!(isPartial ? key in other : hasOwnProperty8.call(other, key))) {
25394         return false;
25395       }
25396     }
25397     var objStacked = stack.get(object);
25398     var othStacked = stack.get(other);
25399     if (objStacked && othStacked) {
25400       return objStacked == other && othStacked == object;
25401     }
25402     var result = true;
25403     stack.set(object, other);
25404     stack.set(other, object);
25405     var skipCtor = isPartial;
25406     while (++index < objLength) {
25407       key = objProps[index];
25408       var objValue = object[key], othValue = other[key];
25409       if (customizer) {
25410         var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
25411       }
25412       if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
25413         result = false;
25414         break;
25415       }
25416       skipCtor || (skipCtor = key == "constructor");
25417     }
25418     if (result && !skipCtor) {
25419       var objCtor = object.constructor, othCtor = other.constructor;
25420       if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
25421         result = false;
25422       }
25423     }
25424     stack["delete"](object);
25425     stack["delete"](other);
25426     return result;
25427   }
25428   var equalObjects_default = equalObjects;
25429
25430   // node_modules/lodash-es/_baseIsEqualDeep.js
25431   var COMPARE_PARTIAL_FLAG4 = 1;
25432   var argsTag3 = "[object Arguments]";
25433   var arrayTag2 = "[object Array]";
25434   var objectTag3 = "[object Object]";
25435   var objectProto12 = Object.prototype;
25436   var hasOwnProperty9 = objectProto12.hasOwnProperty;
25437   function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
25438     var objIsArr = isArray_default(object), othIsArr = isArray_default(other), objTag = objIsArr ? arrayTag2 : getTag_default(object), othTag = othIsArr ? arrayTag2 : getTag_default(other);
25439     objTag = objTag == argsTag3 ? objectTag3 : objTag;
25440     othTag = othTag == argsTag3 ? objectTag3 : othTag;
25441     var objIsObj = objTag == objectTag3, othIsObj = othTag == objectTag3, isSameTag = objTag == othTag;
25442     if (isSameTag && isBuffer_default(object)) {
25443       if (!isBuffer_default(other)) {
25444         return false;
25445       }
25446       objIsArr = true;
25447       objIsObj = false;
25448     }
25449     if (isSameTag && !objIsObj) {
25450       stack || (stack = new Stack_default());
25451       return objIsArr || isTypedArray_default(object) ? equalArrays_default(object, other, bitmask, customizer, equalFunc, stack) : equalByTag_default(object, other, objTag, bitmask, customizer, equalFunc, stack);
25452     }
25453     if (!(bitmask & COMPARE_PARTIAL_FLAG4)) {
25454       var objIsWrapped = objIsObj && hasOwnProperty9.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty9.call(other, "__wrapped__");
25455       if (objIsWrapped || othIsWrapped) {
25456         var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
25457         stack || (stack = new Stack_default());
25458         return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
25459       }
25460     }
25461     if (!isSameTag) {
25462       return false;
25463     }
25464     stack || (stack = new Stack_default());
25465     return equalObjects_default(object, other, bitmask, customizer, equalFunc, stack);
25466   }
25467   var baseIsEqualDeep_default = baseIsEqualDeep;
25468
25469   // node_modules/lodash-es/_baseIsEqual.js
25470   function baseIsEqual(value, other, bitmask, customizer, stack) {
25471     if (value === other) {
25472       return true;
25473     }
25474     if (value == null || other == null || !isObjectLike_default(value) && !isObjectLike_default(other)) {
25475       return value !== value && other !== other;
25476     }
25477     return baseIsEqualDeep_default(value, other, bitmask, customizer, baseIsEqual, stack);
25478   }
25479   var baseIsEqual_default = baseIsEqual;
25480
25481   // node_modules/lodash-es/now.js
25482   var now2 = function() {
25483     return root_default.Date.now();
25484   };
25485   var now_default = now2;
25486
25487   // node_modules/lodash-es/debounce.js
25488   var FUNC_ERROR_TEXT = "Expected a function";
25489   var nativeMax = Math.max;
25490   var nativeMin = Math.min;
25491   function debounce(func, wait, options2) {
25492     var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
25493     if (typeof func != "function") {
25494       throw new TypeError(FUNC_ERROR_TEXT);
25495     }
25496     wait = toNumber_default(wait) || 0;
25497     if (isObject_default(options2)) {
25498       leading = !!options2.leading;
25499       maxing = "maxWait" in options2;
25500       maxWait = maxing ? nativeMax(toNumber_default(options2.maxWait) || 0, wait) : maxWait;
25501       trailing = "trailing" in options2 ? !!options2.trailing : trailing;
25502     }
25503     function invokeFunc(time) {
25504       var args = lastArgs, thisArg = lastThis;
25505       lastArgs = lastThis = void 0;
25506       lastInvokeTime = time;
25507       result = func.apply(thisArg, args);
25508       return result;
25509     }
25510     function leadingEdge(time) {
25511       lastInvokeTime = time;
25512       timerId = setTimeout(timerExpired, wait);
25513       return leading ? invokeFunc(time) : result;
25514     }
25515     function remainingWait(time) {
25516       var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
25517       return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
25518     }
25519     function shouldInvoke(time) {
25520       var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
25521       return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
25522     }
25523     function timerExpired() {
25524       var time = now_default();
25525       if (shouldInvoke(time)) {
25526         return trailingEdge(time);
25527       }
25528       timerId = setTimeout(timerExpired, remainingWait(time));
25529     }
25530     function trailingEdge(time) {
25531       timerId = void 0;
25532       if (trailing && lastArgs) {
25533         return invokeFunc(time);
25534       }
25535       lastArgs = lastThis = void 0;
25536       return result;
25537     }
25538     function cancel() {
25539       if (timerId !== void 0) {
25540         clearTimeout(timerId);
25541       }
25542       lastInvokeTime = 0;
25543       lastArgs = lastCallTime = lastThis = timerId = void 0;
25544     }
25545     function flush() {
25546       return timerId === void 0 ? result : trailingEdge(now_default());
25547     }
25548     function debounced() {
25549       var time = now_default(), isInvoking = shouldInvoke(time);
25550       lastArgs = arguments;
25551       lastThis = this;
25552       lastCallTime = time;
25553       if (isInvoking) {
25554         if (timerId === void 0) {
25555           return leadingEdge(lastCallTime);
25556         }
25557         if (maxing) {
25558           clearTimeout(timerId);
25559           timerId = setTimeout(timerExpired, wait);
25560           return invokeFunc(lastCallTime);
25561         }
25562       }
25563       if (timerId === void 0) {
25564         timerId = setTimeout(timerExpired, wait);
25565       }
25566       return result;
25567     }
25568     debounced.cancel = cancel;
25569     debounced.flush = flush;
25570     return debounced;
25571   }
25572   var debounce_default = debounce;
25573
25574   // node_modules/lodash-es/_escapeHtmlChar.js
25575   var htmlEscapes = {
25576     "&": "&amp;",
25577     "<": "&lt;",
25578     ">": "&gt;",
25579     '"': "&quot;",
25580     "'": "&#39;"
25581   };
25582   var escapeHtmlChar = basePropertyOf_default(htmlEscapes);
25583   var escapeHtmlChar_default = escapeHtmlChar;
25584
25585   // node_modules/lodash-es/escape.js
25586   var reUnescapedHtml = /[&<>"']/g;
25587   var reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
25588   function escape2(string) {
25589     string = toString_default(string);
25590     return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar_default) : string;
25591   }
25592   var escape_default = escape2;
25593
25594   // node_modules/lodash-es/isEqual.js
25595   function isEqual(value, other) {
25596     return baseIsEqual_default(value, other);
25597   }
25598   var isEqual_default = isEqual;
25599
25600   // node_modules/lodash-es/throttle.js
25601   var FUNC_ERROR_TEXT2 = "Expected a function";
25602   function throttle(func, wait, options2) {
25603     var leading = true, trailing = true;
25604     if (typeof func != "function") {
25605       throw new TypeError(FUNC_ERROR_TEXT2);
25606     }
25607     if (isObject_default(options2)) {
25608       leading = "leading" in options2 ? !!options2.leading : leading;
25609       trailing = "trailing" in options2 ? !!options2.trailing : trailing;
25610     }
25611     return debounce_default(func, wait, {
25612       "leading": leading,
25613       "maxWait": wait,
25614       "trailing": trailing
25615     });
25616   }
25617   var throttle_default = throttle;
25618
25619   // node_modules/lodash-es/_unescapeHtmlChar.js
25620   var htmlUnescapes = {
25621     "&amp;": "&",
25622     "&lt;": "<",
25623     "&gt;": ">",
25624     "&quot;": '"',
25625     "&#39;": "'"
25626   };
25627   var unescapeHtmlChar = basePropertyOf_default(htmlUnescapes);
25628   var unescapeHtmlChar_default = unescapeHtmlChar;
25629
25630   // node_modules/lodash-es/unescape.js
25631   var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
25632   var reHasEscapedHtml = RegExp(reEscapedHtml.source);
25633   function unescape2(string) {
25634     string = toString_default(string);
25635     return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar_default) : string;
25636   }
25637   var unescape_default = unescape2;
25638
25639   // modules/util/detect.js
25640   var _detected;
25641   function utilDetect(refresh2) {
25642     if (_detected && !refresh2)
25643       return _detected;
25644     _detected = {};
25645     const ua = navigator.userAgent;
25646     let m = null;
25647     m = ua.match(/(edge)\/?\s*(\.?\d+(\.\d+)*)/i);
25648     if (m !== null) {
25649       _detected.browser = m[1];
25650       _detected.version = m[2];
25651     }
25652     if (!_detected.browser) {
25653       m = ua.match(/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/i);
25654       if (m !== null) {
25655         _detected.browser = "msie";
25656         _detected.version = m[1];
25657       }
25658     }
25659     if (!_detected.browser) {
25660       m = ua.match(/(opr)\/?\s*(\.?\d+(\.\d+)*)/i);
25661       if (m !== null) {
25662         _detected.browser = "Opera";
25663         _detected.version = m[2];
25664       }
25665     }
25666     if (!_detected.browser) {
25667       m = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
25668       if (m !== null) {
25669         _detected.browser = m[1];
25670         _detected.version = m[2];
25671         m = ua.match(/version\/([\.\d]+)/i);
25672         if (m !== null)
25673           _detected.version = m[1];
25674       }
25675     }
25676     if (!_detected.browser) {
25677       _detected.browser = navigator.appName;
25678       _detected.version = navigator.appVersion;
25679     }
25680     _detected.version = _detected.version.split(/\W/).slice(0, 2).join(".");
25681     _detected.opera = _detected.browser.toLowerCase() === "opera" && Number(_detected.version) < 15;
25682     if (_detected.browser.toLowerCase() === "msie") {
25683       _detected.ie = true;
25684       _detected.browser = "Internet Explorer";
25685       _detected.support = false;
25686     } else {
25687       _detected.ie = false;
25688       _detected.support = true;
25689     }
25690     _detected.filedrop = window.FileReader && "ondrop" in window;
25691     if (/Win/.test(ua)) {
25692       _detected.os = "win";
25693       _detected.platform = "Windows";
25694     } else if (/Mac/.test(ua)) {
25695       _detected.os = "mac";
25696       _detected.platform = "Macintosh";
25697     } else if (/X11/.test(ua) || /Linux/.test(ua)) {
25698       _detected.os = "linux";
25699       _detected.platform = "Linux";
25700     } else {
25701       _detected.os = "win";
25702       _detected.platform = "Unknown";
25703     }
25704     _detected.isMobileWebKit = (/\b(iPad|iPhone|iPod)\b/.test(ua) || // HACK: iPadOS 13+ requests desktop sites by default by using a Mac user agent,
25705     // so assume any "mac" with multitouch is actually iOS
25706     navigator.platform === "MacIntel" && "maxTouchPoints" in navigator && navigator.maxTouchPoints > 1) && /WebKit/.test(ua) && !/Edge/.test(ua) && !window.MSStream;
25707     _detected.browserLocales = Array.from(new Set(
25708       // remove duplicates
25709       [navigator.language].concat(navigator.languages || []).concat([
25710         // old property for backwards compatibility
25711         navigator.userLanguage
25712       ]).filter(Boolean)
25713     ));
25714     const loc = window.top.location;
25715     let origin = loc.origin;
25716     if (!origin) {
25717       origin = loc.protocol + "//" + loc.hostname + (loc.port ? ":" + loc.port : "");
25718     }
25719     _detected.host = origin + loc.pathname;
25720     return _detected;
25721   }
25722
25723   // modules/util/aes.js
25724   var import_aes_js = __toESM(require_aes_js());
25725   var DEFAULT_128 = [250, 157, 60, 79, 142, 134, 229, 129, 138, 126, 210, 129, 29, 71, 160, 208];
25726   function utilAesEncrypt(text2, key) {
25727     key = key || DEFAULT_128;
25728     const textBytes = import_aes_js.default.utils.utf8.toBytes(text2);
25729     const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
25730     const encryptedBytes = aesCtr.encrypt(textBytes);
25731     const encryptedHex = import_aes_js.default.utils.hex.fromBytes(encryptedBytes);
25732     return encryptedHex;
25733   }
25734   function utilAesDecrypt(encryptedHex, key) {
25735     key = key || DEFAULT_128;
25736     const encryptedBytes = import_aes_js.default.utils.hex.toBytes(encryptedHex);
25737     const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
25738     const decryptedBytes = aesCtr.decrypt(encryptedBytes);
25739     const text2 = import_aes_js.default.utils.utf8.fromBytes(decryptedBytes);
25740     return text2;
25741   }
25742
25743   // modules/util/clean_tags.js
25744   function utilCleanTags(tags) {
25745     var out = {};
25746     for (var k in tags) {
25747       if (!k)
25748         continue;
25749       var v = tags[k];
25750       if (v !== void 0) {
25751         out[k] = cleanValue(k, v);
25752       }
25753     }
25754     return out;
25755     function cleanValue(k2, v2) {
25756       function keepSpaces(k3) {
25757         return /_hours|_times|:conditional$/.test(k3);
25758       }
25759       function skip(k3) {
25760         return /^(description|note|fixme)$/.test(k3);
25761       }
25762       if (skip(k2))
25763         return v2;
25764       var cleaned = v2.split(";").map(function(s) {
25765         return s.trim();
25766       }).join(keepSpaces(k2) ? "; " : ";");
25767       if (k2.indexOf("website") !== -1 || k2.indexOf("email") !== -1 || cleaned.indexOf("http") === 0) {
25768         cleaned = cleaned.replace(/[\u200B-\u200F\uFEFF]/g, "");
25769       }
25770       return cleaned;
25771     }
25772   }
25773
25774   // modules/util/get_set_value.js
25775   function utilGetSetValue(selection2, value, shouldUpdate) {
25776     function setValue(value2, shouldUpdate2) {
25777       function valueNull() {
25778         delete this.value;
25779       }
25780       function valueConstant() {
25781         if (shouldUpdate2(this.value, value2)) {
25782           this.value = value2;
25783         }
25784       }
25785       function valueFunction() {
25786         var x = value2.apply(this, arguments);
25787         if (x === null || x === void 0) {
25788           delete this.value;
25789         } else if (shouldUpdate2(this.value, x)) {
25790           this.value = x;
25791         }
25792       }
25793       return value2 === null || value2 === void 0 ? valueNull : typeof value2 === "function" ? valueFunction : valueConstant;
25794     }
25795     function stickyCursor(func) {
25796       const supportedTypes = ["text", "search", "url", "tel", "password"];
25797       return function() {
25798         if (!supportedTypes.includes(this.type)) {
25799           return;
25800         }
25801         const cursor = { start: this.selectionStart, end: this.selectionEnd };
25802         func.apply(this, arguments);
25803         this.setSelectionRange(cursor.start, cursor.end);
25804       };
25805     }
25806     if (arguments.length === 1) {
25807       return selection2.property("value");
25808     }
25809     if (shouldUpdate === void 0) {
25810       shouldUpdate = (a, b) => a !== b;
25811     }
25812     return selection2.each(stickyCursor(setValue(value, shouldUpdate)));
25813   }
25814
25815   // modules/util/keybinding.js
25816   function utilKeybinding(namespace) {
25817     var _keybindings = {};
25818     function testBindings(d3_event, isCapturing) {
25819       var didMatch = false;
25820       var bindings = Object.keys(_keybindings).map(function(id2) {
25821         return _keybindings[id2];
25822       });
25823       var i2, binding;
25824       for (i2 = 0; i2 < bindings.length; i2++) {
25825         binding = bindings[i2];
25826         if (!binding.event.modifiers.shiftKey)
25827           continue;
25828         if (!!binding.capture !== isCapturing)
25829           continue;
25830         if (matches(d3_event, binding, true)) {
25831           binding.callback(d3_event);
25832           didMatch = true;
25833           break;
25834         }
25835       }
25836       if (didMatch)
25837         return;
25838       for (i2 = 0; i2 < bindings.length; i2++) {
25839         binding = bindings[i2];
25840         if (binding.event.modifiers.shiftKey)
25841           continue;
25842         if (!!binding.capture !== isCapturing)
25843           continue;
25844         if (matches(d3_event, binding, false)) {
25845           binding.callback(d3_event);
25846           break;
25847         }
25848       }
25849       function matches(d3_event2, binding2, testShift) {
25850         var event = d3_event2;
25851         var isMatch = false;
25852         var tryKeyCode = true;
25853         if (event.key !== void 0) {
25854           tryKeyCode = event.key.charCodeAt(0) > 127;
25855           isMatch = true;
25856           if (binding2.event.key === void 0) {
25857             isMatch = false;
25858           } else if (Array.isArray(binding2.event.key)) {
25859             if (binding2.event.key.map(function(s) {
25860               return s.toLowerCase();
25861             }).indexOf(event.key.toLowerCase()) === -1) {
25862               isMatch = false;
25863             }
25864           } else {
25865             if (event.key.toLowerCase() !== binding2.event.key.toLowerCase()) {
25866               isMatch = false;
25867             }
25868           }
25869         }
25870         if (!isMatch && (tryKeyCode || binding2.event.modifiers.altKey)) {
25871           isMatch = event.keyCode === binding2.event.keyCode;
25872         }
25873         if (!isMatch)
25874           return false;
25875         if (!(event.ctrlKey && event.altKey)) {
25876           if (event.ctrlKey !== binding2.event.modifiers.ctrlKey)
25877             return false;
25878           if (event.altKey !== binding2.event.modifiers.altKey)
25879             return false;
25880         }
25881         if (event.metaKey !== binding2.event.modifiers.metaKey)
25882           return false;
25883         if (testShift && event.shiftKey !== binding2.event.modifiers.shiftKey)
25884           return false;
25885         return true;
25886       }
25887     }
25888     function capture(d3_event) {
25889       testBindings(d3_event, true);
25890     }
25891     function bubble(d3_event) {
25892       var tagName = select_default2(d3_event.target).node().tagName;
25893       if (tagName === "INPUT" || tagName === "SELECT" || tagName === "TEXTAREA") {
25894         return;
25895       }
25896       testBindings(d3_event, false);
25897     }
25898     function keybinding(selection2) {
25899       selection2 = selection2 || select_default2(document);
25900       selection2.on("keydown.capture." + namespace, capture, true);
25901       selection2.on("keydown.bubble." + namespace, bubble, false);
25902       return keybinding;
25903     }
25904     keybinding.unbind = function(selection2) {
25905       _keybindings = [];
25906       selection2 = selection2 || select_default2(document);
25907       selection2.on("keydown.capture." + namespace, null);
25908       selection2.on("keydown.bubble." + namespace, null);
25909       return keybinding;
25910     };
25911     keybinding.clear = function() {
25912       _keybindings = {};
25913       return keybinding;
25914     };
25915     keybinding.off = function(codes, capture2) {
25916       var arr = utilArrayUniq([].concat(codes));
25917       for (var i2 = 0; i2 < arr.length; i2++) {
25918         var id2 = arr[i2] + (capture2 ? "-capture" : "-bubble");
25919         delete _keybindings[id2];
25920       }
25921       return keybinding;
25922     };
25923     keybinding.on = function(codes, callback, capture2) {
25924       if (typeof callback !== "function") {
25925         return keybinding.off(codes, capture2);
25926       }
25927       var arr = utilArrayUniq([].concat(codes));
25928       for (var i2 = 0; i2 < arr.length; i2++) {
25929         var id2 = arr[i2] + (capture2 ? "-capture" : "-bubble");
25930         var binding = {
25931           id: id2,
25932           capture: capture2,
25933           callback,
25934           event: {
25935             key: void 0,
25936             // preferred
25937             keyCode: 0,
25938             // fallback
25939             modifiers: {
25940               shiftKey: false,
25941               ctrlKey: false,
25942               altKey: false,
25943               metaKey: false
25944             }
25945           }
25946         };
25947         if (_keybindings[id2]) {
25948           console.warn('warning: duplicate keybinding for "' + id2 + '"');
25949         }
25950         _keybindings[id2] = binding;
25951         var matches = arr[i2].toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g);
25952         for (var j2 = 0; j2 < matches.length; j2++) {
25953           if (matches[j2] === "++")
25954             matches[j2] = "+";
25955           if (matches[j2] in utilKeybinding.modifierCodes) {
25956             var prop = utilKeybinding.modifierProperties[utilKeybinding.modifierCodes[matches[j2]]];
25957             binding.event.modifiers[prop] = true;
25958           } else {
25959             binding.event.key = utilKeybinding.keys[matches[j2]] || matches[j2];
25960             if (matches[j2] in utilKeybinding.keyCodes) {
25961               binding.event.keyCode = utilKeybinding.keyCodes[matches[j2]];
25962             }
25963           }
25964         }
25965       }
25966       return keybinding;
25967     };
25968     return keybinding;
25969   }
25970   utilKeybinding.modifierCodes = {
25971     // Shift key, ⇧
25972     "\u21E7": 16,
25973     shift: 16,
25974     // CTRL key, on Mac: ⌃
25975     "\u2303": 17,
25976     ctrl: 17,
25977     // ALT key, on Mac: ⌥ (Alt)
25978     "\u2325": 18,
25979     alt: 18,
25980     option: 18,
25981     // META, on Mac: ⌘ (CMD), on Windows (Win), on Linux (Super)
25982     "\u2318": 91,
25983     meta: 91,
25984     cmd: 91,
25985     "super": 91,
25986     win: 91
25987   };
25988   utilKeybinding.modifierProperties = {
25989     16: "shiftKey",
25990     17: "ctrlKey",
25991     18: "altKey",
25992     91: "metaKey"
25993   };
25994   utilKeybinding.plusKeys = ["plus", "ffplus", "=", "ffequals", "\u2260", "\xB1"];
25995   utilKeybinding.minusKeys = ["_", "-", "ffminus", "dash", "\u2013", "\u2014"];
25996   utilKeybinding.keys = {
25997     // Backspace key, on Mac: ⌫ (Backspace)
25998     "\u232B": "Backspace",
25999     backspace: "Backspace",
26000     // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
26001     "\u21E5": "Tab",
26002     "\u21C6": "Tab",
26003     tab: "Tab",
26004     // Return key, ↩
26005     "\u21A9": "Enter",
26006     "\u21B5": "Enter",
26007     "\u23CE": "Enter",
26008     "return": "Enter",
26009     enter: "Enter",
26010     "\u2305": "Enter",
26011     // Pause/Break key
26012     "pause": "Pause",
26013     "pause-break": "Pause",
26014     // Caps Lock key, ⇪
26015     "\u21EA": "CapsLock",
26016     caps: "CapsLock",
26017     "caps-lock": "CapsLock",
26018     // Escape key, on Mac: ⎋, on Windows: Esc
26019     "\u238B": ["Escape", "Esc"],
26020     escape: ["Escape", "Esc"],
26021     esc: ["Escape", "Esc"],
26022     // Space key
26023     space: [" ", "Spacebar"],
26024     // Page-Up key, or pgup, on Mac: ↖
26025     "\u2196": "PageUp",
26026     pgup: "PageUp",
26027     "page-up": "PageUp",
26028     // Page-Down key, or pgdown, on Mac: ↘
26029     "\u2198": "PageDown",
26030     pgdown: "PageDown",
26031     "page-down": "PageDown",
26032     // END key, on Mac: ⇟
26033     "\u21DF": "End",
26034     end: "End",
26035     // HOME key, on Mac: ⇞
26036     "\u21DE": "Home",
26037     home: "Home",
26038     // Insert key, or ins
26039     ins: "Insert",
26040     insert: "Insert",
26041     // Delete key, on Mac: ⌦ (Delete)
26042     "\u2326": ["Delete", "Del"],
26043     del: ["Delete", "Del"],
26044     "delete": ["Delete", "Del"],
26045     // Left Arrow Key, or ←
26046     "\u2190": ["ArrowLeft", "Left"],
26047     left: ["ArrowLeft", "Left"],
26048     "arrow-left": ["ArrowLeft", "Left"],
26049     // Up Arrow Key, or ↑
26050     "\u2191": ["ArrowUp", "Up"],
26051     up: ["ArrowUp", "Up"],
26052     "arrow-up": ["ArrowUp", "Up"],
26053     // Right Arrow Key, or →
26054     "\u2192": ["ArrowRight", "Right"],
26055     right: ["ArrowRight", "Right"],
26056     "arrow-right": ["ArrowRight", "Right"],
26057     // Up Arrow Key, or ↓
26058     "\u2193": ["ArrowDown", "Down"],
26059     down: ["ArrowDown", "Down"],
26060     "arrow-down": ["ArrowDown", "Down"],
26061     // odities, stuff for backward compatibility (browsers and code):
26062     // Num-Multiply, or *
26063     "*": ["*", "Multiply"],
26064     star: ["*", "Multiply"],
26065     asterisk: ["*", "Multiply"],
26066     multiply: ["*", "Multiply"],
26067     // Num-Plus or +
26068     "+": ["+", "Add"],
26069     "plus": ["+", "Add"],
26070     // Num-Subtract, or -
26071     "-": ["-", "Subtract"],
26072     subtract: ["-", "Subtract"],
26073     "dash": ["-", "Subtract"],
26074     // Semicolon
26075     semicolon: ";",
26076     // = or equals
26077     equals: "=",
26078     // Comma, or ,
26079     comma: ",",
26080     // Period, or ., or full-stop
26081     period: ".",
26082     "full-stop": ".",
26083     // Slash, or /, or forward-slash
26084     slash: "/",
26085     "forward-slash": "/",
26086     // Tick, or `, or back-quote
26087     tick: "`",
26088     "back-quote": "`",
26089     // Open bracket, or [
26090     "open-bracket": "[",
26091     // Back slash, or \
26092     "back-slash": "\\",
26093     // Close backet, or ]
26094     "close-bracket": "]",
26095     // Apostrophe, or Quote, or '
26096     quote: "'",
26097     apostrophe: "'",
26098     // NUMPAD 0-9
26099     "num-0": "0",
26100     "num-1": "1",
26101     "num-2": "2",
26102     "num-3": "3",
26103     "num-4": "4",
26104     "num-5": "5",
26105     "num-6": "6",
26106     "num-7": "7",
26107     "num-8": "8",
26108     "num-9": "9",
26109     // F1-F25
26110     f1: "F1",
26111     f2: "F2",
26112     f3: "F3",
26113     f4: "F4",
26114     f5: "F5",
26115     f6: "F6",
26116     f7: "F7",
26117     f8: "F8",
26118     f9: "F9",
26119     f10: "F10",
26120     f11: "F11",
26121     f12: "F12",
26122     f13: "F13",
26123     f14: "F14",
26124     f15: "F15",
26125     f16: "F16",
26126     f17: "F17",
26127     f18: "F18",
26128     f19: "F19",
26129     f20: "F20",
26130     f21: "F21",
26131     f22: "F22",
26132     f23: "F23",
26133     f24: "F24",
26134     f25: "F25"
26135   };
26136   utilKeybinding.keyCodes = {
26137     // Backspace key, on Mac: ⌫ (Backspace)
26138     "\u232B": 8,
26139     backspace: 8,
26140     // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
26141     "\u21E5": 9,
26142     "\u21C6": 9,
26143     tab: 9,
26144     // Return key, ↩
26145     "\u21A9": 13,
26146     "\u21B5": 13,
26147     "\u23CE": 13,
26148     "return": 13,
26149     enter: 13,
26150     "\u2305": 13,
26151     // Pause/Break key
26152     "pause": 19,
26153     "pause-break": 19,
26154     // Caps Lock key, ⇪
26155     "\u21EA": 20,
26156     caps: 20,
26157     "caps-lock": 20,
26158     // Escape key, on Mac: ⎋, on Windows: Esc
26159     "\u238B": 27,
26160     escape: 27,
26161     esc: 27,
26162     // Space key
26163     space: 32,
26164     // Page-Up key, or pgup, on Mac: ↖
26165     "\u2196": 33,
26166     pgup: 33,
26167     "page-up": 33,
26168     // Page-Down key, or pgdown, on Mac: ↘
26169     "\u2198": 34,
26170     pgdown: 34,
26171     "page-down": 34,
26172     // END key, on Mac: ⇟
26173     "\u21DF": 35,
26174     end: 35,
26175     // HOME key, on Mac: ⇞
26176     "\u21DE": 36,
26177     home: 36,
26178     // Insert key, or ins
26179     ins: 45,
26180     insert: 45,
26181     // Delete key, on Mac: ⌦ (Delete)
26182     "\u2326": 46,
26183     del: 46,
26184     "delete": 46,
26185     // Left Arrow Key, or ←
26186     "\u2190": 37,
26187     left: 37,
26188     "arrow-left": 37,
26189     // Up Arrow Key, or ↑
26190     "\u2191": 38,
26191     up: 38,
26192     "arrow-up": 38,
26193     // Right Arrow Key, or →
26194     "\u2192": 39,
26195     right: 39,
26196     "arrow-right": 39,
26197     // Up Arrow Key, or ↓
26198     "\u2193": 40,
26199     down: 40,
26200     "arrow-down": 40,
26201     // odities, printing characters that come out wrong:
26202     // Firefox Equals
26203     "ffequals": 61,
26204     // Num-Multiply, or *
26205     "*": 106,
26206     star: 106,
26207     asterisk: 106,
26208     multiply: 106,
26209     // Num-Plus or +
26210     "+": 107,
26211     "plus": 107,
26212     // Num-Subtract, or -
26213     "-": 109,
26214     subtract: 109,
26215     // Vertical Bar / Pipe
26216     "|": 124,
26217     // Firefox Plus
26218     "ffplus": 171,
26219     // Firefox Minus
26220     "ffminus": 173,
26221     // Semicolon
26222     ";": 186,
26223     semicolon: 186,
26224     // = or equals
26225     "=": 187,
26226     "equals": 187,
26227     // Comma, or ,
26228     ",": 188,
26229     comma: 188,
26230     // Dash / Underscore key
26231     "dash": 189,
26232     // Period, or ., or full-stop
26233     ".": 190,
26234     period: 190,
26235     "full-stop": 190,
26236     // Slash, or /, or forward-slash
26237     "/": 191,
26238     slash: 191,
26239     "forward-slash": 191,
26240     // Tick, or `, or back-quote
26241     "`": 192,
26242     tick: 192,
26243     "back-quote": 192,
26244     // Open bracket, or [
26245     "[": 219,
26246     "open-bracket": 219,
26247     // Back slash, or \
26248     "\\": 220,
26249     "back-slash": 220,
26250     // Close backet, or ]
26251     "]": 221,
26252     "close-bracket": 221,
26253     // Apostrophe, or Quote, or '
26254     "'": 222,
26255     quote: 222,
26256     apostrophe: 222
26257   };
26258   var i = 95;
26259   var n = 0;
26260   while (++i < 106) {
26261     utilKeybinding.keyCodes["num-" + n] = i;
26262     ++n;
26263   }
26264   i = 47;
26265   n = 0;
26266   while (++i < 58) {
26267     utilKeybinding.keyCodes[n] = i;
26268     ++n;
26269   }
26270   i = 111;
26271   n = 1;
26272   while (++i < 136) {
26273     utilKeybinding.keyCodes["f" + n] = i;
26274     ++n;
26275   }
26276   i = 64;
26277   while (++i < 91) {
26278     utilKeybinding.keyCodes[String.fromCharCode(i).toLowerCase()] = i;
26279   }
26280
26281   // modules/util/object.js
26282   function utilObjectOmit(obj, omitKeys) {
26283     return Object.keys(obj).reduce(function(result, key) {
26284       if (omitKeys.indexOf(key) === -1) {
26285         result[key] = obj[key];
26286       }
26287       return result;
26288     }, {});
26289   }
26290
26291   // modules/util/rebind.js
26292   function utilRebind(target, source) {
26293     var i2 = 1, n2 = arguments.length, method;
26294     while (++i2 < n2) {
26295       target[method = arguments[i2]] = d3_rebind(target, source, source[method]);
26296     }
26297     return target;
26298   }
26299   function d3_rebind(target, source, method) {
26300     return function() {
26301       var value = method.apply(source, arguments);
26302       return value === source ? target : value;
26303     };
26304   }
26305
26306   // modules/util/session_mutex.js
26307   function utilSessionMutex(name) {
26308     var mutex = {};
26309     var intervalID;
26310     function renew() {
26311       var expires = /* @__PURE__ */ new Date();
26312       expires.setSeconds(expires.getSeconds() + 5);
26313       document.cookie = name + "=1; expires=" + expires.toUTCString() + "; sameSite=strict";
26314     }
26315     mutex.lock = function() {
26316       if (intervalID)
26317         return true;
26318       var cookie = document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + name + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1");
26319       if (cookie)
26320         return false;
26321       renew();
26322       intervalID = window.setInterval(renew, 4e3);
26323       return true;
26324     };
26325     mutex.unlock = function() {
26326       if (!intervalID)
26327         return;
26328       document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; sameSite=strict";
26329       clearInterval(intervalID);
26330       intervalID = null;
26331     };
26332     mutex.locked = function() {
26333       return !!intervalID;
26334     };
26335     return mutex;
26336   }
26337
26338   // modules/util/tiler.js
26339   function utilTiler() {
26340     var _size = [256, 256];
26341     var _scale = 256;
26342     var _tileSize = 256;
26343     var _zoomExtent = [0, 20];
26344     var _translate = [_size[0] / 2, _size[1] / 2];
26345     var _margin = 0;
26346     var _skipNullIsland = false;
26347     function clamp3(num, min3, max3) {
26348       return Math.max(min3, Math.min(num, max3));
26349     }
26350     function nearNullIsland(tile) {
26351       var x = tile[0];
26352       var y = tile[1];
26353       var z = tile[2];
26354       if (z >= 7) {
26355         var center = Math.pow(2, z - 1);
26356         var width = Math.pow(2, z - 6);
26357         var min3 = center - width / 2;
26358         var max3 = center + width / 2 - 1;
26359         return x >= min3 && x <= max3 && y >= min3 && y <= max3;
26360       }
26361       return false;
26362     }
26363     function tiler8() {
26364       var z = geoScaleToZoom(_scale / (2 * Math.PI), _tileSize);
26365       var z0 = clamp3(Math.round(z), _zoomExtent[0], _zoomExtent[1]);
26366       var tileMin = 0;
26367       var tileMax = Math.pow(2, z0) - 1;
26368       var log2ts = Math.log(_tileSize) * Math.LOG2E;
26369       var k = Math.pow(2, z - z0 + log2ts);
26370       var origin = [
26371         (_translate[0] - _scale / 2) / k,
26372         (_translate[1] - _scale / 2) / k
26373       ];
26374       var cols = range(
26375         clamp3(Math.floor(-origin[0]) - _margin, tileMin, tileMax + 1),
26376         clamp3(Math.ceil(_size[0] / k - origin[0]) + _margin, tileMin, tileMax + 1)
26377       );
26378       var rows = range(
26379         clamp3(Math.floor(-origin[1]) - _margin, tileMin, tileMax + 1),
26380         clamp3(Math.ceil(_size[1] / k - origin[1]) + _margin, tileMin, tileMax + 1)
26381       );
26382       var tiles = [];
26383       for (var i2 = 0; i2 < rows.length; i2++) {
26384         var y = rows[i2];
26385         for (var j2 = 0; j2 < cols.length; j2++) {
26386           var x = cols[j2];
26387           if (i2 >= _margin && i2 <= rows.length - _margin && j2 >= _margin && j2 <= cols.length - _margin) {
26388             tiles.unshift([x, y, z0]);
26389           } else {
26390             tiles.push([x, y, z0]);
26391           }
26392         }
26393       }
26394       tiles.translate = origin;
26395       tiles.scale = k;
26396       return tiles;
26397     }
26398     tiler8.getTiles = function(projection2) {
26399       var origin = [
26400         projection2.scale() * Math.PI - projection2.translate()[0],
26401         projection2.scale() * Math.PI - projection2.translate()[1]
26402       ];
26403       this.size(projection2.clipExtent()[1]).scale(projection2.scale() * 2 * Math.PI).translate(projection2.translate());
26404       var tiles = tiler8();
26405       var ts = tiles.scale;
26406       return tiles.map(function(tile) {
26407         if (_skipNullIsland && nearNullIsland(tile)) {
26408           return false;
26409         }
26410         var x = tile[0] * ts - origin[0];
26411         var y = tile[1] * ts - origin[1];
26412         return {
26413           id: tile.toString(),
26414           xyz: tile,
26415           extent: geoExtent(
26416             projection2.invert([x, y + ts]),
26417             projection2.invert([x + ts, y])
26418           )
26419         };
26420       }).filter(Boolean);
26421     };
26422     tiler8.getGeoJSON = function(projection2) {
26423       var features = tiler8.getTiles(projection2).map(function(tile) {
26424         return {
26425           type: "Feature",
26426           properties: {
26427             id: tile.id,
26428             name: tile.id
26429           },
26430           geometry: {
26431             type: "Polygon",
26432             coordinates: [tile.extent.polygon()]
26433           }
26434         };
26435       });
26436       return {
26437         type: "FeatureCollection",
26438         features
26439       };
26440     };
26441     tiler8.tileSize = function(val) {
26442       if (!arguments.length)
26443         return _tileSize;
26444       _tileSize = val;
26445       return tiler8;
26446     };
26447     tiler8.zoomExtent = function(val) {
26448       if (!arguments.length)
26449         return _zoomExtent;
26450       _zoomExtent = val;
26451       return tiler8;
26452     };
26453     tiler8.size = function(val) {
26454       if (!arguments.length)
26455         return _size;
26456       _size = val;
26457       return tiler8;
26458     };
26459     tiler8.scale = function(val) {
26460       if (!arguments.length)
26461         return _scale;
26462       _scale = val;
26463       return tiler8;
26464     };
26465     tiler8.translate = function(val) {
26466       if (!arguments.length)
26467         return _translate;
26468       _translate = val;
26469       return tiler8;
26470     };
26471     tiler8.margin = function(val) {
26472       if (!arguments.length)
26473         return _margin;
26474       _margin = +val;
26475       return tiler8;
26476     };
26477     tiler8.skipNullIsland = function(val) {
26478       if (!arguments.length)
26479         return _skipNullIsland;
26480       _skipNullIsland = val;
26481       return tiler8;
26482     };
26483     return tiler8;
26484   }
26485
26486   // modules/util/trigger_event.js
26487   function utilTriggerEvent(target, type2) {
26488     target.each(function() {
26489       var evt = document.createEvent("HTMLEvents");
26490       evt.initEvent(type2, true, true);
26491       this.dispatchEvent(evt);
26492     });
26493   }
26494
26495   // modules/core/localizer.js
26496   var _mainLocalizer = coreLocalizer();
26497   var _t = _mainLocalizer.t;
26498   function coreLocalizer() {
26499     let localizer = {};
26500     let _dataLanguages = {};
26501     let _dataLocales = {};
26502     let _localeStrings = {};
26503     let _localeCode = "en-US";
26504     let _localeCodes = ["en-US", "en"];
26505     let _languageCode = "en";
26506     let _textDirection = "ltr";
26507     let _usesMetric = false;
26508     let _languageNames = {};
26509     let _scriptNames = {};
26510     localizer.localeCode = () => _localeCode;
26511     localizer.localeCodes = () => _localeCodes;
26512     localizer.languageCode = () => _languageCode;
26513     localizer.textDirection = () => _textDirection;
26514     localizer.usesMetric = () => _usesMetric;
26515     localizer.languageNames = () => _languageNames;
26516     localizer.scriptNames = () => _scriptNames;
26517     let _preferredLocaleCodes = [];
26518     localizer.preferredLocaleCodes = function(codes) {
26519       if (!arguments.length)
26520         return _preferredLocaleCodes;
26521       if (typeof codes === "string") {
26522         _preferredLocaleCodes = codes.split(/,|;| /gi).filter(Boolean);
26523       } else {
26524         _preferredLocaleCodes = codes;
26525       }
26526       return localizer;
26527     };
26528     var _loadPromise;
26529     localizer.ensureLoaded = () => {
26530       if (_loadPromise)
26531         return _loadPromise;
26532       let filesToFetch = [
26533         "languages",
26534         // load the list of languages
26535         "locales"
26536         // load the list of supported locales
26537       ];
26538       const localeDirs = {
26539         general: "locales",
26540         tagging: presetsCdnUrl + "dist/translations"
26541       };
26542       let fileMap = _mainFileFetcher.fileMap();
26543       for (let scopeId in localeDirs) {
26544         const key = `locales_index_${scopeId}`;
26545         if (!fileMap[key]) {
26546           fileMap[key] = localeDirs[scopeId] + "/index.min.json";
26547         }
26548         filesToFetch.push(key);
26549       }
26550       return _loadPromise = Promise.all(filesToFetch.map((key) => _mainFileFetcher.get(key))).then((results) => {
26551         _dataLanguages = results[0];
26552         _dataLocales = results[1];
26553         let indexes = results.slice(2);
26554         let requestedLocales = (_preferredLocaleCodes || []).concat(utilDetect().browserLocales).concat(["en"]);
26555         _localeCodes = localesToUseFrom(requestedLocales);
26556         _localeCode = _localeCodes[0];
26557         let loadStringsPromises = [];
26558         indexes.forEach((index, i2) => {
26559           const fullCoverageIndex = _localeCodes.findIndex(function(locale2) {
26560             return index[locale2] && index[locale2].pct === 1;
26561           });
26562           _localeCodes.slice(0, fullCoverageIndex + 1).forEach(function(code) {
26563             let scopeId = Object.keys(localeDirs)[i2];
26564             let directory = Object.values(localeDirs)[i2];
26565             if (index[code])
26566               loadStringsPromises.push(localizer.loadLocale(code, scopeId, directory));
26567           });
26568         });
26569         return Promise.all(loadStringsPromises);
26570       }).then(() => {
26571         updateForCurrentLocale();
26572       }).catch((err) => console.error(err));
26573     };
26574     function localesToUseFrom(requestedLocales) {
26575       let supportedLocales = _dataLocales;
26576       let toUse = [];
26577       for (let i2 in requestedLocales) {
26578         let locale2 = requestedLocales[i2];
26579         if (supportedLocales[locale2])
26580           toUse.push(locale2);
26581         if (locale2.includes("-")) {
26582           let langPart = locale2.split("-")[0];
26583           if (supportedLocales[langPart])
26584             toUse.push(langPart);
26585         }
26586       }
26587       return utilArrayUniq(toUse);
26588     }
26589     function updateForCurrentLocale() {
26590       if (!_localeCode)
26591         return;
26592       _languageCode = _localeCode.split("-")[0];
26593       const currentData = _dataLocales[_localeCode] || _dataLocales[_languageCode];
26594       const hash = utilStringQs(window.location.hash);
26595       if (hash.rtl === "true") {
26596         _textDirection = "rtl";
26597       } else if (hash.rtl === "false") {
26598         _textDirection = "ltr";
26599       } else {
26600         _textDirection = currentData && currentData.rtl ? "rtl" : "ltr";
26601       }
26602       let locale2 = _localeCode;
26603       if (locale2.toLowerCase() === "en-us")
26604         locale2 = "en";
26605       _languageNames = _localeStrings.general[locale2].languageNames || _localeStrings.general[_languageCode].languageNames;
26606       _scriptNames = _localeStrings.general[locale2].scriptNames || _localeStrings.general[_languageCode].scriptNames;
26607       _usesMetric = _localeCode.slice(-3).toLowerCase() !== "-us";
26608     }
26609     localizer.loadLocale = (locale2, scopeId, directory) => {
26610       if (locale2.toLowerCase() === "en-us")
26611         locale2 = "en";
26612       if (_localeStrings[scopeId] && _localeStrings[scopeId][locale2]) {
26613         return Promise.resolve(locale2);
26614       }
26615       let fileMap = _mainFileFetcher.fileMap();
26616       const key = `locale_${scopeId}_${locale2}`;
26617       if (!fileMap[key]) {
26618         fileMap[key] = `${directory}/${locale2}.min.json`;
26619       }
26620       return _mainFileFetcher.get(key).then((d) => {
26621         if (!_localeStrings[scopeId])
26622           _localeStrings[scopeId] = {};
26623         _localeStrings[scopeId][locale2] = d[locale2];
26624         return locale2;
26625       });
26626     };
26627     localizer.pluralRule = function(number3) {
26628       return pluralRule(number3, _localeCode);
26629     };
26630     function pluralRule(number3, localeCode) {
26631       const rules = "Intl" in window && Intl.PluralRules && new Intl.PluralRules(localeCode);
26632       if (rules) {
26633         return rules.select(number3);
26634       }
26635       if (number3 === 1)
26636         return "one";
26637       return "other";
26638     }
26639     localizer.tInfo = function(origStringId, replacements, locale2) {
26640       let stringId = origStringId.trim();
26641       let scopeId = "general";
26642       if (stringId[0] === "_") {
26643         let split = stringId.split(".");
26644         scopeId = split[0].slice(1);
26645         stringId = split.slice(1).join(".");
26646       }
26647       locale2 = locale2 || _localeCode;
26648       let path = stringId.split(".").map((s) => s.replace(/<TX_DOT>/g, ".")).reverse();
26649       let stringsKey = locale2;
26650       if (stringsKey.toLowerCase() === "en-us")
26651         stringsKey = "en";
26652       let result = _localeStrings && _localeStrings[scopeId] && _localeStrings[scopeId][stringsKey];
26653       while (result !== void 0 && path.length) {
26654         result = result[path.pop()];
26655       }
26656       if (result !== void 0) {
26657         if (replacements) {
26658           if (typeof result === "object" && Object.keys(result).length) {
26659             const number3 = Object.values(replacements).find(function(value) {
26660               return typeof value === "number";
26661             });
26662             if (number3 !== void 0) {
26663               const rule = pluralRule(number3, locale2);
26664               if (result[rule]) {
26665                 result = result[rule];
26666               } else {
26667                 result = Object.values(result)[0];
26668               }
26669             }
26670           }
26671           if (typeof result === "string") {
26672             for (let key in replacements) {
26673               let value = replacements[key];
26674               if (typeof value === "number") {
26675                 if (value.toLocaleString) {
26676                   value = value.toLocaleString(locale2, {
26677                     style: "decimal",
26678                     useGrouping: true,
26679                     minimumFractionDigits: 0
26680                   });
26681                 } else {
26682                   value = value.toString();
26683                 }
26684               }
26685               const token = `{${key}}`;
26686               const regex = new RegExp(token, "g");
26687               result = result.replace(regex, value);
26688             }
26689           }
26690         }
26691         if (typeof result === "string") {
26692           return {
26693             text: result,
26694             locale: locale2
26695           };
26696         }
26697       }
26698       let index = _localeCodes.indexOf(locale2);
26699       if (index >= 0 && index < _localeCodes.length - 1) {
26700         let fallback = _localeCodes[index + 1];
26701         return localizer.tInfo(origStringId, replacements, fallback);
26702       }
26703       if (replacements && "default" in replacements) {
26704         return {
26705           text: replacements.default,
26706           locale: null
26707         };
26708       }
26709       const missing = `Missing ${locale2} translation: ${origStringId}`;
26710       if (typeof console !== "undefined")
26711         console.error(missing);
26712       return {
26713         text: missing,
26714         locale: "en"
26715       };
26716     };
26717     localizer.hasTextForStringId = function(stringId) {
26718       return !!localizer.tInfo(stringId, { default: "nothing found" }).locale;
26719     };
26720     localizer.t = function(stringId, replacements, locale2) {
26721       return localizer.tInfo(stringId, replacements, locale2).text;
26722     };
26723     localizer.t.html = function(stringId, replacements, locale2) {
26724       replacements = Object.assign({}, replacements);
26725       for (var k in replacements) {
26726         if (typeof replacements[k] === "string") {
26727           replacements[k] = escape_default(replacements[k]);
26728         }
26729         if (typeof replacements[k] === "object" && typeof replacements[k].html === "string") {
26730           replacements[k] = replacements[k].html;
26731         }
26732       }
26733       const info = localizer.tInfo(stringId, replacements, locale2);
26734       if (info.text) {
26735         return `<span class="localized-text" lang="${info.locale || "und"}">${info.text}</span>`;
26736       } else {
26737         return "";
26738       }
26739     };
26740     localizer.t.append = function(stringId, replacements, locale2) {
26741       const ret = function(selection2) {
26742         const info = localizer.tInfo(stringId, replacements, locale2);
26743         return selection2.append("span").attr("class", "localized-text").attr("lang", info.locale || "und").text((replacements && replacements.prefix || "") + info.text + (replacements && replacements.suffix || ""));
26744       };
26745       ret.stringId = stringId;
26746       return ret;
26747     };
26748     localizer.languageName = (code, options2) => {
26749       if (_languageNames && _languageNames[code]) {
26750         return _languageNames[code];
26751       }
26752       if (options2 && options2.localOnly)
26753         return null;
26754       const langInfo = _dataLanguages[code];
26755       if (langInfo) {
26756         if (langInfo.nativeName) {
26757           return localizer.t("translate.language_and_code", { language: langInfo.nativeName, code });
26758         } else if (langInfo.base && langInfo.script) {
26759           const base = langInfo.base;
26760           if (_languageNames && _languageNames[base]) {
26761             const scriptCode = langInfo.script;
26762             const script = _scriptNames && _scriptNames[scriptCode] || scriptCode;
26763             return localizer.t("translate.language_and_code", { language: _languageNames[base], code: script });
26764           } else if (_dataLanguages[base] && _dataLanguages[base].nativeName) {
26765             return localizer.t("translate.language_and_code", { language: _dataLanguages[base].nativeName, code });
26766           }
26767         }
26768       }
26769       return code;
26770     };
26771     localizer.floatFormatter = (locale2) => {
26772       if (!("Intl" in window && "NumberFormat" in Intl && "formatToParts" in Intl.NumberFormat.prototype)) {
26773         return (number3, fractionDigits) => {
26774           return fractionDigits === void 0 ? number3.toString() : number3.toFixed(fractionDigits);
26775         };
26776       } else {
26777         return (number3, fractionDigits) => number3.toLocaleString(locale2, {
26778           minimumFractionDigits: fractionDigits,
26779           maximumFractionDigits: fractionDigits === void 0 ? 20 : fractionDigits
26780         });
26781       }
26782     };
26783     localizer.floatParser = (locale2) => {
26784       const polyfill = (string) => +string.trim();
26785       if (!("Intl" in window && "NumberFormat" in Intl))
26786         return polyfill;
26787       const format2 = new Intl.NumberFormat(locale2, { maximumFractionDigits: 20 });
26788       if (!("formatToParts" in format2))
26789         return polyfill;
26790       const parts = format2.formatToParts(-12345.6);
26791       const numerals = Array.from({ length: 10 }).map((_, i2) => format2.format(i2));
26792       const index = new Map(numerals.map((d, i2) => [d, i2]));
26793       const literalPart = parts.find((d) => d.type === "literal");
26794       const literal = literalPart && new RegExp(`[${literalPart.value}]`, "g");
26795       const groupPart = parts.find((d) => d.type === "group");
26796       const group = groupPart && new RegExp(`[${groupPart.value}]`, "g");
26797       const decimalPart = parts.find((d) => d.type === "decimal");
26798       const decimal = decimalPart && new RegExp(`[${decimalPart.value}]`);
26799       const numeral = new RegExp(`[${numerals.join("")}]`, "g");
26800       const getIndex = (d) => index.get(d);
26801       return (string) => {
26802         string = string.trim();
26803         if (literal)
26804           string = string.replace(literal, "");
26805         if (group)
26806           string = string.replace(group, "");
26807         if (decimal)
26808           string = string.replace(decimal, ".");
26809         string = string.replace(numeral, getIndex);
26810         return string ? +string : NaN;
26811       };
26812     };
26813     localizer.decimalPlaceCounter = (locale2) => {
26814       var literal, group, decimal;
26815       if ("Intl" in window && "NumberFormat" in Intl) {
26816         const format2 = new Intl.NumberFormat(locale2, { maximumFractionDigits: 20 });
26817         if ("formatToParts" in format2) {
26818           const parts = format2.formatToParts(-12345.6);
26819           const literalPart = parts.find((d) => d.type === "literal");
26820           literal = literalPart && new RegExp(`[${literalPart.value}]`, "g");
26821           const groupPart = parts.find((d) => d.type === "group");
26822           group = groupPart && new RegExp(`[${groupPart.value}]`, "g");
26823           const decimalPart = parts.find((d) => d.type === "decimal");
26824           decimal = decimalPart && new RegExp(`[${decimalPart.value}]`);
26825         }
26826       }
26827       return (string) => {
26828         string = string.trim();
26829         if (literal)
26830           string = string.replace(literal, "");
26831         if (group)
26832           string = string.replace(group, "");
26833         const parts = string.split(decimal || ".");
26834         return parts && parts[1] && parts[1].length || 0;
26835       };
26836     };
26837     return localizer;
26838   }
26839
26840   // modules/presets/collection.js
26841   function presetCollection(collection) {
26842     const MAXRESULTS = 50;
26843     let _this = {};
26844     let _memo = {};
26845     _this.collection = collection;
26846     _this.item = (id2) => {
26847       if (_memo[id2])
26848         return _memo[id2];
26849       const found = _this.collection.find((d) => d.id === id2);
26850       if (found)
26851         _memo[id2] = found;
26852       return found;
26853     };
26854     _this.index = (id2) => _this.collection.findIndex((d) => d.id === id2);
26855     _this.matchGeometry = (geometry) => {
26856       return presetCollection(
26857         _this.collection.filter((d) => d.matchGeometry(geometry))
26858       );
26859     };
26860     _this.matchAllGeometry = (geometries) => {
26861       return presetCollection(
26862         _this.collection.filter((d) => d && d.matchAllGeometry(geometries))
26863       );
26864     };
26865     _this.matchAnyGeometry = (geometries) => {
26866       return presetCollection(
26867         _this.collection.filter((d) => geometries.some((geom) => d.matchGeometry(geom)))
26868       );
26869     };
26870     _this.fallback = (geometry) => {
26871       let id2 = geometry;
26872       if (id2 === "vertex")
26873         id2 = "point";
26874       return _this.item(id2);
26875     };
26876     _this.search = (value, geometry, loc) => {
26877       if (!value)
26878         return _this;
26879       value = value.toLowerCase().trim();
26880       function leading(a) {
26881         const index = a.indexOf(value);
26882         return index === 0 || a[index - 1] === " ";
26883       }
26884       function leadingStrict(a) {
26885         const index = a.indexOf(value);
26886         return index === 0;
26887       }
26888       function sortPresets(nameProp, aliasesProp) {
26889         return function sortNames(a, b) {
26890           let aCompare = a[nameProp]();
26891           let bCompare = b[nameProp]();
26892           if (aliasesProp) {
26893             const findMatchingAlias = (strings) => {
26894               if (strings.some((s) => s === value)) {
26895                 return strings.find((s) => s === value);
26896               } else {
26897                 return strings.filter((s) => s.includes(value)).sort((a2, b2) => a2.length - b2.length)[0];
26898               }
26899             };
26900             aCompare = findMatchingAlias([aCompare].concat(a[aliasesProp]()));
26901             bCompare = findMatchingAlias([bCompare].concat(b[aliasesProp]()));
26902           }
26903           if (value === aCompare)
26904             return -1;
26905           if (value === bCompare)
26906             return 1;
26907           let i2 = b.originalScore - a.originalScore;
26908           if (i2 !== 0)
26909             return i2;
26910           i2 = aCompare.indexOf(value) - bCompare.indexOf(value);
26911           if (i2 !== 0)
26912             return i2;
26913           return aCompare.length - bCompare.length;
26914         };
26915       }
26916       let pool = _this.collection;
26917       if (Array.isArray(loc)) {
26918         const validHere = _sharedLocationManager.locationSetsAt(loc);
26919         pool = pool.filter((a) => !a.locationSetID || validHere[a.locationSetID]);
26920       }
26921       const searchable = pool.filter((a) => a.searchable !== false && a.suggestion !== true);
26922       const suggestions = pool.filter((a) => a.suggestion === true);
26923       const leadingNames = searchable.filter((a) => leading(a.searchName()) || a.searchAliases().some(leading)).sort(sortPresets("searchName", "searchAliases"));
26924       const leadingSuggestions = suggestions.filter((a) => leadingStrict(a.searchName())).sort(sortPresets("searchName"));
26925       const leadingNamesStripped = searchable.filter((a) => leading(a.searchNameStripped()) || a.searchAliasesStripped().some(leading)).sort(sortPresets("searchNameStripped", "searchAliasesStripped"));
26926       const leadingSuggestionsStripped = suggestions.filter((a) => leadingStrict(a.searchNameStripped())).sort(sortPresets("searchNameStripped"));
26927       const leadingTerms = searchable.filter((a) => (a.terms() || []).some(leading));
26928       const leadingSuggestionTerms = suggestions.filter((a) => (a.terms() || []).some(leading));
26929       const leadingTagValues = searchable.filter((a) => Object.values(a.tags || {}).filter((val) => val !== "*").some(leading));
26930       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);
26931       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);
26932       const similarTerms = searchable.filter((a) => {
26933         return (a.terms() || []).some((b) => {
26934           return utilEditDistance(value, b) + Math.min(value.length - b.length, 0) < 3;
26935         });
26936       });
26937       let leadingTagKeyValues = [];
26938       if (value.includes("=")) {
26939         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]))));
26940       }
26941       let results = leadingNames.concat(
26942         leadingSuggestions,
26943         leadingNamesStripped,
26944         leadingSuggestionsStripped,
26945         leadingTerms,
26946         leadingSuggestionTerms,
26947         leadingTagValues,
26948         similarName,
26949         similarSuggestions,
26950         similarTerms,
26951         leadingTagKeyValues
26952       ).slice(0, MAXRESULTS - 1);
26953       if (geometry) {
26954         if (typeof geometry === "string") {
26955           results.push(_this.fallback(geometry));
26956         } else {
26957           geometry.forEach((geom) => results.push(_this.fallback(geom)));
26958         }
26959       }
26960       return presetCollection(utilArrayUniq(results));
26961     };
26962     return _this;
26963   }
26964
26965   // modules/presets/category.js
26966   function presetCategory(categoryID, category, allPresets) {
26967     let _this = Object.assign({}, category);
26968     let _searchName;
26969     let _searchNameStripped;
26970     _this.id = categoryID;
26971     _this.members = presetCollection(
26972       (category.members || []).map((presetID) => allPresets[presetID]).filter(Boolean)
26973     );
26974     _this.geometry = _this.members.collection.reduce((acc, preset) => {
26975       for (let i2 in preset.geometry) {
26976         const geometry = preset.geometry[i2];
26977         if (acc.indexOf(geometry) === -1) {
26978           acc.push(geometry);
26979         }
26980       }
26981       return acc;
26982     }, []);
26983     _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
26984     _this.matchAllGeometry = (geometries) => _this.members.collection.some((preset) => preset.matchAllGeometry(geometries));
26985     _this.matchScore = () => -1;
26986     _this.name = () => _t(`_tagging.presets.categories.${categoryID}.name`, { "default": categoryID });
26987     _this.nameLabel = () => _t.append(`_tagging.presets.categories.${categoryID}.name`, { "default": categoryID });
26988     _this.terms = () => [];
26989     _this.searchName = () => {
26990       if (!_searchName) {
26991         _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
26992       }
26993       return _searchName;
26994     };
26995     _this.searchNameStripped = () => {
26996       if (!_searchNameStripped) {
26997         _searchNameStripped = _this.searchName();
26998         if (_searchNameStripped.normalize)
26999           _searchNameStripped = _searchNameStripped.normalize("NFD");
27000         _searchNameStripped = _searchNameStripped.replace(/[\u0300-\u036f]/g, "");
27001       }
27002       return _searchNameStripped;
27003     };
27004     _this.searchAliases = () => [];
27005     _this.searchAliasesStripped = () => [];
27006     return _this;
27007   }
27008
27009   // modules/presets/field.js
27010   function presetField(fieldID, field, allFields) {
27011     allFields = allFields || {};
27012     let _this = Object.assign({}, field);
27013     _this.id = fieldID;
27014     _this.safeid = utilSafeClassName(fieldID);
27015     _this.matchGeometry = (geom) => !_this.geometry || _this.geometry.indexOf(geom) !== -1;
27016     _this.matchAllGeometry = (geometries) => {
27017       return !_this.geometry || geometries.every((geom) => _this.geometry.indexOf(geom) !== -1);
27018     };
27019     _this.t = (scope, options2) => _t(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
27020     _this.t.html = (scope, options2) => _t.html(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
27021     _this.t.append = (scope, options2) => _t.append(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
27022     _this.hasTextForStringId = (scope) => _mainLocalizer.hasTextForStringId(`_tagging.presets.fields.${fieldID}.${scope}`);
27023     _this.resolveReference = (which) => {
27024       const referenceRegex = /^\{(.*)\}$/;
27025       const match = (field[which] || "").match(referenceRegex);
27026       if (match) {
27027         const field2 = allFields[match[1]];
27028         if (field2) {
27029           return field2;
27030         }
27031         console.error(`Unable to resolve referenced field: ${match[1]}`);
27032       }
27033       return _this;
27034     };
27035     _this.title = () => _this.overrideLabel || _this.resolveReference("label").t("label", { "default": fieldID });
27036     _this.label = () => _this.overrideLabel ? (selection2) => selection2.text(_this.overrideLabel) : _this.resolveReference("label").t.append("label", { "default": fieldID });
27037     _this.placeholder = () => _this.resolveReference("placeholder").t("placeholder", { "default": "" });
27038     _this.originalTerms = (_this.terms || []).join();
27039     _this.terms = () => _this.resolveReference("label").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
27040     _this.increment = _this.type === "number" ? _this.increment || 1 : void 0;
27041     return _this;
27042   }
27043
27044   // modules/presets/preset.js
27045   var import_lodash = __toESM(require_lodash());
27046   function presetPreset(presetID, preset, addable, allFields, allPresets) {
27047     allFields = allFields || {};
27048     allPresets = allPresets || {};
27049     let _this = Object.assign({}, preset);
27050     let _addable = addable || false;
27051     let _searchName;
27052     let _searchNameStripped;
27053     let _searchAliases;
27054     let _searchAliasesStripped;
27055     const referenceRegex = /^\{(.*)\}$/;
27056     _this.id = presetID;
27057     _this.safeid = utilSafeClassName(presetID);
27058     _this.originalTerms = (_this.terms || []).join();
27059     _this.originalName = _this.name || "";
27060     _this.originalAliases = (_this.aliases || []).join("\n");
27061     _this.originalScore = _this.matchScore || 1;
27062     _this.originalReference = _this.reference || {};
27063     _this.originalFields = _this.fields || [];
27064     _this.originalMoreFields = _this.moreFields || [];
27065     _this.fields = (loc) => resolveFields("fields", loc);
27066     _this.moreFields = (loc) => resolveFields("moreFields", loc);
27067     _this.tags = _this.tags || {};
27068     _this.addTags = _this.addTags || _this.tags;
27069     _this.removeTags = _this.removeTags || _this.addTags;
27070     _this.geometry = _this.geometry || [];
27071     _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
27072     _this.matchAllGeometry = (geoms) => geoms.every(_this.matchGeometry);
27073     _this.matchScore = (entityTags) => {
27074       const tags = _this.tags;
27075       let seen = {};
27076       let score = 0;
27077       for (let k in tags) {
27078         seen[k] = true;
27079         if (entityTags[k] === tags[k]) {
27080           score += _this.originalScore;
27081         } else if (tags[k] === "*" && k in entityTags) {
27082           score += _this.originalScore / 2;
27083         } else {
27084           return -1;
27085         }
27086       }
27087       const addTags = _this.addTags;
27088       for (let k in addTags) {
27089         if (!seen[k] && entityTags[k] === addTags[k]) {
27090           score += _this.originalScore;
27091         }
27092       }
27093       if (_this.searchable === false) {
27094         score *= 0.999;
27095       }
27096       return score;
27097     };
27098     _this.t = (scope, options2) => {
27099       const textID = `_tagging.presets.presets.${presetID}.${scope}`;
27100       return _t(textID, options2);
27101     };
27102     _this.t.append = (scope, options2) => {
27103       const textID = `_tagging.presets.presets.${presetID}.${scope}`;
27104       return _t.append(textID, options2);
27105     };
27106     function resolveReference(which) {
27107       const match = (_this[which] || "").match(referenceRegex);
27108       if (match) {
27109         const preset2 = allPresets[match[1]];
27110         if (preset2) {
27111           return preset2;
27112         }
27113         console.error(`Unable to resolve referenced preset: ${match[1]}`);
27114       }
27115       return _this;
27116     }
27117     _this.name = () => {
27118       return resolveReference("originalName").t("name", { "default": _this.originalName || presetID });
27119     };
27120     _this.nameLabel = () => {
27121       return resolveReference("originalName").t.append("name", { "default": _this.originalName || presetID });
27122     };
27123     _this.subtitle = () => {
27124       if (_this.suggestion) {
27125         let path = presetID.split("/");
27126         path.pop();
27127         return _t("_tagging.presets.presets." + path.join("/") + ".name");
27128       }
27129       return null;
27130     };
27131     _this.subtitleLabel = () => {
27132       if (_this.suggestion) {
27133         let path = presetID.split("/");
27134         path.pop();
27135         return _t.append("_tagging.presets.presets." + path.join("/") + ".name");
27136       }
27137       return null;
27138     };
27139     _this.aliases = () => {
27140       return resolveReference("originalName").t("aliases", { "default": _this.originalAliases }).trim().split(/\s*[\r\n]+\s*/);
27141     };
27142     _this.terms = () => {
27143       return resolveReference("originalName").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
27144     };
27145     _this.searchName = () => {
27146       if (!_searchName) {
27147         _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
27148       }
27149       return _searchName;
27150     };
27151     _this.searchNameStripped = () => {
27152       if (!_searchNameStripped) {
27153         _searchNameStripped = stripDiacritics(_this.searchName());
27154       }
27155       return _searchNameStripped;
27156     };
27157     _this.searchAliases = () => {
27158       if (!_searchAliases) {
27159         _searchAliases = _this.aliases().map((alias) => alias.toLowerCase());
27160       }
27161       return _searchAliases;
27162     };
27163     _this.searchAliasesStripped = () => {
27164       if (!_searchAliasesStripped) {
27165         _searchAliasesStripped = _this.searchAliases();
27166         _searchAliasesStripped = _searchAliasesStripped.map(stripDiacritics);
27167       }
27168       return _searchAliasesStripped;
27169     };
27170     _this.isFallback = () => {
27171       const tagCount = Object.keys(_this.tags).length;
27172       return tagCount === 0 || tagCount === 1 && _this.tags.hasOwnProperty("area");
27173     };
27174     _this.addable = function(val) {
27175       if (!arguments.length)
27176         return _addable;
27177       _addable = val;
27178       return _this;
27179     };
27180     _this.reference = () => {
27181       const qid = _this.tags.wikidata || _this.tags["flag:wikidata"] || _this.tags["brand:wikidata"] || _this.tags["network:wikidata"] || _this.tags["operator:wikidata"];
27182       if (qid) {
27183         return { qid };
27184       }
27185       let key = _this.originalReference.key || Object.keys(utilObjectOmit(_this.tags, "name"))[0];
27186       let value = _this.originalReference.value || _this.tags[key];
27187       if (value === "*") {
27188         return { key };
27189       } else {
27190         return { key, value };
27191       }
27192     };
27193     _this.unsetTags = (tags, geometry, ignoringKeys, skipFieldDefaults, loc) => {
27194       let removeTags = ignoringKeys ? utilObjectOmit(_this.removeTags, ignoringKeys) : _this.removeTags;
27195       tags = utilObjectOmit(tags, Object.keys(removeTags));
27196       if (geometry && !skipFieldDefaults) {
27197         _this.fields(loc).forEach((field) => {
27198           if (field.matchGeometry(geometry) && field.key && field.default === tags[field.key] && (!ignoringKeys || ignoringKeys.indexOf(field.key) === -1)) {
27199             delete tags[field.key];
27200           }
27201         });
27202       }
27203       delete tags.area;
27204       return tags;
27205     };
27206     _this.setTags = (tags, geometry, skipFieldDefaults, loc) => {
27207       const addTags = _this.addTags;
27208       tags = Object.assign({}, tags);
27209       for (let k in addTags) {
27210         if (addTags[k] === "*") {
27211           if (_this.tags[k] || !tags[k]) {
27212             tags[k] = "yes";
27213           }
27214         } else {
27215           tags[k] = addTags[k];
27216         }
27217       }
27218       if (!addTags.hasOwnProperty("area")) {
27219         delete tags.area;
27220         if (geometry === "area") {
27221           let needsAreaTag = true;
27222           for (let k in addTags) {
27223             if (_this.geometry.indexOf("line") === -1 && k in osmAreaKeys || k in osmAreaKeysExceptions && addTags[k] in osmAreaKeysExceptions[k]) {
27224               needsAreaTag = false;
27225               break;
27226             }
27227           }
27228           if (needsAreaTag) {
27229             tags.area = "yes";
27230           }
27231         }
27232       }
27233       if (geometry && !skipFieldDefaults) {
27234         _this.fields(loc).forEach((field) => {
27235           if (field.matchGeometry(geometry) && field.key && !tags[field.key] && field.default) {
27236             tags[field.key] = field.default;
27237           }
27238         });
27239       }
27240       return tags;
27241     };
27242     function resolveFields(which, loc) {
27243       const fieldIDs = which === "fields" ? _this.originalFields : _this.originalMoreFields;
27244       let resolved = [];
27245       fieldIDs.forEach((fieldID) => {
27246         const match = fieldID.match(referenceRegex);
27247         if (match !== null) {
27248           resolved = resolved.concat(inheritFields(allPresets[match[1]], which));
27249         } else if (allFields[fieldID]) {
27250           resolved.push(allFields[fieldID]);
27251         } else {
27252           console.log(`Cannot resolve "${fieldID}" found in ${_this.id}.${which}`);
27253         }
27254       });
27255       if (!resolved.length) {
27256         const endIndex = _this.id.lastIndexOf("/");
27257         const parentID = endIndex && _this.id.substring(0, endIndex);
27258         if (parentID) {
27259           let parent = allPresets[parentID];
27260           if (loc) {
27261             const validHere = _sharedLocationManager.locationSetsAt(loc);
27262             if (parent?.locationSetID && !validHere[parent.locationSetID]) {
27263               const candidateIDs = Object.keys(allPresets).filter((k) => k.startsWith(parentID));
27264               parent = allPresets[candidateIDs.find((candidateID) => {
27265                 const candidate = allPresets[candidateID];
27266                 return validHere[candidate.locationSetID] && (0, import_lodash.isEqual)(candidate.tags, parent.tags);
27267               })];
27268             }
27269           }
27270           resolved = inheritFields(parent, which);
27271         }
27272       }
27273       return utilArrayUniq(resolved);
27274       function inheritFields(parent, which2) {
27275         if (!parent)
27276           return [];
27277         if (which2 === "fields") {
27278           return parent.fields().filter(shouldInherit);
27279         } else if (which2 === "moreFields") {
27280           return parent.moreFields();
27281         } else {
27282           return [];
27283         }
27284       }
27285       function shouldInherit(f2) {
27286         if (f2.key && _this.tags[f2.key] !== void 0 && // inherit anyway if multiple values are allowed or just a checkbox
27287         f2.type !== "multiCombo" && f2.type !== "semiCombo" && f2.type !== "manyCombo" && f2.type !== "check")
27288           return false;
27289         return true;
27290       }
27291     }
27292     function stripDiacritics(s) {
27293       if (s.normalize)
27294         s = s.normalize("NFD");
27295       s = s.replace(/[\u0300-\u036f]/g, "");
27296       return s;
27297     }
27298     return _this;
27299   }
27300
27301   // modules/presets/index.js
27302   var _mainPresetIndex = presetIndex();
27303   function presetIndex() {
27304     const dispatch10 = dispatch_default("favoritePreset", "recentsChange");
27305     const MAXRECENTS = 30;
27306     const POINT = presetPreset("point", { name: "Point", tags: {}, geometry: ["point", "vertex"], matchScore: 0.1 });
27307     const LINE = presetPreset("line", { name: "Line", tags: {}, geometry: ["line"], matchScore: 0.1 });
27308     const AREA = presetPreset("area", { name: "Area", tags: { area: "yes" }, geometry: ["area"], matchScore: 0.1 });
27309     const RELATION = presetPreset("relation", { name: "Relation", tags: {}, geometry: ["relation"], matchScore: 0.1 });
27310     let _this = presetCollection([POINT, LINE, AREA, RELATION]);
27311     let _presets = { point: POINT, line: LINE, area: AREA, relation: RELATION };
27312     let _defaults = {
27313       point: presetCollection([POINT]),
27314       vertex: presetCollection([POINT]),
27315       line: presetCollection([LINE]),
27316       area: presetCollection([AREA]),
27317       relation: presetCollection([RELATION])
27318     };
27319     let _fields = {};
27320     let _categories = {};
27321     let _universal = [];
27322     let _addablePresetIDs = null;
27323     let _recents;
27324     let _favorites;
27325     let _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
27326     let _loadPromise;
27327     _this.ensureLoaded = () => {
27328       if (_loadPromise)
27329         return _loadPromise;
27330       return _loadPromise = Promise.all([
27331         _mainFileFetcher.get("preset_categories"),
27332         _mainFileFetcher.get("preset_defaults"),
27333         _mainFileFetcher.get("preset_presets"),
27334         _mainFileFetcher.get("preset_fields")
27335       ]).then((vals) => {
27336         _this.merge({
27337           categories: vals[0],
27338           defaults: vals[1],
27339           presets: vals[2],
27340           fields: vals[3]
27341         });
27342         osmSetAreaKeys(_this.areaKeys());
27343         osmSetLineTags(_this.lineTags());
27344         osmSetPointTags(_this.pointTags());
27345         osmSetVertexTags(_this.vertexTags());
27346       });
27347     };
27348     _this.merge = (d) => {
27349       let newLocationSets = [];
27350       if (d.fields) {
27351         Object.keys(d.fields).forEach((fieldID) => {
27352           let f2 = d.fields[fieldID];
27353           if (f2) {
27354             f2 = presetField(fieldID, f2, _fields);
27355             if (f2.locationSet)
27356               newLocationSets.push(f2);
27357             _fields[fieldID] = f2;
27358           } else {
27359             delete _fields[fieldID];
27360           }
27361         });
27362       }
27363       if (d.presets) {
27364         Object.keys(d.presets).forEach((presetID) => {
27365           let p = d.presets[presetID];
27366           if (p) {
27367             const isAddable = !_addablePresetIDs || _addablePresetIDs.has(presetID);
27368             p = presetPreset(presetID, p, isAddable, _fields, _presets);
27369             if (p.locationSet)
27370               newLocationSets.push(p);
27371             _presets[presetID] = p;
27372           } else {
27373             const existing = _presets[presetID];
27374             if (existing && !existing.isFallback()) {
27375               delete _presets[presetID];
27376             }
27377           }
27378         });
27379       }
27380       if (d.categories) {
27381         Object.keys(d.categories).forEach((categoryID) => {
27382           let c = d.categories[categoryID];
27383           if (c) {
27384             c = presetCategory(categoryID, c, _presets);
27385             if (c.locationSet)
27386               newLocationSets.push(c);
27387             _categories[categoryID] = c;
27388           } else {
27389             delete _categories[categoryID];
27390           }
27391         });
27392       }
27393       _this.collection = Object.values(_presets).concat(Object.values(_categories));
27394       if (d.defaults) {
27395         Object.keys(d.defaults).forEach((geometry) => {
27396           const def = d.defaults[geometry];
27397           if (Array.isArray(def)) {
27398             _defaults[geometry] = presetCollection(
27399               def.map((id2) => _presets[id2] || _categories[id2]).filter(Boolean)
27400             );
27401           } else {
27402             delete _defaults[geometry];
27403           }
27404         });
27405       }
27406       _universal = Object.values(_fields).filter((field) => field.universal);
27407       _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
27408       _this.collection.forEach((preset) => {
27409         (preset.geometry || []).forEach((geometry) => {
27410           let g = _geometryIndex[geometry];
27411           for (let key in preset.tags) {
27412             g[key] = g[key] || {};
27413             let value = preset.tags[key];
27414             (g[key][value] = g[key][value] || []).push(preset);
27415           }
27416         });
27417       });
27418       if (d.featureCollection && Array.isArray(d.featureCollection.features)) {
27419         _sharedLocationManager.mergeCustomGeoJSON(d.featureCollection);
27420       }
27421       if (newLocationSets.length) {
27422         _sharedLocationManager.mergeLocationSets(newLocationSets);
27423       }
27424       return _this;
27425     };
27426     _this.match = (entity, resolver) => {
27427       return resolver.transient(entity, "presetMatch", () => {
27428         let geometry = entity.geometry(resolver);
27429         if (geometry === "vertex" && entity.isOnAddressLine(resolver)) {
27430           geometry = "point";
27431         }
27432         const entityExtent = entity.extent(resolver);
27433         return _this.matchTags(entity.tags, geometry, entityExtent.center());
27434       });
27435     };
27436     _this.matchTags = (tags, geometry, loc) => {
27437       const keyIndex = _geometryIndex[geometry];
27438       let bestScore = -1;
27439       let bestMatch;
27440       let matchCandidates = [];
27441       for (let k in tags) {
27442         let indexMatches = [];
27443         let valueIndex = keyIndex[k];
27444         if (!valueIndex)
27445           continue;
27446         let keyValueMatches = valueIndex[tags[k]];
27447         if (keyValueMatches)
27448           indexMatches.push(...keyValueMatches);
27449         let keyStarMatches = valueIndex["*"];
27450         if (keyStarMatches)
27451           indexMatches.push(...keyStarMatches);
27452         if (indexMatches.length === 0)
27453           continue;
27454         for (let i2 = 0; i2 < indexMatches.length; i2++) {
27455           const candidate = indexMatches[i2];
27456           const score = candidate.matchScore(tags);
27457           if (score === -1) {
27458             continue;
27459           }
27460           matchCandidates.push({ score, candidate });
27461           if (score > bestScore) {
27462             bestScore = score;
27463             bestMatch = candidate;
27464           }
27465         }
27466       }
27467       if (bestMatch && bestMatch.locationSetID && bestMatch.locationSetID !== "+[Q2]" && Array.isArray(loc)) {
27468         const validHere = _sharedLocationManager.locationSetsAt(loc);
27469         if (!validHere[bestMatch.locationSetID]) {
27470           matchCandidates.sort((a, b) => a.score < b.score ? 1 : -1);
27471           for (let i2 = 0; i2 < matchCandidates.length; i2++) {
27472             const candidateScore = matchCandidates[i2];
27473             if (!candidateScore.candidate.locationSetID || validHere[candidateScore.candidate.locationSetID]) {
27474               bestMatch = candidateScore.candidate;
27475               bestScore = candidateScore.score;
27476               break;
27477             }
27478           }
27479         }
27480       }
27481       if (!bestMatch || bestMatch.isFallback()) {
27482         for (let k in tags) {
27483           if (/^addr:/.test(k) && keyIndex["addr:*"] && keyIndex["addr:*"]["*"]) {
27484             bestMatch = keyIndex["addr:*"]["*"][0];
27485             break;
27486           }
27487         }
27488       }
27489       return bestMatch || _this.fallback(geometry);
27490     };
27491     _this.allowsVertex = (entity, resolver) => {
27492       if (entity.type !== "node")
27493         return false;
27494       if (Object.keys(entity.tags).length === 0)
27495         return true;
27496       return resolver.transient(entity, "vertexMatch", () => {
27497         if (entity.isOnAddressLine(resolver))
27498           return true;
27499         const geometries = osmNodeGeometriesForTags(entity.tags);
27500         if (geometries.vertex)
27501           return true;
27502         if (geometries.point)
27503           return false;
27504         return true;
27505       });
27506     };
27507     _this.areaKeys = () => {
27508       const ignore = {
27509         barrier: true,
27510         highway: true,
27511         footway: true,
27512         railway: true,
27513         junction: true,
27514         traffic_calming: true,
27515         type: true
27516       };
27517       let areaKeys = {};
27518       const presets = _this.collection.filter((p) => !p.suggestion && !p.replacement);
27519       presets.forEach((p) => {
27520         const keys2 = p.tags && Object.keys(p.tags);
27521         const key = keys2 && keys2.length && keys2[0];
27522         if (!key)
27523           return;
27524         if (ignore[key])
27525           return;
27526         if (p.geometry.indexOf("area") !== -1) {
27527           areaKeys[key] = areaKeys[key] || {};
27528         }
27529       });
27530       presets.forEach((p) => {
27531         let key;
27532         for (key in p.addTags) {
27533           const value = p.addTags[key];
27534           if (key in areaKeys && // probably an area...
27535           p.geometry.indexOf("line") !== -1 && // but sometimes a line
27536           value !== "*") {
27537             areaKeys[key][value] = true;
27538           }
27539         }
27540       });
27541       return areaKeys;
27542     };
27543     _this.lineTags = () => {
27544       return _this.collection.filter((lineTags, d) => {
27545         if (d.suggestion || d.replacement || d.searchable === false)
27546           return lineTags;
27547         const keys2 = d.tags && Object.keys(d.tags);
27548         const key = keys2 && keys2.length && keys2[0];
27549         if (!key)
27550           return lineTags;
27551         if (d.geometry.indexOf("line") !== -1) {
27552           lineTags[key] = lineTags[key] || [];
27553           lineTags[key].push(d.tags);
27554         }
27555         return lineTags;
27556       }, {});
27557     };
27558     _this.pointTags = () => {
27559       return _this.collection.reduce((pointTags, d) => {
27560         if (d.suggestion || d.replacement || d.searchable === false)
27561           return pointTags;
27562         const keys2 = d.tags && Object.keys(d.tags);
27563         const key = keys2 && keys2.length && keys2[0];
27564         if (!key)
27565           return pointTags;
27566         if (d.geometry.indexOf("point") !== -1) {
27567           pointTags[key] = pointTags[key] || {};
27568           pointTags[key][d.tags[key]] = true;
27569         }
27570         return pointTags;
27571       }, {});
27572     };
27573     _this.vertexTags = () => {
27574       return _this.collection.reduce((vertexTags, d) => {
27575         if (d.suggestion || d.replacement || d.searchable === false)
27576           return vertexTags;
27577         const keys2 = d.tags && Object.keys(d.tags);
27578         const key = keys2 && keys2.length && keys2[0];
27579         if (!key)
27580           return vertexTags;
27581         if (d.geometry.indexOf("vertex") !== -1) {
27582           vertexTags[key] = vertexTags[key] || {};
27583           vertexTags[key][d.tags[key]] = true;
27584         }
27585         return vertexTags;
27586       }, {});
27587     };
27588     _this.field = (id2) => _fields[id2];
27589     _this.universal = () => _universal;
27590     _this.defaults = (geometry, n2, startWithRecents, loc, extraPresets) => {
27591       let recents = [];
27592       if (startWithRecents) {
27593         recents = _this.recent().matchGeometry(geometry).collection.slice(0, 4);
27594       }
27595       let defaults2;
27596       if (_addablePresetIDs) {
27597         defaults2 = Array.from(_addablePresetIDs).map(function(id2) {
27598           var preset = _this.item(id2);
27599           if (preset && preset.matchGeometry(geometry))
27600             return preset;
27601           return null;
27602         }).filter(Boolean);
27603       } else {
27604         defaults2 = _defaults[geometry].collection.concat(_this.fallback(geometry));
27605       }
27606       let result = presetCollection(
27607         utilArrayUniq(recents.concat(defaults2).concat(extraPresets || [])).slice(0, n2 - 1)
27608       );
27609       if (Array.isArray(loc)) {
27610         const validHere = _sharedLocationManager.locationSetsAt(loc);
27611         result.collection = result.collection.filter((a) => !a.locationSetID || validHere[a.locationSetID]);
27612       }
27613       return result;
27614     };
27615     _this.addablePresetIDs = function(val) {
27616       if (!arguments.length)
27617         return _addablePresetIDs;
27618       if (Array.isArray(val))
27619         val = new Set(val);
27620       _addablePresetIDs = val;
27621       if (_addablePresetIDs) {
27622         _this.collection.forEach((p) => {
27623           if (p.addable)
27624             p.addable(_addablePresetIDs.has(p.id));
27625         });
27626       } else {
27627         _this.collection.forEach((p) => {
27628           if (p.addable)
27629             p.addable(true);
27630         });
27631       }
27632       return _this;
27633     };
27634     _this.recent = () => {
27635       return presetCollection(
27636         utilArrayUniq(_this.getRecents().map((d) => d.preset).filter((d) => d.searchable !== false))
27637       );
27638     };
27639     function RibbonItem(preset, source) {
27640       let item = {};
27641       item.preset = preset;
27642       item.source = source;
27643       item.isFavorite = () => item.source === "favorite";
27644       item.isRecent = () => item.source === "recent";
27645       item.matches = (preset2) => item.preset.id === preset2.id;
27646       item.minified = () => ({ pID: item.preset.id });
27647       return item;
27648     }
27649     function ribbonItemForMinified(d, source) {
27650       if (d && d.pID) {
27651         const preset = _this.item(d.pID);
27652         if (!preset)
27653           return null;
27654         return RibbonItem(preset, source);
27655       }
27656       return null;
27657     }
27658     _this.getGenericRibbonItems = () => {
27659       return ["point", "line", "area"].map((id2) => RibbonItem(_this.item(id2), "generic"));
27660     };
27661     _this.getAddable = () => {
27662       if (!_addablePresetIDs)
27663         return [];
27664       return _addablePresetIDs.map((id2) => {
27665         const preset = _this.item(id2);
27666         if (preset)
27667           return RibbonItem(preset, "addable");
27668         return null;
27669       }).filter(Boolean);
27670     };
27671     function setRecents(items) {
27672       _recents = items;
27673       const minifiedItems = items.map((d) => d.minified());
27674       corePreferences("preset_recents", JSON.stringify(minifiedItems));
27675       dispatch10.call("recentsChange");
27676     }
27677     _this.getRecents = () => {
27678       if (!_recents) {
27679         _recents = (JSON.parse(corePreferences("preset_recents")) || []).reduce((acc, d) => {
27680           let item = ribbonItemForMinified(d, "recent");
27681           if (item && item.preset.addable())
27682             acc.push(item);
27683           return acc;
27684         }, []);
27685       }
27686       return _recents;
27687     };
27688     _this.addRecent = (preset, besidePreset, after) => {
27689       const recents = _this.getRecents();
27690       const beforeItem = _this.recentMatching(besidePreset);
27691       let toIndex = recents.indexOf(beforeItem);
27692       if (after)
27693         toIndex += 1;
27694       const newItem = RibbonItem(preset, "recent");
27695       recents.splice(toIndex, 0, newItem);
27696       setRecents(recents);
27697     };
27698     _this.removeRecent = (preset) => {
27699       const item = _this.recentMatching(preset);
27700       if (item) {
27701         let items = _this.getRecents();
27702         items.splice(items.indexOf(item), 1);
27703         setRecents(items);
27704       }
27705     };
27706     _this.recentMatching = (preset) => {
27707       const items = _this.getRecents();
27708       for (let i2 in items) {
27709         if (items[i2].matches(preset)) {
27710           return items[i2];
27711         }
27712       }
27713       return null;
27714     };
27715     _this.moveItem = (items, fromIndex, toIndex) => {
27716       if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= items.length || toIndex >= items.length)
27717         return null;
27718       items.splice(toIndex, 0, items.splice(fromIndex, 1)[0]);
27719       return items;
27720     };
27721     _this.moveRecent = (item, beforeItem) => {
27722       const recents = _this.getRecents();
27723       const fromIndex = recents.indexOf(item);
27724       const toIndex = recents.indexOf(beforeItem);
27725       const items = _this.moveItem(recents, fromIndex, toIndex);
27726       if (items)
27727         setRecents(items);
27728     };
27729     _this.setMostRecent = (preset) => {
27730       if (preset.searchable === false)
27731         return;
27732       let items = _this.getRecents();
27733       let item = _this.recentMatching(preset);
27734       if (item) {
27735         items.splice(items.indexOf(item), 1);
27736       } else {
27737         item = RibbonItem(preset, "recent");
27738       }
27739       while (items.length >= MAXRECENTS) {
27740         items.pop();
27741       }
27742       items.unshift(item);
27743       setRecents(items);
27744     };
27745     function setFavorites(items) {
27746       _favorites = items;
27747       const minifiedItems = items.map((d) => d.minified());
27748       corePreferences("preset_favorites", JSON.stringify(minifiedItems));
27749       dispatch10.call("favoritePreset");
27750     }
27751     _this.addFavorite = (preset, besidePreset, after) => {
27752       const favorites = _this.getFavorites();
27753       const beforeItem = _this.favoriteMatching(besidePreset);
27754       let toIndex = favorites.indexOf(beforeItem);
27755       if (after)
27756         toIndex += 1;
27757       const newItem = RibbonItem(preset, "favorite");
27758       favorites.splice(toIndex, 0, newItem);
27759       setFavorites(favorites);
27760     };
27761     _this.toggleFavorite = (preset) => {
27762       const favs = _this.getFavorites();
27763       const favorite = _this.favoriteMatching(preset);
27764       if (favorite) {
27765         favs.splice(favs.indexOf(favorite), 1);
27766       } else {
27767         if (favs.length === 10) {
27768           favs.pop();
27769         }
27770         favs.push(RibbonItem(preset, "favorite"));
27771       }
27772       setFavorites(favs);
27773     };
27774     _this.removeFavorite = (preset) => {
27775       const item = _this.favoriteMatching(preset);
27776       if (item) {
27777         const items = _this.getFavorites();
27778         items.splice(items.indexOf(item), 1);
27779         setFavorites(items);
27780       }
27781     };
27782     _this.getFavorites = () => {
27783       if (!_favorites) {
27784         let rawFavorites = JSON.parse(corePreferences("preset_favorites"));
27785         if (!rawFavorites) {
27786           rawFavorites = [];
27787           corePreferences("preset_favorites", JSON.stringify(rawFavorites));
27788         }
27789         _favorites = rawFavorites.reduce((output, d) => {
27790           const item = ribbonItemForMinified(d, "favorite");
27791           if (item && item.preset.addable())
27792             output.push(item);
27793           return output;
27794         }, []);
27795       }
27796       return _favorites;
27797     };
27798     _this.favoriteMatching = (preset) => {
27799       const favs = _this.getFavorites();
27800       for (let index in favs) {
27801         if (favs[index].matches(preset)) {
27802           return favs[index];
27803         }
27804       }
27805       return null;
27806     };
27807     return utilRebind(_this, dispatch10, "on");
27808   }
27809
27810   // modules/util/util.js
27811   function utilTagText(entity) {
27812     var obj = entity && entity.tags || {};
27813     return Object.keys(obj).map(function(k) {
27814       return k + "=" + obj[k];
27815     }).join(", ");
27816   }
27817   function utilTotalExtent(array2, graph) {
27818     var extent = geoExtent();
27819     var val, entity;
27820     for (var i2 = 0; i2 < array2.length; i2++) {
27821       val = array2[i2];
27822       entity = typeof val === "string" ? graph.hasEntity(val) : val;
27823       if (entity) {
27824         extent._extend(entity.extent(graph));
27825       }
27826     }
27827     return extent;
27828   }
27829   function utilTagDiff(oldTags, newTags) {
27830     var tagDiff = [];
27831     var keys2 = utilArrayUnion(Object.keys(oldTags), Object.keys(newTags)).sort();
27832     keys2.forEach(function(k) {
27833       var oldVal = oldTags[k];
27834       var newVal = newTags[k];
27835       if ((oldVal || oldVal === "") && (newVal === void 0 || newVal !== oldVal)) {
27836         tagDiff.push({
27837           type: "-",
27838           key: k,
27839           oldVal,
27840           newVal,
27841           display: "- " + k + "=" + oldVal
27842         });
27843       }
27844       if ((newVal || newVal === "") && (oldVal === void 0 || newVal !== oldVal)) {
27845         tagDiff.push({
27846           type: "+",
27847           key: k,
27848           oldVal,
27849           newVal,
27850           display: "+ " + k + "=" + newVal
27851         });
27852       }
27853     });
27854     return tagDiff;
27855   }
27856   function utilEntitySelector(ids) {
27857     return ids.length ? "." + ids.join(",.") : "nothing";
27858   }
27859   function utilEntityOrMemberSelector(ids, graph) {
27860     var seen = new Set(ids);
27861     ids.forEach(collectShallowDescendants);
27862     return utilEntitySelector(Array.from(seen));
27863     function collectShallowDescendants(id2) {
27864       var entity = graph.hasEntity(id2);
27865       if (!entity || entity.type !== "relation")
27866         return;
27867       entity.members.map(function(member) {
27868         return member.id;
27869       }).forEach(function(id3) {
27870         seen.add(id3);
27871       });
27872     }
27873   }
27874   function utilEntityOrDeepMemberSelector(ids, graph) {
27875     return utilEntitySelector(utilEntityAndDeepMemberIDs(ids, graph));
27876   }
27877   function utilEntityAndDeepMemberIDs(ids, graph) {
27878     var seen = /* @__PURE__ */ new Set();
27879     ids.forEach(collectDeepDescendants);
27880     return Array.from(seen);
27881     function collectDeepDescendants(id2) {
27882       if (seen.has(id2))
27883         return;
27884       seen.add(id2);
27885       var entity = graph.hasEntity(id2);
27886       if (!entity || entity.type !== "relation")
27887         return;
27888       entity.members.map(function(member) {
27889         return member.id;
27890       }).forEach(collectDeepDescendants);
27891     }
27892   }
27893   function utilDeepMemberSelector(ids, graph, skipMultipolgonMembers) {
27894     var idsSet = new Set(ids);
27895     var seen = /* @__PURE__ */ new Set();
27896     var returners = /* @__PURE__ */ new Set();
27897     ids.forEach(collectDeepDescendants);
27898     return utilEntitySelector(Array.from(returners));
27899     function collectDeepDescendants(id2) {
27900       if (seen.has(id2))
27901         return;
27902       seen.add(id2);
27903       if (!idsSet.has(id2)) {
27904         returners.add(id2);
27905       }
27906       var entity = graph.hasEntity(id2);
27907       if (!entity || entity.type !== "relation")
27908         return;
27909       if (skipMultipolgonMembers && entity.isMultipolygon())
27910         return;
27911       entity.members.map(function(member) {
27912         return member.id;
27913       }).forEach(collectDeepDescendants);
27914     }
27915   }
27916   function utilHighlightEntities(ids, highlighted, context) {
27917     context.surface().selectAll(utilEntityOrDeepMemberSelector(ids, context.graph())).classed("highlighted", highlighted);
27918   }
27919   function utilGetAllNodes(ids, graph) {
27920     var seen = /* @__PURE__ */ new Set();
27921     var nodes = /* @__PURE__ */ new Set();
27922     ids.forEach(collectNodes);
27923     return Array.from(nodes);
27924     function collectNodes(id2) {
27925       if (seen.has(id2))
27926         return;
27927       seen.add(id2);
27928       var entity = graph.hasEntity(id2);
27929       if (!entity)
27930         return;
27931       if (entity.type === "node") {
27932         nodes.add(entity);
27933       } else if (entity.type === "way") {
27934         entity.nodes.forEach(collectNodes);
27935       } else {
27936         entity.members.map(function(member) {
27937           return member.id;
27938         }).forEach(collectNodes);
27939       }
27940     }
27941   }
27942   function utilDisplayName(entity) {
27943     var localizedNameKey = "name:" + _mainLocalizer.languageCode().toLowerCase();
27944     var name = entity.tags[localizedNameKey] || entity.tags.name || "";
27945     if (name)
27946       return name;
27947     var tags = {
27948       direction: entity.tags.direction,
27949       from: entity.tags.from,
27950       network: entity.tags.cycle_network || entity.tags.network,
27951       ref: entity.tags.ref,
27952       to: entity.tags.to,
27953       via: entity.tags.via
27954     };
27955     var keyComponents = [];
27956     if (tags.network) {
27957       keyComponents.push("network");
27958     }
27959     if (tags.ref) {
27960       keyComponents.push("ref");
27961     }
27962     if (entity.tags.route) {
27963       if (tags.direction) {
27964         keyComponents.push("direction");
27965       } else if (tags.from && tags.to) {
27966         keyComponents.push("from");
27967         keyComponents.push("to");
27968         if (tags.via) {
27969           keyComponents.push("via");
27970         }
27971       }
27972     }
27973     if (keyComponents.length) {
27974       name = _t("inspector.display_name." + keyComponents.join("_"), tags);
27975     }
27976     return name;
27977   }
27978   function utilDisplayNameForPath(entity) {
27979     var name = utilDisplayName(entity);
27980     var isFirefox = utilDetect().browser.toLowerCase().indexOf("firefox") > -1;
27981     var isNewChromium = Number(utilDetect().version.split(".")[0]) >= 96;
27982     if (!isFirefox && !isNewChromium && name && rtlRegex.test(name)) {
27983       name = fixRTLTextForSvg(name);
27984     }
27985     return name;
27986   }
27987   function utilDisplayType(id2) {
27988     return {
27989       n: _t("inspector.node"),
27990       w: _t("inspector.way"),
27991       r: _t("inspector.relation")
27992     }[id2.charAt(0)];
27993   }
27994   function utilDisplayLabel(entity, graphOrGeometry, verbose) {
27995     var result;
27996     var displayName = utilDisplayName(entity);
27997     var preset = typeof graphOrGeometry === "string" ? _mainPresetIndex.matchTags(entity.tags, graphOrGeometry) : _mainPresetIndex.match(entity, graphOrGeometry);
27998     var presetName = preset && (preset.suggestion ? preset.subtitle() : preset.name());
27999     if (verbose) {
28000       result = [presetName, displayName].filter(Boolean).join(" ");
28001     } else {
28002       result = displayName || presetName;
28003     }
28004     return result || utilDisplayType(entity.id);
28005   }
28006   function utilEntityRoot(entityType) {
28007     return {
28008       node: "n",
28009       way: "w",
28010       relation: "r"
28011     }[entityType];
28012   }
28013   function utilCombinedTags(entityIDs, graph) {
28014     var tags = {};
28015     var tagCounts = {};
28016     var allKeys = /* @__PURE__ */ new Set();
28017     var entities = entityIDs.map(function(entityID) {
28018       return graph.hasEntity(entityID);
28019     }).filter(Boolean);
28020     entities.forEach(function(entity) {
28021       var keys2 = Object.keys(entity.tags).filter(Boolean);
28022       keys2.forEach(function(key2) {
28023         allKeys.add(key2);
28024       });
28025     });
28026     entities.forEach(function(entity) {
28027       allKeys.forEach(function(key2) {
28028         var value = entity.tags[key2];
28029         if (!tags.hasOwnProperty(key2)) {
28030           tags[key2] = value;
28031         } else {
28032           if (!Array.isArray(tags[key2])) {
28033             if (tags[key2] !== value) {
28034               tags[key2] = [tags[key2], value];
28035             }
28036           } else {
28037             if (tags[key2].indexOf(value) === -1) {
28038               tags[key2].push(value);
28039             }
28040           }
28041         }
28042         var tagHash = key2 + "=" + value;
28043         if (!tagCounts[tagHash])
28044           tagCounts[tagHash] = 0;
28045         tagCounts[tagHash] += 1;
28046       });
28047     });
28048     for (var key in tags) {
28049       if (!Array.isArray(tags[key]))
28050         continue;
28051       tags[key] = tags[key].sort(function(val12, val2) {
28052         var key2 = key2;
28053         var count2 = tagCounts[key2 + "=" + val2];
28054         var count1 = tagCounts[key2 + "=" + val12];
28055         if (count2 !== count1) {
28056           return count2 - count1;
28057         }
28058         if (val2 && val12) {
28059           return val12.localeCompare(val2);
28060         }
28061         return val12 ? 1 : -1;
28062       });
28063     }
28064     return tags;
28065   }
28066   function utilStringQs(str2) {
28067     var i2 = 0;
28068     while (i2 < str2.length && (str2[i2] === "?" || str2[i2] === "#"))
28069       i2++;
28070     str2 = str2.slice(i2);
28071     return str2.split("&").reduce(function(obj, pair2) {
28072       var parts = pair2.split("=");
28073       if (parts.length === 2) {
28074         obj[parts[0]] = null === parts[1] ? "" : decodeURIComponent(parts[1]);
28075       }
28076       return obj;
28077     }, {});
28078   }
28079   function utilQsString(obj, noencode) {
28080     function softEncode(s) {
28081       return encodeURIComponent(s).replace(/(%2F|%3A|%2C|%7B|%7D)/g, decodeURIComponent);
28082     }
28083     return Object.keys(obj).sort().map(function(key) {
28084       return encodeURIComponent(key) + "=" + (noencode ? softEncode(obj[key]) : encodeURIComponent(obj[key]));
28085     }).join("&");
28086   }
28087   function utilPrefixDOMProperty(property) {
28088     var prefixes2 = ["webkit", "ms", "moz", "o"];
28089     var i2 = -1;
28090     var n2 = prefixes2.length;
28091     var s = document.body;
28092     if (property in s)
28093       return property;
28094     property = property.slice(0, 1).toUpperCase() + property.slice(1);
28095     while (++i2 < n2) {
28096       if (prefixes2[i2] + property in s) {
28097         return prefixes2[i2] + property;
28098       }
28099     }
28100     return false;
28101   }
28102   function utilPrefixCSSProperty(property) {
28103     var prefixes2 = ["webkit", "ms", "Moz", "O"];
28104     var i2 = -1;
28105     var n2 = prefixes2.length;
28106     var s = document.body.style;
28107     if (property.toLowerCase() in s) {
28108       return property.toLowerCase();
28109     }
28110     while (++i2 < n2) {
28111       if (prefixes2[i2] + property in s) {
28112         return "-" + prefixes2[i2].toLowerCase() + property.replace(/([A-Z])/g, "-$1").toLowerCase();
28113       }
28114     }
28115     return false;
28116   }
28117   var transformProperty;
28118   function utilSetTransform(el, x, y, scale) {
28119     var prop = transformProperty = transformProperty || utilPrefixCSSProperty("Transform");
28120     var translate = utilDetect().opera ? "translate(" + x + "px," + y + "px)" : "translate3d(" + x + "px," + y + "px,0)";
28121     return el.style(prop, translate + (scale ? " scale(" + scale + ")" : ""));
28122   }
28123   function utilEditDistance(a, b) {
28124     a = (0, import_diacritics.remove)(a.toLowerCase());
28125     b = (0, import_diacritics.remove)(b.toLowerCase());
28126     if (a.length === 0)
28127       return b.length;
28128     if (b.length === 0)
28129       return a.length;
28130     var matrix = [];
28131     var i2, j2;
28132     for (i2 = 0; i2 <= b.length; i2++) {
28133       matrix[i2] = [i2];
28134     }
28135     for (j2 = 0; j2 <= a.length; j2++) {
28136       matrix[0][j2] = j2;
28137     }
28138     for (i2 = 1; i2 <= b.length; i2++) {
28139       for (j2 = 1; j2 <= a.length; j2++) {
28140         if (b.charAt(i2 - 1) === a.charAt(j2 - 1)) {
28141           matrix[i2][j2] = matrix[i2 - 1][j2 - 1];
28142         } else {
28143           matrix[i2][j2] = Math.min(
28144             matrix[i2 - 1][j2 - 1] + 1,
28145             // substitution
28146             Math.min(
28147               matrix[i2][j2 - 1] + 1,
28148               // insertion
28149               matrix[i2 - 1][j2] + 1
28150             )
28151           );
28152         }
28153       }
28154     }
28155     return matrix[b.length][a.length];
28156   }
28157   function utilFastMouse(container) {
28158     var rect = container.getBoundingClientRect();
28159     var rectLeft = rect.left;
28160     var rectTop = rect.top;
28161     var clientLeft = +container.clientLeft;
28162     var clientTop = +container.clientTop;
28163     return function(e) {
28164       return [
28165         e.clientX - rectLeft - clientLeft,
28166         e.clientY - rectTop - clientTop
28167       ];
28168     };
28169   }
28170   function utilAsyncMap(inputs, func, callback) {
28171     var remaining = inputs.length;
28172     var results = [];
28173     var errors = [];
28174     inputs.forEach(function(d, i2) {
28175       func(d, function done(err, data) {
28176         errors[i2] = err;
28177         results[i2] = data;
28178         remaining--;
28179         if (!remaining)
28180           callback(errors, results);
28181       });
28182     });
28183   }
28184   function utilWrap(index, length) {
28185     if (index < 0) {
28186       index += Math.ceil(-index / length) * length;
28187     }
28188     return index % length;
28189   }
28190   function utilFunctor(value) {
28191     if (typeof value === "function")
28192       return value;
28193     return function() {
28194       return value;
28195     };
28196   }
28197   function utilNoAuto(selection2) {
28198     var isText = selection2.size() && selection2.node().tagName.toLowerCase() === "textarea";
28199     return selection2.attr("autocomplete", "new-password").attr("autocorrect", "off").attr("autocapitalize", "off").attr("spellcheck", isText ? "true" : "false");
28200   }
28201   function utilHashcode(str2) {
28202     var hash = 0;
28203     if (str2.length === 0) {
28204       return hash;
28205     }
28206     for (var i2 = 0; i2 < str2.length; i2++) {
28207       var char = str2.charCodeAt(i2);
28208       hash = (hash << 5) - hash + char;
28209       hash = hash & hash;
28210     }
28211     return hash;
28212   }
28213   function utilSafeClassName(str2) {
28214     return str2.toLowerCase().replace(/[^a-z0-9]+/g, "_");
28215   }
28216   function utilUniqueDomId(val) {
28217     return "ideditor-" + utilSafeClassName(val.toString()) + "-" + (/* @__PURE__ */ new Date()).getTime().toString();
28218   }
28219   function utilUnicodeCharsCount(str2) {
28220     return Array.from(str2).length;
28221   }
28222   function utilUnicodeCharsTruncated(str2, limit) {
28223     return Array.from(str2).slice(0, limit).join("");
28224   }
28225   function toNumericID(id2) {
28226     var match = id2.match(/^[cnwr](-?\d+)$/);
28227     if (match) {
28228       return parseInt(match[1], 10);
28229     }
28230     return NaN;
28231   }
28232   function compareNumericIDs(left, right) {
28233     if (isNaN(left) && isNaN(right))
28234       return -1;
28235     if (isNaN(left))
28236       return 1;
28237     if (isNaN(right))
28238       return -1;
28239     if (Math.sign(left) !== Math.sign(right))
28240       return -Math.sign(left);
28241     if (Math.sign(left) < 0)
28242       return Math.sign(right - left);
28243     return Math.sign(left - right);
28244   }
28245   function utilCompareIDs(left, right) {
28246     return compareNumericIDs(toNumericID(left), toNumericID(right));
28247   }
28248   function utilOldestID(ids) {
28249     if (ids.length === 0) {
28250       return void 0;
28251     }
28252     var oldestIDIndex = 0;
28253     var oldestID = toNumericID(ids[0]);
28254     for (var i2 = 1; i2 < ids.length; i2++) {
28255       var num = toNumericID(ids[i2]);
28256       if (compareNumericIDs(oldestID, num) === 1) {
28257         oldestIDIndex = i2;
28258         oldestID = num;
28259       }
28260     }
28261     return ids[oldestIDIndex];
28262   }
28263   function utilCleanOsmString(val, maxChars) {
28264     if (val === void 0 || val === null) {
28265       val = "";
28266     } else {
28267       val = val.toString();
28268     }
28269     val = val.trim();
28270     if (val.normalize)
28271       val = val.normalize("NFC");
28272     return utilUnicodeCharsTruncated(val, maxChars);
28273   }
28274
28275   // modules/osm/entity.js
28276   function osmEntity(attrs) {
28277     if (this instanceof osmEntity)
28278       return;
28279     if (attrs && attrs.type) {
28280       return osmEntity[attrs.type].apply(this, arguments);
28281     } else if (attrs && attrs.id) {
28282       return osmEntity[osmEntity.id.type(attrs.id)].apply(this, arguments);
28283     }
28284     return new osmEntity().initialize(arguments);
28285   }
28286   osmEntity.id = function(type2) {
28287     return osmEntity.id.fromOSM(type2, osmEntity.id.next[type2]--);
28288   };
28289   osmEntity.id.next = {
28290     changeset: -1,
28291     node: -1,
28292     way: -1,
28293     relation: -1
28294   };
28295   osmEntity.id.fromOSM = function(type2, id2) {
28296     return type2[0] + id2;
28297   };
28298   osmEntity.id.toOSM = function(id2) {
28299     var match = id2.match(/^[cnwr](-?\d+)$/);
28300     if (match) {
28301       return match[1];
28302     }
28303     return "";
28304   };
28305   osmEntity.id.type = function(id2) {
28306     return { "c": "changeset", "n": "node", "w": "way", "r": "relation" }[id2[0]];
28307   };
28308   osmEntity.key = function(entity) {
28309     return entity.id + "v" + (entity.v || 0);
28310   };
28311   var _deprecatedTagValuesByKey;
28312   osmEntity.deprecatedTagValuesByKey = function(dataDeprecated) {
28313     if (!_deprecatedTagValuesByKey) {
28314       _deprecatedTagValuesByKey = {};
28315       dataDeprecated.forEach(function(d) {
28316         var oldKeys = Object.keys(d.old);
28317         if (oldKeys.length === 1) {
28318           var oldKey = oldKeys[0];
28319           var oldValue = d.old[oldKey];
28320           if (oldValue !== "*") {
28321             if (!_deprecatedTagValuesByKey[oldKey]) {
28322               _deprecatedTagValuesByKey[oldKey] = [oldValue];
28323             } else {
28324               _deprecatedTagValuesByKey[oldKey].push(oldValue);
28325             }
28326           }
28327         }
28328       });
28329     }
28330     return _deprecatedTagValuesByKey;
28331   };
28332   osmEntity.prototype = {
28333     tags: {},
28334     initialize: function(sources) {
28335       for (var i2 = 0; i2 < sources.length; ++i2) {
28336         var source = sources[i2];
28337         for (var prop in source) {
28338           if (Object.prototype.hasOwnProperty.call(source, prop)) {
28339             if (source[prop] === void 0) {
28340               delete this[prop];
28341             } else {
28342               this[prop] = source[prop];
28343             }
28344           }
28345         }
28346       }
28347       if (!this.id && this.type) {
28348         this.id = osmEntity.id(this.type);
28349       }
28350       if (!this.hasOwnProperty("visible")) {
28351         this.visible = true;
28352       }
28353       if (debug) {
28354         Object.freeze(this);
28355         Object.freeze(this.tags);
28356         if (this.loc)
28357           Object.freeze(this.loc);
28358         if (this.nodes)
28359           Object.freeze(this.nodes);
28360         if (this.members)
28361           Object.freeze(this.members);
28362       }
28363       return this;
28364     },
28365     copy: function(resolver, copies) {
28366       if (copies[this.id])
28367         return copies[this.id];
28368       var copy2 = osmEntity(this, { id: void 0, user: void 0, version: void 0 });
28369       copies[this.id] = copy2;
28370       return copy2;
28371     },
28372     osmId: function() {
28373       return osmEntity.id.toOSM(this.id);
28374     },
28375     isNew: function() {
28376       var osmId = osmEntity.id.toOSM(this.id);
28377       return osmId.length === 0 || osmId[0] === "-";
28378     },
28379     update: function(attrs) {
28380       return osmEntity(this, attrs, { v: 1 + (this.v || 0) });
28381     },
28382     mergeTags: function(tags) {
28383       var merged = Object.assign({}, this.tags);
28384       var changed = false;
28385       for (var k in tags) {
28386         var t1 = merged[k];
28387         var t2 = tags[k];
28388         if (!t1) {
28389           changed = true;
28390           merged[k] = t2;
28391         } else if (t1 !== t2) {
28392           changed = true;
28393           merged[k] = utilUnicodeCharsTruncated(
28394             utilArrayUnion(t1.split(/;\s*/), t2.split(/;\s*/)).join(";"),
28395             255
28396             // avoid exceeding character limit; see also context.maxCharsForTagValue()
28397           );
28398         }
28399       }
28400       return changed ? this.update({ tags: merged }) : this;
28401     },
28402     intersects: function(extent, resolver) {
28403       return this.extent(resolver).intersects(extent);
28404     },
28405     hasNonGeometryTags: function() {
28406       return Object.keys(this.tags).some(function(k) {
28407         return k !== "area";
28408       });
28409     },
28410     hasParentRelations: function(resolver) {
28411       return resolver.parentRelations(this).length > 0;
28412     },
28413     hasInterestingTags: function() {
28414       return Object.keys(this.tags).some(osmIsInterestingTag);
28415     },
28416     isHighwayIntersection: function() {
28417       return false;
28418     },
28419     isDegenerate: function() {
28420       return true;
28421     },
28422     deprecatedTags: function(dataDeprecated) {
28423       var tags = this.tags;
28424       if (Object.keys(tags).length === 0)
28425         return [];
28426       var deprecated = [];
28427       dataDeprecated.forEach(function(d) {
28428         var oldKeys = Object.keys(d.old);
28429         if (d.replace) {
28430           var hasExistingValues = Object.keys(d.replace).some(function(replaceKey) {
28431             if (!tags[replaceKey] || d.old[replaceKey])
28432               return false;
28433             var replaceValue = d.replace[replaceKey];
28434             if (replaceValue === "*")
28435               return false;
28436             if (replaceValue === tags[replaceKey])
28437               return false;
28438             return true;
28439           });
28440           if (hasExistingValues)
28441             return;
28442         }
28443         var matchesDeprecatedTags = oldKeys.every(function(oldKey) {
28444           if (!tags[oldKey])
28445             return false;
28446           if (d.old[oldKey] === "*")
28447             return true;
28448           if (d.old[oldKey] === tags[oldKey])
28449             return true;
28450           var vals = tags[oldKey].split(";").filter(Boolean);
28451           if (vals.length === 0) {
28452             return false;
28453           } else if (vals.length > 1) {
28454             return vals.indexOf(d.old[oldKey]) !== -1;
28455           } else {
28456             if (tags[oldKey] === d.old[oldKey]) {
28457               if (d.replace && d.old[oldKey] === d.replace[oldKey]) {
28458                 var replaceKeys = Object.keys(d.replace);
28459                 return !replaceKeys.every(function(replaceKey) {
28460                   return tags[replaceKey] === d.replace[replaceKey];
28461                 });
28462               } else {
28463                 return true;
28464               }
28465             }
28466           }
28467           return false;
28468         });
28469         if (matchesDeprecatedTags) {
28470           deprecated.push(d);
28471         }
28472       });
28473       return deprecated;
28474     }
28475   };
28476
28477   // modules/osm/lanes.js
28478   function osmLanes(entity) {
28479     if (entity.type !== "way")
28480       return null;
28481     if (!entity.tags.highway)
28482       return null;
28483     var tags = entity.tags;
28484     var isOneWay = entity.isOneWay();
28485     var laneCount = getLaneCount(tags, isOneWay);
28486     var maxspeed = parseMaxspeed(tags);
28487     var laneDirections = parseLaneDirections(tags, isOneWay, laneCount);
28488     var forward = laneDirections.forward;
28489     var backward = laneDirections.backward;
28490     var bothways = laneDirections.bothways;
28491     var turnLanes = {};
28492     turnLanes.unspecified = parseTurnLanes(tags["turn:lanes"]);
28493     turnLanes.forward = parseTurnLanes(tags["turn:lanes:forward"]);
28494     turnLanes.backward = parseTurnLanes(tags["turn:lanes:backward"]);
28495     var maxspeedLanes = {};
28496     maxspeedLanes.unspecified = parseMaxspeedLanes(tags["maxspeed:lanes"], maxspeed);
28497     maxspeedLanes.forward = parseMaxspeedLanes(tags["maxspeed:lanes:forward"], maxspeed);
28498     maxspeedLanes.backward = parseMaxspeedLanes(tags["maxspeed:lanes:backward"], maxspeed);
28499     var psvLanes = {};
28500     psvLanes.unspecified = parseMiscLanes(tags["psv:lanes"]);
28501     psvLanes.forward = parseMiscLanes(tags["psv:lanes:forward"]);
28502     psvLanes.backward = parseMiscLanes(tags["psv:lanes:backward"]);
28503     var busLanes = {};
28504     busLanes.unspecified = parseMiscLanes(tags["bus:lanes"]);
28505     busLanes.forward = parseMiscLanes(tags["bus:lanes:forward"]);
28506     busLanes.backward = parseMiscLanes(tags["bus:lanes:backward"]);
28507     var taxiLanes = {};
28508     taxiLanes.unspecified = parseMiscLanes(tags["taxi:lanes"]);
28509     taxiLanes.forward = parseMiscLanes(tags["taxi:lanes:forward"]);
28510     taxiLanes.backward = parseMiscLanes(tags["taxi:lanes:backward"]);
28511     var hovLanes = {};
28512     hovLanes.unspecified = parseMiscLanes(tags["hov:lanes"]);
28513     hovLanes.forward = parseMiscLanes(tags["hov:lanes:forward"]);
28514     hovLanes.backward = parseMiscLanes(tags["hov:lanes:backward"]);
28515     var hgvLanes = {};
28516     hgvLanes.unspecified = parseMiscLanes(tags["hgv:lanes"]);
28517     hgvLanes.forward = parseMiscLanes(tags["hgv:lanes:forward"]);
28518     hgvLanes.backward = parseMiscLanes(tags["hgv:lanes:backward"]);
28519     var bicyclewayLanes = {};
28520     bicyclewayLanes.unspecified = parseBicycleWay(tags["bicycleway:lanes"]);
28521     bicyclewayLanes.forward = parseBicycleWay(tags["bicycleway:lanes:forward"]);
28522     bicyclewayLanes.backward = parseBicycleWay(tags["bicycleway:lanes:backward"]);
28523     var lanesObj = {
28524       forward: [],
28525       backward: [],
28526       unspecified: []
28527     };
28528     mapToLanesObj(lanesObj, turnLanes, "turnLane");
28529     mapToLanesObj(lanesObj, maxspeedLanes, "maxspeed");
28530     mapToLanesObj(lanesObj, psvLanes, "psv");
28531     mapToLanesObj(lanesObj, busLanes, "bus");
28532     mapToLanesObj(lanesObj, taxiLanes, "taxi");
28533     mapToLanesObj(lanesObj, hovLanes, "hov");
28534     mapToLanesObj(lanesObj, hgvLanes, "hgv");
28535     mapToLanesObj(lanesObj, bicyclewayLanes, "bicycleway");
28536     return {
28537       metadata: {
28538         count: laneCount,
28539         oneway: isOneWay,
28540         forward,
28541         backward,
28542         bothways,
28543         turnLanes,
28544         maxspeed,
28545         maxspeedLanes,
28546         psvLanes,
28547         busLanes,
28548         taxiLanes,
28549         hovLanes,
28550         hgvLanes,
28551         bicyclewayLanes
28552       },
28553       lanes: lanesObj
28554     };
28555   }
28556   function getLaneCount(tags, isOneWay) {
28557     var count;
28558     if (tags.lanes) {
28559       count = parseInt(tags.lanes, 10);
28560       if (count > 0) {
28561         return count;
28562       }
28563     }
28564     switch (tags.highway) {
28565       case "trunk":
28566       case "motorway":
28567         count = isOneWay ? 2 : 4;
28568         break;
28569       default:
28570         count = isOneWay ? 1 : 2;
28571         break;
28572     }
28573     return count;
28574   }
28575   function parseMaxspeed(tags) {
28576     var maxspeed = tags.maxspeed;
28577     if (!maxspeed)
28578       return;
28579     var maxspeedRegex = /^([0-9][\.0-9]+?)(?:[ ]?(?:km\/h|kmh|kph|mph|knots))?$/;
28580     if (!maxspeedRegex.test(maxspeed))
28581       return;
28582     return parseInt(maxspeed, 10);
28583   }
28584   function parseLaneDirections(tags, isOneWay, laneCount) {
28585     var forward = parseInt(tags["lanes:forward"], 10);
28586     var backward = parseInt(tags["lanes:backward"], 10);
28587     var bothways = parseInt(tags["lanes:both_ways"], 10) > 0 ? 1 : 0;
28588     if (parseInt(tags.oneway, 10) === -1) {
28589       forward = 0;
28590       bothways = 0;
28591       backward = laneCount;
28592     } else if (isOneWay) {
28593       forward = laneCount;
28594       bothways = 0;
28595       backward = 0;
28596     } else if (isNaN(forward) && isNaN(backward)) {
28597       backward = Math.floor((laneCount - bothways) / 2);
28598       forward = laneCount - bothways - backward;
28599     } else if (isNaN(forward)) {
28600       if (backward > laneCount - bothways) {
28601         backward = laneCount - bothways;
28602       }
28603       forward = laneCount - bothways - backward;
28604     } else if (isNaN(backward)) {
28605       if (forward > laneCount - bothways) {
28606         forward = laneCount - bothways;
28607       }
28608       backward = laneCount - bothways - forward;
28609     }
28610     return {
28611       forward,
28612       backward,
28613       bothways
28614     };
28615   }
28616   function parseTurnLanes(tag) {
28617     if (!tag)
28618       return;
28619     var validValues = [
28620       "left",
28621       "slight_left",
28622       "sharp_left",
28623       "through",
28624       "right",
28625       "slight_right",
28626       "sharp_right",
28627       "reverse",
28628       "merge_to_left",
28629       "merge_to_right",
28630       "none"
28631     ];
28632     return tag.split("|").map(function(s) {
28633       if (s === "")
28634         s = "none";
28635       return s.split(";").map(function(d) {
28636         return validValues.indexOf(d) === -1 ? "unknown" : d;
28637       });
28638     });
28639   }
28640   function parseMaxspeedLanes(tag, maxspeed) {
28641     if (!tag)
28642       return;
28643     return tag.split("|").map(function(s) {
28644       if (s === "none")
28645         return s;
28646       var m = parseInt(s, 10);
28647       if (s === "" || m === maxspeed)
28648         return null;
28649       return isNaN(m) ? "unknown" : m;
28650     });
28651   }
28652   function parseMiscLanes(tag) {
28653     if (!tag)
28654       return;
28655     var validValues = [
28656       "yes",
28657       "no",
28658       "designated"
28659     ];
28660     return tag.split("|").map(function(s) {
28661       if (s === "")
28662         s = "no";
28663       return validValues.indexOf(s) === -1 ? "unknown" : s;
28664     });
28665   }
28666   function parseBicycleWay(tag) {
28667     if (!tag)
28668       return;
28669     var validValues = [
28670       "yes",
28671       "no",
28672       "designated",
28673       "lane"
28674     ];
28675     return tag.split("|").map(function(s) {
28676       if (s === "")
28677         s = "no";
28678       return validValues.indexOf(s) === -1 ? "unknown" : s;
28679     });
28680   }
28681   function mapToLanesObj(lanesObj, data, key) {
28682     if (data.forward) {
28683       data.forward.forEach(function(l, i2) {
28684         if (!lanesObj.forward[i2])
28685           lanesObj.forward[i2] = {};
28686         lanesObj.forward[i2][key] = l;
28687       });
28688     }
28689     if (data.backward) {
28690       data.backward.forEach(function(l, i2) {
28691         if (!lanesObj.backward[i2])
28692           lanesObj.backward[i2] = {};
28693         lanesObj.backward[i2][key] = l;
28694       });
28695     }
28696     if (data.unspecified) {
28697       data.unspecified.forEach(function(l, i2) {
28698         if (!lanesObj.unspecified[i2])
28699           lanesObj.unspecified[i2] = {};
28700         lanesObj.unspecified[i2][key] = l;
28701       });
28702     }
28703   }
28704
28705   // modules/osm/way.js
28706   function osmWay() {
28707     if (!(this instanceof osmWay)) {
28708       return new osmWay().initialize(arguments);
28709     } else if (arguments.length) {
28710       this.initialize(arguments);
28711     }
28712   }
28713   osmEntity.way = osmWay;
28714   osmWay.prototype = Object.create(osmEntity.prototype);
28715   Object.assign(osmWay.prototype, {
28716     type: "way",
28717     nodes: [],
28718     copy: function(resolver, copies) {
28719       if (copies[this.id])
28720         return copies[this.id];
28721       var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
28722       var nodes = this.nodes.map(function(id2) {
28723         return resolver.entity(id2).copy(resolver, copies).id;
28724       });
28725       copy2 = copy2.update({ nodes });
28726       copies[this.id] = copy2;
28727       return copy2;
28728     },
28729     extent: function(resolver) {
28730       return resolver.transient(this, "extent", function() {
28731         var extent = geoExtent();
28732         for (var i2 = 0; i2 < this.nodes.length; i2++) {
28733           var node = resolver.hasEntity(this.nodes[i2]);
28734           if (node) {
28735             extent._extend(node.extent());
28736           }
28737         }
28738         return extent;
28739       });
28740     },
28741     first: function() {
28742       return this.nodes[0];
28743     },
28744     last: function() {
28745       return this.nodes[this.nodes.length - 1];
28746     },
28747     contains: function(node) {
28748       return this.nodes.indexOf(node) >= 0;
28749     },
28750     affix: function(node) {
28751       if (this.nodes[0] === node)
28752         return "prefix";
28753       if (this.nodes[this.nodes.length - 1] === node)
28754         return "suffix";
28755     },
28756     layer: function() {
28757       if (isFinite(this.tags.layer)) {
28758         return Math.max(-10, Math.min(+this.tags.layer, 10));
28759       }
28760       if (this.tags.covered === "yes")
28761         return -1;
28762       if (this.tags.location === "overground")
28763         return 1;
28764       if (this.tags.location === "underground")
28765         return -1;
28766       if (this.tags.location === "underwater")
28767         return -10;
28768       if (this.tags.power === "line")
28769         return 10;
28770       if (this.tags.power === "minor_line")
28771         return 10;
28772       if (this.tags.aerialway)
28773         return 10;
28774       if (this.tags.bridge)
28775         return 1;
28776       if (this.tags.cutting)
28777         return -1;
28778       if (this.tags.tunnel)
28779         return -1;
28780       if (this.tags.waterway)
28781         return -1;
28782       if (this.tags.man_made === "pipeline")
28783         return -10;
28784       if (this.tags.boundary)
28785         return -10;
28786       return 0;
28787     },
28788     // the approximate width of the line based on its tags except its `width` tag
28789     impliedLineWidthMeters: function() {
28790       var averageWidths = {
28791         highway: {
28792           // width is for single lane
28793           motorway: 5,
28794           motorway_link: 5,
28795           trunk: 4.5,
28796           trunk_link: 4.5,
28797           primary: 4,
28798           secondary: 4,
28799           tertiary: 4,
28800           primary_link: 4,
28801           secondary_link: 4,
28802           tertiary_link: 4,
28803           unclassified: 4,
28804           road: 4,
28805           living_street: 4,
28806           bus_guideway: 4,
28807           pedestrian: 4,
28808           residential: 3.5,
28809           service: 3.5,
28810           track: 3,
28811           cycleway: 2.5,
28812           bridleway: 2,
28813           corridor: 2,
28814           steps: 2,
28815           path: 1.5,
28816           footway: 1.5
28817         },
28818         railway: {
28819           // width includes ties and rail bed, not just track gauge
28820           rail: 2.5,
28821           light_rail: 2.5,
28822           tram: 2.5,
28823           subway: 2.5,
28824           monorail: 2.5,
28825           funicular: 2.5,
28826           disused: 2.5,
28827           preserved: 2.5,
28828           miniature: 1.5,
28829           narrow_gauge: 1.5
28830         },
28831         waterway: {
28832           river: 50,
28833           canal: 25,
28834           stream: 5,
28835           tidal_channel: 5,
28836           fish_pass: 2.5,
28837           drain: 2.5,
28838           ditch: 1.5
28839         }
28840       };
28841       for (var key in averageWidths) {
28842         if (this.tags[key] && averageWidths[key][this.tags[key]]) {
28843           var width = averageWidths[key][this.tags[key]];
28844           if (key === "highway") {
28845             var laneCount = this.tags.lanes && parseInt(this.tags.lanes, 10);
28846             if (!laneCount)
28847               laneCount = this.isOneWay() ? 1 : 2;
28848             return width * laneCount;
28849           }
28850           return width;
28851         }
28852       }
28853       return null;
28854     },
28855     isOneWay: function() {
28856       var values = {
28857         "yes": true,
28858         "1": true,
28859         "-1": true,
28860         "reversible": true,
28861         "alternating": true,
28862         "no": false,
28863         "0": false
28864       };
28865       if (values[this.tags.oneway] !== void 0) {
28866         return values[this.tags.oneway];
28867       }
28868       for (var key in this.tags) {
28869         if (key in osmOneWayTags && this.tags[key] in osmOneWayTags[key]) {
28870           return true;
28871         }
28872       }
28873       return false;
28874     },
28875     // Some identifier for tag that implies that this way is "sided",
28876     // i.e. the right side is the 'inside' (e.g. the right side of a
28877     // natural=cliff is lower).
28878     sidednessIdentifier: function() {
28879       for (const realKey in this.tags) {
28880         const value = this.tags[realKey];
28881         const key = osmRemoveLifecyclePrefix(realKey);
28882         if (key in osmRightSideIsInsideTags && value in osmRightSideIsInsideTags[key]) {
28883           if (osmRightSideIsInsideTags[key][value] === true) {
28884             return key;
28885           } else {
28886             return osmRightSideIsInsideTags[key][value];
28887           }
28888         }
28889       }
28890       return null;
28891     },
28892     isSided: function() {
28893       if (this.tags.two_sided === "yes") {
28894         return false;
28895       }
28896       return this.sidednessIdentifier() !== null;
28897     },
28898     lanes: function() {
28899       return osmLanes(this);
28900     },
28901     isClosed: function() {
28902       return this.nodes.length > 1 && this.first() === this.last();
28903     },
28904     isConvex: function(resolver) {
28905       if (!this.isClosed() || this.isDegenerate())
28906         return null;
28907       var nodes = utilArrayUniq(resolver.childNodes(this));
28908       var coords = nodes.map(function(n2) {
28909         return n2.loc;
28910       });
28911       var curr = 0;
28912       var prev = 0;
28913       for (var i2 = 0; i2 < coords.length; i2++) {
28914         var o = coords[(i2 + 1) % coords.length];
28915         var a = coords[i2];
28916         var b = coords[(i2 + 2) % coords.length];
28917         var res = geoVecCross(a, b, o);
28918         curr = res > 0 ? 1 : res < 0 ? -1 : 0;
28919         if (curr === 0) {
28920           continue;
28921         } else if (prev && curr !== prev) {
28922           return false;
28923         }
28924         prev = curr;
28925       }
28926       return true;
28927     },
28928     // returns an object with the tag that implies this is an area, if any
28929     tagSuggestingArea: function() {
28930       return osmTagSuggestingArea(this.tags);
28931     },
28932     isArea: function() {
28933       if (this.tags.area === "yes")
28934         return true;
28935       if (!this.isClosed() || this.tags.area === "no")
28936         return false;
28937       return this.tagSuggestingArea() !== null;
28938     },
28939     isDegenerate: function() {
28940       return new Set(this.nodes).size < (this.isArea() ? 3 : 2);
28941     },
28942     areAdjacent: function(n1, n2) {
28943       for (var i2 = 0; i2 < this.nodes.length; i2++) {
28944         if (this.nodes[i2] === n1) {
28945           if (this.nodes[i2 - 1] === n2)
28946             return true;
28947           if (this.nodes[i2 + 1] === n2)
28948             return true;
28949         }
28950       }
28951       return false;
28952     },
28953     geometry: function(graph) {
28954       return graph.transient(this, "geometry", function() {
28955         return this.isArea() ? "area" : "line";
28956       });
28957     },
28958     // returns an array of objects representing the segments between the nodes in this way
28959     segments: function(graph) {
28960       function segmentExtent(graph2) {
28961         var n1 = graph2.hasEntity(this.nodes[0]);
28962         var n2 = graph2.hasEntity(this.nodes[1]);
28963         return n1 && n2 && geoExtent([
28964           [
28965             Math.min(n1.loc[0], n2.loc[0]),
28966             Math.min(n1.loc[1], n2.loc[1])
28967           ],
28968           [
28969             Math.max(n1.loc[0], n2.loc[0]),
28970             Math.max(n1.loc[1], n2.loc[1])
28971           ]
28972         ]);
28973       }
28974       return graph.transient(this, "segments", function() {
28975         var segments = [];
28976         for (var i2 = 0; i2 < this.nodes.length - 1; i2++) {
28977           segments.push({
28978             id: this.id + "-" + i2,
28979             wayId: this.id,
28980             index: i2,
28981             nodes: [this.nodes[i2], this.nodes[i2 + 1]],
28982             extent: segmentExtent
28983           });
28984         }
28985         return segments;
28986       });
28987     },
28988     // If this way is not closed, append the beginning node to the end of the nodelist to close it.
28989     close: function() {
28990       if (this.isClosed() || !this.nodes.length)
28991         return this;
28992       var nodes = this.nodes.slice();
28993       nodes = nodes.filter(noRepeatNodes);
28994       nodes.push(nodes[0]);
28995       return this.update({ nodes });
28996     },
28997     // If this way is closed, remove any connector nodes from the end of the nodelist to unclose it.
28998     unclose: function() {
28999       if (!this.isClosed())
29000         return this;
29001       var nodes = this.nodes.slice();
29002       var connector = this.first();
29003       var i2 = nodes.length - 1;
29004       while (i2 > 0 && nodes.length > 1 && nodes[i2] === connector) {
29005         nodes.splice(i2, 1);
29006         i2 = nodes.length - 1;
29007       }
29008       nodes = nodes.filter(noRepeatNodes);
29009       return this.update({ nodes });
29010     },
29011     // Adds a node (id) in front of the node which is currently at position index.
29012     // If index is undefined, the node will be added to the end of the way for linear ways,
29013     //   or just before the final connecting node for circular ways.
29014     // Consecutive duplicates are eliminated including existing ones.
29015     // Circularity is always preserved when adding a node.
29016     addNode: function(id2, index) {
29017       var nodes = this.nodes.slice();
29018       var isClosed = this.isClosed();
29019       var max3 = isClosed ? nodes.length - 1 : nodes.length;
29020       if (index === void 0) {
29021         index = max3;
29022       }
29023       if (index < 0 || index > max3) {
29024         throw new RangeError("index " + index + " out of range 0.." + max3);
29025       }
29026       if (isClosed) {
29027         var connector = this.first();
29028         var i2 = 1;
29029         while (i2 < nodes.length && nodes.length > 2 && nodes[i2] === connector) {
29030           nodes.splice(i2, 1);
29031           if (index > i2)
29032             index--;
29033         }
29034         i2 = nodes.length - 1;
29035         while (i2 > 0 && nodes.length > 1 && nodes[i2] === connector) {
29036           nodes.splice(i2, 1);
29037           if (index > i2)
29038             index--;
29039           i2 = nodes.length - 1;
29040         }
29041       }
29042       nodes.splice(index, 0, id2);
29043       nodes = nodes.filter(noRepeatNodes);
29044       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29045         nodes.push(nodes[0]);
29046       }
29047       return this.update({ nodes });
29048     },
29049     // Replaces the node which is currently at position index with the given node (id).
29050     // Consecutive duplicates are eliminated including existing ones.
29051     // Circularity is preserved when updating a node.
29052     updateNode: function(id2, index) {
29053       var nodes = this.nodes.slice();
29054       var isClosed = this.isClosed();
29055       var max3 = nodes.length - 1;
29056       if (index === void 0 || index < 0 || index > max3) {
29057         throw new RangeError("index " + index + " out of range 0.." + max3);
29058       }
29059       if (isClosed) {
29060         var connector = this.first();
29061         var i2 = 1;
29062         while (i2 < nodes.length && nodes.length > 2 && nodes[i2] === connector) {
29063           nodes.splice(i2, 1);
29064           if (index > i2)
29065             index--;
29066         }
29067         i2 = nodes.length - 1;
29068         while (i2 > 0 && nodes.length > 1 && nodes[i2] === connector) {
29069           nodes.splice(i2, 1);
29070           if (index === i2)
29071             index = 0;
29072           i2 = nodes.length - 1;
29073         }
29074       }
29075       nodes.splice(index, 1, id2);
29076       nodes = nodes.filter(noRepeatNodes);
29077       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29078         nodes.push(nodes[0]);
29079       }
29080       return this.update({ nodes });
29081     },
29082     // Replaces each occurrence of node id needle with replacement.
29083     // Consecutive duplicates are eliminated including existing ones.
29084     // Circularity is preserved.
29085     replaceNode: function(needleID, replacementID) {
29086       var nodes = this.nodes.slice();
29087       var isClosed = this.isClosed();
29088       for (var i2 = 0; i2 < nodes.length; i2++) {
29089         if (nodes[i2] === needleID) {
29090           nodes[i2] = replacementID;
29091         }
29092       }
29093       nodes = nodes.filter(noRepeatNodes);
29094       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29095         nodes.push(nodes[0]);
29096       }
29097       return this.update({ nodes });
29098     },
29099     // Removes each occurrence of node id.
29100     // Consecutive duplicates are eliminated including existing ones.
29101     // Circularity is preserved.
29102     removeNode: function(id2) {
29103       var nodes = this.nodes.slice();
29104       var isClosed = this.isClosed();
29105       nodes = nodes.filter(function(node) {
29106         return node !== id2;
29107       }).filter(noRepeatNodes);
29108       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29109         nodes.push(nodes[0]);
29110       }
29111       return this.update({ nodes });
29112     },
29113     asJXON: function(changeset_id) {
29114       var r = {
29115         way: {
29116           "@id": this.osmId(),
29117           "@version": this.version || 0,
29118           nd: this.nodes.map(function(id2) {
29119             return { keyAttributes: { ref: osmEntity.id.toOSM(id2) } };
29120           }, this),
29121           tag: Object.keys(this.tags).map(function(k) {
29122             return { keyAttributes: { k, v: this.tags[k] } };
29123           }, this)
29124         }
29125       };
29126       if (changeset_id) {
29127         r.way["@changeset"] = changeset_id;
29128       }
29129       return r;
29130     },
29131     asGeoJSON: function(resolver) {
29132       return resolver.transient(this, "GeoJSON", function() {
29133         var coordinates = resolver.childNodes(this).map(function(n2) {
29134           return n2.loc;
29135         });
29136         if (this.isArea() && this.isClosed()) {
29137           return {
29138             type: "Polygon",
29139             coordinates: [coordinates]
29140           };
29141         } else {
29142           return {
29143             type: "LineString",
29144             coordinates
29145           };
29146         }
29147       });
29148     },
29149     area: function(resolver) {
29150       return resolver.transient(this, "area", function() {
29151         var nodes = resolver.childNodes(this);
29152         var json = {
29153           type: "Polygon",
29154           coordinates: [nodes.map(function(n2) {
29155             return n2.loc;
29156           })]
29157         };
29158         if (!this.isClosed() && nodes.length) {
29159           json.coordinates[0].push(nodes[0].loc);
29160         }
29161         var area = area_default(json);
29162         if (area > 2 * Math.PI) {
29163           json.coordinates[0] = json.coordinates[0].reverse();
29164           area = area_default(json);
29165         }
29166         return isNaN(area) ? 0 : area;
29167       });
29168     }
29169   });
29170   function noRepeatNodes(node, i2, arr) {
29171     return i2 === 0 || node !== arr[i2 - 1];
29172   }
29173
29174   // modules/osm/multipolygon.js
29175   function osmOldMultipolygonOuterMemberOfRelation(entity, graph) {
29176     if (entity.type !== "relation" || !entity.isMultipolygon() || Object.keys(entity.tags).filter(osmIsInterestingTag).length > 1) {
29177       return false;
29178     }
29179     var outerMember;
29180     for (var memberIndex in entity.members) {
29181       var member = entity.members[memberIndex];
29182       if (!member.role || member.role === "outer") {
29183         if (outerMember)
29184           return false;
29185         if (member.type !== "way")
29186           return false;
29187         if (!graph.hasEntity(member.id))
29188           return false;
29189         outerMember = graph.entity(member.id);
29190         if (Object.keys(outerMember.tags).filter(osmIsInterestingTag).length === 0) {
29191           return false;
29192         }
29193       }
29194     }
29195     return outerMember;
29196   }
29197   function osmIsOldMultipolygonOuterMember(entity, graph) {
29198     if (entity.type !== "way" || Object.keys(entity.tags).filter(osmIsInterestingTag).length === 0) {
29199       return false;
29200     }
29201     var parents = graph.parentRelations(entity);
29202     if (parents.length !== 1)
29203       return false;
29204     var parent = parents[0];
29205     if (!parent.isMultipolygon() || Object.keys(parent.tags).filter(osmIsInterestingTag).length > 1) {
29206       return false;
29207     }
29208     var members = parent.members, member;
29209     for (var i2 = 0; i2 < members.length; i2++) {
29210       member = members[i2];
29211       if (member.id === entity.id && member.role && member.role !== "outer") {
29212         return false;
29213       }
29214       if (member.id !== entity.id && (!member.role || member.role === "outer")) {
29215         return false;
29216       }
29217     }
29218     return parent;
29219   }
29220   function osmOldMultipolygonOuterMember(entity, graph) {
29221     if (entity.type !== "way")
29222       return false;
29223     var parents = graph.parentRelations(entity);
29224     if (parents.length !== 1)
29225       return false;
29226     var parent = parents[0];
29227     if (!parent.isMultipolygon() || Object.keys(parent.tags).filter(osmIsInterestingTag).length > 1) {
29228       return false;
29229     }
29230     var members = parent.members, member, outerMember;
29231     for (var i2 = 0; i2 < members.length; i2++) {
29232       member = members[i2];
29233       if (!member.role || member.role === "outer") {
29234         if (outerMember)
29235           return false;
29236         outerMember = member;
29237       }
29238     }
29239     if (!outerMember)
29240       return false;
29241     var outerEntity = graph.hasEntity(outerMember.id);
29242     if (!outerEntity || !Object.keys(outerEntity.tags).filter(osmIsInterestingTag).length) {
29243       return false;
29244     }
29245     return outerEntity;
29246   }
29247   function osmJoinWays(toJoin, graph) {
29248     function resolve(member) {
29249       return graph.childNodes(graph.entity(member.id));
29250     }
29251     function reverse(item2) {
29252       var action = actionReverse(item2.id, { reverseOneway: true });
29253       sequences.actions.push(action);
29254       return item2 instanceof osmWay ? action(graph).entity(item2.id) : item2;
29255     }
29256     toJoin = toJoin.filter(function(member) {
29257       return member.type === "way" && graph.hasEntity(member.id);
29258     });
29259     var i2;
29260     var joinAsMembers = true;
29261     for (i2 = 0; i2 < toJoin.length; i2++) {
29262       if (toJoin[i2] instanceof osmWay) {
29263         joinAsMembers = false;
29264         break;
29265       }
29266     }
29267     var sequences = [];
29268     sequences.actions = [];
29269     while (toJoin.length) {
29270       var item = toJoin.shift();
29271       var currWays = [item];
29272       var currNodes = resolve(item).slice();
29273       while (toJoin.length) {
29274         var start2 = currNodes[0];
29275         var end = currNodes[currNodes.length - 1];
29276         var fn = null;
29277         var nodes = null;
29278         for (i2 = 0; i2 < toJoin.length; i2++) {
29279           item = toJoin[i2];
29280           nodes = resolve(item);
29281           if (joinAsMembers && currWays.length === 1 && nodes[0] !== end && nodes[nodes.length - 1] !== end && (nodes[nodes.length - 1] === start2 || nodes[0] === start2)) {
29282             currWays[0] = reverse(currWays[0]);
29283             currNodes.reverse();
29284             start2 = currNodes[0];
29285             end = currNodes[currNodes.length - 1];
29286           }
29287           if (nodes[0] === end) {
29288             fn = currNodes.push;
29289             nodes = nodes.slice(1);
29290             break;
29291           } else if (nodes[nodes.length - 1] === end) {
29292             fn = currNodes.push;
29293             nodes = nodes.slice(0, -1).reverse();
29294             item = reverse(item);
29295             break;
29296           } else if (nodes[nodes.length - 1] === start2) {
29297             fn = currNodes.unshift;
29298             nodes = nodes.slice(0, -1);
29299             break;
29300           } else if (nodes[0] === start2) {
29301             fn = currNodes.unshift;
29302             nodes = nodes.slice(1).reverse();
29303             item = reverse(item);
29304             break;
29305           } else {
29306             fn = nodes = null;
29307           }
29308         }
29309         if (!nodes) {
29310           break;
29311         }
29312         fn.apply(currWays, [item]);
29313         fn.apply(currNodes, nodes);
29314         toJoin.splice(i2, 1);
29315       }
29316       currWays.nodes = currNodes;
29317       sequences.push(currWays);
29318     }
29319     return sequences;
29320   }
29321
29322   // modules/actions/add_member.js
29323   function actionAddMember(relationId, member, memberIndex, insertPair) {
29324     return function action(graph) {
29325       var relation = graph.entity(relationId);
29326       var isPTv2 = /stop|platform/.test(member.role);
29327       if ((isNaN(memberIndex) || insertPair) && member.type === "way" && !isPTv2) {
29328         graph = addWayMember(relation, graph);
29329       } else {
29330         if (isPTv2 && isNaN(memberIndex)) {
29331           memberIndex = 0;
29332         }
29333         graph = graph.replace(relation.addMember(member, memberIndex));
29334       }
29335       return graph;
29336     };
29337     function addWayMember(relation, graph) {
29338       var groups, tempWay, insertPairIsReversed, item, i2, j2, k;
29339       var PTv2members = [];
29340       var members = [];
29341       for (i2 = 0; i2 < relation.members.length; i2++) {
29342         var m = relation.members[i2];
29343         if (/stop|platform/.test(m.role)) {
29344           PTv2members.push(m);
29345         } else {
29346           members.push(m);
29347         }
29348       }
29349       relation = relation.update({ members });
29350       if (insertPair) {
29351         tempWay = osmWay({ id: "wTemp", nodes: insertPair.nodes });
29352         graph = graph.replace(tempWay);
29353         var tempMember = { id: tempWay.id, type: "way", role: member.role };
29354         var tempRelation = relation.replaceMember({ id: insertPair.originalID }, tempMember, true);
29355         groups = utilArrayGroupBy(tempRelation.members, "type");
29356         groups.way = groups.way || [];
29357         var originalWay = graph.entity(insertPair.originalID);
29358         var insertedWay = graph.entity(insertPair.insertedID);
29359         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];
29360       } else {
29361         groups = utilArrayGroupBy(relation.members, "type");
29362         groups.way = groups.way || [];
29363         groups.way.push(member);
29364       }
29365       members = withIndex(groups.way);
29366       var joined = osmJoinWays(members, graph);
29367       for (i2 = 0; i2 < joined.length; i2++) {
29368         var segment = joined[i2];
29369         var nodes = segment.nodes.slice();
29370         var startIndex = segment[0].index;
29371         for (j2 = 0; j2 < members.length; j2++) {
29372           if (members[j2].index === startIndex) {
29373             break;
29374           }
29375         }
29376         for (k = 0; k < segment.length; k++) {
29377           item = segment[k];
29378           var way = graph.entity(item.id);
29379           if (tempWay && item.id === tempWay.id) {
29380             var reverse = nodes[0].id !== insertPair.nodes[0] ^ insertPairIsReversed;
29381             if (reverse) {
29382               item.pair = [
29383                 { id: insertPair.insertedID, type: "way", role: item.role },
29384                 { id: insertPair.originalID, type: "way", role: item.role }
29385               ];
29386             } else {
29387               item.pair = [
29388                 { id: insertPair.originalID, type: "way", role: item.role },
29389                 { id: insertPair.insertedID, type: "way", role: item.role }
29390               ];
29391             }
29392           }
29393           if (k > 0) {
29394             if (j2 + k >= members.length || item.index !== members[j2 + k].index) {
29395               moveMember(members, item.index, j2 + k);
29396             }
29397           }
29398           nodes.splice(0, way.nodes.length - 1);
29399         }
29400       }
29401       if (tempWay) {
29402         graph = graph.remove(tempWay);
29403       }
29404       var wayMembers = [];
29405       for (i2 = 0; i2 < members.length; i2++) {
29406         item = members[i2];
29407         if (item.index === -1)
29408           continue;
29409         if (item.pair) {
29410           wayMembers.push(item.pair[0]);
29411           wayMembers.push(item.pair[1]);
29412         } else {
29413           wayMembers.push(utilObjectOmit(item, ["index"]));
29414         }
29415       }
29416       var newMembers = PTv2members.concat(groups.node || [], wayMembers, groups.relation || []);
29417       return graph.replace(relation.update({ members: newMembers }));
29418       function moveMember(arr, findIndex, toIndex) {
29419         var i3;
29420         for (i3 = 0; i3 < arr.length; i3++) {
29421           if (arr[i3].index === findIndex) {
29422             break;
29423           }
29424         }
29425         var item2 = Object.assign({}, arr[i3]);
29426         arr[i3].index = -1;
29427         item2.index = toIndex;
29428         arr.splice(toIndex, 0, item2);
29429       }
29430       function withIndex(arr) {
29431         var result = new Array(arr.length);
29432         for (var i3 = 0; i3 < arr.length; i3++) {
29433           result[i3] = Object.assign({}, arr[i3]);
29434           result[i3].index = i3;
29435         }
29436         return result;
29437       }
29438     }
29439   }
29440
29441   // modules/actions/add_midpoint.js
29442   function actionAddMidpoint(midpoint, node) {
29443     return function(graph) {
29444       graph = graph.replace(node.move(midpoint.loc));
29445       var parents = utilArrayIntersection(
29446         graph.parentWays(graph.entity(midpoint.edge[0])),
29447         graph.parentWays(graph.entity(midpoint.edge[1]))
29448       );
29449       parents.forEach(function(way) {
29450         for (var i2 = 0; i2 < way.nodes.length - 1; i2++) {
29451           if (geoEdgeEqual([way.nodes[i2], way.nodes[i2 + 1]], midpoint.edge)) {
29452             graph = graph.replace(graph.entity(way.id).addNode(node.id, i2 + 1));
29453             return;
29454           }
29455         }
29456       });
29457       return graph;
29458     };
29459   }
29460
29461   // modules/actions/add_vertex.js
29462   function actionAddVertex(wayId, nodeId, index) {
29463     return function(graph) {
29464       return graph.replace(graph.entity(wayId).addNode(nodeId, index));
29465     };
29466   }
29467
29468   // modules/actions/change_member.js
29469   function actionChangeMember(relationId, member, memberIndex) {
29470     return function(graph) {
29471       return graph.replace(graph.entity(relationId).updateMember(member, memberIndex));
29472     };
29473   }
29474
29475   // modules/actions/change_preset.js
29476   function actionChangePreset(entityID, oldPreset, newPreset, skipFieldDefaults) {
29477     return function action(graph) {
29478       var entity = graph.entity(entityID);
29479       var geometry = entity.geometry(graph);
29480       var tags = entity.tags;
29481       const loc = entity.extent(graph).center();
29482       var preserveKeys;
29483       if (newPreset) {
29484         preserveKeys = [];
29485         if (newPreset.addTags) {
29486           preserveKeys = preserveKeys.concat(Object.keys(newPreset.addTags));
29487         }
29488         if (oldPreset && !oldPreset.id.startsWith(newPreset.id)) {
29489           newPreset.fields(loc).concat(newPreset.moreFields(loc)).filter((f2) => f2.matchGeometry(geometry)).map((f2) => f2.key).filter(Boolean).forEach((key) => preserveKeys.push(key));
29490         }
29491       }
29492       if (oldPreset)
29493         tags = oldPreset.unsetTags(tags, geometry, preserveKeys, false, loc);
29494       if (newPreset)
29495         tags = newPreset.setTags(tags, geometry, skipFieldDefaults, loc);
29496       return graph.replace(entity.update({ tags }));
29497     };
29498   }
29499
29500   // modules/actions/change_tags.js
29501   function actionChangeTags(entityId, tags) {
29502     return function(graph) {
29503       var entity = graph.entity(entityId);
29504       return graph.replace(entity.update({ tags }));
29505     };
29506   }
29507
29508   // modules/osm/node.js
29509   var cardinal = {
29510     north: 0,
29511     n: 0,
29512     northnortheast: 22,
29513     nne: 22,
29514     northeast: 45,
29515     ne: 45,
29516     eastnortheast: 67,
29517     ene: 67,
29518     east: 90,
29519     e: 90,
29520     eastsoutheast: 112,
29521     ese: 112,
29522     southeast: 135,
29523     se: 135,
29524     southsoutheast: 157,
29525     sse: 157,
29526     south: 180,
29527     s: 180,
29528     southsouthwest: 202,
29529     ssw: 202,
29530     southwest: 225,
29531     sw: 225,
29532     westsouthwest: 247,
29533     wsw: 247,
29534     west: 270,
29535     w: 270,
29536     westnorthwest: 292,
29537     wnw: 292,
29538     northwest: 315,
29539     nw: 315,
29540     northnorthwest: 337,
29541     nnw: 337
29542   };
29543   function osmNode() {
29544     if (!(this instanceof osmNode)) {
29545       return new osmNode().initialize(arguments);
29546     } else if (arguments.length) {
29547       this.initialize(arguments);
29548     }
29549   }
29550   osmEntity.node = osmNode;
29551   osmNode.prototype = Object.create(osmEntity.prototype);
29552   Object.assign(osmNode.prototype, {
29553     type: "node",
29554     loc: [9999, 9999],
29555     extent: function() {
29556       return new geoExtent(this.loc);
29557     },
29558     geometry: function(graph) {
29559       return graph.transient(this, "geometry", function() {
29560         return graph.isPoi(this) ? "point" : "vertex";
29561       });
29562     },
29563     move: function(loc) {
29564       return this.update({ loc });
29565     },
29566     isDegenerate: function() {
29567       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);
29568     },
29569     // Inspect tags and geometry to determine which direction(s) this node/vertex points
29570     directions: function(resolver, projection2) {
29571       var val;
29572       var i2;
29573       if (this.isHighwayIntersection(resolver) && (this.tags.stop || "").toLowerCase() === "all") {
29574         val = "all";
29575       } else {
29576         val = (this.tags.direction || "").toLowerCase();
29577         var re2 = /:direction$/i;
29578         var keys2 = Object.keys(this.tags);
29579         for (i2 = 0; i2 < keys2.length; i2++) {
29580           if (re2.test(keys2[i2])) {
29581             val = this.tags[keys2[i2]].toLowerCase();
29582             break;
29583           }
29584         }
29585       }
29586       if (val === "")
29587         return [];
29588       var values = val.split(";");
29589       var results = [];
29590       values.forEach(function(v) {
29591         if (cardinal[v] !== void 0) {
29592           v = cardinal[v];
29593         }
29594         if (v !== "" && !isNaN(+v)) {
29595           results.push(+v);
29596           return;
29597         }
29598         var lookBackward = this.tags["traffic_sign:backward"] || v === "backward" || v === "both" || v === "all";
29599         var lookForward = this.tags["traffic_sign:forward"] || v === "forward" || v === "both" || v === "all";
29600         if (!lookForward && !lookBackward)
29601           return;
29602         var nodeIds = {};
29603         resolver.parentWays(this).forEach(function(parent) {
29604           var nodes = parent.nodes;
29605           for (i2 = 0; i2 < nodes.length; i2++) {
29606             if (nodes[i2] === this.id) {
29607               if (lookForward && i2 > 0) {
29608                 nodeIds[nodes[i2 - 1]] = true;
29609               }
29610               if (lookBackward && i2 < nodes.length - 1) {
29611                 nodeIds[nodes[i2 + 1]] = true;
29612               }
29613             }
29614           }
29615         }, this);
29616         Object.keys(nodeIds).forEach(function(nodeId) {
29617           results.push(
29618             geoAngle(this, resolver.entity(nodeId), projection2) * (180 / Math.PI) + 90
29619           );
29620         }, this);
29621       }, this);
29622       return utilArrayUniq(results);
29623     },
29624     isCrossing: function() {
29625       return this.tags.highway === "crossing" || this.tags.railway && this.tags.railway.indexOf("crossing") !== -1;
29626     },
29627     isEndpoint: function(resolver) {
29628       return resolver.transient(this, "isEndpoint", function() {
29629         var id2 = this.id;
29630         return resolver.parentWays(this).filter(function(parent) {
29631           return !parent.isClosed() && !!parent.affix(id2);
29632         }).length > 0;
29633       });
29634     },
29635     isConnected: function(resolver) {
29636       return resolver.transient(this, "isConnected", function() {
29637         var parents = resolver.parentWays(this);
29638         if (parents.length > 1) {
29639           for (var i2 in parents) {
29640             if (parents[i2].geometry(resolver) === "line" && parents[i2].hasInterestingTags())
29641               return true;
29642           }
29643         } else if (parents.length === 1) {
29644           var way = parents[0];
29645           var nodes = way.nodes.slice();
29646           if (way.isClosed()) {
29647             nodes.pop();
29648           }
29649           return nodes.indexOf(this.id) !== nodes.lastIndexOf(this.id);
29650         }
29651         return false;
29652       });
29653     },
29654     parentIntersectionWays: function(resolver) {
29655       return resolver.transient(this, "parentIntersectionWays", function() {
29656         return resolver.parentWays(this).filter(function(parent) {
29657           return (parent.tags.highway || parent.tags.waterway || parent.tags.railway || parent.tags.aeroway) && parent.geometry(resolver) === "line";
29658         });
29659       });
29660     },
29661     isIntersection: function(resolver) {
29662       return this.parentIntersectionWays(resolver).length > 1;
29663     },
29664     isHighwayIntersection: function(resolver) {
29665       return resolver.transient(this, "isHighwayIntersection", function() {
29666         return resolver.parentWays(this).filter(function(parent) {
29667           return parent.tags.highway && parent.geometry(resolver) === "line";
29668         }).length > 1;
29669       });
29670     },
29671     isOnAddressLine: function(resolver) {
29672       return resolver.transient(this, "isOnAddressLine", function() {
29673         return resolver.parentWays(this).filter(function(parent) {
29674           return parent.tags.hasOwnProperty("addr:interpolation") && parent.geometry(resolver) === "line";
29675         }).length > 0;
29676       });
29677     },
29678     asJXON: function(changeset_id) {
29679       var r = {
29680         node: {
29681           "@id": this.osmId(),
29682           "@lon": this.loc[0],
29683           "@lat": this.loc[1],
29684           "@version": this.version || 0,
29685           tag: Object.keys(this.tags).map(function(k) {
29686             return { keyAttributes: { k, v: this.tags[k] } };
29687           }, this)
29688         }
29689       };
29690       if (changeset_id)
29691         r.node["@changeset"] = changeset_id;
29692       return r;
29693     },
29694     asGeoJSON: function() {
29695       return {
29696         type: "Point",
29697         coordinates: this.loc
29698       };
29699     }
29700   });
29701
29702   // modules/actions/circularize.js
29703   function actionCircularize(wayId, projection2, maxAngle) {
29704     maxAngle = (maxAngle || 20) * Math.PI / 180;
29705     var action = function(graph, t) {
29706       if (t === null || !isFinite(t))
29707         t = 1;
29708       t = Math.min(Math.max(+t, 0), 1);
29709       var way = graph.entity(wayId);
29710       var origNodes = {};
29711       graph.childNodes(way).forEach(function(node2) {
29712         if (!origNodes[node2.id])
29713           origNodes[node2.id] = node2;
29714       });
29715       if (!way.isConvex(graph)) {
29716         graph = action.makeConvex(graph);
29717       }
29718       var nodes = utilArrayUniq(graph.childNodes(way));
29719       var keyNodes = nodes.filter(function(n2) {
29720         return graph.parentWays(n2).length !== 1;
29721       });
29722       var points = nodes.map(function(n2) {
29723         return projection2(n2.loc);
29724       });
29725       var keyPoints = keyNodes.map(function(n2) {
29726         return projection2(n2.loc);
29727       });
29728       var centroid = points.length === 2 ? geoVecInterp(points[0], points[1], 0.5) : centroid_default2(points);
29729       var radius = median(points, function(p) {
29730         return geoVecLength(centroid, p);
29731       });
29732       var sign2 = area_default3(points) > 0 ? 1 : -1;
29733       var ids, i2, j2, k;
29734       if (!keyNodes.length) {
29735         keyNodes = [nodes[0]];
29736         keyPoints = [points[0]];
29737       }
29738       if (keyNodes.length === 1) {
29739         var index = nodes.indexOf(keyNodes[0]);
29740         var oppositeIndex = Math.floor((index + nodes.length / 2) % nodes.length);
29741         keyNodes.push(nodes[oppositeIndex]);
29742         keyPoints.push(points[oppositeIndex]);
29743       }
29744       for (i2 = 0; i2 < keyPoints.length; i2++) {
29745         var nextKeyNodeIndex = (i2 + 1) % keyNodes.length;
29746         var startNode = keyNodes[i2];
29747         var endNode = keyNodes[nextKeyNodeIndex];
29748         var startNodeIndex = nodes.indexOf(startNode);
29749         var endNodeIndex = nodes.indexOf(endNode);
29750         var numberNewPoints = -1;
29751         var indexRange = endNodeIndex - startNodeIndex;
29752         var nearNodes = {};
29753         var inBetweenNodes = [];
29754         var startAngle, endAngle, totalAngle, eachAngle;
29755         var angle2, loc, node, origNode;
29756         if (indexRange < 0) {
29757           indexRange += nodes.length;
29758         }
29759         var distance = geoVecLength(centroid, keyPoints[i2]) || 1e-4;
29760         keyPoints[i2] = [
29761           centroid[0] + (keyPoints[i2][0] - centroid[0]) / distance * radius,
29762           centroid[1] + (keyPoints[i2][1] - centroid[1]) / distance * radius
29763         ];
29764         loc = projection2.invert(keyPoints[i2]);
29765         node = keyNodes[i2];
29766         origNode = origNodes[node.id];
29767         node = node.move(geoVecInterp(origNode.loc, loc, t));
29768         graph = graph.replace(node);
29769         startAngle = Math.atan2(keyPoints[i2][1] - centroid[1], keyPoints[i2][0] - centroid[0]);
29770         endAngle = Math.atan2(keyPoints[nextKeyNodeIndex][1] - centroid[1], keyPoints[nextKeyNodeIndex][0] - centroid[0]);
29771         totalAngle = endAngle - startAngle;
29772         if (totalAngle * sign2 > 0) {
29773           totalAngle = -sign2 * (2 * Math.PI - Math.abs(totalAngle));
29774         }
29775         do {
29776           numberNewPoints++;
29777           eachAngle = totalAngle / (indexRange + numberNewPoints);
29778         } while (Math.abs(eachAngle) > maxAngle);
29779         for (j2 = 1; j2 < indexRange; j2++) {
29780           angle2 = startAngle + j2 * eachAngle;
29781           loc = projection2.invert([
29782             centroid[0] + Math.cos(angle2) * radius,
29783             centroid[1] + Math.sin(angle2) * radius
29784           ]);
29785           node = nodes[(j2 + startNodeIndex) % nodes.length];
29786           origNode = origNodes[node.id];
29787           nearNodes[node.id] = angle2;
29788           node = node.move(geoVecInterp(origNode.loc, loc, t));
29789           graph = graph.replace(node);
29790         }
29791         for (j2 = 0; j2 < numberNewPoints; j2++) {
29792           angle2 = startAngle + (indexRange + j2) * eachAngle;
29793           loc = projection2.invert([
29794             centroid[0] + Math.cos(angle2) * radius,
29795             centroid[1] + Math.sin(angle2) * radius
29796           ]);
29797           var min3 = Infinity;
29798           for (var nodeId in nearNodes) {
29799             var nearAngle = nearNodes[nodeId];
29800             var dist = Math.abs(nearAngle - angle2);
29801             if (dist < min3) {
29802               min3 = dist;
29803               origNode = origNodes[nodeId];
29804             }
29805           }
29806           node = osmNode({ loc: geoVecInterp(origNode.loc, loc, t) });
29807           graph = graph.replace(node);
29808           nodes.splice(endNodeIndex + j2, 0, node);
29809           inBetweenNodes.push(node.id);
29810         }
29811         if (indexRange === 1 && inBetweenNodes.length) {
29812           var startIndex1 = way.nodes.lastIndexOf(startNode.id);
29813           var endIndex1 = way.nodes.lastIndexOf(endNode.id);
29814           var wayDirection1 = endIndex1 - startIndex1;
29815           if (wayDirection1 < -1) {
29816             wayDirection1 = 1;
29817           }
29818           var parentWays = graph.parentWays(keyNodes[i2]);
29819           for (j2 = 0; j2 < parentWays.length; j2++) {
29820             var sharedWay = parentWays[j2];
29821             if (sharedWay === way)
29822               continue;
29823             if (sharedWay.areAdjacent(startNode.id, endNode.id)) {
29824               var startIndex2 = sharedWay.nodes.lastIndexOf(startNode.id);
29825               var endIndex2 = sharedWay.nodes.lastIndexOf(endNode.id);
29826               var wayDirection2 = endIndex2 - startIndex2;
29827               var insertAt = endIndex2;
29828               if (wayDirection2 < -1) {
29829                 wayDirection2 = 1;
29830               }
29831               if (wayDirection1 !== wayDirection2) {
29832                 inBetweenNodes.reverse();
29833                 insertAt = startIndex2;
29834               }
29835               for (k = 0; k < inBetweenNodes.length; k++) {
29836                 sharedWay = sharedWay.addNode(inBetweenNodes[k], insertAt + k);
29837               }
29838               graph = graph.replace(sharedWay);
29839             }
29840           }
29841         }
29842       }
29843       ids = nodes.map(function(n2) {
29844         return n2.id;
29845       });
29846       ids.push(ids[0]);
29847       way = way.update({ nodes: ids });
29848       graph = graph.replace(way);
29849       return graph;
29850     };
29851     action.makeConvex = function(graph) {
29852       var way = graph.entity(wayId);
29853       var nodes = utilArrayUniq(graph.childNodes(way));
29854       var points = nodes.map(function(n2) {
29855         return projection2(n2.loc);
29856       });
29857       var sign2 = area_default3(points) > 0 ? 1 : -1;
29858       var hull = hull_default(points);
29859       var i2, j2;
29860       if (sign2 === -1) {
29861         nodes.reverse();
29862         points.reverse();
29863       }
29864       for (i2 = 0; i2 < hull.length - 1; i2++) {
29865         var startIndex = points.indexOf(hull[i2]);
29866         var endIndex = points.indexOf(hull[i2 + 1]);
29867         var indexRange = endIndex - startIndex;
29868         if (indexRange < 0) {
29869           indexRange += nodes.length;
29870         }
29871         for (j2 = 1; j2 < indexRange; j2++) {
29872           var point2 = geoVecInterp(hull[i2], hull[i2 + 1], j2 / indexRange);
29873           var node = nodes[(j2 + startIndex) % nodes.length].move(projection2.invert(point2));
29874           graph = graph.replace(node);
29875         }
29876       }
29877       return graph;
29878     };
29879     action.disabled = function(graph) {
29880       if (!graph.entity(wayId).isClosed()) {
29881         return "not_closed";
29882       }
29883       var way = graph.entity(wayId);
29884       var nodes = utilArrayUniq(graph.childNodes(way));
29885       var points = nodes.map(function(n2) {
29886         return projection2(n2.loc);
29887       });
29888       var hull = hull_default(points);
29889       var epsilonAngle = Math.PI / 180;
29890       if (hull.length !== points.length || hull.length < 3) {
29891         return false;
29892       }
29893       var centroid = centroid_default2(points);
29894       var radius = geoVecLengthSquare(centroid, points[0]);
29895       var i2, actualPoint;
29896       for (i2 = 0; i2 < hull.length; i2++) {
29897         actualPoint = hull[i2];
29898         var actualDist = geoVecLengthSquare(actualPoint, centroid);
29899         var diff = Math.abs(actualDist - radius);
29900         if (diff > 0.05 * radius) {
29901           return false;
29902         }
29903       }
29904       for (i2 = 0; i2 < hull.length; i2++) {
29905         actualPoint = hull[i2];
29906         var nextPoint = hull[(i2 + 1) % hull.length];
29907         var startAngle = Math.atan2(actualPoint[1] - centroid[1], actualPoint[0] - centroid[0]);
29908         var endAngle = Math.atan2(nextPoint[1] - centroid[1], nextPoint[0] - centroid[0]);
29909         var angle2 = endAngle - startAngle;
29910         if (angle2 < 0) {
29911           angle2 = -angle2;
29912         }
29913         if (angle2 > Math.PI) {
29914           angle2 = 2 * Math.PI - angle2;
29915         }
29916         if (angle2 > maxAngle + epsilonAngle) {
29917           return false;
29918         }
29919       }
29920       return "already_circular";
29921     };
29922     action.transitionable = true;
29923     return action;
29924   }
29925
29926   // modules/actions/delete_way.js
29927   function actionDeleteWay(wayID) {
29928     function canDeleteNode(node, graph) {
29929       if (graph.parentWays(node).length || graph.parentRelations(node).length)
29930         return false;
29931       var geometries = osmNodeGeometriesForTags(node.tags);
29932       if (geometries.point)
29933         return false;
29934       if (geometries.vertex)
29935         return true;
29936       return !node.hasInterestingTags();
29937     }
29938     var action = function(graph) {
29939       var way = graph.entity(wayID);
29940       graph.parentRelations(way).forEach(function(parent) {
29941         parent = parent.removeMembersWithID(wayID);
29942         graph = graph.replace(parent);
29943         if (parent.isDegenerate()) {
29944           graph = actionDeleteRelation(parent.id)(graph);
29945         }
29946       });
29947       new Set(way.nodes).forEach(function(nodeID) {
29948         graph = graph.replace(way.removeNode(nodeID));
29949         var node = graph.entity(nodeID);
29950         if (canDeleteNode(node, graph)) {
29951           graph = graph.remove(node);
29952         }
29953       });
29954       return graph.remove(way);
29955     };
29956     return action;
29957   }
29958
29959   // modules/actions/delete_multiple.js
29960   function actionDeleteMultiple(ids) {
29961     var actions = {
29962       way: actionDeleteWay,
29963       node: actionDeleteNode,
29964       relation: actionDeleteRelation
29965     };
29966     var action = function(graph) {
29967       ids.forEach(function(id2) {
29968         if (graph.hasEntity(id2)) {
29969           graph = actions[graph.entity(id2).type](id2)(graph);
29970         }
29971       });
29972       return graph;
29973     };
29974     return action;
29975   }
29976
29977   // modules/actions/delete_relation.js
29978   function actionDeleteRelation(relationID, allowUntaggedMembers) {
29979     function canDeleteEntity(entity, graph) {
29980       return !graph.parentWays(entity).length && !graph.parentRelations(entity).length && (!entity.hasInterestingTags() && !allowUntaggedMembers);
29981     }
29982     var action = function(graph) {
29983       var relation = graph.entity(relationID);
29984       graph.parentRelations(relation).forEach(function(parent) {
29985         parent = parent.removeMembersWithID(relationID);
29986         graph = graph.replace(parent);
29987         if (parent.isDegenerate()) {
29988           graph = actionDeleteRelation(parent.id)(graph);
29989         }
29990       });
29991       var memberIDs = utilArrayUniq(relation.members.map(function(m) {
29992         return m.id;
29993       }));
29994       memberIDs.forEach(function(memberID) {
29995         graph = graph.replace(relation.removeMembersWithID(memberID));
29996         var entity = graph.entity(memberID);
29997         if (canDeleteEntity(entity, graph)) {
29998           graph = actionDeleteMultiple([memberID])(graph);
29999         }
30000       });
30001       return graph.remove(relation);
30002     };
30003     return action;
30004   }
30005
30006   // modules/actions/delete_node.js
30007   function actionDeleteNode(nodeId) {
30008     var action = function(graph) {
30009       var node = graph.entity(nodeId);
30010       graph.parentWays(node).forEach(function(parent) {
30011         parent = parent.removeNode(nodeId);
30012         graph = graph.replace(parent);
30013         if (parent.isDegenerate()) {
30014           graph = actionDeleteWay(parent.id)(graph);
30015         }
30016       });
30017       graph.parentRelations(node).forEach(function(parent) {
30018         parent = parent.removeMembersWithID(nodeId);
30019         graph = graph.replace(parent);
30020         if (parent.isDegenerate()) {
30021           graph = actionDeleteRelation(parent.id)(graph);
30022         }
30023       });
30024       return graph.remove(node);
30025     };
30026     return action;
30027   }
30028
30029   // modules/actions/connect.js
30030   function actionConnect(nodeIDs) {
30031     var action = function(graph) {
30032       var survivor;
30033       var node;
30034       var parents;
30035       var i2, j2;
30036       nodeIDs.reverse();
30037       var interestingIDs = [];
30038       for (i2 = 0; i2 < nodeIDs.length; i2++) {
30039         node = graph.entity(nodeIDs[i2]);
30040         if (node.hasInterestingTags()) {
30041           if (!node.isNew()) {
30042             interestingIDs.push(node.id);
30043           }
30044         }
30045       }
30046       survivor = graph.entity(utilOldestID(interestingIDs.length > 0 ? interestingIDs : nodeIDs));
30047       for (i2 = 0; i2 < nodeIDs.length; i2++) {
30048         node = graph.entity(nodeIDs[i2]);
30049         if (node.id === survivor.id)
30050           continue;
30051         parents = graph.parentWays(node);
30052         for (j2 = 0; j2 < parents.length; j2++) {
30053           graph = graph.replace(parents[j2].replaceNode(node.id, survivor.id));
30054         }
30055         parents = graph.parentRelations(node);
30056         for (j2 = 0; j2 < parents.length; j2++) {
30057           graph = graph.replace(parents[j2].replaceMember(node, survivor));
30058         }
30059         survivor = survivor.mergeTags(node.tags);
30060         graph = actionDeleteNode(node.id)(graph);
30061       }
30062       graph = graph.replace(survivor);
30063       parents = graph.parentWays(survivor);
30064       for (i2 = 0; i2 < parents.length; i2++) {
30065         if (parents[i2].isDegenerate()) {
30066           graph = actionDeleteWay(parents[i2].id)(graph);
30067         }
30068       }
30069       return graph;
30070     };
30071     action.disabled = function(graph) {
30072       var seen = {};
30073       var restrictionIDs = [];
30074       var survivor;
30075       var node, way;
30076       var relations, relation, role;
30077       var i2, j2, k;
30078       survivor = graph.entity(utilOldestID(nodeIDs));
30079       for (i2 = 0; i2 < nodeIDs.length; i2++) {
30080         node = graph.entity(nodeIDs[i2]);
30081         relations = graph.parentRelations(node);
30082         for (j2 = 0; j2 < relations.length; j2++) {
30083           relation = relations[j2];
30084           role = relation.memberById(node.id).role || "";
30085           if (relation.hasFromViaTo()) {
30086             restrictionIDs.push(relation.id);
30087           }
30088           if (seen[relation.id] !== void 0 && seen[relation.id] !== role) {
30089             return "relation";
30090           } else {
30091             seen[relation.id] = role;
30092           }
30093         }
30094       }
30095       for (i2 = 0; i2 < nodeIDs.length; i2++) {
30096         node = graph.entity(nodeIDs[i2]);
30097         var parents = graph.parentWays(node);
30098         for (j2 = 0; j2 < parents.length; j2++) {
30099           var parent = parents[j2];
30100           relations = graph.parentRelations(parent);
30101           for (k = 0; k < relations.length; k++) {
30102             relation = relations[k];
30103             if (relation.hasFromViaTo()) {
30104               restrictionIDs.push(relation.id);
30105             }
30106           }
30107         }
30108       }
30109       restrictionIDs = utilArrayUniq(restrictionIDs);
30110       for (i2 = 0; i2 < restrictionIDs.length; i2++) {
30111         relation = graph.entity(restrictionIDs[i2]);
30112         if (!relation.isComplete(graph))
30113           continue;
30114         var memberWays = relation.members.filter(function(m) {
30115           return m.type === "way";
30116         }).map(function(m) {
30117           return graph.entity(m.id);
30118         });
30119         memberWays = utilArrayUniq(memberWays);
30120         var f2 = relation.memberByRole("from");
30121         var t = relation.memberByRole("to");
30122         var isUturn = f2.id === t.id;
30123         var nodes = { from: [], via: [], to: [], keyfrom: [], keyto: [] };
30124         for (j2 = 0; j2 < relation.members.length; j2++) {
30125           collectNodes(relation.members[j2], nodes);
30126         }
30127         nodes.keyfrom = utilArrayUniq(nodes.keyfrom.filter(hasDuplicates));
30128         nodes.keyto = utilArrayUniq(nodes.keyto.filter(hasDuplicates));
30129         var filter2 = keyNodeFilter(nodes.keyfrom, nodes.keyto);
30130         nodes.from = nodes.from.filter(filter2);
30131         nodes.via = nodes.via.filter(filter2);
30132         nodes.to = nodes.to.filter(filter2);
30133         var connectFrom = false;
30134         var connectVia = false;
30135         var connectTo = false;
30136         var connectKeyFrom = false;
30137         var connectKeyTo = false;
30138         for (j2 = 0; j2 < nodeIDs.length; j2++) {
30139           var n2 = nodeIDs[j2];
30140           if (nodes.from.indexOf(n2) !== -1) {
30141             connectFrom = true;
30142           }
30143           if (nodes.via.indexOf(n2) !== -1) {
30144             connectVia = true;
30145           }
30146           if (nodes.to.indexOf(n2) !== -1) {
30147             connectTo = true;
30148           }
30149           if (nodes.keyfrom.indexOf(n2) !== -1) {
30150             connectKeyFrom = true;
30151           }
30152           if (nodes.keyto.indexOf(n2) !== -1) {
30153             connectKeyTo = true;
30154           }
30155         }
30156         if (connectFrom && connectTo && !isUturn) {
30157           return "restriction";
30158         }
30159         if (connectFrom && connectVia) {
30160           return "restriction";
30161         }
30162         if (connectTo && connectVia) {
30163           return "restriction";
30164         }
30165         if (connectKeyFrom || connectKeyTo) {
30166           if (nodeIDs.length !== 2) {
30167             return "restriction";
30168           }
30169           var n0 = null;
30170           var n1 = null;
30171           for (j2 = 0; j2 < memberWays.length; j2++) {
30172             way = memberWays[j2];
30173             if (way.contains(nodeIDs[0])) {
30174               n0 = nodeIDs[0];
30175             }
30176             if (way.contains(nodeIDs[1])) {
30177               n1 = nodeIDs[1];
30178             }
30179           }
30180           if (n0 && n1) {
30181             var ok = false;
30182             for (j2 = 0; j2 < memberWays.length; j2++) {
30183               way = memberWays[j2];
30184               if (way.areAdjacent(n0, n1)) {
30185                 ok = true;
30186                 break;
30187               }
30188             }
30189             if (!ok) {
30190               return "restriction";
30191             }
30192           }
30193         }
30194         for (j2 = 0; j2 < memberWays.length; j2++) {
30195           way = memberWays[j2].update({});
30196           for (k = 0; k < nodeIDs.length; k++) {
30197             if (nodeIDs[k] === survivor.id)
30198               continue;
30199             if (way.areAdjacent(nodeIDs[k], survivor.id)) {
30200               way = way.removeNode(nodeIDs[k]);
30201             } else {
30202               way = way.replaceNode(nodeIDs[k], survivor.id);
30203             }
30204           }
30205           if (way.isDegenerate()) {
30206             return "restriction";
30207           }
30208         }
30209       }
30210       return false;
30211       function hasDuplicates(n3, i3, arr) {
30212         return arr.indexOf(n3) !== arr.lastIndexOf(n3);
30213       }
30214       function keyNodeFilter(froms, tos) {
30215         return function(n3) {
30216           return froms.indexOf(n3) === -1 && tos.indexOf(n3) === -1;
30217         };
30218       }
30219       function collectNodes(member, collection) {
30220         var entity = graph.hasEntity(member.id);
30221         if (!entity)
30222           return;
30223         var role2 = member.role || "";
30224         if (!collection[role2]) {
30225           collection[role2] = [];
30226         }
30227         if (member.type === "node") {
30228           collection[role2].push(member.id);
30229           if (role2 === "via") {
30230             collection.keyfrom.push(member.id);
30231             collection.keyto.push(member.id);
30232           }
30233         } else if (member.type === "way") {
30234           collection[role2].push.apply(collection[role2], entity.nodes);
30235           if (role2 === "from" || role2 === "via") {
30236             collection.keyfrom.push(entity.first());
30237             collection.keyfrom.push(entity.last());
30238           }
30239           if (role2 === "to" || role2 === "via") {
30240             collection.keyto.push(entity.first());
30241             collection.keyto.push(entity.last());
30242           }
30243         }
30244       }
30245     };
30246     return action;
30247   }
30248
30249   // modules/actions/copy_entities.js
30250   function actionCopyEntities(ids, fromGraph) {
30251     var _copies = {};
30252     var action = function(graph) {
30253       ids.forEach(function(id3) {
30254         fromGraph.entity(id3).copy(fromGraph, _copies);
30255       });
30256       for (var id2 in _copies) {
30257         graph = graph.replace(_copies[id2]);
30258       }
30259       return graph;
30260     };
30261     action.copies = function() {
30262       return _copies;
30263     };
30264     return action;
30265   }
30266
30267   // modules/actions/delete_member.js
30268   function actionDeleteMember(relationId, memberIndex) {
30269     return function(graph) {
30270       var relation = graph.entity(relationId).removeMember(memberIndex);
30271       graph = graph.replace(relation);
30272       if (relation.isDegenerate()) {
30273         graph = actionDeleteRelation(relation.id)(graph);
30274       }
30275       return graph;
30276     };
30277   }
30278
30279   // modules/actions/discard_tags.js
30280   function actionDiscardTags(difference, discardTags) {
30281     discardTags = discardTags || {};
30282     return (graph) => {
30283       difference.modified().forEach(checkTags);
30284       difference.created().forEach(checkTags);
30285       return graph;
30286       function checkTags(entity) {
30287         const keys2 = Object.keys(entity.tags);
30288         let didDiscard = false;
30289         let tags = {};
30290         for (let i2 = 0; i2 < keys2.length; i2++) {
30291           const k = keys2[i2];
30292           if (discardTags[k] || !entity.tags[k]) {
30293             didDiscard = true;
30294           } else {
30295             tags[k] = entity.tags[k];
30296           }
30297         }
30298         if (didDiscard) {
30299           graph = graph.replace(entity.update({ tags }));
30300         }
30301       }
30302     };
30303   }
30304
30305   // modules/actions/disconnect.js
30306   function actionDisconnect(nodeId, newNodeId) {
30307     var wayIds;
30308     var disconnectableRelationTypes = {
30309       "associatedStreet": true,
30310       "enforcement": true,
30311       "site": true
30312     };
30313     var action = function(graph) {
30314       var node = graph.entity(nodeId);
30315       var connections = action.connections(graph);
30316       connections.forEach(function(connection) {
30317         var way = graph.entity(connection.wayID);
30318         var newNode = osmNode({ id: newNodeId, loc: node.loc, tags: node.tags });
30319         graph = graph.replace(newNode);
30320         if (connection.index === 0 && way.isArea()) {
30321           graph = graph.replace(way.replaceNode(way.nodes[0], newNode.id));
30322         } else if (way.isClosed() && connection.index === way.nodes.length - 1) {
30323           graph = graph.replace(way.unclose().addNode(newNode.id));
30324         } else {
30325           graph = graph.replace(way.updateNode(newNode.id, connection.index));
30326         }
30327       });
30328       return graph;
30329     };
30330     action.connections = function(graph) {
30331       var candidates = [];
30332       var keeping = false;
30333       var parentWays = graph.parentWays(graph.entity(nodeId));
30334       var way, waynode;
30335       for (var i2 = 0; i2 < parentWays.length; i2++) {
30336         way = parentWays[i2];
30337         if (wayIds && wayIds.indexOf(way.id) === -1) {
30338           keeping = true;
30339           continue;
30340         }
30341         if (way.isArea() && way.nodes[0] === nodeId) {
30342           candidates.push({ wayID: way.id, index: 0 });
30343         } else {
30344           for (var j2 = 0; j2 < way.nodes.length; j2++) {
30345             waynode = way.nodes[j2];
30346             if (waynode === nodeId) {
30347               if (way.isClosed() && parentWays.length > 1 && wayIds && wayIds.indexOf(way.id) !== -1 && j2 === way.nodes.length - 1) {
30348                 continue;
30349               }
30350               candidates.push({ wayID: way.id, index: j2 });
30351             }
30352           }
30353         }
30354       }
30355       return keeping ? candidates : candidates.slice(1);
30356     };
30357     action.disabled = function(graph) {
30358       var connections = action.connections(graph);
30359       if (connections.length === 0)
30360         return "not_connected";
30361       var parentWays = graph.parentWays(graph.entity(nodeId));
30362       var seenRelationIds = {};
30363       var sharedRelation;
30364       parentWays.forEach(function(way) {
30365         var relations = graph.parentRelations(way);
30366         relations.filter((relation) => !disconnectableRelationTypes[relation.tags.type]).forEach(function(relation) {
30367           if (relation.id in seenRelationIds) {
30368             if (wayIds) {
30369               if (wayIds.indexOf(way.id) !== -1 || wayIds.indexOf(seenRelationIds[relation.id]) !== -1) {
30370                 sharedRelation = relation;
30371               }
30372             } else {
30373               sharedRelation = relation;
30374             }
30375           } else {
30376             seenRelationIds[relation.id] = way.id;
30377           }
30378         });
30379       });
30380       if (sharedRelation)
30381         return "relation";
30382     };
30383     action.limitWays = function(val) {
30384       if (!arguments.length)
30385         return wayIds;
30386       wayIds = val;
30387       return action;
30388     };
30389     return action;
30390   }
30391
30392   // modules/actions/extract.js
30393   function actionExtract(entityID, projection2) {
30394     var extractedNodeID;
30395     var action = function(graph) {
30396       var entity = graph.entity(entityID);
30397       if (entity.type === "node") {
30398         return extractFromNode(entity, graph);
30399       }
30400       return extractFromWayOrRelation(entity, graph);
30401     };
30402     function extractFromNode(node, graph) {
30403       extractedNodeID = node.id;
30404       var replacement = osmNode({ loc: node.loc });
30405       graph = graph.replace(replacement);
30406       graph = graph.parentWays(node).reduce(function(accGraph, parentWay) {
30407         return accGraph.replace(parentWay.replaceNode(entityID, replacement.id));
30408       }, graph);
30409       return graph.parentRelations(node).reduce(function(accGraph, parentRel) {
30410         return accGraph.replace(parentRel.replaceMember(node, replacement));
30411       }, graph);
30412     }
30413     function extractFromWayOrRelation(entity, graph) {
30414       var fromGeometry = entity.geometry(graph);
30415       var keysToCopyAndRetain = ["source", "wheelchair"];
30416       var keysToRetain = ["area"];
30417       var buildingKeysToRetain = ["architect", "building", "height", "layer"];
30418       var extractedLoc = path_default(projection2).centroid(entity.asGeoJSON(graph));
30419       extractedLoc = extractedLoc && projection2.invert(extractedLoc);
30420       if (!extractedLoc || !isFinite(extractedLoc[0]) || !isFinite(extractedLoc[1])) {
30421         extractedLoc = entity.extent(graph).center();
30422       }
30423       var indoorAreaValues = {
30424         area: true,
30425         corridor: true,
30426         elevator: true,
30427         level: true,
30428         room: true
30429       };
30430       var isBuilding = entity.tags.building && entity.tags.building !== "no" || entity.tags["building:part"] && entity.tags["building:part"] !== "no";
30431       var isIndoorArea = fromGeometry === "area" && entity.tags.indoor && indoorAreaValues[entity.tags.indoor];
30432       var entityTags = Object.assign({}, entity.tags);
30433       var pointTags = {};
30434       for (var key in entityTags) {
30435         if (entity.type === "relation" && key === "type") {
30436           continue;
30437         }
30438         if (keysToRetain.indexOf(key) !== -1) {
30439           continue;
30440         }
30441         if (isBuilding) {
30442           if (buildingKeysToRetain.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/))
30443             continue;
30444         }
30445         if (isIndoorArea && key === "indoor") {
30446           continue;
30447         }
30448         pointTags[key] = entityTags[key];
30449         if (keysToCopyAndRetain.indexOf(key) !== -1 || key.match(/^addr:.{1,}/)) {
30450           continue;
30451         } else if (isIndoorArea && key === "level") {
30452           continue;
30453         }
30454         delete entityTags[key];
30455       }
30456       if (!isBuilding && !isIndoorArea && fromGeometry === "area") {
30457         entityTags.area = "yes";
30458       }
30459       var replacement = osmNode({ loc: extractedLoc, tags: pointTags });
30460       graph = graph.replace(replacement);
30461       extractedNodeID = replacement.id;
30462       return graph.replace(entity.update({ tags: entityTags }));
30463     }
30464     action.getExtractedNodeID = function() {
30465       return extractedNodeID;
30466     };
30467     return action;
30468   }
30469
30470   // modules/actions/join.js
30471   function actionJoin(ids) {
30472     function groupEntitiesByGeometry(graph) {
30473       var entities = ids.map(function(id2) {
30474         return graph.entity(id2);
30475       });
30476       return Object.assign(
30477         { line: [] },
30478         utilArrayGroupBy(entities, function(entity) {
30479           return entity.geometry(graph);
30480         })
30481       );
30482     }
30483     var action = function(graph) {
30484       var ways = ids.map(graph.entity, graph);
30485       var survivorID = utilOldestID(ways.map((way) => way.id));
30486       ways.sort(function(a, b) {
30487         var aSided = a.isSided();
30488         var bSided = b.isSided();
30489         return aSided && !bSided ? -1 : bSided && !aSided ? 1 : 0;
30490       });
30491       var sequences = osmJoinWays(ways, graph);
30492       var joined = sequences[0];
30493       graph = sequences.actions.reduce(function(g, action2) {
30494         return action2(g);
30495       }, graph);
30496       var survivor = graph.entity(survivorID);
30497       survivor = survivor.update({ nodes: joined.nodes.map(function(n2) {
30498         return n2.id;
30499       }) });
30500       graph = graph.replace(survivor);
30501       joined.forEach(function(way) {
30502         if (way.id === survivorID)
30503           return;
30504         graph.parentRelations(way).forEach(function(parent) {
30505           graph = graph.replace(parent.replaceMember(way, survivor));
30506         });
30507         survivor = survivor.mergeTags(way.tags);
30508         graph = graph.replace(survivor);
30509         graph = actionDeleteWay(way.id)(graph);
30510       });
30511       function checkForSimpleMultipolygon() {
30512         if (!survivor.isClosed())
30513           return;
30514         var multipolygons = graph.parentMultipolygons(survivor).filter(function(multipolygon2) {
30515           return multipolygon2.members.length === 1;
30516         });
30517         if (multipolygons.length !== 1)
30518           return;
30519         var multipolygon = multipolygons[0];
30520         for (var key in survivor.tags) {
30521           if (multipolygon.tags[key] && // don't collapse if tags cannot be cleanly merged
30522           multipolygon.tags[key] !== survivor.tags[key])
30523             return;
30524         }
30525         survivor = survivor.mergeTags(multipolygon.tags);
30526         graph = graph.replace(survivor);
30527         graph = actionDeleteRelation(
30528           multipolygon.id,
30529           true
30530           /* allow untagged members */
30531         )(graph);
30532         var tags = Object.assign({}, survivor.tags);
30533         if (survivor.geometry(graph) !== "area") {
30534           tags.area = "yes";
30535         }
30536         delete tags.type;
30537         survivor = survivor.update({ tags });
30538         graph = graph.replace(survivor);
30539       }
30540       checkForSimpleMultipolygon();
30541       return graph;
30542     };
30543     action.resultingWayNodesLength = function(graph) {
30544       return ids.reduce(function(count, id2) {
30545         return count + graph.entity(id2).nodes.length;
30546       }, 0) - ids.length - 1;
30547     };
30548     action.disabled = function(graph) {
30549       var geometries = groupEntitiesByGeometry(graph);
30550       if (ids.length < 2 || ids.length !== geometries.line.length) {
30551         return "not_eligible";
30552       }
30553       var joined = osmJoinWays(ids.map(graph.entity, graph), graph);
30554       if (joined.length > 1) {
30555         return "not_adjacent";
30556       }
30557       var i2;
30558       var sortedParentRelations = function(id2) {
30559         return graph.parentRelations(graph.entity(id2)).filter((rel) => !rel.isRestriction() && !rel.isConnectivity()).sort((a, b) => a.id - b.id);
30560       };
30561       var relsA = sortedParentRelations(ids[0]);
30562       for (i2 = 1; i2 < ids.length; i2++) {
30563         var relsB = sortedParentRelations(ids[i2]);
30564         if (!utilArrayIdentical(relsA, relsB)) {
30565           return "conflicting_relations";
30566         }
30567       }
30568       for (i2 = 0; i2 < ids.length - 1; i2++) {
30569         for (var j2 = i2 + 1; j2 < ids.length; j2++) {
30570           var path1 = graph.childNodes(graph.entity(ids[i2])).map(function(e) {
30571             return e.loc;
30572           });
30573           var path2 = graph.childNodes(graph.entity(ids[j2])).map(function(e) {
30574             return e.loc;
30575           });
30576           var intersections = geoPathIntersections(path1, path2);
30577           var common = utilArrayIntersection(
30578             joined[0].nodes.map(function(n2) {
30579               return n2.loc.toString();
30580             }),
30581             intersections.map(function(n2) {
30582               return n2.toString();
30583             })
30584           );
30585           if (common.length !== intersections.length) {
30586             return "paths_intersect";
30587           }
30588         }
30589       }
30590       var nodeIds = joined[0].nodes.map(function(n2) {
30591         return n2.id;
30592       }).slice(1, -1);
30593       var relation;
30594       var tags = {};
30595       var conflicting = false;
30596       joined[0].forEach(function(way) {
30597         var parents = graph.parentRelations(way);
30598         parents.forEach(function(parent) {
30599           if ((parent.isRestriction() || parent.isConnectivity()) && parent.members.some(function(m) {
30600             return nodeIds.indexOf(m.id) >= 0;
30601           })) {
30602             relation = parent;
30603           }
30604         });
30605         for (var k in way.tags) {
30606           if (!(k in tags)) {
30607             tags[k] = way.tags[k];
30608           } else if (tags[k] && osmIsInterestingTag(k) && tags[k] !== way.tags[k]) {
30609             conflicting = true;
30610           }
30611         }
30612       });
30613       if (relation) {
30614         return relation.isRestriction() ? "restriction" : "connectivity";
30615       }
30616       if (conflicting) {
30617         return "conflicting_tags";
30618       }
30619     };
30620     return action;
30621   }
30622
30623   // modules/actions/merge.js
30624   function actionMerge(ids) {
30625     function groupEntitiesByGeometry(graph) {
30626       var entities = ids.map(function(id2) {
30627         return graph.entity(id2);
30628       });
30629       return Object.assign(
30630         { point: [], area: [], line: [], relation: [] },
30631         utilArrayGroupBy(entities, function(entity) {
30632           return entity.geometry(graph);
30633         })
30634       );
30635     }
30636     var action = function(graph) {
30637       var geometries = groupEntitiesByGeometry(graph);
30638       var target = geometries.area[0] || geometries.line[0];
30639       var points = geometries.point;
30640       points.forEach(function(point2) {
30641         target = target.mergeTags(point2.tags);
30642         graph = graph.replace(target);
30643         graph.parentRelations(point2).forEach(function(parent) {
30644           graph = graph.replace(parent.replaceMember(point2, target));
30645         });
30646         var nodes = utilArrayUniq(graph.childNodes(target));
30647         var removeNode = point2;
30648         if (!point2.isNew()) {
30649           var inserted = false;
30650           var canBeReplaced = function(node2) {
30651             return !(graph.parentWays(node2).length > 1 || graph.parentRelations(node2).length);
30652           };
30653           var replaceNode = function(node2) {
30654             graph = graph.replace(point2.update({ tags: node2.tags, loc: node2.loc }));
30655             target = target.replaceNode(node2.id, point2.id);
30656             graph = graph.replace(target);
30657             removeNode = node2;
30658             inserted = true;
30659           };
30660           var i2;
30661           var node;
30662           for (i2 = 0; i2 < nodes.length; i2++) {
30663             node = nodes[i2];
30664             if (canBeReplaced(node) && node.isNew()) {
30665               replaceNode(node);
30666               break;
30667             }
30668           }
30669           if (!inserted && point2.hasInterestingTags()) {
30670             for (i2 = 0; i2 < nodes.length; i2++) {
30671               node = nodes[i2];
30672               if (canBeReplaced(node) && !node.hasInterestingTags()) {
30673                 replaceNode(node);
30674                 break;
30675               }
30676             }
30677             if (!inserted) {
30678               for (i2 = 0; i2 < nodes.length; i2++) {
30679                 node = nodes[i2];
30680                 if (canBeReplaced(node) && utilCompareIDs(point2.id, node.id) < 0) {
30681                   replaceNode(node);
30682                   break;
30683                 }
30684               }
30685             }
30686           }
30687         }
30688         graph = graph.remove(removeNode);
30689       });
30690       if (target.tags.area === "yes") {
30691         var tags = Object.assign({}, target.tags);
30692         delete tags.area;
30693         if (osmTagSuggestingArea(tags)) {
30694           target = target.update({ tags });
30695           graph = graph.replace(target);
30696         }
30697       }
30698       return graph;
30699     };
30700     action.disabled = function(graph) {
30701       var geometries = groupEntitiesByGeometry(graph);
30702       if (geometries.point.length === 0 || geometries.area.length + geometries.line.length !== 1 || geometries.relation.length !== 0) {
30703         return "not_eligible";
30704       }
30705     };
30706     return action;
30707   }
30708
30709   // modules/actions/merge_nodes.js
30710   function actionMergeNodes(nodeIDs, loc) {
30711     function chooseLoc(graph) {
30712       if (!nodeIDs.length)
30713         return null;
30714       var sum = [0, 0];
30715       var interestingCount = 0;
30716       var interestingLoc;
30717       for (var i2 = 0; i2 < nodeIDs.length; i2++) {
30718         var node = graph.entity(nodeIDs[i2]);
30719         if (node.hasInterestingTags()) {
30720           interestingLoc = ++interestingCount === 1 ? node.loc : null;
30721         }
30722         sum = geoVecAdd(sum, node.loc);
30723       }
30724       return interestingLoc || geoVecScale(sum, 1 / nodeIDs.length);
30725     }
30726     var action = function(graph) {
30727       if (nodeIDs.length < 2)
30728         return graph;
30729       var toLoc = loc;
30730       if (!toLoc) {
30731         toLoc = chooseLoc(graph);
30732       }
30733       for (var i2 = 0; i2 < nodeIDs.length; i2++) {
30734         var node = graph.entity(nodeIDs[i2]);
30735         if (node.loc !== toLoc) {
30736           graph = graph.replace(node.move(toLoc));
30737         }
30738       }
30739       return actionConnect(nodeIDs)(graph);
30740     };
30741     action.disabled = function(graph) {
30742       if (nodeIDs.length < 2)
30743         return "not_eligible";
30744       for (var i2 = 0; i2 < nodeIDs.length; i2++) {
30745         var entity = graph.entity(nodeIDs[i2]);
30746         if (entity.type !== "node")
30747           return "not_eligible";
30748       }
30749       return actionConnect(nodeIDs).disabled(graph);
30750     };
30751     return action;
30752   }
30753
30754   // modules/osm/changeset.js
30755   function osmChangeset() {
30756     if (!(this instanceof osmChangeset)) {
30757       return new osmChangeset().initialize(arguments);
30758     } else if (arguments.length) {
30759       this.initialize(arguments);
30760     }
30761   }
30762   osmEntity.changeset = osmChangeset;
30763   osmChangeset.prototype = Object.create(osmEntity.prototype);
30764   Object.assign(osmChangeset.prototype, {
30765     type: "changeset",
30766     extent: function() {
30767       return new geoExtent();
30768     },
30769     geometry: function() {
30770       return "changeset";
30771     },
30772     asJXON: function() {
30773       return {
30774         osm: {
30775           changeset: {
30776             tag: Object.keys(this.tags).map(function(k) {
30777               return { "@k": k, "@v": this.tags[k] };
30778             }, this),
30779             "@version": 0.6,
30780             "@generator": "iD"
30781           }
30782         }
30783       };
30784     },
30785     // Generate [osmChange](http://wiki.openstreetmap.org/wiki/OsmChange)
30786     // XML. Returns a string.
30787     osmChangeJXON: function(changes) {
30788       var changeset_id = this.id;
30789       function nest(x, order) {
30790         var groups = {};
30791         for (var i2 = 0; i2 < x.length; i2++) {
30792           var tagName = Object.keys(x[i2])[0];
30793           if (!groups[tagName])
30794             groups[tagName] = [];
30795           groups[tagName].push(x[i2][tagName]);
30796         }
30797         var ordered = {};
30798         order.forEach(function(o) {
30799           if (groups[o])
30800             ordered[o] = groups[o];
30801         });
30802         return ordered;
30803       }
30804       function sort(changes2) {
30805         function resolve(item) {
30806           return relations.find(function(relation2) {
30807             return item.keyAttributes.type === "relation" && item.keyAttributes.ref === relation2["@id"];
30808           });
30809         }
30810         function isNew(item) {
30811           return !sorted[item["@id"]] && !processing.find(function(proc) {
30812             return proc["@id"] === item["@id"];
30813           });
30814         }
30815         var processing = [];
30816         var sorted = {};
30817         var relations = changes2.relation;
30818         if (!relations)
30819           return changes2;
30820         for (var i2 = 0; i2 < relations.length; i2++) {
30821           var relation = relations[i2];
30822           if (!sorted[relation["@id"]]) {
30823             processing.push(relation);
30824           }
30825           while (processing.length > 0) {
30826             var next = processing[0], deps = next.member.map(resolve).filter(Boolean).filter(isNew);
30827             if (deps.length === 0) {
30828               sorted[next["@id"]] = next;
30829               processing.shift();
30830             } else {
30831               processing = deps.concat(processing);
30832             }
30833           }
30834         }
30835         changes2.relation = Object.values(sorted);
30836         return changes2;
30837       }
30838       function rep2(entity) {
30839         return entity.asJXON(changeset_id);
30840       }
30841       return {
30842         osmChange: {
30843           "@version": 0.6,
30844           "@generator": "iD",
30845           "create": sort(nest(changes.created.map(rep2), ["node", "way", "relation"])),
30846           "modify": nest(changes.modified.map(rep2), ["node", "way", "relation"]),
30847           "delete": Object.assign(nest(changes.deleted.map(rep2), ["relation", "way", "node"]), { "@if-unused": true })
30848         }
30849       };
30850     },
30851     asGeoJSON: function() {
30852       return {};
30853     }
30854   });
30855
30856   // modules/osm/note.js
30857   function osmNote() {
30858     if (!(this instanceof osmNote)) {
30859       return new osmNote().initialize(arguments);
30860     } else if (arguments.length) {
30861       this.initialize(arguments);
30862     }
30863   }
30864   osmNote.id = function() {
30865     return osmNote.id.next--;
30866   };
30867   osmNote.id.next = -1;
30868   Object.assign(osmNote.prototype, {
30869     type: "note",
30870     initialize: function(sources) {
30871       for (var i2 = 0; i2 < sources.length; ++i2) {
30872         var source = sources[i2];
30873         for (var prop in source) {
30874           if (Object.prototype.hasOwnProperty.call(source, prop)) {
30875             if (source[prop] === void 0) {
30876               delete this[prop];
30877             } else {
30878               this[prop] = source[prop];
30879             }
30880           }
30881         }
30882       }
30883       if (!this.id) {
30884         this.id = osmNote.id().toString();
30885       }
30886       return this;
30887     },
30888     extent: function() {
30889       return new geoExtent(this.loc);
30890     },
30891     update: function(attrs) {
30892       return osmNote(this, attrs);
30893     },
30894     isNew: function() {
30895       return this.id < 0;
30896     },
30897     move: function(loc) {
30898       return this.update({ loc });
30899     }
30900   });
30901
30902   // modules/osm/relation.js
30903   function osmRelation() {
30904     if (!(this instanceof osmRelation)) {
30905       return new osmRelation().initialize(arguments);
30906     } else if (arguments.length) {
30907       this.initialize(arguments);
30908     }
30909   }
30910   osmEntity.relation = osmRelation;
30911   osmRelation.prototype = Object.create(osmEntity.prototype);
30912   osmRelation.creationOrder = function(a, b) {
30913     var aId = parseInt(osmEntity.id.toOSM(a.id), 10);
30914     var bId = parseInt(osmEntity.id.toOSM(b.id), 10);
30915     if (aId < 0 || bId < 0)
30916       return aId - bId;
30917     return bId - aId;
30918   };
30919   Object.assign(osmRelation.prototype, {
30920     type: "relation",
30921     members: [],
30922     copy: function(resolver, copies) {
30923       if (copies[this.id])
30924         return copies[this.id];
30925       var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
30926       var members = this.members.map(function(member) {
30927         return Object.assign({}, member, { id: resolver.entity(member.id).copy(resolver, copies).id });
30928       });
30929       copy2 = copy2.update({ members });
30930       copies[this.id] = copy2;
30931       return copy2;
30932     },
30933     extent: function(resolver, memo) {
30934       return resolver.transient(this, "extent", function() {
30935         if (memo && memo[this.id])
30936           return geoExtent();
30937         memo = memo || {};
30938         memo[this.id] = true;
30939         var extent = geoExtent();
30940         for (var i2 = 0; i2 < this.members.length; i2++) {
30941           var member = resolver.hasEntity(this.members[i2].id);
30942           if (member) {
30943             extent._extend(member.extent(resolver, memo));
30944           }
30945         }
30946         return extent;
30947       });
30948     },
30949     geometry: function(graph) {
30950       return graph.transient(this, "geometry", function() {
30951         return this.isMultipolygon() ? "area" : "relation";
30952       });
30953     },
30954     isDegenerate: function() {
30955       return this.members.length === 0;
30956     },
30957     // Return an array of members, each extended with an 'index' property whose value
30958     // is the member index.
30959     indexedMembers: function() {
30960       var result = new Array(this.members.length);
30961       for (var i2 = 0; i2 < this.members.length; i2++) {
30962         result[i2] = Object.assign({}, this.members[i2], { index: i2 });
30963       }
30964       return result;
30965     },
30966     // Return the first member with the given role. A copy of the member object
30967     // is returned, extended with an 'index' property whose value is the member index.
30968     memberByRole: function(role) {
30969       for (var i2 = 0; i2 < this.members.length; i2++) {
30970         if (this.members[i2].role === role) {
30971           return Object.assign({}, this.members[i2], { index: i2 });
30972         }
30973       }
30974     },
30975     // Same as memberByRole, but returns all members with the given role
30976     membersByRole: function(role) {
30977       var result = [];
30978       for (var i2 = 0; i2 < this.members.length; i2++) {
30979         if (this.members[i2].role === role) {
30980           result.push(Object.assign({}, this.members[i2], { index: i2 }));
30981         }
30982       }
30983       return result;
30984     },
30985     // Return the first member with the given id. A copy of the member object
30986     // is returned, extended with an 'index' property whose value is the member index.
30987     memberById: function(id2) {
30988       for (var i2 = 0; i2 < this.members.length; i2++) {
30989         if (this.members[i2].id === id2) {
30990           return Object.assign({}, this.members[i2], { index: i2 });
30991         }
30992       }
30993     },
30994     // Return the first member with the given id and role. A copy of the member object
30995     // is returned, extended with an 'index' property whose value is the member index.
30996     memberByIdAndRole: function(id2, role) {
30997       for (var i2 = 0; i2 < this.members.length; i2++) {
30998         if (this.members[i2].id === id2 && this.members[i2].role === role) {
30999           return Object.assign({}, this.members[i2], { index: i2 });
31000         }
31001       }
31002     },
31003     addMember: function(member, index) {
31004       var members = this.members.slice();
31005       members.splice(index === void 0 ? members.length : index, 0, member);
31006       return this.update({ members });
31007     },
31008     updateMember: function(member, index) {
31009       var members = this.members.slice();
31010       members.splice(index, 1, Object.assign({}, members[index], member));
31011       return this.update({ members });
31012     },
31013     removeMember: function(index) {
31014       var members = this.members.slice();
31015       members.splice(index, 1);
31016       return this.update({ members });
31017     },
31018     removeMembersWithID: function(id2) {
31019       var members = this.members.filter(function(m) {
31020         return m.id !== id2;
31021       });
31022       return this.update({ members });
31023     },
31024     moveMember: function(fromIndex, toIndex) {
31025       var members = this.members.slice();
31026       members.splice(toIndex, 0, members.splice(fromIndex, 1)[0]);
31027       return this.update({ members });
31028     },
31029     // Wherever a member appears with id `needle.id`, replace it with a member
31030     // with id `replacement.id`, type `replacement.type`, and the original role,
31031     // By default, adding a duplicate member (by id and role) is prevented.
31032     // Return an updated relation.
31033     replaceMember: function(needle, replacement, keepDuplicates) {
31034       if (!this.memberById(needle.id))
31035         return this;
31036       var members = [];
31037       for (var i2 = 0; i2 < this.members.length; i2++) {
31038         var member = this.members[i2];
31039         if (member.id !== needle.id) {
31040           members.push(member);
31041         } else if (keepDuplicates || !this.memberByIdAndRole(replacement.id, member.role)) {
31042           members.push({ id: replacement.id, type: replacement.type, role: member.role });
31043         }
31044       }
31045       return this.update({ members });
31046     },
31047     asJXON: function(changeset_id) {
31048       var r = {
31049         relation: {
31050           "@id": this.osmId(),
31051           "@version": this.version || 0,
31052           member: this.members.map(function(member) {
31053             return {
31054               keyAttributes: {
31055                 type: member.type,
31056                 role: member.role,
31057                 ref: osmEntity.id.toOSM(member.id)
31058               }
31059             };
31060           }, this),
31061           tag: Object.keys(this.tags).map(function(k) {
31062             return { keyAttributes: { k, v: this.tags[k] } };
31063           }, this)
31064         }
31065       };
31066       if (changeset_id) {
31067         r.relation["@changeset"] = changeset_id;
31068       }
31069       return r;
31070     },
31071     asGeoJSON: function(resolver) {
31072       return resolver.transient(this, "GeoJSON", function() {
31073         if (this.isMultipolygon()) {
31074           return {
31075             type: "MultiPolygon",
31076             coordinates: this.multipolygon(resolver)
31077           };
31078         } else {
31079           return {
31080             type: "FeatureCollection",
31081             properties: this.tags,
31082             features: this.members.map(function(member) {
31083               return Object.assign({ role: member.role }, resolver.entity(member.id).asGeoJSON(resolver));
31084             })
31085           };
31086         }
31087       });
31088     },
31089     area: function(resolver) {
31090       return resolver.transient(this, "area", function() {
31091         return area_default(this.asGeoJSON(resolver));
31092       });
31093     },
31094     isMultipolygon: function() {
31095       return this.tags.type === "multipolygon";
31096     },
31097     isComplete: function(resolver) {
31098       for (var i2 = 0; i2 < this.members.length; i2++) {
31099         if (!resolver.hasEntity(this.members[i2].id)) {
31100           return false;
31101         }
31102       }
31103       return true;
31104     },
31105     hasFromViaTo: function() {
31106       return this.members.some(function(m) {
31107         return m.role === "from";
31108       }) && this.members.some(function(m) {
31109         return m.role === "via";
31110       }) && this.members.some(function(m) {
31111         return m.role === "to";
31112       });
31113     },
31114     isRestriction: function() {
31115       return !!(this.tags.type && this.tags.type.match(/^restriction:?/));
31116     },
31117     isValidRestriction: function() {
31118       if (!this.isRestriction())
31119         return false;
31120       var froms = this.members.filter(function(m) {
31121         return m.role === "from";
31122       });
31123       var vias = this.members.filter(function(m) {
31124         return m.role === "via";
31125       });
31126       var tos = this.members.filter(function(m) {
31127         return m.role === "to";
31128       });
31129       if (froms.length !== 1 && this.tags.restriction !== "no_entry")
31130         return false;
31131       if (froms.some(function(m) {
31132         return m.type !== "way";
31133       }))
31134         return false;
31135       if (tos.length !== 1 && this.tags.restriction !== "no_exit")
31136         return false;
31137       if (tos.some(function(m) {
31138         return m.type !== "way";
31139       }))
31140         return false;
31141       if (vias.length === 0)
31142         return false;
31143       if (vias.length > 1 && vias.some(function(m) {
31144         return m.type !== "way";
31145       }))
31146         return false;
31147       return true;
31148     },
31149     isConnectivity: function() {
31150       return !!(this.tags.type && this.tags.type.match(/^connectivity:?/));
31151     },
31152     // Returns an array [A0, ... An], each Ai being an array of node arrays [Nds0, ... Ndsm],
31153     // where Nds0 is an outer ring and subsequent Ndsi's (if any i > 0) being inner rings.
31154     //
31155     // This corresponds to the structure needed for rendering a multipolygon path using a
31156     // `evenodd` fill rule, as well as the structure of a GeoJSON MultiPolygon geometry.
31157     //
31158     // In the case of invalid geometries, this function will still return a result which
31159     // includes the nodes of all way members, but some Nds may be unclosed and some inner
31160     // rings not matched with the intended outer ring.
31161     //
31162     multipolygon: function(resolver) {
31163       var outers = this.members.filter(function(m) {
31164         return "outer" === (m.role || "outer");
31165       });
31166       var inners = this.members.filter(function(m) {
31167         return "inner" === m.role;
31168       });
31169       outers = osmJoinWays(outers, resolver);
31170       inners = osmJoinWays(inners, resolver);
31171       var sequenceToLineString = function(sequence) {
31172         if (sequence.nodes.length > 2 && sequence.nodes[0] !== sequence.nodes[sequence.nodes.length - 1]) {
31173           sequence.nodes.push(sequence.nodes[0]);
31174         }
31175         return sequence.nodes.map(function(node) {
31176           return node.loc;
31177         });
31178       };
31179       outers = outers.map(sequenceToLineString);
31180       inners = inners.map(sequenceToLineString);
31181       var result = outers.map(function(o2) {
31182         return [area_default({ type: "Polygon", coordinates: [o2] }) > 2 * Math.PI ? o2.reverse() : o2];
31183       });
31184       function findOuter(inner2) {
31185         var o2, outer;
31186         for (o2 = 0; o2 < outers.length; o2++) {
31187           outer = outers[o2];
31188           if (geoPolygonContainsPolygon(outer, inner2)) {
31189             return o2;
31190           }
31191         }
31192         for (o2 = 0; o2 < outers.length; o2++) {
31193           outer = outers[o2];
31194           if (geoPolygonIntersectsPolygon(outer, inner2, false)) {
31195             return o2;
31196           }
31197         }
31198       }
31199       for (var i2 = 0; i2 < inners.length; i2++) {
31200         var inner = inners[i2];
31201         if (area_default({ type: "Polygon", coordinates: [inner] }) < 2 * Math.PI) {
31202           inner = inner.reverse();
31203         }
31204         var o = findOuter(inners[i2]);
31205         if (o !== void 0) {
31206           result[o].push(inners[i2]);
31207         } else {
31208           result.push([inners[i2]]);
31209         }
31210       }
31211       return result;
31212     }
31213   });
31214
31215   // modules/osm/qa_item.js
31216   var QAItem = class _QAItem {
31217     constructor(loc, service, itemType, id2, props) {
31218       this.loc = loc;
31219       this.service = service.title;
31220       this.itemType = itemType;
31221       this.id = id2 ? id2 : `${_QAItem.id()}`;
31222       this.update(props);
31223       if (service && typeof service.getIcon === "function") {
31224         this.icon = service.getIcon(itemType);
31225       }
31226     }
31227     update(props) {
31228       const { loc, service, itemType, id: id2 } = this;
31229       Object.keys(props).forEach((prop) => this[prop] = props[prop]);
31230       this.loc = loc;
31231       this.service = service;
31232       this.itemType = itemType;
31233       this.id = id2;
31234       return this;
31235     }
31236     // Generic handling for newly created QAItems
31237     static id() {
31238       return this.nextId--;
31239     }
31240   };
31241   QAItem.nextId = -1;
31242
31243   // modules/actions/split.js
31244   function actionSplit(nodeIds, newWayIds) {
31245     if (typeof nodeIds === "string")
31246       nodeIds = [nodeIds];
31247     var _wayIDs;
31248     var _keepHistoryOn = "longest";
31249     var _createdWayIDs = [];
31250     function dist(graph, nA, nB) {
31251       var locA = graph.entity(nA).loc;
31252       var locB = graph.entity(nB).loc;
31253       var epsilon3 = 1e-6;
31254       return locA && locB ? geoSphericalDistance(locA, locB) : epsilon3;
31255     }
31256     function splitArea(nodes, idxA, graph) {
31257       var lengths = new Array(nodes.length);
31258       var length;
31259       var i2;
31260       var best = 0;
31261       var idxB;
31262       function wrap2(index) {
31263         return utilWrap(index, nodes.length);
31264       }
31265       length = 0;
31266       for (i2 = wrap2(idxA + 1); i2 !== idxA; i2 = wrap2(i2 + 1)) {
31267         length += dist(graph, nodes[i2], nodes[wrap2(i2 - 1)]);
31268         lengths[i2] = length;
31269       }
31270       length = 0;
31271       for (i2 = wrap2(idxA - 1); i2 !== idxA; i2 = wrap2(i2 - 1)) {
31272         length += dist(graph, nodes[i2], nodes[wrap2(i2 + 1)]);
31273         if (length < lengths[i2]) {
31274           lengths[i2] = length;
31275         }
31276       }
31277       for (i2 = 0; i2 < nodes.length; i2++) {
31278         var cost = lengths[i2] / dist(graph, nodes[idxA], nodes[i2]);
31279         if (cost > best) {
31280           idxB = i2;
31281           best = cost;
31282         }
31283       }
31284       return idxB;
31285     }
31286     function totalLengthBetweenNodes(graph, nodes) {
31287       var totalLength = 0;
31288       for (var i2 = 0; i2 < nodes.length - 1; i2++) {
31289         totalLength += dist(graph, nodes[i2], nodes[i2 + 1]);
31290       }
31291       return totalLength;
31292     }
31293     function split(graph, nodeId, wayA, newWayId) {
31294       var wayB = osmWay({ id: newWayId, tags: wayA.tags });
31295       var origNodes = wayA.nodes.slice();
31296       var nodesA;
31297       var nodesB;
31298       var isArea = wayA.isArea();
31299       var isOuter = osmIsOldMultipolygonOuterMember(wayA, graph);
31300       if (wayA.isClosed()) {
31301         var nodes = wayA.nodes.slice(0, -1);
31302         var idxA = nodes.indexOf(nodeId);
31303         var idxB = splitArea(nodes, idxA, graph);
31304         if (idxB < idxA) {
31305           nodesA = nodes.slice(idxA).concat(nodes.slice(0, idxB + 1));
31306           nodesB = nodes.slice(idxB, idxA + 1);
31307         } else {
31308           nodesA = nodes.slice(idxA, idxB + 1);
31309           nodesB = nodes.slice(idxB).concat(nodes.slice(0, idxA + 1));
31310         }
31311       } else {
31312         var idx = wayA.nodes.indexOf(nodeId, 1);
31313         nodesA = wayA.nodes.slice(0, idx + 1);
31314         nodesB = wayA.nodes.slice(idx);
31315       }
31316       var lengthA = totalLengthBetweenNodes(graph, nodesA);
31317       var lengthB = totalLengthBetweenNodes(graph, nodesB);
31318       if (_keepHistoryOn === "longest" && lengthB > lengthA) {
31319         wayA = wayA.update({ nodes: nodesB });
31320         wayB = wayB.update({ nodes: nodesA });
31321         var temp = lengthA;
31322         lengthA = lengthB;
31323         lengthB = temp;
31324       } else {
31325         wayA = wayA.update({ nodes: nodesA });
31326         wayB = wayB.update({ nodes: nodesB });
31327       }
31328       if (wayA.tags.step_count) {
31329         var stepCount = Number(wayA.tags.step_count);
31330         if (stepCount && // ensure a number
31331         isFinite(stepCount) && // ensure positive
31332         stepCount > 0 && // ensure integer
31333         Math.round(stepCount) === stepCount) {
31334           var tagsA = Object.assign({}, wayA.tags);
31335           var tagsB = Object.assign({}, wayB.tags);
31336           var ratioA = lengthA / (lengthA + lengthB);
31337           var countA = Math.round(stepCount * ratioA);
31338           tagsA.step_count = countA.toString();
31339           tagsB.step_count = (stepCount - countA).toString();
31340           wayA = wayA.update({ tags: tagsA });
31341           wayB = wayB.update({ tags: tagsB });
31342         }
31343       }
31344       graph = graph.replace(wayA);
31345       graph = graph.replace(wayB);
31346       graph.parentRelations(wayA).forEach(function(relation) {
31347         var member;
31348         if (relation.hasFromViaTo()) {
31349           var f2 = relation.memberByRole("from");
31350           var v = relation.membersByRole("via");
31351           var t = relation.memberByRole("to");
31352           var i2;
31353           if (f2.id === wayA.id || t.id === wayA.id) {
31354             var keepB = false;
31355             if (v.length === 1 && v[0].type === "node") {
31356               keepB = wayB.contains(v[0].id);
31357             } else {
31358               for (i2 = 0; i2 < v.length; i2++) {
31359                 if (v[i2].type === "way") {
31360                   var wayVia = graph.hasEntity(v[i2].id);
31361                   if (wayVia && utilArrayIntersection(wayB.nodes, wayVia.nodes).length) {
31362                     keepB = true;
31363                     break;
31364                   }
31365                 }
31366               }
31367             }
31368             if (keepB) {
31369               relation = relation.replaceMember(wayA, wayB);
31370               graph = graph.replace(relation);
31371             }
31372           } else {
31373             for (i2 = 0; i2 < v.length; i2++) {
31374               if (v[i2].type === "way" && v[i2].id === wayA.id) {
31375                 member = {
31376                   id: wayB.id,
31377                   type: "way",
31378                   role: "via"
31379                 };
31380                 graph = actionAddMember(relation.id, member, v[i2].index + 1)(graph);
31381                 break;
31382               }
31383             }
31384           }
31385         } else {
31386           if (relation === isOuter) {
31387             graph = graph.replace(relation.mergeTags(wayA.tags));
31388             graph = graph.replace(wayA.update({ tags: {} }));
31389             graph = graph.replace(wayB.update({ tags: {} }));
31390           }
31391           member = {
31392             id: wayB.id,
31393             type: "way",
31394             role: relation.memberById(wayA.id).role
31395           };
31396           var insertPair = {
31397             originalID: wayA.id,
31398             insertedID: wayB.id,
31399             nodes: origNodes
31400           };
31401           graph = actionAddMember(relation.id, member, void 0, insertPair)(graph);
31402         }
31403       });
31404       if (!isOuter && isArea) {
31405         var multipolygon = osmRelation({
31406           tags: Object.assign({}, wayA.tags, { type: "multipolygon" }),
31407           members: [
31408             { id: wayA.id, role: "outer", type: "way" },
31409             { id: wayB.id, role: "outer", type: "way" }
31410           ]
31411         });
31412         graph = graph.replace(multipolygon);
31413         graph = graph.replace(wayA.update({ tags: {} }));
31414         graph = graph.replace(wayB.update({ tags: {} }));
31415       }
31416       _createdWayIDs.push(wayB.id);
31417       return graph;
31418     }
31419     var action = function(graph) {
31420       _createdWayIDs = [];
31421       var newWayIndex = 0;
31422       for (var i2 = 0; i2 < nodeIds.length; i2++) {
31423         var nodeId = nodeIds[i2];
31424         var candidates = action.waysForNode(nodeId, graph);
31425         for (var j2 = 0; j2 < candidates.length; j2++) {
31426           graph = split(graph, nodeId, candidates[j2], newWayIds && newWayIds[newWayIndex]);
31427           newWayIndex += 1;
31428         }
31429       }
31430       return graph;
31431     };
31432     action.getCreatedWayIDs = function() {
31433       return _createdWayIDs;
31434     };
31435     action.waysForNode = function(nodeId, graph) {
31436       var node = graph.entity(nodeId);
31437       var splittableParents = graph.parentWays(node).filter(isSplittable);
31438       if (!_wayIDs) {
31439         var hasLine = splittableParents.some(function(parent) {
31440           return parent.geometry(graph) === "line";
31441         });
31442         if (hasLine) {
31443           return splittableParents.filter(function(parent) {
31444             return parent.geometry(graph) === "line";
31445           });
31446         }
31447       }
31448       return splittableParents;
31449       function isSplittable(parent) {
31450         if (_wayIDs && _wayIDs.indexOf(parent.id) === -1)
31451           return false;
31452         if (parent.isClosed())
31453           return true;
31454         for (var i2 = 1; i2 < parent.nodes.length - 1; i2++) {
31455           if (parent.nodes[i2] === nodeId)
31456             return true;
31457         }
31458         return false;
31459       }
31460     };
31461     action.ways = function(graph) {
31462       return utilArrayUniq([].concat.apply([], nodeIds.map(function(nodeId) {
31463         return action.waysForNode(nodeId, graph);
31464       })));
31465     };
31466     action.disabled = function(graph) {
31467       for (var i2 = 0; i2 < nodeIds.length; i2++) {
31468         var nodeId = nodeIds[i2];
31469         var candidates = action.waysForNode(nodeId, graph);
31470         if (candidates.length === 0 || _wayIDs && _wayIDs.length !== candidates.length) {
31471           return "not_eligible";
31472         }
31473       }
31474     };
31475     action.limitWays = function(val) {
31476       if (!arguments.length)
31477         return _wayIDs;
31478       _wayIDs = val;
31479       return action;
31480     };
31481     action.keepHistoryOn = function(val) {
31482       if (!arguments.length)
31483         return _keepHistoryOn;
31484       _keepHistoryOn = val;
31485       return action;
31486     };
31487     return action;
31488   }
31489
31490   // modules/core/graph.js
31491   function coreGraph(other, mutable) {
31492     if (!(this instanceof coreGraph))
31493       return new coreGraph(other, mutable);
31494     if (other instanceof coreGraph) {
31495       var base = other.base();
31496       this.entities = Object.assign(Object.create(base.entities), other.entities);
31497       this._parentWays = Object.assign(Object.create(base.parentWays), other._parentWays);
31498       this._parentRels = Object.assign(Object.create(base.parentRels), other._parentRels);
31499     } else {
31500       this.entities = /* @__PURE__ */ Object.create({});
31501       this._parentWays = /* @__PURE__ */ Object.create({});
31502       this._parentRels = /* @__PURE__ */ Object.create({});
31503       this.rebase(other || [], [this]);
31504     }
31505     this.transients = {};
31506     this._childNodes = {};
31507     this.frozen = !mutable;
31508   }
31509   coreGraph.prototype = {
31510     hasEntity: function(id2) {
31511       return this.entities[id2];
31512     },
31513     entity: function(id2) {
31514       var entity = this.entities[id2];
31515       if (!entity) {
31516         entity = this.entities.__proto__[id2];
31517       }
31518       if (!entity) {
31519         throw new Error("entity " + id2 + " not found");
31520       }
31521       return entity;
31522     },
31523     geometry: function(id2) {
31524       return this.entity(id2).geometry(this);
31525     },
31526     transient: function(entity, key, fn) {
31527       var id2 = entity.id;
31528       var transients = this.transients[id2] || (this.transients[id2] = {});
31529       if (transients[key] !== void 0) {
31530         return transients[key];
31531       }
31532       transients[key] = fn.call(entity);
31533       return transients[key];
31534     },
31535     parentWays: function(entity) {
31536       var parents = this._parentWays[entity.id];
31537       var result = [];
31538       if (parents) {
31539         parents.forEach(function(id2) {
31540           result.push(this.entity(id2));
31541         }, this);
31542       }
31543       return result;
31544     },
31545     isPoi: function(entity) {
31546       var parents = this._parentWays[entity.id];
31547       return !parents || parents.size === 0;
31548     },
31549     isShared: function(entity) {
31550       var parents = this._parentWays[entity.id];
31551       return parents && parents.size > 1;
31552     },
31553     parentRelations: function(entity) {
31554       var parents = this._parentRels[entity.id];
31555       var result = [];
31556       if (parents) {
31557         parents.forEach(function(id2) {
31558           result.push(this.entity(id2));
31559         }, this);
31560       }
31561       return result;
31562     },
31563     parentMultipolygons: function(entity) {
31564       return this.parentRelations(entity).filter(function(relation) {
31565         return relation.isMultipolygon();
31566       });
31567     },
31568     childNodes: function(entity) {
31569       if (this._childNodes[entity.id])
31570         return this._childNodes[entity.id];
31571       if (!entity.nodes)
31572         return [];
31573       var nodes = [];
31574       for (var i2 = 0; i2 < entity.nodes.length; i2++) {
31575         nodes[i2] = this.entity(entity.nodes[i2]);
31576       }
31577       if (debug)
31578         Object.freeze(nodes);
31579       this._childNodes[entity.id] = nodes;
31580       return this._childNodes[entity.id];
31581     },
31582     base: function() {
31583       return {
31584         "entities": Object.getPrototypeOf(this.entities),
31585         "parentWays": Object.getPrototypeOf(this._parentWays),
31586         "parentRels": Object.getPrototypeOf(this._parentRels)
31587       };
31588     },
31589     // Unlike other graph methods, rebase mutates in place. This is because it
31590     // is used only during the history operation that merges newly downloaded
31591     // data into each state. To external consumers, it should appear as if the
31592     // graph always contained the newly downloaded data.
31593     rebase: function(entities, stack, force) {
31594       var base = this.base();
31595       var i2, j2, k, id2;
31596       for (i2 = 0; i2 < entities.length; i2++) {
31597         var entity = entities[i2];
31598         if (!entity.visible || !force && base.entities[entity.id])
31599           continue;
31600         base.entities[entity.id] = entity;
31601         this._updateCalculated(void 0, entity, base.parentWays, base.parentRels);
31602         if (entity.type === "way") {
31603           for (j2 = 0; j2 < entity.nodes.length; j2++) {
31604             id2 = entity.nodes[j2];
31605             for (k = 1; k < stack.length; k++) {
31606               var ents = stack[k].entities;
31607               if (ents.hasOwnProperty(id2) && ents[id2] === void 0) {
31608                 delete ents[id2];
31609               }
31610             }
31611           }
31612         }
31613       }
31614       for (i2 = 0; i2 < stack.length; i2++) {
31615         stack[i2]._updateRebased();
31616       }
31617     },
31618     _updateRebased: function() {
31619       var base = this.base();
31620       Object.keys(this._parentWays).forEach(function(child) {
31621         if (base.parentWays[child]) {
31622           base.parentWays[child].forEach(function(id2) {
31623             if (!this.entities.hasOwnProperty(id2)) {
31624               this._parentWays[child].add(id2);
31625             }
31626           }, this);
31627         }
31628       }, this);
31629       Object.keys(this._parentRels).forEach(function(child) {
31630         if (base.parentRels[child]) {
31631           base.parentRels[child].forEach(function(id2) {
31632             if (!this.entities.hasOwnProperty(id2)) {
31633               this._parentRels[child].add(id2);
31634             }
31635           }, this);
31636         }
31637       }, this);
31638       this.transients = {};
31639     },
31640     // Updates calculated properties (parentWays, parentRels) for the specified change
31641     _updateCalculated: function(oldentity, entity, parentWays, parentRels) {
31642       parentWays = parentWays || this._parentWays;
31643       parentRels = parentRels || this._parentRels;
31644       var type2 = entity && entity.type || oldentity && oldentity.type;
31645       var removed, added, i2;
31646       if (type2 === "way") {
31647         if (oldentity && entity) {
31648           removed = utilArrayDifference(oldentity.nodes, entity.nodes);
31649           added = utilArrayDifference(entity.nodes, oldentity.nodes);
31650         } else if (oldentity) {
31651           removed = oldentity.nodes;
31652           added = [];
31653         } else if (entity) {
31654           removed = [];
31655           added = entity.nodes;
31656         }
31657         for (i2 = 0; i2 < removed.length; i2++) {
31658           parentWays[removed[i2]] = new Set(parentWays[removed[i2]]);
31659           parentWays[removed[i2]].delete(oldentity.id);
31660         }
31661         for (i2 = 0; i2 < added.length; i2++) {
31662           parentWays[added[i2]] = new Set(parentWays[added[i2]]);
31663           parentWays[added[i2]].add(entity.id);
31664         }
31665       } else if (type2 === "relation") {
31666         var oldentityMemberIDs = oldentity ? oldentity.members.map(function(m) {
31667           return m.id;
31668         }) : [];
31669         var entityMemberIDs = entity ? entity.members.map(function(m) {
31670           return m.id;
31671         }) : [];
31672         if (oldentity && entity) {
31673           removed = utilArrayDifference(oldentityMemberIDs, entityMemberIDs);
31674           added = utilArrayDifference(entityMemberIDs, oldentityMemberIDs);
31675         } else if (oldentity) {
31676           removed = oldentityMemberIDs;
31677           added = [];
31678         } else if (entity) {
31679           removed = [];
31680           added = entityMemberIDs;
31681         }
31682         for (i2 = 0; i2 < removed.length; i2++) {
31683           parentRels[removed[i2]] = new Set(parentRels[removed[i2]]);
31684           parentRels[removed[i2]].delete(oldentity.id);
31685         }
31686         for (i2 = 0; i2 < added.length; i2++) {
31687           parentRels[added[i2]] = new Set(parentRels[added[i2]]);
31688           parentRels[added[i2]].add(entity.id);
31689         }
31690       }
31691     },
31692     replace: function(entity) {
31693       if (this.entities[entity.id] === entity)
31694         return this;
31695       return this.update(function() {
31696         this._updateCalculated(this.entities[entity.id], entity);
31697         this.entities[entity.id] = entity;
31698       });
31699     },
31700     remove: function(entity) {
31701       return this.update(function() {
31702         this._updateCalculated(entity, void 0);
31703         this.entities[entity.id] = void 0;
31704       });
31705     },
31706     revert: function(id2) {
31707       var baseEntity = this.base().entities[id2];
31708       var headEntity = this.entities[id2];
31709       if (headEntity === baseEntity)
31710         return this;
31711       return this.update(function() {
31712         this._updateCalculated(headEntity, baseEntity);
31713         delete this.entities[id2];
31714       });
31715     },
31716     update: function() {
31717       var graph = this.frozen ? coreGraph(this, true) : this;
31718       for (var i2 = 0; i2 < arguments.length; i2++) {
31719         arguments[i2].call(graph, graph);
31720       }
31721       if (this.frozen)
31722         graph.frozen = true;
31723       return graph;
31724     },
31725     // Obliterates any existing entities
31726     load: function(entities) {
31727       var base = this.base();
31728       this.entities = Object.create(base.entities);
31729       for (var i2 in entities) {
31730         this.entities[i2] = entities[i2];
31731         this._updateCalculated(base.entities[i2], this.entities[i2]);
31732       }
31733       return this;
31734     }
31735   };
31736
31737   // modules/osm/intersection.js
31738   function osmTurn(turn) {
31739     if (!(this instanceof osmTurn)) {
31740       return new osmTurn(turn);
31741     }
31742     Object.assign(this, turn);
31743   }
31744   function osmIntersection(graph, startVertexId, maxDistance) {
31745     maxDistance = maxDistance || 30;
31746     var vgraph = coreGraph();
31747     var i2, j2, k;
31748     function memberOfRestriction(entity) {
31749       return graph.parentRelations(entity).some(function(r) {
31750         return r.isRestriction();
31751       });
31752     }
31753     function isRoad(way2) {
31754       if (way2.isArea() || way2.isDegenerate())
31755         return false;
31756       var roads = {
31757         "motorway": true,
31758         "motorway_link": true,
31759         "trunk": true,
31760         "trunk_link": true,
31761         "primary": true,
31762         "primary_link": true,
31763         "secondary": true,
31764         "secondary_link": true,
31765         "tertiary": true,
31766         "tertiary_link": true,
31767         "residential": true,
31768         "unclassified": true,
31769         "living_street": true,
31770         "service": true,
31771         "road": true,
31772         "track": true
31773       };
31774       return roads[way2.tags.highway];
31775     }
31776     var startNode = graph.entity(startVertexId);
31777     var checkVertices = [startNode];
31778     var checkWays;
31779     var vertices = [];
31780     var vertexIds = [];
31781     var vertex;
31782     var ways = [];
31783     var wayIds = [];
31784     var way;
31785     var nodes = [];
31786     var node;
31787     var parents = [];
31788     var parent;
31789     var actions = [];
31790     while (checkVertices.length) {
31791       vertex = checkVertices.pop();
31792       checkWays = graph.parentWays(vertex);
31793       var hasWays = false;
31794       for (i2 = 0; i2 < checkWays.length; i2++) {
31795         way = checkWays[i2];
31796         if (!isRoad(way) && !memberOfRestriction(way))
31797           continue;
31798         ways.push(way);
31799         hasWays = true;
31800         nodes = utilArrayUniq(graph.childNodes(way));
31801         for (j2 = 0; j2 < nodes.length; j2++) {
31802           node = nodes[j2];
31803           if (node === vertex)
31804             continue;
31805           if (vertices.indexOf(node) !== -1)
31806             continue;
31807           if (geoSphericalDistance(node.loc, startNode.loc) > maxDistance)
31808             continue;
31809           var hasParents = false;
31810           parents = graph.parentWays(node);
31811           for (k = 0; k < parents.length; k++) {
31812             parent = parents[k];
31813             if (parent === way)
31814               continue;
31815             if (ways.indexOf(parent) !== -1)
31816               continue;
31817             if (!isRoad(parent))
31818               continue;
31819             hasParents = true;
31820             break;
31821           }
31822           if (hasParents) {
31823             checkVertices.push(node);
31824           }
31825         }
31826       }
31827       if (hasWays) {
31828         vertices.push(vertex);
31829       }
31830     }
31831     vertices = utilArrayUniq(vertices);
31832     ways = utilArrayUniq(ways);
31833     ways.forEach(function(way2) {
31834       graph.childNodes(way2).forEach(function(node2) {
31835         vgraph = vgraph.replace(node2);
31836       });
31837       vgraph = vgraph.replace(way2);
31838       graph.parentRelations(way2).forEach(function(relation) {
31839         if (relation.isRestriction()) {
31840           if (relation.isValidRestriction(graph)) {
31841             vgraph = vgraph.replace(relation);
31842           } else if (relation.isComplete(graph)) {
31843             actions.push(actionDeleteRelation(relation.id));
31844           }
31845         }
31846       });
31847     });
31848     ways.forEach(function(w) {
31849       var way2 = vgraph.entity(w.id);
31850       if (way2.tags.oneway === "-1") {
31851         var action = actionReverse(way2.id, { reverseOneway: true });
31852         actions.push(action);
31853         vgraph = action(vgraph);
31854       }
31855     });
31856     var origCount = osmEntity.id.next.way;
31857     vertices.forEach(function(v) {
31858       var splitAll = actionSplit([v.id]).keepHistoryOn("first");
31859       if (!splitAll.disabled(vgraph)) {
31860         splitAll.ways(vgraph).forEach(function(way2) {
31861           var splitOne = actionSplit([v.id]).limitWays([way2.id]).keepHistoryOn("first");
31862           actions.push(splitOne);
31863           vgraph = splitOne(vgraph);
31864         });
31865       }
31866     });
31867     osmEntity.id.next.way = origCount;
31868     vertexIds = vertices.map(function(v) {
31869       return v.id;
31870     });
31871     vertices = [];
31872     ways = [];
31873     vertexIds.forEach(function(id2) {
31874       var vertex2 = vgraph.entity(id2);
31875       var parents2 = vgraph.parentWays(vertex2);
31876       vertices.push(vertex2);
31877       ways = ways.concat(parents2);
31878     });
31879     vertices = utilArrayUniq(vertices);
31880     ways = utilArrayUniq(ways);
31881     vertexIds = vertices.map(function(v) {
31882       return v.id;
31883     });
31884     wayIds = ways.map(function(w) {
31885       return w.id;
31886     });
31887     function withMetadata(way2, vertexIds2) {
31888       var __oneWay = way2.isOneWay();
31889       var __first = vertexIds2.indexOf(way2.first()) !== -1;
31890       var __last = vertexIds2.indexOf(way2.last()) !== -1;
31891       var __via = __first && __last;
31892       var __from = __first && !__oneWay || __last;
31893       var __to = __first || __last && !__oneWay;
31894       return way2.update({
31895         __first,
31896         __last,
31897         __from,
31898         __via,
31899         __to,
31900         __oneWay
31901       });
31902     }
31903     ways = [];
31904     wayIds.forEach(function(id2) {
31905       var way2 = withMetadata(vgraph.entity(id2), vertexIds);
31906       vgraph = vgraph.replace(way2);
31907       ways.push(way2);
31908     });
31909     var keepGoing;
31910     var removeWayIds = [];
31911     var removeVertexIds = [];
31912     do {
31913       keepGoing = false;
31914       checkVertices = vertexIds.slice();
31915       for (i2 = 0; i2 < checkVertices.length; i2++) {
31916         var vertexId = checkVertices[i2];
31917         vertex = vgraph.hasEntity(vertexId);
31918         if (!vertex) {
31919           if (vertexIds.indexOf(vertexId) !== -1) {
31920             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
31921           }
31922           removeVertexIds.push(vertexId);
31923           continue;
31924         }
31925         parents = vgraph.parentWays(vertex);
31926         if (parents.length < 3) {
31927           if (vertexIds.indexOf(vertexId) !== -1) {
31928             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
31929           }
31930         }
31931         if (parents.length === 2) {
31932           var a = parents[0];
31933           var b = parents[1];
31934           var aIsLeaf = a && !a.__via;
31935           var bIsLeaf = b && !b.__via;
31936           var leaf, survivor;
31937           if (aIsLeaf && !bIsLeaf) {
31938             leaf = a;
31939             survivor = b;
31940           } else if (!aIsLeaf && bIsLeaf) {
31941             leaf = b;
31942             survivor = a;
31943           }
31944           if (leaf && survivor) {
31945             survivor = withMetadata(survivor, vertexIds);
31946             vgraph = vgraph.replace(survivor).remove(leaf);
31947             removeWayIds.push(leaf.id);
31948             keepGoing = true;
31949           }
31950         }
31951         parents = vgraph.parentWays(vertex);
31952         if (parents.length < 2) {
31953           if (vertexIds.indexOf(vertexId) !== -1) {
31954             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
31955           }
31956           removeVertexIds.push(vertexId);
31957           keepGoing = true;
31958         }
31959         if (parents.length < 1) {
31960           vgraph = vgraph.remove(vertex);
31961         }
31962       }
31963     } while (keepGoing);
31964     vertices = vertices.filter(function(vertex2) {
31965       return removeVertexIds.indexOf(vertex2.id) === -1;
31966     }).map(function(vertex2) {
31967       return vgraph.entity(vertex2.id);
31968     });
31969     ways = ways.filter(function(way2) {
31970       return removeWayIds.indexOf(way2.id) === -1;
31971     }).map(function(way2) {
31972       return vgraph.entity(way2.id);
31973     });
31974     var intersection = {
31975       graph: vgraph,
31976       actions,
31977       vertices,
31978       ways
31979     };
31980     intersection.turns = function(fromWayId, maxViaWay) {
31981       if (!fromWayId)
31982         return [];
31983       if (!maxViaWay)
31984         maxViaWay = 0;
31985       var vgraph2 = intersection.graph;
31986       var keyVertexIds = intersection.vertices.map(function(v) {
31987         return v.id;
31988       });
31989       var start2 = vgraph2.entity(fromWayId);
31990       if (!start2 || !(start2.__from || start2.__via))
31991         return [];
31992       var maxPathLength = maxViaWay * 2 + 3;
31993       var turns = [];
31994       step(start2);
31995       return turns;
31996       function step(entity, currPath, currRestrictions, matchedRestriction) {
31997         currPath = (currPath || []).slice();
31998         if (currPath.length >= maxPathLength)
31999           return;
32000         currPath.push(entity.id);
32001         currRestrictions = (currRestrictions || []).slice();
32002         if (entity.type === "node") {
32003           stepNode(entity, currPath, currRestrictions);
32004         } else {
32005           stepWay(entity, currPath, currRestrictions, matchedRestriction);
32006         }
32007       }
32008       function stepNode(entity, currPath, currRestrictions) {
32009         var i3, j3;
32010         var parents2 = vgraph2.parentWays(entity);
32011         var nextWays = [];
32012         for (i3 = 0; i3 < parents2.length; i3++) {
32013           var way2 = parents2[i3];
32014           if (way2.__oneWay && way2.nodes[0] !== entity.id)
32015             continue;
32016           if (currPath.indexOf(way2.id) !== -1 && currPath.length >= 3)
32017             continue;
32018           var restrict = null;
32019           for (j3 = 0; j3 < currRestrictions.length; j3++) {
32020             var restriction = currRestrictions[j3];
32021             var f2 = restriction.memberByRole("from");
32022             var v = restriction.membersByRole("via");
32023             var t = restriction.memberByRole("to");
32024             var isNo = /^no_/.test(restriction.tags.restriction);
32025             var isOnly = /^only_/.test(restriction.tags.restriction);
32026             if (!(isNo || isOnly)) {
32027               continue;
32028             }
32029             var matchesFrom = f2.id === fromWayId;
32030             var matchesViaTo = false;
32031             var isAlongOnlyPath = false;
32032             if (t.id === way2.id) {
32033               if (v.length === 1 && v[0].type === "node") {
32034                 matchesViaTo = v[0].id === entity.id && (matchesFrom && currPath.length === 2 || !matchesFrom && currPath.length > 2);
32035               } else {
32036                 var pathVias = [];
32037                 for (k = 2; k < currPath.length; k += 2) {
32038                   pathVias.push(currPath[k]);
32039                 }
32040                 var restrictionVias = [];
32041                 for (k = 0; k < v.length; k++) {
32042                   if (v[k].type === "way") {
32043                     restrictionVias.push(v[k].id);
32044                   }
32045                 }
32046                 var diff = utilArrayDifference(pathVias, restrictionVias);
32047                 matchesViaTo = !diff.length;
32048               }
32049             } else if (isOnly) {
32050               for (k = 0; k < v.length; k++) {
32051                 if (v[k].type === "way" && v[k].id === way2.id) {
32052                   isAlongOnlyPath = true;
32053                   break;
32054                 }
32055               }
32056             }
32057             if (matchesViaTo) {
32058               if (isOnly) {
32059                 restrict = { id: restriction.id, direct: matchesFrom, from: f2.id, only: true, end: true };
32060               } else {
32061                 restrict = { id: restriction.id, direct: matchesFrom, from: f2.id, no: true, end: true };
32062               }
32063             } else {
32064               if (isAlongOnlyPath) {
32065                 restrict = { id: restriction.id, direct: false, from: f2.id, only: true, end: false };
32066               } else if (isOnly) {
32067                 restrict = { id: restriction.id, direct: false, from: f2.id, no: true, end: true };
32068               }
32069             }
32070             if (restrict && restrict.direct)
32071               break;
32072           }
32073           nextWays.push({ way: way2, restrict });
32074         }
32075         nextWays.forEach(function(nextWay) {
32076           step(nextWay.way, currPath, currRestrictions, nextWay.restrict);
32077         });
32078       }
32079       function stepWay(entity, currPath, currRestrictions, matchedRestriction) {
32080         var i3;
32081         if (currPath.length >= 3) {
32082           var turnPath = currPath.slice();
32083           if (matchedRestriction && matchedRestriction.direct === false) {
32084             for (i3 = 0; i3 < turnPath.length; i3++) {
32085               if (turnPath[i3] === matchedRestriction.from) {
32086                 turnPath = turnPath.slice(i3);
32087                 break;
32088               }
32089             }
32090           }
32091           var turn = pathToTurn(turnPath);
32092           if (turn) {
32093             if (matchedRestriction) {
32094               turn.restrictionID = matchedRestriction.id;
32095               turn.no = matchedRestriction.no;
32096               turn.only = matchedRestriction.only;
32097               turn.direct = matchedRestriction.direct;
32098             }
32099             turns.push(osmTurn(turn));
32100           }
32101           if (currPath[0] === currPath[2])
32102             return;
32103         }
32104         if (matchedRestriction && matchedRestriction.end)
32105           return;
32106         var n1 = vgraph2.entity(entity.first());
32107         var n2 = vgraph2.entity(entity.last());
32108         var dist = geoSphericalDistance(n1.loc, n2.loc);
32109         var nextNodes = [];
32110         if (currPath.length > 1) {
32111           if (dist > maxDistance)
32112             return;
32113           if (!entity.__via)
32114             return;
32115         }
32116         if (!entity.__oneWay && // bidirectional..
32117         keyVertexIds.indexOf(n1.id) !== -1 && // key vertex..
32118         currPath.indexOf(n1.id) === -1) {
32119           nextNodes.push(n1);
32120         }
32121         if (keyVertexIds.indexOf(n2.id) !== -1 && // key vertex..
32122         currPath.indexOf(n2.id) === -1) {
32123           nextNodes.push(n2);
32124         }
32125         nextNodes.forEach(function(nextNode) {
32126           var fromRestrictions = vgraph2.parentRelations(entity).filter(function(r) {
32127             if (!r.isRestriction())
32128               return false;
32129             var f2 = r.memberByRole("from");
32130             if (!f2 || f2.id !== entity.id)
32131               return false;
32132             var isOnly = /^only_/.test(r.tags.restriction);
32133             if (!isOnly)
32134               return true;
32135             var isOnlyVia = false;
32136             var v = r.membersByRole("via");
32137             if (v.length === 1 && v[0].type === "node") {
32138               isOnlyVia = v[0].id === nextNode.id;
32139             } else {
32140               for (var i4 = 0; i4 < v.length; i4++) {
32141                 if (v[i4].type !== "way")
32142                   continue;
32143                 var viaWay = vgraph2.entity(v[i4].id);
32144                 if (viaWay.first() === nextNode.id || viaWay.last() === nextNode.id) {
32145                   isOnlyVia = true;
32146                   break;
32147                 }
32148               }
32149             }
32150             return isOnlyVia;
32151           });
32152           step(nextNode, currPath, currRestrictions.concat(fromRestrictions), false);
32153         });
32154       }
32155       function pathToTurn(path) {
32156         if (path.length < 3)
32157           return;
32158         var fromWayId2, fromNodeId, fromVertexId;
32159         var toWayId, toNodeId, toVertexId;
32160         var viaWayIds, viaNodeId, isUturn;
32161         fromWayId2 = path[0];
32162         toWayId = path[path.length - 1];
32163         if (path.length === 3 && fromWayId2 === toWayId) {
32164           var way2 = vgraph2.entity(fromWayId2);
32165           if (way2.__oneWay)
32166             return null;
32167           isUturn = true;
32168           viaNodeId = fromVertexId = toVertexId = path[1];
32169           fromNodeId = toNodeId = adjacentNode(fromWayId2, viaNodeId);
32170         } else {
32171           isUturn = false;
32172           fromVertexId = path[1];
32173           fromNodeId = adjacentNode(fromWayId2, fromVertexId);
32174           toVertexId = path[path.length - 2];
32175           toNodeId = adjacentNode(toWayId, toVertexId);
32176           if (path.length === 3) {
32177             viaNodeId = path[1];
32178           } else {
32179             viaWayIds = path.filter(function(entityId) {
32180               return entityId[0] === "w";
32181             });
32182             viaWayIds = viaWayIds.slice(1, viaWayIds.length - 1);
32183           }
32184         }
32185         return {
32186           key: path.join("_"),
32187           path,
32188           from: { node: fromNodeId, way: fromWayId2, vertex: fromVertexId },
32189           via: { node: viaNodeId, ways: viaWayIds },
32190           to: { node: toNodeId, way: toWayId, vertex: toVertexId },
32191           u: isUturn
32192         };
32193         function adjacentNode(wayId, affixId) {
32194           var nodes2 = vgraph2.entity(wayId).nodes;
32195           return affixId === nodes2[0] ? nodes2[1] : nodes2[nodes2.length - 2];
32196         }
32197       }
32198     };
32199     return intersection;
32200   }
32201   function osmInferRestriction(graph, turn, projection2) {
32202     var fromWay = graph.entity(turn.from.way);
32203     var fromNode = graph.entity(turn.from.node);
32204     var fromVertex = graph.entity(turn.from.vertex);
32205     var toWay = graph.entity(turn.to.way);
32206     var toNode = graph.entity(turn.to.node);
32207     var toVertex = graph.entity(turn.to.vertex);
32208     var fromOneWay = fromWay.tags.oneway === "yes";
32209     var toOneWay = toWay.tags.oneway === "yes";
32210     var angle2 = (geoAngle(fromVertex, fromNode, projection2) - geoAngle(toVertex, toNode, projection2)) * 180 / Math.PI;
32211     while (angle2 < 0) {
32212       angle2 += 360;
32213     }
32214     if (fromNode === toNode) {
32215       return "no_u_turn";
32216     }
32217     if ((angle2 < 23 || angle2 > 336) && fromOneWay && toOneWay) {
32218       return "no_u_turn";
32219     }
32220     if ((angle2 < 40 || angle2 > 319) && fromOneWay && toOneWay && turn.from.vertex !== turn.to.vertex) {
32221       return "no_u_turn";
32222     }
32223     if (angle2 < 158) {
32224       return "no_right_turn";
32225     }
32226     if (angle2 > 202) {
32227       return "no_left_turn";
32228     }
32229     return "no_straight_on";
32230   }
32231
32232   // modules/actions/merge_polygon.js
32233   function actionMergePolygon(ids, newRelationId) {
32234     function groupEntities(graph) {
32235       var entities = ids.map(function(id2) {
32236         return graph.entity(id2);
32237       });
32238       var geometryGroups = utilArrayGroupBy(entities, function(entity) {
32239         if (entity.type === "way" && entity.isClosed()) {
32240           return "closedWay";
32241         } else if (entity.type === "relation" && entity.isMultipolygon()) {
32242           return "multipolygon";
32243         } else {
32244           return "other";
32245         }
32246       });
32247       return Object.assign(
32248         { closedWay: [], multipolygon: [], other: [] },
32249         geometryGroups
32250       );
32251     }
32252     var action = function(graph) {
32253       var entities = groupEntities(graph);
32254       var polygons = entities.multipolygon.reduce(function(polygons2, m) {
32255         return polygons2.concat(osmJoinWays(m.members, graph));
32256       }, []).concat(entities.closedWay.map(function(d) {
32257         var member = [{ id: d.id }];
32258         member.nodes = graph.childNodes(d);
32259         return member;
32260       }));
32261       var contained = polygons.map(function(w, i2) {
32262         return polygons.map(function(d, n2) {
32263           if (i2 === n2)
32264             return null;
32265           return geoPolygonContainsPolygon(
32266             d.nodes.map(function(n3) {
32267               return n3.loc;
32268             }),
32269             w.nodes.map(function(n3) {
32270               return n3.loc;
32271             })
32272           );
32273         });
32274       });
32275       var members = [];
32276       var outer = true;
32277       while (polygons.length) {
32278         extractUncontained(polygons);
32279         polygons = polygons.filter(isContained);
32280         contained = contained.filter(isContained).map(filterContained);
32281       }
32282       function isContained(d, i2) {
32283         return contained[i2].some(function(val) {
32284           return val;
32285         });
32286       }
32287       function filterContained(d) {
32288         return d.filter(isContained);
32289       }
32290       function extractUncontained(polygons2) {
32291         polygons2.forEach(function(d, i2) {
32292           if (!isContained(d, i2)) {
32293             d.forEach(function(member) {
32294               members.push({
32295                 type: "way",
32296                 id: member.id,
32297                 role: outer ? "outer" : "inner"
32298               });
32299             });
32300           }
32301         });
32302         outer = !outer;
32303       }
32304       var relation;
32305       if (entities.multipolygon.length > 0) {
32306         var oldestID = utilOldestID(entities.multipolygon.map((entity) => entity.id));
32307         relation = entities.multipolygon.find((entity) => entity.id === oldestID);
32308       } else {
32309         relation = osmRelation({ id: newRelationId, tags: { type: "multipolygon" } });
32310       }
32311       entities.multipolygon.forEach(function(m) {
32312         if (m.id !== relation.id) {
32313           relation = relation.mergeTags(m.tags);
32314           graph = graph.remove(m);
32315         }
32316       });
32317       entities.closedWay.forEach(function(way) {
32318         function isThisOuter(m) {
32319           return m.id === way.id && m.role !== "inner";
32320         }
32321         if (members.some(isThisOuter)) {
32322           relation = relation.mergeTags(way.tags);
32323           graph = graph.replace(way.update({ tags: {} }));
32324         }
32325       });
32326       return graph.replace(relation.update({
32327         members,
32328         tags: utilObjectOmit(relation.tags, ["area"])
32329       }));
32330     };
32331     action.disabled = function(graph) {
32332       var entities = groupEntities(graph);
32333       if (entities.other.length > 0 || entities.closedWay.length + entities.multipolygon.length < 2) {
32334         return "not_eligible";
32335       }
32336       if (!entities.multipolygon.every(function(r) {
32337         return r.isComplete(graph);
32338       })) {
32339         return "incomplete_relation";
32340       }
32341       if (!entities.multipolygon.length) {
32342         var sharedMultipolygons = [];
32343         entities.closedWay.forEach(function(way, i2) {
32344           if (i2 === 0) {
32345             sharedMultipolygons = graph.parentMultipolygons(way);
32346           } else {
32347             sharedMultipolygons = utilArrayIntersection(sharedMultipolygons, graph.parentMultipolygons(way));
32348           }
32349         });
32350         sharedMultipolygons = sharedMultipolygons.filter(function(relation) {
32351           return relation.members.length === entities.closedWay.length;
32352         });
32353         if (sharedMultipolygons.length) {
32354           return "not_eligible";
32355         }
32356       } else if (entities.closedWay.some(function(way) {
32357         return utilArrayIntersection(graph.parentMultipolygons(way), entities.multipolygon).length;
32358       })) {
32359         return "not_eligible";
32360       }
32361     };
32362     return action;
32363   }
32364
32365   // modules/actions/merge_remote_changes.js
32366   var import_fast_deep_equal = __toESM(require_fast_deep_equal());
32367
32368   // node_modules/node-diff3/index.mjs
32369   function LCS(buffer1, buffer2) {
32370     let equivalenceClasses = {};
32371     for (let j2 = 0; j2 < buffer2.length; j2++) {
32372       const item = buffer2[j2];
32373       if (equivalenceClasses[item]) {
32374         equivalenceClasses[item].push(j2);
32375       } else {
32376         equivalenceClasses[item] = [j2];
32377       }
32378     }
32379     const NULLRESULT = { buffer1index: -1, buffer2index: -1, chain: null };
32380     let candidates = [NULLRESULT];
32381     for (let i2 = 0; i2 < buffer1.length; i2++) {
32382       const item = buffer1[i2];
32383       const buffer2indices = equivalenceClasses[item] || [];
32384       let r = 0;
32385       let c = candidates[0];
32386       for (let jx = 0; jx < buffer2indices.length; jx++) {
32387         const j2 = buffer2indices[jx];
32388         let s;
32389         for (s = r; s < candidates.length; s++) {
32390           if (candidates[s].buffer2index < j2 && (s === candidates.length - 1 || candidates[s + 1].buffer2index > j2)) {
32391             break;
32392           }
32393         }
32394         if (s < candidates.length) {
32395           const newCandidate = { buffer1index: i2, buffer2index: j2, chain: candidates[s] };
32396           if (r === candidates.length) {
32397             candidates.push(c);
32398           } else {
32399             candidates[r] = c;
32400           }
32401           r = s + 1;
32402           c = newCandidate;
32403           if (r === candidates.length) {
32404             break;
32405           }
32406         }
32407       }
32408       candidates[r] = c;
32409     }
32410     return candidates[candidates.length - 1];
32411   }
32412   function diffIndices(buffer1, buffer2) {
32413     const lcs = LCS(buffer1, buffer2);
32414     let result = [];
32415     let tail1 = buffer1.length;
32416     let tail2 = buffer2.length;
32417     for (let candidate = lcs; candidate !== null; candidate = candidate.chain) {
32418       const mismatchLength1 = tail1 - candidate.buffer1index - 1;
32419       const mismatchLength2 = tail2 - candidate.buffer2index - 1;
32420       tail1 = candidate.buffer1index;
32421       tail2 = candidate.buffer2index;
32422       if (mismatchLength1 || mismatchLength2) {
32423         result.push({
32424           buffer1: [tail1 + 1, mismatchLength1],
32425           buffer1Content: buffer1.slice(tail1 + 1, tail1 + 1 + mismatchLength1),
32426           buffer2: [tail2 + 1, mismatchLength2],
32427           buffer2Content: buffer2.slice(tail2 + 1, tail2 + 1 + mismatchLength2)
32428         });
32429       }
32430     }
32431     result.reverse();
32432     return result;
32433   }
32434   function diff3MergeRegions(a, o, b) {
32435     let hunks = [];
32436     function addHunk(h, ab) {
32437       hunks.push({
32438         ab,
32439         oStart: h.buffer1[0],
32440         oLength: h.buffer1[1],
32441         // length of o to remove
32442         abStart: h.buffer2[0],
32443         abLength: h.buffer2[1]
32444         // length of a/b to insert
32445         // abContent: (ab === 'a' ? a : b).slice(h.buffer2[0], h.buffer2[0] + h.buffer2[1])
32446       });
32447     }
32448     diffIndices(o, a).forEach((item) => addHunk(item, "a"));
32449     diffIndices(o, b).forEach((item) => addHunk(item, "b"));
32450     hunks.sort((x, y) => x.oStart - y.oStart);
32451     let results = [];
32452     let currOffset = 0;
32453     function advanceTo(endOffset) {
32454       if (endOffset > currOffset) {
32455         results.push({
32456           stable: true,
32457           buffer: "o",
32458           bufferStart: currOffset,
32459           bufferLength: endOffset - currOffset,
32460           bufferContent: o.slice(currOffset, endOffset)
32461         });
32462         currOffset = endOffset;
32463       }
32464     }
32465     while (hunks.length) {
32466       let hunk = hunks.shift();
32467       let regionStart = hunk.oStart;
32468       let regionEnd = hunk.oStart + hunk.oLength;
32469       let regionHunks = [hunk];
32470       advanceTo(regionStart);
32471       while (hunks.length) {
32472         const nextHunk = hunks[0];
32473         const nextHunkStart = nextHunk.oStart;
32474         if (nextHunkStart > regionEnd)
32475           break;
32476         regionEnd = Math.max(regionEnd, nextHunkStart + nextHunk.oLength);
32477         regionHunks.push(hunks.shift());
32478       }
32479       if (regionHunks.length === 1) {
32480         if (hunk.abLength > 0) {
32481           const buffer = hunk.ab === "a" ? a : b;
32482           results.push({
32483             stable: true,
32484             buffer: hunk.ab,
32485             bufferStart: hunk.abStart,
32486             bufferLength: hunk.abLength,
32487             bufferContent: buffer.slice(hunk.abStart, hunk.abStart + hunk.abLength)
32488           });
32489         }
32490       } else {
32491         let bounds = {
32492           a: [a.length, -1, o.length, -1],
32493           b: [b.length, -1, o.length, -1]
32494         };
32495         while (regionHunks.length) {
32496           hunk = regionHunks.shift();
32497           const oStart = hunk.oStart;
32498           const oEnd = oStart + hunk.oLength;
32499           const abStart = hunk.abStart;
32500           const abEnd = abStart + hunk.abLength;
32501           let b2 = bounds[hunk.ab];
32502           b2[0] = Math.min(abStart, b2[0]);
32503           b2[1] = Math.max(abEnd, b2[1]);
32504           b2[2] = Math.min(oStart, b2[2]);
32505           b2[3] = Math.max(oEnd, b2[3]);
32506         }
32507         const aStart = bounds.a[0] + (regionStart - bounds.a[2]);
32508         const aEnd = bounds.a[1] + (regionEnd - bounds.a[3]);
32509         const bStart = bounds.b[0] + (regionStart - bounds.b[2]);
32510         const bEnd = bounds.b[1] + (regionEnd - bounds.b[3]);
32511         let result = {
32512           stable: false,
32513           aStart,
32514           aLength: aEnd - aStart,
32515           aContent: a.slice(aStart, aEnd),
32516           oStart: regionStart,
32517           oLength: regionEnd - regionStart,
32518           oContent: o.slice(regionStart, regionEnd),
32519           bStart,
32520           bLength: bEnd - bStart,
32521           bContent: b.slice(bStart, bEnd)
32522         };
32523         results.push(result);
32524       }
32525       currOffset = regionEnd;
32526     }
32527     advanceTo(o.length);
32528     return results;
32529   }
32530   function diff3Merge(a, o, b, options2) {
32531     let defaults2 = {
32532       excludeFalseConflicts: true,
32533       stringSeparator: /\s+/
32534     };
32535     options2 = Object.assign(defaults2, options2);
32536     if (typeof a === "string")
32537       a = a.split(options2.stringSeparator);
32538     if (typeof o === "string")
32539       o = o.split(options2.stringSeparator);
32540     if (typeof b === "string")
32541       b = b.split(options2.stringSeparator);
32542     let results = [];
32543     const regions = diff3MergeRegions(a, o, b);
32544     let okBuffer = [];
32545     function flushOk() {
32546       if (okBuffer.length) {
32547         results.push({ ok: okBuffer });
32548       }
32549       okBuffer = [];
32550     }
32551     function isFalseConflict(a2, b2) {
32552       if (a2.length !== b2.length)
32553         return false;
32554       for (let i2 = 0; i2 < a2.length; i2++) {
32555         if (a2[i2] !== b2[i2])
32556           return false;
32557       }
32558       return true;
32559     }
32560     regions.forEach((region) => {
32561       if (region.stable) {
32562         okBuffer.push(...region.bufferContent);
32563       } else {
32564         if (options2.excludeFalseConflicts && isFalseConflict(region.aContent, region.bContent)) {
32565           okBuffer.push(...region.aContent);
32566         } else {
32567           flushOk();
32568           results.push({
32569             conflict: {
32570               a: region.aContent,
32571               aIndex: region.aStart,
32572               o: region.oContent,
32573               oIndex: region.oStart,
32574               b: region.bContent,
32575               bIndex: region.bStart
32576             }
32577           });
32578         }
32579       }
32580     });
32581     flushOk();
32582     return results;
32583   }
32584
32585   // modules/actions/merge_remote_changes.js
32586   var import_lodash2 = __toESM(require_lodash());
32587   function actionMergeRemoteChanges(id2, localGraph, remoteGraph, discardTags, formatUser) {
32588     discardTags = discardTags || {};
32589     var _option = "safe";
32590     var _conflicts = [];
32591     function user(d) {
32592       return typeof formatUser === "function" ? formatUser(d) : (0, import_lodash2.escape)(d);
32593     }
32594     function mergeLocation(remote, target) {
32595       function pointEqual(a, b) {
32596         var epsilon3 = 1e-6;
32597         return Math.abs(a[0] - b[0]) < epsilon3 && Math.abs(a[1] - b[1]) < epsilon3;
32598       }
32599       if (_option === "force_local" || pointEqual(target.loc, remote.loc)) {
32600         return target;
32601       }
32602       if (_option === "force_remote") {
32603         return target.update({ loc: remote.loc });
32604       }
32605       _conflicts.push(_t.html("merge_remote_changes.conflict.location", { user: { html: user(remote.user) } }));
32606       return target;
32607     }
32608     function mergeNodes(base, remote, target) {
32609       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.nodes, remote.nodes)) {
32610         return target;
32611       }
32612       if (_option === "force_remote") {
32613         return target.update({ nodes: remote.nodes });
32614       }
32615       var ccount = _conflicts.length;
32616       var o = base.nodes || [];
32617       var a = target.nodes || [];
32618       var b = remote.nodes || [];
32619       var nodes = [];
32620       var hunks = diff3Merge(a, o, b, { excludeFalseConflicts: true });
32621       for (var i2 = 0; i2 < hunks.length; i2++) {
32622         var hunk = hunks[i2];
32623         if (hunk.ok) {
32624           nodes.push.apply(nodes, hunk.ok);
32625         } else {
32626           var c = hunk.conflict;
32627           if ((0, import_fast_deep_equal.default)(c.o, c.a)) {
32628             nodes.push.apply(nodes, c.b);
32629           } else if ((0, import_fast_deep_equal.default)(c.o, c.b)) {
32630             nodes.push.apply(nodes, c.a);
32631           } else {
32632             _conflicts.push(_t.html("merge_remote_changes.conflict.nodelist", { user: { html: user(remote.user) } }));
32633             break;
32634           }
32635         }
32636       }
32637       return _conflicts.length === ccount ? target.update({ nodes }) : target;
32638     }
32639     function mergeChildren(targetWay, children2, updates, graph) {
32640       function isUsed(node2, targetWay2) {
32641         var hasInterestingParent = graph.parentWays(node2).some(function(way) {
32642           return way.id !== targetWay2.id;
32643         });
32644         return node2.hasInterestingTags() || hasInterestingParent || graph.parentRelations(node2).length > 0;
32645       }
32646       var ccount = _conflicts.length;
32647       for (var i2 = 0; i2 < children2.length; i2++) {
32648         var id3 = children2[i2];
32649         var node = graph.hasEntity(id3);
32650         if (targetWay.nodes.indexOf(id3) === -1) {
32651           if (node && !isUsed(node, targetWay)) {
32652             updates.removeIds.push(id3);
32653           }
32654           continue;
32655         }
32656         var local = localGraph.hasEntity(id3);
32657         var remote = remoteGraph.hasEntity(id3);
32658         var target;
32659         if (_option === "force_remote" && remote && remote.visible) {
32660           updates.replacements.push(remote);
32661         } else if (_option === "force_local" && local) {
32662           target = osmEntity(local);
32663           if (remote) {
32664             target = target.update({ version: remote.version });
32665           }
32666           updates.replacements.push(target);
32667         } else if (_option === "safe" && local && remote && local.version !== remote.version) {
32668           target = osmEntity(local, { version: remote.version });
32669           if (remote.visible) {
32670             target = mergeLocation(remote, target);
32671           } else {
32672             _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
32673           }
32674           if (_conflicts.length !== ccount)
32675             break;
32676           updates.replacements.push(target);
32677         }
32678       }
32679       return targetWay;
32680     }
32681     function updateChildren(updates, graph) {
32682       for (var i2 = 0; i2 < updates.replacements.length; i2++) {
32683         graph = graph.replace(updates.replacements[i2]);
32684       }
32685       if (updates.removeIds.length) {
32686         graph = actionDeleteMultiple(updates.removeIds)(graph);
32687       }
32688       return graph;
32689     }
32690     function mergeMembers(remote, target) {
32691       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.members, remote.members)) {
32692         return target;
32693       }
32694       if (_option === "force_remote") {
32695         return target.update({ members: remote.members });
32696       }
32697       _conflicts.push(_t.html("merge_remote_changes.conflict.memberlist", { user: { html: user(remote.user) } }));
32698       return target;
32699     }
32700     function mergeTags(base, remote, target) {
32701       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.tags, remote.tags)) {
32702         return target;
32703       }
32704       if (_option === "force_remote") {
32705         return target.update({ tags: remote.tags });
32706       }
32707       var ccount = _conflicts.length;
32708       var o = base.tags || {};
32709       var a = target.tags || {};
32710       var b = remote.tags || {};
32711       var keys2 = utilArrayUnion(utilArrayUnion(Object.keys(o), Object.keys(a)), Object.keys(b)).filter(function(k2) {
32712         return !discardTags[k2];
32713       });
32714       var tags = Object.assign({}, a);
32715       var changed = false;
32716       for (var i2 = 0; i2 < keys2.length; i2++) {
32717         var k = keys2[i2];
32718         if (o[k] !== b[k] && a[k] !== b[k]) {
32719           if (o[k] !== a[k]) {
32720             _conflicts.push(_t.html(
32721               "merge_remote_changes.conflict.tags",
32722               { tag: k, local: a[k], remote: b[k], user: { html: user(remote.user) } }
32723             ));
32724           } else {
32725             if (b.hasOwnProperty(k)) {
32726               tags[k] = b[k];
32727             } else {
32728               delete tags[k];
32729             }
32730             changed = true;
32731           }
32732         }
32733       }
32734       return changed && _conflicts.length === ccount ? target.update({ tags }) : target;
32735     }
32736     var action = function(graph) {
32737       var updates = { replacements: [], removeIds: [] };
32738       var base = graph.base().entities[id2];
32739       var local = localGraph.entity(id2);
32740       var remote = remoteGraph.entity(id2);
32741       var target = osmEntity(local, { version: remote.version });
32742       if (!remote.visible) {
32743         if (_option === "force_remote") {
32744           return actionDeleteMultiple([id2])(graph);
32745         } else if (_option === "force_local") {
32746           if (target.type === "way") {
32747             target = mergeChildren(target, utilArrayUniq(local.nodes), updates, graph);
32748             graph = updateChildren(updates, graph);
32749           }
32750           return graph.replace(target);
32751         } else {
32752           _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
32753           return graph;
32754         }
32755       }
32756       if (target.type === "node") {
32757         target = mergeLocation(remote, target);
32758       } else if (target.type === "way") {
32759         graph.rebase(remoteGraph.childNodes(remote), [graph], false);
32760         target = mergeNodes(base, remote, target);
32761         target = mergeChildren(target, utilArrayUnion(local.nodes, remote.nodes), updates, graph);
32762       } else if (target.type === "relation") {
32763         target = mergeMembers(remote, target);
32764       }
32765       target = mergeTags(base, remote, target);
32766       if (!_conflicts.length) {
32767         graph = updateChildren(updates, graph).replace(target);
32768       }
32769       return graph;
32770     };
32771     action.withOption = function(opt) {
32772       _option = opt;
32773       return action;
32774     };
32775     action.conflicts = function() {
32776       return _conflicts;
32777     };
32778     return action;
32779   }
32780
32781   // modules/actions/move.js
32782   function actionMove(moveIDs, tryDelta, projection2, cache) {
32783     var _delta = tryDelta;
32784     function setupCache(graph) {
32785       function canMove(nodeID) {
32786         if (moveIDs.indexOf(nodeID) !== -1)
32787           return true;
32788         var parents = graph.parentWays(graph.entity(nodeID));
32789         if (parents.length < 3)
32790           return true;
32791         var parentsMoving = parents.every(function(way) {
32792           return cache.moving[way.id];
32793         });
32794         if (!parentsMoving)
32795           delete cache.moving[nodeID];
32796         return parentsMoving;
32797       }
32798       function cacheEntities(ids) {
32799         for (var i2 = 0; i2 < ids.length; i2++) {
32800           var id2 = ids[i2];
32801           if (cache.moving[id2])
32802             continue;
32803           cache.moving[id2] = true;
32804           var entity = graph.hasEntity(id2);
32805           if (!entity)
32806             continue;
32807           if (entity.type === "node") {
32808             cache.nodes.push(id2);
32809             cache.startLoc[id2] = entity.loc;
32810           } else if (entity.type === "way") {
32811             cache.ways.push(id2);
32812             cacheEntities(entity.nodes);
32813           } else {
32814             cacheEntities(entity.members.map(function(member) {
32815               return member.id;
32816             }));
32817           }
32818         }
32819       }
32820       function cacheIntersections(ids) {
32821         function isEndpoint(way2, id3) {
32822           return !way2.isClosed() && !!way2.affix(id3);
32823         }
32824         for (var i2 = 0; i2 < ids.length; i2++) {
32825           var id2 = ids[i2];
32826           var childNodes = graph.childNodes(graph.entity(id2));
32827           for (var j2 = 0; j2 < childNodes.length; j2++) {
32828             var node = childNodes[j2];
32829             var parents = graph.parentWays(node);
32830             if (parents.length !== 2)
32831               continue;
32832             var moved = graph.entity(id2);
32833             var unmoved = null;
32834             for (var k = 0; k < parents.length; k++) {
32835               var way = parents[k];
32836               if (!cache.moving[way.id]) {
32837                 unmoved = way;
32838                 break;
32839               }
32840             }
32841             if (!unmoved)
32842               continue;
32843             if (utilArrayIntersection(moved.nodes, unmoved.nodes).length > 2)
32844               continue;
32845             if (moved.isArea() || unmoved.isArea())
32846               continue;
32847             cache.intersections.push({
32848               nodeId: node.id,
32849               movedId: moved.id,
32850               unmovedId: unmoved.id,
32851               movedIsEP: isEndpoint(moved, node.id),
32852               unmovedIsEP: isEndpoint(unmoved, node.id)
32853             });
32854           }
32855         }
32856       }
32857       if (!cache) {
32858         cache = {};
32859       }
32860       if (!cache.ok) {
32861         cache.moving = {};
32862         cache.intersections = [];
32863         cache.replacedVertex = {};
32864         cache.startLoc = {};
32865         cache.nodes = [];
32866         cache.ways = [];
32867         cacheEntities(moveIDs);
32868         cacheIntersections(cache.ways);
32869         cache.nodes = cache.nodes.filter(canMove);
32870         cache.ok = true;
32871       }
32872     }
32873     function replaceMovedVertex(nodeId, wayId, graph, delta) {
32874       var way = graph.entity(wayId);
32875       var moved = graph.entity(nodeId);
32876       var movedIndex = way.nodes.indexOf(nodeId);
32877       var len, prevIndex, nextIndex;
32878       if (way.isClosed()) {
32879         len = way.nodes.length - 1;
32880         prevIndex = (movedIndex + len - 1) % len;
32881         nextIndex = (movedIndex + len + 1) % len;
32882       } else {
32883         len = way.nodes.length;
32884         prevIndex = movedIndex - 1;
32885         nextIndex = movedIndex + 1;
32886       }
32887       var prev = graph.hasEntity(way.nodes[prevIndex]);
32888       var next = graph.hasEntity(way.nodes[nextIndex]);
32889       if (!prev || !next)
32890         return graph;
32891       var key = wayId + "_" + nodeId;
32892       var orig = cache.replacedVertex[key];
32893       if (!orig) {
32894         orig = osmNode();
32895         cache.replacedVertex[key] = orig;
32896         cache.startLoc[orig.id] = cache.startLoc[nodeId];
32897       }
32898       var start2, end;
32899       if (delta) {
32900         start2 = projection2(cache.startLoc[nodeId]);
32901         end = projection2.invert(geoVecAdd(start2, delta));
32902       } else {
32903         end = cache.startLoc[nodeId];
32904       }
32905       orig = orig.move(end);
32906       var angle2 = Math.abs(geoAngle(orig, prev, projection2) - geoAngle(orig, next, projection2)) * 180 / Math.PI;
32907       if (angle2 > 175 && angle2 < 185)
32908         return graph;
32909       var p1 = [prev.loc, orig.loc, moved.loc, next.loc].map(projection2);
32910       var p2 = [prev.loc, moved.loc, orig.loc, next.loc].map(projection2);
32911       var d1 = geoPathLength(p1);
32912       var d2 = geoPathLength(p2);
32913       var insertAt = d1 <= d2 ? movedIndex : nextIndex;
32914       if (way.isClosed() && insertAt === 0)
32915         insertAt = len;
32916       way = way.addNode(orig.id, insertAt);
32917       return graph.replace(orig).replace(way);
32918     }
32919     function removeDuplicateVertices(wayId, graph) {
32920       var way = graph.entity(wayId);
32921       var epsilon3 = 1e-6;
32922       var prev, curr;
32923       function isInteresting(node, graph2) {
32924         return graph2.parentWays(node).length > 1 || graph2.parentRelations(node).length || node.hasInterestingTags();
32925       }
32926       for (var i2 = 0; i2 < way.nodes.length; i2++) {
32927         curr = graph.entity(way.nodes[i2]);
32928         if (prev && curr && geoVecEqual(prev.loc, curr.loc, epsilon3)) {
32929           if (!isInteresting(prev, graph)) {
32930             way = way.removeNode(prev.id);
32931             graph = graph.replace(way).remove(prev);
32932           } else if (!isInteresting(curr, graph)) {
32933             way = way.removeNode(curr.id);
32934             graph = graph.replace(way).remove(curr);
32935           }
32936         }
32937         prev = curr;
32938       }
32939       return graph;
32940     }
32941     function unZorroIntersection(intersection, graph) {
32942       var vertex = graph.entity(intersection.nodeId);
32943       var way1 = graph.entity(intersection.movedId);
32944       var way2 = graph.entity(intersection.unmovedId);
32945       var isEP1 = intersection.movedIsEP;
32946       var isEP2 = intersection.unmovedIsEP;
32947       if (isEP1 && isEP2)
32948         return graph;
32949       var nodes1 = graph.childNodes(way1).filter(function(n2) {
32950         return n2 !== vertex;
32951       });
32952       var nodes2 = graph.childNodes(way2).filter(function(n2) {
32953         return n2 !== vertex;
32954       });
32955       if (way1.isClosed() && way1.first() === vertex.id)
32956         nodes1.push(nodes1[0]);
32957       if (way2.isClosed() && way2.first() === vertex.id)
32958         nodes2.push(nodes2[0]);
32959       var edge1 = !isEP1 && geoChooseEdge(nodes1, projection2(vertex.loc), projection2);
32960       var edge2 = !isEP2 && geoChooseEdge(nodes2, projection2(vertex.loc), projection2);
32961       var loc;
32962       if (!isEP1 && !isEP2) {
32963         var epsilon3 = 1e-6, maxIter = 10;
32964         for (var i2 = 0; i2 < maxIter; i2++) {
32965           loc = geoVecInterp(edge1.loc, edge2.loc, 0.5);
32966           edge1 = geoChooseEdge(nodes1, projection2(loc), projection2);
32967           edge2 = geoChooseEdge(nodes2, projection2(loc), projection2);
32968           if (Math.abs(edge1.distance - edge2.distance) < epsilon3)
32969             break;
32970         }
32971       } else if (!isEP1) {
32972         loc = edge1.loc;
32973       } else {
32974         loc = edge2.loc;
32975       }
32976       graph = graph.replace(vertex.move(loc));
32977       if (!isEP1 && edge1.index !== way1.nodes.indexOf(vertex.id)) {
32978         way1 = way1.removeNode(vertex.id).addNode(vertex.id, edge1.index);
32979         graph = graph.replace(way1);
32980       }
32981       if (!isEP2 && edge2.index !== way2.nodes.indexOf(vertex.id)) {
32982         way2 = way2.removeNode(vertex.id).addNode(vertex.id, edge2.index);
32983         graph = graph.replace(way2);
32984       }
32985       return graph;
32986     }
32987     function cleanupIntersections(graph) {
32988       for (var i2 = 0; i2 < cache.intersections.length; i2++) {
32989         var obj = cache.intersections[i2];
32990         graph = replaceMovedVertex(obj.nodeId, obj.movedId, graph, _delta);
32991         graph = replaceMovedVertex(obj.nodeId, obj.unmovedId, graph, null);
32992         graph = unZorroIntersection(obj, graph);
32993         graph = removeDuplicateVertices(obj.movedId, graph);
32994         graph = removeDuplicateVertices(obj.unmovedId, graph);
32995       }
32996       return graph;
32997     }
32998     function limitDelta(graph) {
32999       function moveNode(loc) {
33000         return geoVecAdd(projection2(loc), _delta);
33001       }
33002       for (var i2 = 0; i2 < cache.intersections.length; i2++) {
33003         var obj = cache.intersections[i2];
33004         if (obj.movedIsEP && obj.unmovedIsEP)
33005           continue;
33006         if (!obj.movedIsEP)
33007           continue;
33008         var node = graph.entity(obj.nodeId);
33009         var start2 = projection2(node.loc);
33010         var end = geoVecAdd(start2, _delta);
33011         var movedNodes = graph.childNodes(graph.entity(obj.movedId));
33012         var movedPath = movedNodes.map(function(n2) {
33013           return moveNode(n2.loc);
33014         });
33015         var unmovedNodes = graph.childNodes(graph.entity(obj.unmovedId));
33016         var unmovedPath = unmovedNodes.map(function(n2) {
33017           return projection2(n2.loc);
33018         });
33019         var hits = geoPathIntersections(movedPath, unmovedPath);
33020         for (var j2 = 0; i2 < hits.length; i2++) {
33021           if (geoVecEqual(hits[j2], end))
33022             continue;
33023           var edge = geoChooseEdge(unmovedNodes, end, projection2);
33024           _delta = geoVecSubtract(projection2(edge.loc), start2);
33025         }
33026       }
33027     }
33028     var action = function(graph) {
33029       if (_delta[0] === 0 && _delta[1] === 0)
33030         return graph;
33031       setupCache(graph);
33032       if (cache.intersections.length) {
33033         limitDelta(graph);
33034       }
33035       for (var i2 = 0; i2 < cache.nodes.length; i2++) {
33036         var node = graph.entity(cache.nodes[i2]);
33037         var start2 = projection2(node.loc);
33038         var end = geoVecAdd(start2, _delta);
33039         graph = graph.replace(node.move(projection2.invert(end)));
33040       }
33041       if (cache.intersections.length) {
33042         graph = cleanupIntersections(graph);
33043       }
33044       return graph;
33045     };
33046     action.delta = function() {
33047       return _delta;
33048     };
33049     return action;
33050   }
33051
33052   // modules/actions/move_member.js
33053   function actionMoveMember(relationId, fromIndex, toIndex) {
33054     return function(graph) {
33055       return graph.replace(graph.entity(relationId).moveMember(fromIndex, toIndex));
33056     };
33057   }
33058
33059   // modules/actions/move_node.js
33060   function actionMoveNode(nodeID, toLoc) {
33061     var action = function(graph, t) {
33062       if (t === null || !isFinite(t))
33063         t = 1;
33064       t = Math.min(Math.max(+t, 0), 1);
33065       var node = graph.entity(nodeID);
33066       return graph.replace(
33067         node.move(geoVecInterp(node.loc, toLoc, t))
33068       );
33069     };
33070     action.transitionable = true;
33071     return action;
33072   }
33073
33074   // modules/actions/noop.js
33075   function actionNoop() {
33076     return function(graph) {
33077       return graph;
33078     };
33079   }
33080
33081   // modules/actions/orthogonalize.js
33082   function actionOrthogonalize(wayID, projection2, vertexID, degThresh, ep) {
33083     var epsilon3 = ep || 1e-4;
33084     var threshold = degThresh || 13;
33085     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
33086     var upperThreshold = Math.cos(threshold * Math.PI / 180);
33087     var action = function(graph, t) {
33088       if (t === null || !isFinite(t))
33089         t = 1;
33090       t = Math.min(Math.max(+t, 0), 1);
33091       var way = graph.entity(wayID);
33092       way = way.removeNode("");
33093       if (way.tags.nonsquare) {
33094         var tags = Object.assign({}, way.tags);
33095         delete tags.nonsquare;
33096         way = way.update({ tags });
33097       }
33098       graph = graph.replace(way);
33099       var isClosed = way.isClosed();
33100       var nodes = graph.childNodes(way).slice();
33101       if (isClosed)
33102         nodes.pop();
33103       if (vertexID !== void 0) {
33104         nodes = nodeSubset(nodes, vertexID, isClosed);
33105         if (nodes.length !== 3)
33106           return graph;
33107       }
33108       var nodeCount = {};
33109       var points = [];
33110       var corner = { i: 0, dotp: 1 };
33111       var node, point2, loc, score, motions, i2, j2;
33112       for (i2 = 0; i2 < nodes.length; i2++) {
33113         node = nodes[i2];
33114         nodeCount[node.id] = (nodeCount[node.id] || 0) + 1;
33115         points.push({ id: node.id, coord: projection2(node.loc) });
33116       }
33117       if (points.length === 3) {
33118         for (i2 = 0; i2 < 1e3; i2++) {
33119           motions = points.map(calcMotion);
33120           points[corner.i].coord = geoVecAdd(points[corner.i].coord, motions[corner.i]);
33121           score = corner.dotp;
33122           if (score < epsilon3) {
33123             break;
33124           }
33125         }
33126         node = graph.entity(nodes[corner.i].id);
33127         loc = projection2.invert(points[corner.i].coord);
33128         graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t)));
33129       } else {
33130         var straights = [];
33131         var simplified = [];
33132         for (i2 = 0; i2 < points.length; i2++) {
33133           point2 = points[i2];
33134           var dotp = 0;
33135           if (isClosed || i2 > 0 && i2 < points.length - 1) {
33136             var a = points[(i2 - 1 + points.length) % points.length];
33137             var b = points[(i2 + 1) % points.length];
33138             dotp = Math.abs(geoOrthoNormalizedDotProduct(a.coord, b.coord, point2.coord));
33139           }
33140           if (dotp > upperThreshold) {
33141             straights.push(point2);
33142           } else {
33143             simplified.push(point2);
33144           }
33145         }
33146         var bestPoints = clonePoints(simplified);
33147         var originalPoints = clonePoints(simplified);
33148         score = Infinity;
33149         for (i2 = 0; i2 < 1e3; i2++) {
33150           motions = simplified.map(calcMotion);
33151           for (j2 = 0; j2 < motions.length; j2++) {
33152             simplified[j2].coord = geoVecAdd(simplified[j2].coord, motions[j2]);
33153           }
33154           var newScore = geoOrthoCalcScore(simplified, isClosed, epsilon3, threshold);
33155           if (newScore < score) {
33156             bestPoints = clonePoints(simplified);
33157             score = newScore;
33158           }
33159           if (score < epsilon3) {
33160             break;
33161           }
33162         }
33163         var bestCoords = bestPoints.map(function(p) {
33164           return p.coord;
33165         });
33166         if (isClosed)
33167           bestCoords.push(bestCoords[0]);
33168         for (i2 = 0; i2 < bestPoints.length; i2++) {
33169           point2 = bestPoints[i2];
33170           if (!geoVecEqual(originalPoints[i2].coord, point2.coord)) {
33171             node = graph.entity(point2.id);
33172             loc = projection2.invert(point2.coord);
33173             graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t)));
33174           }
33175         }
33176         for (i2 = 0; i2 < straights.length; i2++) {
33177           point2 = straights[i2];
33178           if (nodeCount[point2.id] > 1)
33179             continue;
33180           node = graph.entity(point2.id);
33181           if (t === 1 && graph.parentWays(node).length === 1 && graph.parentRelations(node).length === 0 && !node.hasInterestingTags()) {
33182             graph = actionDeleteNode(node.id)(graph);
33183           } else {
33184             var choice = geoVecProject(point2.coord, bestCoords);
33185             if (choice) {
33186               loc = projection2.invert(choice.target);
33187               graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t)));
33188             }
33189           }
33190         }
33191       }
33192       return graph;
33193       function clonePoints(array2) {
33194         return array2.map(function(p) {
33195           return { id: p.id, coord: [p.coord[0], p.coord[1]] };
33196         });
33197       }
33198       function calcMotion(point3, i3, array2) {
33199         if (!isClosed && (i3 === 0 || i3 === array2.length - 1))
33200           return [0, 0];
33201         if (nodeCount[array2[i3].id] > 1)
33202           return [0, 0];
33203         var a2 = array2[(i3 - 1 + array2.length) % array2.length].coord;
33204         var origin = point3.coord;
33205         var b2 = array2[(i3 + 1) % array2.length].coord;
33206         var p = geoVecSubtract(a2, origin);
33207         var q = geoVecSubtract(b2, origin);
33208         var scale = 2 * Math.min(geoVecLength(p), geoVecLength(q));
33209         p = geoVecNormalize(p);
33210         q = geoVecNormalize(q);
33211         var dotp2 = p[0] * q[0] + p[1] * q[1];
33212         var val = Math.abs(dotp2);
33213         if (val < lowerThreshold) {
33214           corner.i = i3;
33215           corner.dotp = val;
33216           var vec = geoVecNormalize(geoVecAdd(p, q));
33217           return geoVecScale(vec, 0.1 * dotp2 * scale);
33218         }
33219         return [0, 0];
33220       }
33221     };
33222     function nodeSubset(nodes, vertexID2, isClosed) {
33223       var first = isClosed ? 0 : 1;
33224       var last = isClosed ? nodes.length : nodes.length - 1;
33225       for (var i2 = first; i2 < last; i2++) {
33226         if (nodes[i2].id === vertexID2) {
33227           return [
33228             nodes[(i2 - 1 + nodes.length) % nodes.length],
33229             nodes[i2],
33230             nodes[(i2 + 1) % nodes.length]
33231           ];
33232         }
33233       }
33234       return [];
33235     }
33236     action.disabled = function(graph) {
33237       var way = graph.entity(wayID);
33238       way = way.removeNode("");
33239       graph = graph.replace(way);
33240       var isClosed = way.isClosed();
33241       var nodes = graph.childNodes(way).slice();
33242       if (isClosed)
33243         nodes.pop();
33244       var allowStraightAngles = false;
33245       if (vertexID !== void 0) {
33246         allowStraightAngles = true;
33247         nodes = nodeSubset(nodes, vertexID, isClosed);
33248         if (nodes.length !== 3)
33249           return "end_vertex";
33250       }
33251       var coords = nodes.map(function(n2) {
33252         return projection2(n2.loc);
33253       });
33254       var score = geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles);
33255       if (score === null) {
33256         return "not_squarish";
33257       } else if (score === 0) {
33258         return "square_enough";
33259       } else {
33260         return false;
33261       }
33262     };
33263     action.transitionable = true;
33264     return action;
33265   }
33266
33267   // modules/actions/restrict_turn.js
33268   function actionRestrictTurn(turn, restrictionType, restrictionID) {
33269     return function(graph) {
33270       var fromWay = graph.entity(turn.from.way);
33271       var toWay = graph.entity(turn.to.way);
33272       var viaNode = turn.via.node && graph.entity(turn.via.node);
33273       var viaWays = turn.via.ways && turn.via.ways.map(function(id2) {
33274         return graph.entity(id2);
33275       });
33276       var members = [];
33277       members.push({ id: fromWay.id, type: "way", role: "from" });
33278       if (viaNode) {
33279         members.push({ id: viaNode.id, type: "node", role: "via" });
33280       } else if (viaWays) {
33281         viaWays.forEach(function(viaWay) {
33282           members.push({ id: viaWay.id, type: "way", role: "via" });
33283         });
33284       }
33285       members.push({ id: toWay.id, type: "way", role: "to" });
33286       return graph.replace(osmRelation({
33287         id: restrictionID,
33288         tags: {
33289           type: "restriction",
33290           restriction: restrictionType
33291         },
33292         members
33293       }));
33294     };
33295   }
33296
33297   // modules/actions/revert.js
33298   function actionRevert(id2) {
33299     var action = function(graph) {
33300       var entity = graph.hasEntity(id2), base = graph.base().entities[id2];
33301       if (entity && !base) {
33302         if (entity.type === "node") {
33303           graph.parentWays(entity).forEach(function(parent) {
33304             parent = parent.removeNode(id2);
33305             graph = graph.replace(parent);
33306             if (parent.isDegenerate()) {
33307               graph = actionDeleteWay(parent.id)(graph);
33308             }
33309           });
33310         }
33311         graph.parentRelations(entity).forEach(function(parent) {
33312           parent = parent.removeMembersWithID(id2);
33313           graph = graph.replace(parent);
33314           if (parent.isDegenerate()) {
33315             graph = actionDeleteRelation(parent.id)(graph);
33316           }
33317         });
33318       }
33319       return graph.revert(id2);
33320     };
33321     return action;
33322   }
33323
33324   // modules/actions/rotate.js
33325   function actionRotate(rotateIds, pivot, angle2, projection2) {
33326     var action = function(graph) {
33327       return graph.update(function(graph2) {
33328         utilGetAllNodes(rotateIds, graph2).forEach(function(node) {
33329           var point2 = geoRotate([projection2(node.loc)], angle2, pivot)[0];
33330           graph2 = graph2.replace(node.move(projection2.invert(point2)));
33331         });
33332       });
33333     };
33334     return action;
33335   }
33336
33337   // modules/actions/scale.js
33338   function actionScale(ids, pivotLoc, scaleFactor, projection2) {
33339     return function(graph) {
33340       return graph.update(function(graph2) {
33341         let point2, radial;
33342         utilGetAllNodes(ids, graph2).forEach(function(node) {
33343           point2 = projection2(node.loc);
33344           radial = [
33345             point2[0] - pivotLoc[0],
33346             point2[1] - pivotLoc[1]
33347           ];
33348           point2 = [
33349             pivotLoc[0] + scaleFactor * radial[0],
33350             pivotLoc[1] + scaleFactor * radial[1]
33351           ];
33352           graph2 = graph2.replace(node.move(projection2.invert(point2)));
33353         });
33354       });
33355     };
33356   }
33357
33358   // modules/actions/straighten_nodes.js
33359   function actionStraightenNodes(nodeIDs, projection2) {
33360     function positionAlongWay(a, o, b) {
33361       return geoVecDot(a, b, o) / geoVecDot(b, b, o);
33362     }
33363     function getEndpoints(points) {
33364       var ssr = geoGetSmallestSurroundingRectangle(points);
33365       var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
33366       var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
33367       var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
33368       var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
33369       var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
33370       if (isLong) {
33371         return [p1, q1];
33372       }
33373       return [p2, q2];
33374     }
33375     var action = function(graph, t) {
33376       if (t === null || !isFinite(t))
33377         t = 1;
33378       t = Math.min(Math.max(+t, 0), 1);
33379       var nodes = nodeIDs.map(function(id2) {
33380         return graph.entity(id2);
33381       });
33382       var points = nodes.map(function(n2) {
33383         return projection2(n2.loc);
33384       });
33385       var endpoints = getEndpoints(points);
33386       var startPoint = endpoints[0];
33387       var endPoint = endpoints[1];
33388       for (var i2 = 0; i2 < points.length; i2++) {
33389         var node = nodes[i2];
33390         var point2 = points[i2];
33391         var u = positionAlongWay(point2, startPoint, endPoint);
33392         var point22 = geoVecInterp(startPoint, endPoint, u);
33393         var loc2 = projection2.invert(point22);
33394         graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t)));
33395       }
33396       return graph;
33397     };
33398     action.disabled = function(graph) {
33399       var nodes = nodeIDs.map(function(id2) {
33400         return graph.entity(id2);
33401       });
33402       var points = nodes.map(function(n2) {
33403         return projection2(n2.loc);
33404       });
33405       var endpoints = getEndpoints(points);
33406       var startPoint = endpoints[0];
33407       var endPoint = endpoints[1];
33408       var maxDistance = 0;
33409       for (var i2 = 0; i2 < points.length; i2++) {
33410         var point2 = points[i2];
33411         var u = positionAlongWay(point2, startPoint, endPoint);
33412         var p = geoVecInterp(startPoint, endPoint, u);
33413         var dist = geoVecLength(p, point2);
33414         if (!isNaN(dist) && dist > maxDistance) {
33415           maxDistance = dist;
33416         }
33417       }
33418       if (maxDistance < 1e-4) {
33419         return "straight_enough";
33420       }
33421     };
33422     action.transitionable = true;
33423     return action;
33424   }
33425
33426   // modules/actions/straighten_way.js
33427   function actionStraightenWay(selectedIDs, projection2) {
33428     function positionAlongWay(a, o, b) {
33429       return geoVecDot(a, b, o) / geoVecDot(b, b, o);
33430     }
33431     function allNodes(graph) {
33432       var nodes = [];
33433       var startNodes = [];
33434       var endNodes = [];
33435       var remainingWays = [];
33436       var selectedWays = selectedIDs.filter(function(w) {
33437         return graph.entity(w).type === "way";
33438       });
33439       var selectedNodes = selectedIDs.filter(function(n2) {
33440         return graph.entity(n2).type === "node";
33441       });
33442       for (var i2 = 0; i2 < selectedWays.length; i2++) {
33443         var way = graph.entity(selectedWays[i2]);
33444         nodes = way.nodes.slice(0);
33445         remainingWays.push(nodes);
33446         startNodes.push(nodes[0]);
33447         endNodes.push(nodes[nodes.length - 1]);
33448       }
33449       startNodes = startNodes.filter(function(n2) {
33450         return startNodes.indexOf(n2) === startNodes.lastIndexOf(n2);
33451       });
33452       endNodes = endNodes.filter(function(n2) {
33453         return endNodes.indexOf(n2) === endNodes.lastIndexOf(n2);
33454       });
33455       var currNode = utilArrayDifference(startNodes, endNodes).concat(utilArrayDifference(endNodes, startNodes))[0];
33456       var nextWay = [];
33457       nodes = [];
33458       var getNextWay = function(currNode2, remainingWays2) {
33459         return remainingWays2.filter(function(way2) {
33460           return way2[0] === currNode2 || way2[way2.length - 1] === currNode2;
33461         })[0];
33462       };
33463       while (remainingWays.length) {
33464         nextWay = getNextWay(currNode, remainingWays);
33465         remainingWays = utilArrayDifference(remainingWays, [nextWay]);
33466         if (nextWay[0] !== currNode) {
33467           nextWay.reverse();
33468         }
33469         nodes = nodes.concat(nextWay);
33470         currNode = nodes[nodes.length - 1];
33471       }
33472       if (selectedNodes.length === 2) {
33473         var startNodeIdx = nodes.indexOf(selectedNodes[0]);
33474         var endNodeIdx = nodes.indexOf(selectedNodes[1]);
33475         var sortedStartEnd = [startNodeIdx, endNodeIdx];
33476         sortedStartEnd.sort(function(a, b) {
33477           return a - b;
33478         });
33479         nodes = nodes.slice(sortedStartEnd[0], sortedStartEnd[1] + 1);
33480       }
33481       return nodes.map(function(n2) {
33482         return graph.entity(n2);
33483       });
33484     }
33485     function shouldKeepNode(node, graph) {
33486       return graph.parentWays(node).length > 1 || graph.parentRelations(node).length || node.hasInterestingTags();
33487     }
33488     var action = function(graph, t) {
33489       if (t === null || !isFinite(t))
33490         t = 1;
33491       t = Math.min(Math.max(+t, 0), 1);
33492       var nodes = allNodes(graph);
33493       var points = nodes.map(function(n2) {
33494         return projection2(n2.loc);
33495       });
33496       var startPoint = points[0];
33497       var endPoint = points[points.length - 1];
33498       var toDelete = [];
33499       var i2;
33500       for (i2 = 1; i2 < points.length - 1; i2++) {
33501         var node = nodes[i2];
33502         var point2 = points[i2];
33503         if (t < 1 || shouldKeepNode(node, graph)) {
33504           var u = positionAlongWay(point2, startPoint, endPoint);
33505           var p = geoVecInterp(startPoint, endPoint, u);
33506           var loc2 = projection2.invert(p);
33507           graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t)));
33508         } else {
33509           if (toDelete.indexOf(node) === -1) {
33510             toDelete.push(node);
33511           }
33512         }
33513       }
33514       for (i2 = 0; i2 < toDelete.length; i2++) {
33515         graph = actionDeleteNode(toDelete[i2].id)(graph);
33516       }
33517       return graph;
33518     };
33519     action.disabled = function(graph) {
33520       var nodes = allNodes(graph);
33521       var points = nodes.map(function(n2) {
33522         return projection2(n2.loc);
33523       });
33524       var startPoint = points[0];
33525       var endPoint = points[points.length - 1];
33526       var threshold = 0.2 * geoVecLength(startPoint, endPoint);
33527       var i2;
33528       if (threshold === 0) {
33529         return "too_bendy";
33530       }
33531       var maxDistance = 0;
33532       for (i2 = 1; i2 < points.length - 1; i2++) {
33533         var point2 = points[i2];
33534         var u = positionAlongWay(point2, startPoint, endPoint);
33535         var p = geoVecInterp(startPoint, endPoint, u);
33536         var dist = geoVecLength(p, point2);
33537         if (isNaN(dist) || dist > threshold) {
33538           return "too_bendy";
33539         } else if (dist > maxDistance) {
33540           maxDistance = dist;
33541         }
33542       }
33543       var keepingAllNodes = nodes.every(function(node, i3) {
33544         return i3 === 0 || i3 === nodes.length - 1 || shouldKeepNode(node, graph);
33545       });
33546       if (maxDistance < 1e-4 && // Allow straightening even if already straight in order to remove extraneous nodes
33547       keepingAllNodes) {
33548         return "straight_enough";
33549       }
33550     };
33551     action.transitionable = true;
33552     return action;
33553   }
33554
33555   // modules/actions/unrestrict_turn.js
33556   function actionUnrestrictTurn(turn) {
33557     return function(graph) {
33558       return actionDeleteRelation(turn.restrictionID)(graph);
33559     };
33560   }
33561
33562   // modules/actions/reflect.js
33563   function actionReflect(reflectIds, projection2) {
33564     var _useLongAxis = true;
33565     var action = function(graph, t) {
33566       if (t === null || !isFinite(t))
33567         t = 1;
33568       t = Math.min(Math.max(+t, 0), 1);
33569       var nodes = utilGetAllNodes(reflectIds, graph);
33570       var points = nodes.map(function(n2) {
33571         return projection2(n2.loc);
33572       });
33573       var ssr = geoGetSmallestSurroundingRectangle(points);
33574       var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
33575       var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
33576       var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
33577       var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
33578       var p, q;
33579       var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
33580       if (_useLongAxis && isLong || !_useLongAxis && !isLong) {
33581         p = p1;
33582         q = q1;
33583       } else {
33584         p = p2;
33585         q = q2;
33586       }
33587       var dx = q[0] - p[0];
33588       var dy = q[1] - p[1];
33589       var a = (dx * dx - dy * dy) / (dx * dx + dy * dy);
33590       var b = 2 * dx * dy / (dx * dx + dy * dy);
33591       for (var i2 = 0; i2 < nodes.length; i2++) {
33592         var node = nodes[i2];
33593         var c = projection2(node.loc);
33594         var c2 = [
33595           a * (c[0] - p[0]) + b * (c[1] - p[1]) + p[0],
33596           b * (c[0] - p[0]) - a * (c[1] - p[1]) + p[1]
33597         ];
33598         var loc2 = projection2.invert(c2);
33599         node = node.move(geoVecInterp(node.loc, loc2, t));
33600         graph = graph.replace(node);
33601       }
33602       return graph;
33603     };
33604     action.useLongAxis = function(val) {
33605       if (!arguments.length)
33606         return _useLongAxis;
33607       _useLongAxis = val;
33608       return action;
33609     };
33610     action.transitionable = true;
33611     return action;
33612   }
33613
33614   // modules/actions/upgrade_tags.js
33615   function actionUpgradeTags(entityId, oldTags, replaceTags) {
33616     return function(graph) {
33617       var entity = graph.entity(entityId);
33618       var tags = Object.assign({}, entity.tags);
33619       var transferValue;
33620       var semiIndex;
33621       for (var oldTagKey in oldTags) {
33622         if (!(oldTagKey in tags))
33623           continue;
33624         if (oldTags[oldTagKey] === "*") {
33625           transferValue = tags[oldTagKey];
33626           delete tags[oldTagKey];
33627         } else if (oldTags[oldTagKey] === tags[oldTagKey]) {
33628           delete tags[oldTagKey];
33629         } else {
33630           var vals = tags[oldTagKey].split(";").filter(Boolean);
33631           var oldIndex = vals.indexOf(oldTags[oldTagKey]);
33632           if (vals.length === 1 || oldIndex === -1) {
33633             delete tags[oldTagKey];
33634           } else {
33635             if (replaceTags && replaceTags[oldTagKey]) {
33636               semiIndex = oldIndex;
33637             }
33638             vals.splice(oldIndex, 1);
33639             tags[oldTagKey] = vals.join(";");
33640           }
33641         }
33642       }
33643       if (replaceTags) {
33644         for (var replaceKey in replaceTags) {
33645           var replaceValue = replaceTags[replaceKey];
33646           if (replaceValue === "*") {
33647             if (tags[replaceKey] && tags[replaceKey] !== "no") {
33648               continue;
33649             } else {
33650               tags[replaceKey] = "yes";
33651             }
33652           } else if (replaceValue === "$1") {
33653             tags[replaceKey] = transferValue;
33654           } else {
33655             if (tags[replaceKey] && oldTags[replaceKey] && semiIndex !== void 0) {
33656               var existingVals = tags[replaceKey].split(";").filter(Boolean);
33657               if (existingVals.indexOf(replaceValue) === -1) {
33658                 existingVals.splice(semiIndex, 0, replaceValue);
33659                 tags[replaceKey] = existingVals.join(";");
33660               }
33661             } else {
33662               tags[replaceKey] = replaceValue;
33663             }
33664           }
33665         }
33666       }
33667       return graph.replace(entity.update({ tags }));
33668     };
33669   }
33670
33671   // modules/behavior/edit.js
33672   function behaviorEdit(context) {
33673     function behavior() {
33674       context.map().minzoom(context.minEditableZoom());
33675     }
33676     behavior.off = function() {
33677       context.map().minzoom(0);
33678     };
33679     return behavior;
33680   }
33681
33682   // modules/behavior/hover.js
33683   function behaviorHover(context) {
33684     var dispatch10 = dispatch_default("hover");
33685     var _selection = select_default2(null);
33686     var _newNodeId = null;
33687     var _initialNodeID = null;
33688     var _altDisables;
33689     var _ignoreVertex;
33690     var _targets = [];
33691     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
33692     function keydown(d3_event) {
33693       if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
33694         _selection.selectAll(".hover").classed("hover-suppressed", true).classed("hover", false);
33695         _selection.classed("hover-disabled", true);
33696         dispatch10.call("hover", this, null);
33697       }
33698     }
33699     function keyup(d3_event) {
33700       if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
33701         _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false).classed("hover", true);
33702         _selection.classed("hover-disabled", false);
33703         dispatch10.call("hover", this, _targets);
33704       }
33705     }
33706     function behavior(selection2) {
33707       _selection = selection2;
33708       _targets = [];
33709       if (_initialNodeID) {
33710         _newNodeId = _initialNodeID;
33711         _initialNodeID = null;
33712       } else {
33713         _newNodeId = null;
33714       }
33715       _selection.on(_pointerPrefix + "over.hover", pointerover).on(_pointerPrefix + "out.hover", pointerout).on(_pointerPrefix + "down.hover", pointerover);
33716       select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", pointerout, true).on("keydown.hover", keydown).on("keyup.hover", keyup);
33717       function eventTarget(d3_event) {
33718         var datum2 = d3_event.target && d3_event.target.__data__;
33719         if (typeof datum2 !== "object")
33720           return null;
33721         if (!(datum2 instanceof osmEntity) && datum2.properties && datum2.properties.entity instanceof osmEntity) {
33722           return datum2.properties.entity;
33723         }
33724         return datum2;
33725       }
33726       function pointerover(d3_event) {
33727         if (context.mode().id.indexOf("drag") === -1 && (!d3_event.pointerType || d3_event.pointerType === "mouse") && d3_event.buttons)
33728           return;
33729         var target = eventTarget(d3_event);
33730         if (target && _targets.indexOf(target) === -1) {
33731           _targets.push(target);
33732           updateHover(d3_event, _targets);
33733         }
33734       }
33735       function pointerout(d3_event) {
33736         var target = eventTarget(d3_event);
33737         var index = _targets.indexOf(target);
33738         if (index !== -1) {
33739           _targets.splice(index);
33740           updateHover(d3_event, _targets);
33741         }
33742       }
33743       function allowsVertex(d) {
33744         return d.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d, context.graph());
33745       }
33746       function modeAllowsHover(target) {
33747         var mode = context.mode();
33748         if (mode.id === "add-point") {
33749           return mode.preset.matchGeometry("vertex") || target.type !== "way" && target.geometry(context.graph()) !== "vertex";
33750         }
33751         return true;
33752       }
33753       function updateHover(d3_event, targets) {
33754         _selection.selectAll(".hover").classed("hover", false);
33755         _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false);
33756         var mode = context.mode();
33757         if (!_newNodeId && (mode.id === "draw-line" || mode.id === "draw-area")) {
33758           var node = targets.find(function(target) {
33759             return target instanceof osmEntity && target.type === "node";
33760           });
33761           _newNodeId = node && node.id;
33762         }
33763         targets = targets.filter(function(datum3) {
33764           if (datum3 instanceof osmEntity) {
33765             return datum3.id !== _newNodeId && (datum3.type !== "node" || !_ignoreVertex || allowsVertex(datum3)) && modeAllowsHover(datum3);
33766           }
33767           return true;
33768         });
33769         var selector = "";
33770         for (var i2 in targets) {
33771           var datum2 = targets[i2];
33772           if (datum2.__featurehash__) {
33773             selector += ", .data" + datum2.__featurehash__;
33774           } else if (datum2 instanceof QAItem) {
33775             selector += ", ." + datum2.service + ".itemId-" + datum2.id;
33776           } else if (datum2 instanceof osmNote) {
33777             selector += ", .note-" + datum2.id;
33778           } else if (datum2 instanceof osmEntity) {
33779             selector += ", ." + datum2.id;
33780             if (datum2.type === "relation") {
33781               for (var j2 in datum2.members) {
33782                 selector += ", ." + datum2.members[j2].id;
33783               }
33784             }
33785           }
33786         }
33787         var suppressed = _altDisables && d3_event && d3_event.altKey;
33788         if (selector.trim().length) {
33789           selector = selector.slice(1);
33790           _selection.selectAll(selector).classed(suppressed ? "hover-suppressed" : "hover", true);
33791         }
33792         dispatch10.call("hover", this, !suppressed && targets);
33793       }
33794     }
33795     behavior.off = function(selection2) {
33796       selection2.selectAll(".hover").classed("hover", false);
33797       selection2.selectAll(".hover-suppressed").classed("hover-suppressed", false);
33798       selection2.classed("hover-disabled", false);
33799       selection2.on(_pointerPrefix + "over.hover", null).on(_pointerPrefix + "out.hover", null).on(_pointerPrefix + "down.hover", null);
33800       select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", null, true).on("keydown.hover", null).on("keyup.hover", null);
33801     };
33802     behavior.altDisables = function(val) {
33803       if (!arguments.length)
33804         return _altDisables;
33805       _altDisables = val;
33806       return behavior;
33807     };
33808     behavior.ignoreVertex = function(val) {
33809       if (!arguments.length)
33810         return _ignoreVertex;
33811       _ignoreVertex = val;
33812       return behavior;
33813     };
33814     behavior.initialNodeID = function(nodeId) {
33815       _initialNodeID = nodeId;
33816       return behavior;
33817     };
33818     return utilRebind(behavior, dispatch10, "on");
33819   }
33820
33821   // modules/behavior/draw.js
33822   var _disableSpace = false;
33823   var _lastSpace = null;
33824   function behaviorDraw(context) {
33825     var dispatch10 = dispatch_default(
33826       "move",
33827       "down",
33828       "downcancel",
33829       "click",
33830       "clickWay",
33831       "clickNode",
33832       "undo",
33833       "cancel",
33834       "finish"
33835     );
33836     var keybinding = utilKeybinding("draw");
33837     var _hover = behaviorHover(context).altDisables(true).ignoreVertex(true).on("hover", context.ui().sidebar.hover);
33838     var _edit = behaviorEdit(context);
33839     var _closeTolerance = 4;
33840     var _tolerance = 12;
33841     var _mouseLeave = false;
33842     var _lastMouse = null;
33843     var _lastPointerUpEvent;
33844     var _downPointer;
33845     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
33846     function datum2(d3_event) {
33847       var mode = context.mode();
33848       var isNote = mode && mode.id.indexOf("note") !== -1;
33849       if (d3_event.altKey || isNote)
33850         return {};
33851       var element;
33852       if (d3_event.type === "keydown") {
33853         element = _lastMouse && _lastMouse.target;
33854       } else {
33855         element = d3_event.target;
33856       }
33857       var d = element.__data__;
33858       return d && d.properties && d.properties.target ? d : {};
33859     }
33860     function pointerdown(d3_event) {
33861       if (_downPointer)
33862         return;
33863       var pointerLocGetter = utilFastMouse(this);
33864       _downPointer = {
33865         id: d3_event.pointerId || "mouse",
33866         pointerLocGetter,
33867         downTime: +/* @__PURE__ */ new Date(),
33868         downLoc: pointerLocGetter(d3_event)
33869       };
33870       dispatch10.call("down", this, d3_event, datum2(d3_event));
33871     }
33872     function pointerup(d3_event) {
33873       if (!_downPointer || _downPointer.id !== (d3_event.pointerId || "mouse"))
33874         return;
33875       var downPointer = _downPointer;
33876       _downPointer = null;
33877       _lastPointerUpEvent = d3_event;
33878       if (downPointer.isCancelled)
33879         return;
33880       var t2 = +/* @__PURE__ */ new Date();
33881       var p2 = downPointer.pointerLocGetter(d3_event);
33882       var dist = geoVecLength(downPointer.downLoc, p2);
33883       if (dist < _closeTolerance || dist < _tolerance && t2 - downPointer.downTime < 500) {
33884         select_default2(window).on("click.draw-block", function() {
33885           d3_event.stopPropagation();
33886         }, true);
33887         context.map().dblclickZoomEnable(false);
33888         window.setTimeout(function() {
33889           context.map().dblclickZoomEnable(true);
33890           select_default2(window).on("click.draw-block", null);
33891         }, 500);
33892         click(d3_event, p2);
33893       }
33894     }
33895     function pointermove(d3_event) {
33896       if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse") && !_downPointer.isCancelled) {
33897         var p2 = _downPointer.pointerLocGetter(d3_event);
33898         var dist = geoVecLength(_downPointer.downLoc, p2);
33899         if (dist >= _closeTolerance) {
33900           _downPointer.isCancelled = true;
33901           dispatch10.call("downcancel", this);
33902         }
33903       }
33904       if (d3_event.pointerType && d3_event.pointerType !== "mouse" || d3_event.buttons || _downPointer)
33905         return;
33906       if (_lastPointerUpEvent && _lastPointerUpEvent.pointerType !== "mouse" && d3_event.timeStamp - _lastPointerUpEvent.timeStamp < 100)
33907         return;
33908       _lastMouse = d3_event;
33909       dispatch10.call("move", this, d3_event, datum2(d3_event));
33910     }
33911     function pointercancel(d3_event) {
33912       if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse")) {
33913         if (!_downPointer.isCancelled) {
33914           dispatch10.call("downcancel", this);
33915         }
33916         _downPointer = null;
33917       }
33918     }
33919     function mouseenter() {
33920       _mouseLeave = false;
33921     }
33922     function mouseleave() {
33923       _mouseLeave = true;
33924     }
33925     function allowsVertex(d) {
33926       return d.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d, context.graph());
33927     }
33928     function click(d3_event, loc) {
33929       var d = datum2(d3_event);
33930       var target = d && d.properties && d.properties.entity;
33931       var mode = context.mode();
33932       if (target && target.type === "node" && allowsVertex(target)) {
33933         dispatch10.call("clickNode", this, target, d);
33934         return;
33935       } else if (target && target.type === "way" && (mode.id !== "add-point" || mode.preset.matchGeometry("vertex"))) {
33936         var choice = geoChooseEdge(
33937           context.graph().childNodes(target),
33938           loc,
33939           context.projection,
33940           context.activeID()
33941         );
33942         if (choice) {
33943           var edge = [target.nodes[choice.index - 1], target.nodes[choice.index]];
33944           dispatch10.call("clickWay", this, choice.loc, edge, d);
33945           return;
33946         }
33947       } else if (mode.id !== "add-point" || mode.preset.matchGeometry("point")) {
33948         var locLatLng = context.projection.invert(loc);
33949         dispatch10.call("click", this, locLatLng, d);
33950       }
33951     }
33952     function space(d3_event) {
33953       d3_event.preventDefault();
33954       d3_event.stopPropagation();
33955       var currSpace = context.map().mouse();
33956       if (_disableSpace && _lastSpace) {
33957         var dist = geoVecLength(_lastSpace, currSpace);
33958         if (dist > _tolerance) {
33959           _disableSpace = false;
33960         }
33961       }
33962       if (_disableSpace || _mouseLeave || !_lastMouse)
33963         return;
33964       _lastSpace = currSpace;
33965       _disableSpace = true;
33966       select_default2(window).on("keyup.space-block", function() {
33967         d3_event.preventDefault();
33968         d3_event.stopPropagation();
33969         _disableSpace = false;
33970         select_default2(window).on("keyup.space-block", null);
33971       });
33972       var loc = context.map().mouse() || // or the map center if the mouse has never entered the map
33973       context.projection(context.map().center());
33974       click(d3_event, loc);
33975     }
33976     function backspace(d3_event) {
33977       d3_event.preventDefault();
33978       dispatch10.call("undo");
33979     }
33980     function del(d3_event) {
33981       d3_event.preventDefault();
33982       dispatch10.call("cancel");
33983     }
33984     function ret(d3_event) {
33985       d3_event.preventDefault();
33986       dispatch10.call("finish");
33987     }
33988     function behavior(selection2) {
33989       context.install(_hover);
33990       context.install(_edit);
33991       _downPointer = null;
33992       keybinding.on("\u232B", backspace).on("\u2326", del).on("\u238B", ret).on("\u21A9", ret).on("space", space).on("\u2325space", space);
33993       selection2.on("mouseenter.draw", mouseenter).on("mouseleave.draw", mouseleave).on(_pointerPrefix + "down.draw", pointerdown).on(_pointerPrefix + "move.draw", pointermove);
33994       select_default2(window).on(_pointerPrefix + "up.draw", pointerup, true).on("pointercancel.draw", pointercancel, true);
33995       select_default2(document).call(keybinding);
33996       return behavior;
33997     }
33998     behavior.off = function(selection2) {
33999       context.ui().sidebar.hover.cancel();
34000       context.uninstall(_hover);
34001       context.uninstall(_edit);
34002       selection2.on("mouseenter.draw", null).on("mouseleave.draw", null).on(_pointerPrefix + "down.draw", null).on(_pointerPrefix + "move.draw", null);
34003       select_default2(window).on(_pointerPrefix + "up.draw", null).on("pointercancel.draw", null);
34004       select_default2(document).call(keybinding.unbind);
34005     };
34006     behavior.hover = function() {
34007       return _hover;
34008     };
34009     return utilRebind(behavior, dispatch10, "on");
34010   }
34011
34012   // modules/behavior/breathe.js
34013   var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
34014
34015   // node_modules/d3-scale/src/init.js
34016   function initRange(domain2, range3) {
34017     switch (arguments.length) {
34018       case 0:
34019         break;
34020       case 1:
34021         this.range(domain2);
34022         break;
34023       default:
34024         this.range(range3).domain(domain2);
34025         break;
34026     }
34027     return this;
34028   }
34029
34030   // node_modules/d3-scale/src/constant.js
34031   function constants(x) {
34032     return function() {
34033       return x;
34034     };
34035   }
34036
34037   // node_modules/d3-scale/src/number.js
34038   function number2(x) {
34039     return +x;
34040   }
34041
34042   // node_modules/d3-scale/src/continuous.js
34043   var unit = [0, 1];
34044   function identity3(x) {
34045     return x;
34046   }
34047   function normalize(a, b) {
34048     return (b -= a = +a) ? function(x) {
34049       return (x - a) / b;
34050     } : constants(isNaN(b) ? NaN : 0.5);
34051   }
34052   function clamper(a, b) {
34053     var t;
34054     if (a > b)
34055       t = a, a = b, b = t;
34056     return function(x) {
34057       return Math.max(a, Math.min(b, x));
34058     };
34059   }
34060   function bimap(domain2, range3, interpolate) {
34061     var d0 = domain2[0], d1 = domain2[1], r0 = range3[0], r1 = range3[1];
34062     if (d1 < d0)
34063       d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
34064     else
34065       d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
34066     return function(x) {
34067       return r0(d0(x));
34068     };
34069   }
34070   function polymap(domain2, range3, interpolate) {
34071     var j2 = Math.min(domain2.length, range3.length) - 1, d = new Array(j2), r = new Array(j2), i2 = -1;
34072     if (domain2[j2] < domain2[0]) {
34073       domain2 = domain2.slice().reverse();
34074       range3 = range3.slice().reverse();
34075     }
34076     while (++i2 < j2) {
34077       d[i2] = normalize(domain2[i2], domain2[i2 + 1]);
34078       r[i2] = interpolate(range3[i2], range3[i2 + 1]);
34079     }
34080     return function(x) {
34081       var i3 = bisect_default(domain2, x, 1, j2) - 1;
34082       return r[i3](d[i3](x));
34083     };
34084   }
34085   function copy(source, target) {
34086     return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
34087   }
34088   function transformer2() {
34089     var domain2 = unit, range3 = unit, interpolate = value_default, transform2, untransform, unknown, clamp3 = identity3, piecewise, output, input;
34090     function rescale() {
34091       var n2 = Math.min(domain2.length, range3.length);
34092       if (clamp3 !== identity3)
34093         clamp3 = clamper(domain2[0], domain2[n2 - 1]);
34094       piecewise = n2 > 2 ? polymap : bimap;
34095       output = input = null;
34096       return scale;
34097     }
34098     function scale(x) {
34099       return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain2.map(transform2), range3, interpolate)))(transform2(clamp3(x)));
34100     }
34101     scale.invert = function(y) {
34102       return clamp3(untransform((input || (input = piecewise(range3, domain2.map(transform2), number_default)))(y)));
34103     };
34104     scale.domain = function(_) {
34105       return arguments.length ? (domain2 = Array.from(_, number2), rescale()) : domain2.slice();
34106     };
34107     scale.range = function(_) {
34108       return arguments.length ? (range3 = Array.from(_), rescale()) : range3.slice();
34109     };
34110     scale.rangeRound = function(_) {
34111       return range3 = Array.from(_), interpolate = round_default, rescale();
34112     };
34113     scale.clamp = function(_) {
34114       return arguments.length ? (clamp3 = _ ? true : identity3, rescale()) : clamp3 !== identity3;
34115     };
34116     scale.interpolate = function(_) {
34117       return arguments.length ? (interpolate = _, rescale()) : interpolate;
34118     };
34119     scale.unknown = function(_) {
34120       return arguments.length ? (unknown = _, scale) : unknown;
34121     };
34122     return function(t, u) {
34123       transform2 = t, untransform = u;
34124       return rescale();
34125     };
34126   }
34127   function continuous() {
34128     return transformer2()(identity3, identity3);
34129   }
34130
34131   // node_modules/d3-format/src/formatDecimal.js
34132   function formatDecimal_default(x) {
34133     return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10);
34134   }
34135   function formatDecimalParts(x, p) {
34136     if ((i2 = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0)
34137       return null;
34138     var i2, coefficient = x.slice(0, i2);
34139     return [
34140       coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
34141       +x.slice(i2 + 1)
34142     ];
34143   }
34144
34145   // node_modules/d3-format/src/exponent.js
34146   function exponent_default(x) {
34147     return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
34148   }
34149
34150   // node_modules/d3-format/src/formatGroup.js
34151   function formatGroup_default(grouping, thousands) {
34152     return function(value, width) {
34153       var i2 = value.length, t = [], j2 = 0, g = grouping[0], length = 0;
34154       while (i2 > 0 && g > 0) {
34155         if (length + g + 1 > width)
34156           g = Math.max(1, width - length);
34157         t.push(value.substring(i2 -= g, i2 + g));
34158         if ((length += g + 1) > width)
34159           break;
34160         g = grouping[j2 = (j2 + 1) % grouping.length];
34161       }
34162       return t.reverse().join(thousands);
34163     };
34164   }
34165
34166   // node_modules/d3-format/src/formatNumerals.js
34167   function formatNumerals_default(numerals) {
34168     return function(value) {
34169       return value.replace(/[0-9]/g, function(i2) {
34170         return numerals[+i2];
34171       });
34172     };
34173   }
34174
34175   // node_modules/d3-format/src/formatSpecifier.js
34176   var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
34177   function formatSpecifier(specifier) {
34178     if (!(match = re.exec(specifier)))
34179       throw new Error("invalid format: " + specifier);
34180     var match;
34181     return new FormatSpecifier({
34182       fill: match[1],
34183       align: match[2],
34184       sign: match[3],
34185       symbol: match[4],
34186       zero: match[5],
34187       width: match[6],
34188       comma: match[7],
34189       precision: match[8] && match[8].slice(1),
34190       trim: match[9],
34191       type: match[10]
34192     });
34193   }
34194   formatSpecifier.prototype = FormatSpecifier.prototype;
34195   function FormatSpecifier(specifier) {
34196     this.fill = specifier.fill === void 0 ? " " : specifier.fill + "";
34197     this.align = specifier.align === void 0 ? ">" : specifier.align + "";
34198     this.sign = specifier.sign === void 0 ? "-" : specifier.sign + "";
34199     this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + "";
34200     this.zero = !!specifier.zero;
34201     this.width = specifier.width === void 0 ? void 0 : +specifier.width;
34202     this.comma = !!specifier.comma;
34203     this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;
34204     this.trim = !!specifier.trim;
34205     this.type = specifier.type === void 0 ? "" : specifier.type + "";
34206   }
34207   FormatSpecifier.prototype.toString = function() {
34208     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;
34209   };
34210
34211   // node_modules/d3-format/src/formatTrim.js
34212   function formatTrim_default(s) {
34213     out:
34214       for (var n2 = s.length, i2 = 1, i0 = -1, i1; i2 < n2; ++i2) {
34215         switch (s[i2]) {
34216           case ".":
34217             i0 = i1 = i2;
34218             break;
34219           case "0":
34220             if (i0 === 0)
34221               i0 = i2;
34222             i1 = i2;
34223             break;
34224           default:
34225             if (!+s[i2])
34226               break out;
34227             if (i0 > 0)
34228               i0 = 0;
34229             break;
34230         }
34231       }
34232     return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
34233   }
34234
34235   // node_modules/d3-format/src/formatPrefixAuto.js
34236   var prefixExponent;
34237   function formatPrefixAuto_default(x, p) {
34238     var d = formatDecimalParts(x, p);
34239     if (!d)
34240       return x + "";
34241     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;
34242     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];
34243   }
34244
34245   // node_modules/d3-format/src/formatRounded.js
34246   function formatRounded_default(x, p) {
34247     var d = formatDecimalParts(x, p);
34248     if (!d)
34249       return x + "";
34250     var coefficient = d[0], exponent = d[1];
34251     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");
34252   }
34253
34254   // node_modules/d3-format/src/formatTypes.js
34255   var formatTypes_default = {
34256     "%": (x, p) => (x * 100).toFixed(p),
34257     "b": (x) => Math.round(x).toString(2),
34258     "c": (x) => x + "",
34259     "d": formatDecimal_default,
34260     "e": (x, p) => x.toExponential(p),
34261     "f": (x, p) => x.toFixed(p),
34262     "g": (x, p) => x.toPrecision(p),
34263     "o": (x) => Math.round(x).toString(8),
34264     "p": (x, p) => formatRounded_default(x * 100, p),
34265     "r": formatRounded_default,
34266     "s": formatPrefixAuto_default,
34267     "X": (x) => Math.round(x).toString(16).toUpperCase(),
34268     "x": (x) => Math.round(x).toString(16)
34269   };
34270
34271   // node_modules/d3-format/src/identity.js
34272   function identity_default3(x) {
34273     return x;
34274   }
34275
34276   // node_modules/d3-format/src/locale.js
34277   var map = Array.prototype.map;
34278   var prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
34279   function locale_default(locale2) {
34280     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 + "";
34281     function newFormat(specifier) {
34282       specifier = formatSpecifier(specifier);
34283       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, type2 = specifier.type;
34284       if (type2 === "n")
34285         comma = true, type2 = "g";
34286       else if (!formatTypes_default[type2])
34287         precision2 === void 0 && (precision2 = 12), trim = true, type2 = "g";
34288       if (zero3 || fill === "0" && align === "=")
34289         zero3 = true, fill = "0", align = "=";
34290       var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type2) ? "0" + type2.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type2) ? percent : "";
34291       var formatType = formatTypes_default[type2], maybeSuffix = /[defgprs%]/.test(type2);
34292       precision2 = precision2 === void 0 ? 6 : /[gprs]/.test(type2) ? Math.max(1, Math.min(21, precision2)) : Math.max(0, Math.min(20, precision2));
34293       function format2(value) {
34294         var valuePrefix = prefix, valueSuffix = suffix, i2, n2, c;
34295         if (type2 === "c") {
34296           valueSuffix = formatType(value) + valueSuffix;
34297           value = "";
34298         } else {
34299           value = +value;
34300           var valueNegative = value < 0 || 1 / value < 0;
34301           value = isNaN(value) ? nan : formatType(Math.abs(value), precision2);
34302           if (trim)
34303             value = formatTrim_default(value);
34304           if (valueNegative && +value === 0 && sign2 !== "+")
34305             valueNegative = false;
34306           valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix;
34307           valueSuffix = (type2 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : "");
34308           if (maybeSuffix) {
34309             i2 = -1, n2 = value.length;
34310             while (++i2 < n2) {
34311               if (c = value.charCodeAt(i2), 48 > c || c > 57) {
34312                 valueSuffix = (c === 46 ? decimal + value.slice(i2 + 1) : value.slice(i2)) + valueSuffix;
34313                 value = value.slice(0, i2);
34314                 break;
34315               }
34316             }
34317           }
34318         }
34319         if (comma && !zero3)
34320           value = group(value, Infinity);
34321         var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : "";
34322         if (comma && zero3)
34323           value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
34324         switch (align) {
34325           case "<":
34326             value = valuePrefix + value + valueSuffix + padding;
34327             break;
34328           case "=":
34329             value = valuePrefix + padding + value + valueSuffix;
34330             break;
34331           case "^":
34332             value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);
34333             break;
34334           default:
34335             value = padding + valuePrefix + value + valueSuffix;
34336             break;
34337         }
34338         return numerals(value);
34339       }
34340       format2.toString = function() {
34341         return specifier + "";
34342       };
34343       return format2;
34344     }
34345     function formatPrefix2(specifier, value) {
34346       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];
34347       return function(value2) {
34348         return f2(k * value2) + prefix;
34349       };
34350     }
34351     return {
34352       format: newFormat,
34353       formatPrefix: formatPrefix2
34354     };
34355   }
34356
34357   // node_modules/d3-format/src/defaultLocale.js
34358   var locale;
34359   var format;
34360   var formatPrefix;
34361   defaultLocale({
34362     thousands: ",",
34363     grouping: [3],
34364     currency: ["$", ""]
34365   });
34366   function defaultLocale(definition) {
34367     locale = locale_default(definition);
34368     format = locale.format;
34369     formatPrefix = locale.formatPrefix;
34370     return locale;
34371   }
34372
34373   // node_modules/d3-format/src/precisionFixed.js
34374   function precisionFixed_default(step) {
34375     return Math.max(0, -exponent_default(Math.abs(step)));
34376   }
34377
34378   // node_modules/d3-format/src/precisionPrefix.js
34379   function precisionPrefix_default(step, value) {
34380     return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3 - exponent_default(Math.abs(step)));
34381   }
34382
34383   // node_modules/d3-format/src/precisionRound.js
34384   function precisionRound_default(step, max3) {
34385     step = Math.abs(step), max3 = Math.abs(max3) - step;
34386     return Math.max(0, exponent_default(max3) - exponent_default(step)) + 1;
34387   }
34388
34389   // node_modules/d3-scale/src/tickFormat.js
34390   function tickFormat(start2, stop, count, specifier) {
34391     var step = tickStep(start2, stop, count), precision2;
34392     specifier = formatSpecifier(specifier == null ? ",f" : specifier);
34393     switch (specifier.type) {
34394       case "s": {
34395         var value = Math.max(Math.abs(start2), Math.abs(stop));
34396         if (specifier.precision == null && !isNaN(precision2 = precisionPrefix_default(step, value)))
34397           specifier.precision = precision2;
34398         return formatPrefix(specifier, value);
34399       }
34400       case "":
34401       case "e":
34402       case "g":
34403       case "p":
34404       case "r": {
34405         if (specifier.precision == null && !isNaN(precision2 = precisionRound_default(step, Math.max(Math.abs(start2), Math.abs(stop)))))
34406           specifier.precision = precision2 - (specifier.type === "e");
34407         break;
34408       }
34409       case "f":
34410       case "%": {
34411         if (specifier.precision == null && !isNaN(precision2 = precisionFixed_default(step)))
34412           specifier.precision = precision2 - (specifier.type === "%") * 2;
34413         break;
34414       }
34415     }
34416     return format(specifier);
34417   }
34418
34419   // node_modules/d3-scale/src/linear.js
34420   function linearish(scale) {
34421     var domain2 = scale.domain;
34422     scale.ticks = function(count) {
34423       var d = domain2();
34424       return ticks(d[0], d[d.length - 1], count == null ? 10 : count);
34425     };
34426     scale.tickFormat = function(count, specifier) {
34427       var d = domain2();
34428       return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
34429     };
34430     scale.nice = function(count) {
34431       if (count == null)
34432         count = 10;
34433       var d = domain2();
34434       var i0 = 0;
34435       var i1 = d.length - 1;
34436       var start2 = d[i0];
34437       var stop = d[i1];
34438       var prestep;
34439       var step;
34440       var maxIter = 10;
34441       if (stop < start2) {
34442         step = start2, start2 = stop, stop = step;
34443         step = i0, i0 = i1, i1 = step;
34444       }
34445       while (maxIter-- > 0) {
34446         step = tickIncrement(start2, stop, count);
34447         if (step === prestep) {
34448           d[i0] = start2;
34449           d[i1] = stop;
34450           return domain2(d);
34451         } else if (step > 0) {
34452           start2 = Math.floor(start2 / step) * step;
34453           stop = Math.ceil(stop / step) * step;
34454         } else if (step < 0) {
34455           start2 = Math.ceil(start2 * step) / step;
34456           stop = Math.floor(stop * step) / step;
34457         } else {
34458           break;
34459         }
34460         prestep = step;
34461       }
34462       return scale;
34463     };
34464     return scale;
34465   }
34466   function linear3() {
34467     var scale = continuous();
34468     scale.copy = function() {
34469       return copy(scale, linear3());
34470     };
34471     initRange.apply(scale, arguments);
34472     return linearish(scale);
34473   }
34474
34475   // node_modules/d3-scale/src/quantize.js
34476   function quantize() {
34477     var x05 = 0, x12 = 1, n2 = 1, domain2 = [0.5], range3 = [0, 1], unknown;
34478     function scale(x) {
34479       return x != null && x <= x ? range3[bisect_default(domain2, x, 0, n2)] : unknown;
34480     }
34481     function rescale() {
34482       var i2 = -1;
34483       domain2 = new Array(n2);
34484       while (++i2 < n2)
34485         domain2[i2] = ((i2 + 1) * x12 - (i2 - n2) * x05) / (n2 + 1);
34486       return scale;
34487     }
34488     scale.domain = function(_) {
34489       return arguments.length ? ([x05, x12] = _, x05 = +x05, x12 = +x12, rescale()) : [x05, x12];
34490     };
34491     scale.range = function(_) {
34492       return arguments.length ? (n2 = (range3 = Array.from(_)).length - 1, rescale()) : range3.slice();
34493     };
34494     scale.invertExtent = function(y) {
34495       var i2 = range3.indexOf(y);
34496       return i2 < 0 ? [NaN, NaN] : i2 < 1 ? [x05, domain2[0]] : i2 >= n2 ? [domain2[n2 - 1], x12] : [domain2[i2 - 1], domain2[i2]];
34497     };
34498     scale.unknown = function(_) {
34499       return arguments.length ? (unknown = _, scale) : scale;
34500     };
34501     scale.thresholds = function() {
34502       return domain2.slice();
34503     };
34504     scale.copy = function() {
34505       return quantize().domain([x05, x12]).range(range3).unknown(unknown);
34506     };
34507     return initRange.apply(linearish(scale), arguments);
34508   }
34509
34510   // modules/behavior/breathe.js
34511   function behaviorBreathe() {
34512     var duration = 800;
34513     var steps = 4;
34514     var selector = ".selected.shadow, .selected .shadow";
34515     var _selected = select_default2(null);
34516     var _classed = "";
34517     var _params = {};
34518     var _done = false;
34519     var _timer;
34520     function ratchetyInterpolator(a, b, steps2, units) {
34521       a = Number(a);
34522       b = Number(b);
34523       var sample = quantize().domain([0, 1]).range(quantize_default(number_default(a, b), steps2));
34524       return function(t) {
34525         return String(sample(t)) + (units || "");
34526       };
34527     }
34528     function reset(selection2) {
34529       selection2.style("stroke-opacity", null).style("stroke-width", null).style("fill-opacity", null).style("r", null);
34530     }
34531     function setAnimationParams(transition2, fromTo) {
34532       var toFrom = fromTo === "from" ? "to" : "from";
34533       transition2.styleTween("stroke-opacity", function(d) {
34534         return ratchetyInterpolator(
34535           _params[d.id][toFrom].opacity,
34536           _params[d.id][fromTo].opacity,
34537           steps
34538         );
34539       }).styleTween("stroke-width", function(d) {
34540         return ratchetyInterpolator(
34541           _params[d.id][toFrom].width,
34542           _params[d.id][fromTo].width,
34543           steps,
34544           "px"
34545         );
34546       }).styleTween("fill-opacity", function(d) {
34547         return ratchetyInterpolator(
34548           _params[d.id][toFrom].opacity,
34549           _params[d.id][fromTo].opacity,
34550           steps
34551         );
34552       }).styleTween("r", function(d) {
34553         return ratchetyInterpolator(
34554           _params[d.id][toFrom].width,
34555           _params[d.id][fromTo].width,
34556           steps,
34557           "px"
34558         );
34559       });
34560     }
34561     function calcAnimationParams(selection2) {
34562       selection2.call(reset).each(function(d) {
34563         var s = select_default2(this);
34564         var tag = s.node().tagName;
34565         var p = { "from": {}, "to": {} };
34566         var opacity;
34567         var width;
34568         if (tag === "circle") {
34569           opacity = Number(s.style("fill-opacity") || 0.5);
34570           width = Number(s.style("r") || 15.5);
34571         } else {
34572           opacity = Number(s.style("stroke-opacity") || 0.7);
34573           width = Number(s.style("stroke-width") || 10);
34574         }
34575         p.tag = tag;
34576         p.from.opacity = opacity * 0.6;
34577         p.to.opacity = opacity * 1.25;
34578         p.from.width = width * 0.7;
34579         p.to.width = width * (tag === "circle" ? 1.5 : 1);
34580         _params[d.id] = p;
34581       });
34582     }
34583     function run(surface, fromTo) {
34584       var toFrom = fromTo === "from" ? "to" : "from";
34585       var currSelected = surface.selectAll(selector);
34586       var currClassed = surface.attr("class");
34587       if (_done || currSelected.empty()) {
34588         _selected.call(reset);
34589         _selected = select_default2(null);
34590         return;
34591       }
34592       if (!(0, import_fast_deep_equal2.default)(currSelected.data(), _selected.data()) || currClassed !== _classed) {
34593         _selected.call(reset);
34594         _classed = currClassed;
34595         _selected = currSelected.call(calcAnimationParams);
34596       }
34597       var didCallNextRun = false;
34598       _selected.transition().duration(duration).call(setAnimationParams, fromTo).on("end", function() {
34599         if (!didCallNextRun) {
34600           surface.call(run, toFrom);
34601           didCallNextRun = true;
34602         }
34603         if (!select_default2(this).classed("selected")) {
34604           reset(select_default2(this));
34605         }
34606       });
34607     }
34608     function behavior(surface) {
34609       _done = false;
34610       _timer = timer(function() {
34611         if (surface.selectAll(selector).empty()) {
34612           return false;
34613         }
34614         surface.call(run, "from");
34615         _timer.stop();
34616         return true;
34617       }, 20);
34618     }
34619     behavior.restartIfNeeded = function(surface) {
34620       if (_selected.empty()) {
34621         surface.call(run, "from");
34622         if (_timer) {
34623           _timer.stop();
34624         }
34625       }
34626     };
34627     behavior.off = function() {
34628       _done = true;
34629       if (_timer) {
34630         _timer.stop();
34631       }
34632       _selected.interrupt().call(reset);
34633     };
34634     return behavior;
34635   }
34636
34637   // modules/behavior/operation.js
34638   function behaviorOperation(context) {
34639     var _operation;
34640     function keypress(d3_event) {
34641       if (!context.map().withinEditableZoom())
34642         return;
34643       if (_operation.availableForKeypress && !_operation.availableForKeypress())
34644         return;
34645       d3_event.preventDefault();
34646       var disabled = _operation.disabled();
34647       if (disabled) {
34648         context.ui().flash.duration(4e3).iconName("#iD-operation-" + _operation.id).iconClass("operation disabled").label(_operation.tooltip())();
34649       } else {
34650         context.ui().flash.duration(2e3).iconName("#iD-operation-" + _operation.id).iconClass("operation").label(_operation.annotation() || _operation.title)();
34651         if (_operation.point)
34652           _operation.point(null);
34653         _operation();
34654       }
34655     }
34656     function behavior() {
34657       if (_operation && _operation.available()) {
34658         context.keybinding().on(_operation.keys, keypress);
34659       }
34660       return behavior;
34661     }
34662     behavior.off = function() {
34663       context.keybinding().off(_operation.keys);
34664     };
34665     behavior.which = function(_) {
34666       if (!arguments.length)
34667         return _operation;
34668       _operation = _;
34669       return behavior;
34670     };
34671     return behavior;
34672   }
34673
34674   // modules/operations/circularize.js
34675   function operationCircularize(context, selectedIDs) {
34676     var _extent;
34677     var _actions = selectedIDs.map(getAction).filter(Boolean);
34678     var _amount = _actions.length === 1 ? "single" : "multiple";
34679     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n2) {
34680       return n2.loc;
34681     });
34682     function getAction(entityID) {
34683       var entity = context.entity(entityID);
34684       if (entity.type !== "way" || new Set(entity.nodes).size <= 1)
34685         return null;
34686       if (!_extent) {
34687         _extent = entity.extent(context.graph());
34688       } else {
34689         _extent = _extent.extend(entity.extent(context.graph()));
34690       }
34691       return actionCircularize(entityID, context.projection);
34692     }
34693     var operation = function() {
34694       if (!_actions.length)
34695         return;
34696       var combinedAction = function(graph, t) {
34697         _actions.forEach(function(action) {
34698           if (!action.disabled(graph)) {
34699             graph = action(graph, t);
34700           }
34701         });
34702         return graph;
34703       };
34704       combinedAction.transitionable = true;
34705       context.perform(combinedAction, operation.annotation());
34706       window.setTimeout(function() {
34707         context.validator().validate();
34708       }, 300);
34709     };
34710     operation.available = function() {
34711       return _actions.length && selectedIDs.length === _actions.length;
34712     };
34713     operation.disabled = function() {
34714       if (!_actions.length)
34715         return "";
34716       var actionDisableds = _actions.map(function(action) {
34717         return action.disabled(context.graph());
34718       }).filter(Boolean);
34719       if (actionDisableds.length === _actions.length) {
34720         if (new Set(actionDisableds).size > 1) {
34721           return "multiple_blockers";
34722         }
34723         return actionDisableds[0];
34724       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
34725         return "too_large";
34726       } else if (someMissing()) {
34727         return "not_downloaded";
34728       } else if (selectedIDs.some(context.hasHiddenConnections)) {
34729         return "connected_to_hidden";
34730       }
34731       return false;
34732       function someMissing() {
34733         if (context.inIntro())
34734           return false;
34735         var osm = context.connection();
34736         if (osm) {
34737           var missing = _coords.filter(function(loc) {
34738             return !osm.isDataLoaded(loc);
34739           });
34740           if (missing.length) {
34741             missing.forEach(function(loc) {
34742               context.loadTileAtLoc(loc);
34743             });
34744             return true;
34745           }
34746         }
34747         return false;
34748       }
34749     };
34750     operation.tooltip = function() {
34751       var disable = operation.disabled();
34752       return disable ? _t.append("operations.circularize." + disable + "." + _amount) : _t.append("operations.circularize.description." + _amount);
34753     };
34754     operation.annotation = function() {
34755       return _t("operations.circularize.annotation.feature", { n: _actions.length });
34756     };
34757     operation.id = "circularize";
34758     operation.keys = [_t("operations.circularize.key")];
34759     operation.title = _t.append("operations.circularize.title");
34760     operation.behavior = behaviorOperation(context).which(operation);
34761     return operation;
34762   }
34763
34764   // modules/ui/cmd.js
34765   var uiCmd = function(code) {
34766     var detected = utilDetect();
34767     if (detected.os === "mac") {
34768       return code;
34769     }
34770     if (detected.os === "win") {
34771       if (code === "\u2318\u21E7Z")
34772         return "Ctrl+Y";
34773     }
34774     var result = "", replacements = {
34775       "\u2318": "Ctrl",
34776       "\u21E7": "Shift",
34777       "\u2325": "Alt",
34778       "\u232B": "Backspace",
34779       "\u2326": "Delete"
34780     };
34781     for (var i2 = 0; i2 < code.length; i2++) {
34782       if (code[i2] in replacements) {
34783         result += replacements[code[i2]] + (i2 < code.length - 1 ? "+" : "");
34784       } else {
34785         result += code[i2];
34786       }
34787     }
34788     return result;
34789   };
34790   uiCmd.display = function(code) {
34791     if (code.length !== 1)
34792       return code;
34793     var detected = utilDetect();
34794     var mac = detected.os === "mac";
34795     var replacements = {
34796       "\u2318": mac ? "\u2318 " + _t("shortcuts.key.cmd") : _t("shortcuts.key.ctrl"),
34797       "\u21E7": mac ? "\u21E7 " + _t("shortcuts.key.shift") : _t("shortcuts.key.shift"),
34798       "\u2325": mac ? "\u2325 " + _t("shortcuts.key.option") : _t("shortcuts.key.alt"),
34799       "\u2303": mac ? "\u2303 " + _t("shortcuts.key.ctrl") : _t("shortcuts.key.ctrl"),
34800       "\u232B": mac ? "\u232B " + _t("shortcuts.key.delete") : _t("shortcuts.key.backspace"),
34801       "\u2326": mac ? "\u2326 " + _t("shortcuts.key.del") : _t("shortcuts.key.del"),
34802       "\u2196": mac ? "\u2196 " + _t("shortcuts.key.pgup") : _t("shortcuts.key.pgup"),
34803       "\u2198": mac ? "\u2198 " + _t("shortcuts.key.pgdn") : _t("shortcuts.key.pgdn"),
34804       "\u21DE": mac ? "\u21DE " + _t("shortcuts.key.home") : _t("shortcuts.key.home"),
34805       "\u21DF": mac ? "\u21DF " + _t("shortcuts.key.end") : _t("shortcuts.key.end"),
34806       "\u21B5": mac ? "\u23CE " + _t("shortcuts.key.return") : _t("shortcuts.key.enter"),
34807       "\u238B": mac ? "\u238B " + _t("shortcuts.key.esc") : _t("shortcuts.key.esc"),
34808       "\u2630": mac ? "\u2630 " + _t("shortcuts.key.menu") : _t("shortcuts.key.menu")
34809     };
34810     return replacements[code] || code;
34811   };
34812
34813   // modules/operations/delete.js
34814   function operationDelete(context, selectedIDs) {
34815     var multi = selectedIDs.length === 1 ? "single" : "multiple";
34816     var action = actionDeleteMultiple(selectedIDs);
34817     var nodes = utilGetAllNodes(selectedIDs, context.graph());
34818     var coords = nodes.map(function(n2) {
34819       return n2.loc;
34820     });
34821     var extent = utilTotalExtent(selectedIDs, context.graph());
34822     var operation = function() {
34823       var nextSelectedID;
34824       var nextSelectedLoc;
34825       if (selectedIDs.length === 1) {
34826         var id2 = selectedIDs[0];
34827         var entity = context.entity(id2);
34828         var geometry = entity.geometry(context.graph());
34829         var parents = context.graph().parentWays(entity);
34830         var parent = parents[0];
34831         if (geometry === "vertex") {
34832           var nodes2 = parent.nodes;
34833           var i2 = nodes2.indexOf(id2);
34834           if (i2 === 0) {
34835             i2++;
34836           } else if (i2 === nodes2.length - 1) {
34837             i2--;
34838           } else {
34839             var a = geoSphericalDistance(entity.loc, context.entity(nodes2[i2 - 1]).loc);
34840             var b = geoSphericalDistance(entity.loc, context.entity(nodes2[i2 + 1]).loc);
34841             i2 = a < b ? i2 - 1 : i2 + 1;
34842           }
34843           nextSelectedID = nodes2[i2];
34844           nextSelectedLoc = context.entity(nextSelectedID).loc;
34845         }
34846       }
34847       context.perform(action, operation.annotation());
34848       context.validator().validate();
34849       if (nextSelectedID && nextSelectedLoc) {
34850         if (context.hasEntity(nextSelectedID)) {
34851           context.enter(modeSelect(context, [nextSelectedID]).follow(true));
34852         } else {
34853           context.map().centerEase(nextSelectedLoc);
34854           context.enter(modeBrowse(context));
34855         }
34856       } else {
34857         context.enter(modeBrowse(context));
34858       }
34859     };
34860     operation.available = function() {
34861       return true;
34862     };
34863     operation.disabled = function() {
34864       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
34865         return "too_large";
34866       } else if (someMissing()) {
34867         return "not_downloaded";
34868       } else if (selectedIDs.some(context.hasHiddenConnections)) {
34869         return "connected_to_hidden";
34870       } else if (selectedIDs.some(protectedMember)) {
34871         return "part_of_relation";
34872       } else if (selectedIDs.some(incompleteRelation)) {
34873         return "incomplete_relation";
34874       } else if (selectedIDs.some(hasWikidataTag)) {
34875         return "has_wikidata_tag";
34876       }
34877       return false;
34878       function someMissing() {
34879         if (context.inIntro())
34880           return false;
34881         var osm = context.connection();
34882         if (osm) {
34883           var missing = coords.filter(function(loc) {
34884             return !osm.isDataLoaded(loc);
34885           });
34886           if (missing.length) {
34887             missing.forEach(function(loc) {
34888               context.loadTileAtLoc(loc);
34889             });
34890             return true;
34891           }
34892         }
34893         return false;
34894       }
34895       function hasWikidataTag(id2) {
34896         var entity = context.entity(id2);
34897         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
34898       }
34899       function incompleteRelation(id2) {
34900         var entity = context.entity(id2);
34901         return entity.type === "relation" && !entity.isComplete(context.graph());
34902       }
34903       function protectedMember(id2) {
34904         var entity = context.entity(id2);
34905         if (entity.type !== "way")
34906           return false;
34907         var parents = context.graph().parentRelations(entity);
34908         for (var i2 = 0; i2 < parents.length; i2++) {
34909           var parent = parents[i2];
34910           var type2 = parent.tags.type;
34911           var role = parent.memberById(id2).role || "outer";
34912           if (type2 === "route" || type2 === "boundary" || type2 === "multipolygon" && role === "outer") {
34913             return true;
34914           }
34915         }
34916         return false;
34917       }
34918     };
34919     operation.tooltip = function() {
34920       var disable = operation.disabled();
34921       return disable ? _t.append("operations.delete." + disable + "." + multi) : _t.append("operations.delete.description." + multi);
34922     };
34923     operation.annotation = function() {
34924       return selectedIDs.length === 1 ? _t("operations.delete.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.delete.annotation.feature", { n: selectedIDs.length });
34925     };
34926     operation.id = "delete";
34927     operation.keys = [uiCmd("\u2318\u232B"), uiCmd("\u2318\u2326"), uiCmd("\u2326")];
34928     operation.title = _t.append("operations.delete.title");
34929     operation.behavior = behaviorOperation(context).which(operation);
34930     return operation;
34931   }
34932
34933   // modules/operations/orthogonalize.js
34934   function operationOrthogonalize(context, selectedIDs) {
34935     var _extent;
34936     var _type;
34937     var _actions = selectedIDs.map(chooseAction).filter(Boolean);
34938     var _amount = _actions.length === 1 ? "single" : "multiple";
34939     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n2) {
34940       return n2.loc;
34941     });
34942     function chooseAction(entityID) {
34943       var entity = context.entity(entityID);
34944       var geometry = entity.geometry(context.graph());
34945       if (!_extent) {
34946         _extent = entity.extent(context.graph());
34947       } else {
34948         _extent = _extent.extend(entity.extent(context.graph()));
34949       }
34950       if (entity.type === "way" && new Set(entity.nodes).size > 2) {
34951         if (_type && _type !== "feature")
34952           return null;
34953         _type = "feature";
34954         return actionOrthogonalize(entityID, context.projection);
34955       } else if (geometry === "vertex") {
34956         if (_type && _type !== "corner")
34957           return null;
34958         _type = "corner";
34959         var graph = context.graph();
34960         var parents = graph.parentWays(entity);
34961         if (parents.length === 1) {
34962           var way = parents[0];
34963           if (way.nodes.indexOf(entityID) !== -1) {
34964             return actionOrthogonalize(way.id, context.projection, entityID);
34965           }
34966         }
34967       }
34968       return null;
34969     }
34970     var operation = function() {
34971       if (!_actions.length)
34972         return;
34973       var combinedAction = function(graph, t) {
34974         _actions.forEach(function(action) {
34975           if (!action.disabled(graph)) {
34976             graph = action(graph, t);
34977           }
34978         });
34979         return graph;
34980       };
34981       combinedAction.transitionable = true;
34982       context.perform(combinedAction, operation.annotation());
34983       window.setTimeout(function() {
34984         context.validator().validate();
34985       }, 300);
34986     };
34987     operation.available = function() {
34988       return _actions.length && selectedIDs.length === _actions.length;
34989     };
34990     operation.disabled = function() {
34991       if (!_actions.length)
34992         return "";
34993       var actionDisableds = _actions.map(function(action) {
34994         return action.disabled(context.graph());
34995       }).filter(Boolean);
34996       if (actionDisableds.length === _actions.length) {
34997         if (new Set(actionDisableds).size > 1) {
34998           return "multiple_blockers";
34999         }
35000         return actionDisableds[0];
35001       } else if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
35002         return "too_large";
35003       } else if (someMissing()) {
35004         return "not_downloaded";
35005       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35006         return "connected_to_hidden";
35007       }
35008       return false;
35009       function someMissing() {
35010         if (context.inIntro())
35011           return false;
35012         var osm = context.connection();
35013         if (osm) {
35014           var missing = _coords.filter(function(loc) {
35015             return !osm.isDataLoaded(loc);
35016           });
35017           if (missing.length) {
35018             missing.forEach(function(loc) {
35019               context.loadTileAtLoc(loc);
35020             });
35021             return true;
35022           }
35023         }
35024         return false;
35025       }
35026     };
35027     operation.tooltip = function() {
35028       var disable = operation.disabled();
35029       return disable ? _t.append("operations.orthogonalize." + disable + "." + _amount) : _t.append("operations.orthogonalize.description." + _type + "." + _amount);
35030     };
35031     operation.annotation = function() {
35032       return _t("operations.orthogonalize.annotation." + _type, { n: _actions.length });
35033     };
35034     operation.id = "orthogonalize";
35035     operation.keys = [_t("operations.orthogonalize.key")];
35036     operation.title = _t.append("operations.orthogonalize.title");
35037     operation.behavior = behaviorOperation(context).which(operation);
35038     return operation;
35039   }
35040
35041   // modules/operations/reflect.js
35042   function operationReflectShort(context, selectedIDs) {
35043     return operationReflect(context, selectedIDs, "short");
35044   }
35045   function operationReflectLong(context, selectedIDs) {
35046     return operationReflect(context, selectedIDs, "long");
35047   }
35048   function operationReflect(context, selectedIDs, axis) {
35049     axis = axis || "long";
35050     var multi = selectedIDs.length === 1 ? "single" : "multiple";
35051     var nodes = utilGetAllNodes(selectedIDs, context.graph());
35052     var coords = nodes.map(function(n2) {
35053       return n2.loc;
35054     });
35055     var extent = utilTotalExtent(selectedIDs, context.graph());
35056     var operation = function() {
35057       var action = actionReflect(selectedIDs, context.projection).useLongAxis(Boolean(axis === "long"));
35058       context.perform(action, operation.annotation());
35059       window.setTimeout(function() {
35060         context.validator().validate();
35061       }, 300);
35062     };
35063     operation.available = function() {
35064       return nodes.length >= 3;
35065     };
35066     operation.disabled = function() {
35067       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35068         return "too_large";
35069       } else if (someMissing()) {
35070         return "not_downloaded";
35071       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35072         return "connected_to_hidden";
35073       } else if (selectedIDs.some(incompleteRelation)) {
35074         return "incomplete_relation";
35075       }
35076       return false;
35077       function someMissing() {
35078         if (context.inIntro())
35079           return false;
35080         var osm = context.connection();
35081         if (osm) {
35082           var missing = coords.filter(function(loc) {
35083             return !osm.isDataLoaded(loc);
35084           });
35085           if (missing.length) {
35086             missing.forEach(function(loc) {
35087               context.loadTileAtLoc(loc);
35088             });
35089             return true;
35090           }
35091         }
35092         return false;
35093       }
35094       function incompleteRelation(id2) {
35095         var entity = context.entity(id2);
35096         return entity.type === "relation" && !entity.isComplete(context.graph());
35097       }
35098     };
35099     operation.tooltip = function() {
35100       var disable = operation.disabled();
35101       return disable ? _t.append("operations.reflect." + disable + "." + multi) : _t.append("operations.reflect.description." + axis + "." + multi);
35102     };
35103     operation.annotation = function() {
35104       return _t("operations.reflect.annotation." + axis + ".feature", { n: selectedIDs.length });
35105     };
35106     operation.id = "reflect-" + axis;
35107     operation.keys = [_t("operations.reflect.key." + axis)];
35108     operation.title = _t.append("operations.reflect.title." + axis);
35109     operation.behavior = behaviorOperation(context).which(operation);
35110     return operation;
35111   }
35112
35113   // modules/operations/move.js
35114   function operationMove(context, selectedIDs) {
35115     var multi = selectedIDs.length === 1 ? "single" : "multiple";
35116     var nodes = utilGetAllNodes(selectedIDs, context.graph());
35117     var coords = nodes.map(function(n2) {
35118       return n2.loc;
35119     });
35120     var extent = utilTotalExtent(selectedIDs, context.graph());
35121     var operation = function() {
35122       context.enter(modeMove(context, selectedIDs));
35123     };
35124     operation.available = function() {
35125       return selectedIDs.length > 0;
35126     };
35127     operation.disabled = function() {
35128       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35129         return "too_large";
35130       } else if (someMissing()) {
35131         return "not_downloaded";
35132       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35133         return "connected_to_hidden";
35134       } else if (selectedIDs.some(incompleteRelation)) {
35135         return "incomplete_relation";
35136       }
35137       return false;
35138       function someMissing() {
35139         if (context.inIntro())
35140           return false;
35141         var osm = context.connection();
35142         if (osm) {
35143           var missing = coords.filter(function(loc) {
35144             return !osm.isDataLoaded(loc);
35145           });
35146           if (missing.length) {
35147             missing.forEach(function(loc) {
35148               context.loadTileAtLoc(loc);
35149             });
35150             return true;
35151           }
35152         }
35153         return false;
35154       }
35155       function incompleteRelation(id2) {
35156         var entity = context.entity(id2);
35157         return entity.type === "relation" && !entity.isComplete(context.graph());
35158       }
35159     };
35160     operation.tooltip = function() {
35161       var disable = operation.disabled();
35162       return disable ? _t.append("operations.move." + disable + "." + multi) : _t.append("operations.move.description." + multi);
35163     };
35164     operation.annotation = function() {
35165       return selectedIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.move.annotation.feature", { n: selectedIDs.length });
35166     };
35167     operation.id = "move";
35168     operation.keys = [_t("operations.move.key")];
35169     operation.title = _t.append("operations.move.title");
35170     operation.behavior = behaviorOperation(context).which(operation);
35171     operation.mouseOnly = true;
35172     return operation;
35173   }
35174
35175   // modules/modes/rotate.js
35176   function modeRotate(context, entityIDs) {
35177     var _tolerancePx = 4;
35178     var mode = {
35179       id: "rotate",
35180       button: "browse"
35181     };
35182     var keybinding = utilKeybinding("rotate");
35183     var behaviors = [
35184       behaviorEdit(context),
35185       operationCircularize(context, entityIDs).behavior,
35186       operationDelete(context, entityIDs).behavior,
35187       operationMove(context, entityIDs).behavior,
35188       operationOrthogonalize(context, entityIDs).behavior,
35189       operationReflectLong(context, entityIDs).behavior,
35190       operationReflectShort(context, entityIDs).behavior
35191     ];
35192     var annotation = entityIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.rotate.annotation.feature", { n: entityIDs.length });
35193     var _prevGraph;
35194     var _prevAngle;
35195     var _prevTransform;
35196     var _pivot;
35197     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
35198     function doRotate(d3_event) {
35199       var fn;
35200       if (context.graph() !== _prevGraph) {
35201         fn = context.perform;
35202       } else {
35203         fn = context.replace;
35204       }
35205       var projection2 = context.projection;
35206       var currTransform = projection2.transform();
35207       if (!_prevTransform || currTransform.k !== _prevTransform.k || currTransform.x !== _prevTransform.x || currTransform.y !== _prevTransform.y) {
35208         var nodes = utilGetAllNodes(entityIDs, context.graph());
35209         var points = nodes.map(function(n2) {
35210           return projection2(n2.loc);
35211         });
35212         _pivot = getPivot(points);
35213         _prevAngle = void 0;
35214       }
35215       var currMouse = context.map().mouse(d3_event);
35216       var currAngle = Math.atan2(currMouse[1] - _pivot[1], currMouse[0] - _pivot[0]);
35217       if (typeof _prevAngle === "undefined")
35218         _prevAngle = currAngle;
35219       var delta = currAngle - _prevAngle;
35220       fn(actionRotate(entityIDs, _pivot, delta, projection2));
35221       _prevTransform = currTransform;
35222       _prevAngle = currAngle;
35223       _prevGraph = context.graph();
35224     }
35225     function getPivot(points) {
35226       var _pivot2;
35227       if (points.length === 1) {
35228         _pivot2 = points[0];
35229       } else if (points.length === 2) {
35230         _pivot2 = geoVecInterp(points[0], points[1], 0.5);
35231       } else {
35232         var polygonHull = hull_default(points);
35233         if (polygonHull.length === 2) {
35234           _pivot2 = geoVecInterp(points[0], points[1], 0.5);
35235         } else {
35236           _pivot2 = centroid_default2(hull_default(points));
35237         }
35238       }
35239       return _pivot2;
35240     }
35241     function finish(d3_event) {
35242       d3_event.stopPropagation();
35243       context.replace(actionNoop(), annotation);
35244       context.enter(modeSelect(context, entityIDs));
35245     }
35246     function cancel() {
35247       if (_prevGraph)
35248         context.pop();
35249       context.enter(modeSelect(context, entityIDs));
35250     }
35251     function undone() {
35252       context.enter(modeBrowse(context));
35253     }
35254     mode.enter = function() {
35255       _prevGraph = null;
35256       context.features().forceVisible(entityIDs);
35257       behaviors.forEach(context.install);
35258       var downEvent;
35259       context.surface().on(_pointerPrefix + "down.modeRotate", function(d3_event) {
35260         downEvent = d3_event;
35261       });
35262       select_default2(window).on(_pointerPrefix + "move.modeRotate", doRotate, true).on(_pointerPrefix + "up.modeRotate", function(d3_event) {
35263         if (!downEvent)
35264           return;
35265         var mapNode = context.container().select(".main-map").node();
35266         var pointGetter = utilFastMouse(mapNode);
35267         var p1 = pointGetter(downEvent);
35268         var p2 = pointGetter(d3_event);
35269         var dist = geoVecLength(p1, p2);
35270         if (dist <= _tolerancePx)
35271           finish(d3_event);
35272         downEvent = null;
35273       }, true);
35274       context.history().on("undone.modeRotate", undone);
35275       keybinding.on("\u238B", cancel).on("\u21A9", finish);
35276       select_default2(document).call(keybinding);
35277     };
35278     mode.exit = function() {
35279       behaviors.forEach(context.uninstall);
35280       context.surface().on(_pointerPrefix + "down.modeRotate", null);
35281       select_default2(window).on(_pointerPrefix + "move.modeRotate", null, true).on(_pointerPrefix + "up.modeRotate", null, true);
35282       context.history().on("undone.modeRotate", null);
35283       select_default2(document).call(keybinding.unbind);
35284       context.features().forceVisible([]);
35285     };
35286     mode.selectedIDs = function() {
35287       if (!arguments.length)
35288         return entityIDs;
35289       return mode;
35290     };
35291     return mode;
35292   }
35293
35294   // modules/operations/rotate.js
35295   function operationRotate(context, selectedIDs) {
35296     var multi = selectedIDs.length === 1 ? "single" : "multiple";
35297     var nodes = utilGetAllNodes(selectedIDs, context.graph());
35298     var coords = nodes.map(function(n2) {
35299       return n2.loc;
35300     });
35301     var extent = utilTotalExtent(selectedIDs, context.graph());
35302     var operation = function() {
35303       context.enter(modeRotate(context, selectedIDs));
35304     };
35305     operation.available = function() {
35306       return nodes.length >= 2;
35307     };
35308     operation.disabled = function() {
35309       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35310         return "too_large";
35311       } else if (someMissing()) {
35312         return "not_downloaded";
35313       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35314         return "connected_to_hidden";
35315       } else if (selectedIDs.some(incompleteRelation)) {
35316         return "incomplete_relation";
35317       }
35318       return false;
35319       function someMissing() {
35320         if (context.inIntro())
35321           return false;
35322         var osm = context.connection();
35323         if (osm) {
35324           var missing = coords.filter(function(loc) {
35325             return !osm.isDataLoaded(loc);
35326           });
35327           if (missing.length) {
35328             missing.forEach(function(loc) {
35329               context.loadTileAtLoc(loc);
35330             });
35331             return true;
35332           }
35333         }
35334         return false;
35335       }
35336       function incompleteRelation(id2) {
35337         var entity = context.entity(id2);
35338         return entity.type === "relation" && !entity.isComplete(context.graph());
35339       }
35340     };
35341     operation.tooltip = function() {
35342       var disable = operation.disabled();
35343       return disable ? _t.append("operations.rotate." + disable + "." + multi) : _t.append("operations.rotate.description." + multi);
35344     };
35345     operation.annotation = function() {
35346       return selectedIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.rotate.annotation.feature", { n: selectedIDs.length });
35347     };
35348     operation.id = "rotate";
35349     operation.keys = [_t("operations.rotate.key")];
35350     operation.title = _t.append("operations.rotate.title");
35351     operation.behavior = behaviorOperation(context).which(operation);
35352     operation.mouseOnly = true;
35353     return operation;
35354   }
35355
35356   // modules/modes/move.js
35357   function modeMove(context, entityIDs, baseGraph) {
35358     var _tolerancePx = 4;
35359     var mode = {
35360       id: "move",
35361       button: "browse"
35362     };
35363     var keybinding = utilKeybinding("move");
35364     var behaviors = [
35365       behaviorEdit(context),
35366       operationCircularize(context, entityIDs).behavior,
35367       operationDelete(context, entityIDs).behavior,
35368       operationOrthogonalize(context, entityIDs).behavior,
35369       operationReflectLong(context, entityIDs).behavior,
35370       operationReflectShort(context, entityIDs).behavior,
35371       operationRotate(context, entityIDs).behavior
35372     ];
35373     var annotation = entityIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.move.annotation.feature", { n: entityIDs.length });
35374     var _prevGraph;
35375     var _cache4;
35376     var _origin;
35377     var _nudgeInterval;
35378     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
35379     function doMove(nudge) {
35380       nudge = nudge || [0, 0];
35381       var fn;
35382       if (_prevGraph !== context.graph()) {
35383         _cache4 = {};
35384         _origin = context.map().mouseCoordinates();
35385         fn = context.perform;
35386       } else {
35387         fn = context.overwrite;
35388       }
35389       var currMouse = context.map().mouse();
35390       var origMouse = context.projection(_origin);
35391       var delta = geoVecSubtract(geoVecSubtract(currMouse, origMouse), nudge);
35392       fn(actionMove(entityIDs, delta, context.projection, _cache4));
35393       _prevGraph = context.graph();
35394     }
35395     function startNudge(nudge) {
35396       if (_nudgeInterval)
35397         window.clearInterval(_nudgeInterval);
35398       _nudgeInterval = window.setInterval(function() {
35399         context.map().pan(nudge);
35400         doMove(nudge);
35401       }, 50);
35402     }
35403     function stopNudge() {
35404       if (_nudgeInterval) {
35405         window.clearInterval(_nudgeInterval);
35406         _nudgeInterval = null;
35407       }
35408     }
35409     function move() {
35410       doMove();
35411       var nudge = geoViewportEdge(context.map().mouse(), context.map().dimensions());
35412       if (nudge) {
35413         startNudge(nudge);
35414       } else {
35415         stopNudge();
35416       }
35417     }
35418     function finish(d3_event) {
35419       d3_event.stopPropagation();
35420       context.replace(actionNoop(), annotation);
35421       context.enter(modeSelect(context, entityIDs));
35422       stopNudge();
35423     }
35424     function cancel() {
35425       if (baseGraph) {
35426         while (context.graph() !== baseGraph)
35427           context.pop();
35428         context.enter(modeBrowse(context));
35429       } else {
35430         if (_prevGraph)
35431           context.pop();
35432         context.enter(modeSelect(context, entityIDs));
35433       }
35434       stopNudge();
35435     }
35436     function undone() {
35437       context.enter(modeBrowse(context));
35438     }
35439     mode.enter = function() {
35440       _origin = context.map().mouseCoordinates();
35441       _prevGraph = null;
35442       _cache4 = {};
35443       context.features().forceVisible(entityIDs);
35444       behaviors.forEach(context.install);
35445       var downEvent;
35446       context.surface().on(_pointerPrefix + "down.modeMove", function(d3_event) {
35447         downEvent = d3_event;
35448       });
35449       select_default2(window).on(_pointerPrefix + "move.modeMove", move, true).on(_pointerPrefix + "up.modeMove", function(d3_event) {
35450         if (!downEvent)
35451           return;
35452         var mapNode = context.container().select(".main-map").node();
35453         var pointGetter = utilFastMouse(mapNode);
35454         var p1 = pointGetter(downEvent);
35455         var p2 = pointGetter(d3_event);
35456         var dist = geoVecLength(p1, p2);
35457         if (dist <= _tolerancePx)
35458           finish(d3_event);
35459         downEvent = null;
35460       }, true);
35461       context.history().on("undone.modeMove", undone);
35462       keybinding.on("\u238B", cancel).on("\u21A9", finish);
35463       select_default2(document).call(keybinding);
35464     };
35465     mode.exit = function() {
35466       stopNudge();
35467       behaviors.forEach(function(behavior) {
35468         context.uninstall(behavior);
35469       });
35470       context.surface().on(_pointerPrefix + "down.modeMove", null);
35471       select_default2(window).on(_pointerPrefix + "move.modeMove", null, true).on(_pointerPrefix + "up.modeMove", null, true);
35472       context.history().on("undone.modeMove", null);
35473       select_default2(document).call(keybinding.unbind);
35474       context.features().forceVisible([]);
35475     };
35476     mode.selectedIDs = function() {
35477       if (!arguments.length)
35478         return entityIDs;
35479       return mode;
35480     };
35481     return mode;
35482   }
35483
35484   // modules/behavior/paste.js
35485   function behaviorPaste(context) {
35486     function doPaste(d3_event) {
35487       if (!context.map().withinEditableZoom())
35488         return;
35489       d3_event.preventDefault();
35490       var baseGraph = context.graph();
35491       var mouse = context.map().mouse();
35492       var projection2 = context.projection;
35493       var viewport = geoExtent(projection2.clipExtent()).polygon();
35494       if (!geoPointInPolygon(mouse, viewport))
35495         return;
35496       var oldIDs = context.copyIDs();
35497       if (!oldIDs.length)
35498         return;
35499       var extent = geoExtent();
35500       var oldGraph = context.copyGraph();
35501       var newIDs = [];
35502       var action = actionCopyEntities(oldIDs, oldGraph);
35503       context.perform(action);
35504       var copies = action.copies();
35505       var originals = /* @__PURE__ */ new Set();
35506       Object.values(copies).forEach(function(entity) {
35507         originals.add(entity.id);
35508       });
35509       for (var id2 in copies) {
35510         var oldEntity = oldGraph.entity(id2);
35511         var newEntity = copies[id2];
35512         extent._extend(oldEntity.extent(oldGraph));
35513         var parents = context.graph().parentWays(newEntity);
35514         var parentCopied = parents.some(function(parent) {
35515           return originals.has(parent.id);
35516         });
35517         if (!parentCopied) {
35518           newIDs.push(newEntity.id);
35519         }
35520       }
35521       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
35522       var delta = geoVecSubtract(mouse, copyPoint);
35523       context.perform(actionMove(newIDs, delta, projection2));
35524       context.enter(modeMove(context, newIDs, baseGraph));
35525     }
35526     function behavior() {
35527       context.keybinding().on(uiCmd("\u2318V"), doPaste);
35528       return behavior;
35529     }
35530     behavior.off = function() {
35531       context.keybinding().off(uiCmd("\u2318V"));
35532     };
35533     return behavior;
35534   }
35535
35536   // modules/behavior/drag.js
35537   function behaviorDrag() {
35538     var dispatch10 = dispatch_default("start", "move", "end");
35539     var _tolerancePx = 1;
35540     var _penTolerancePx = 4;
35541     var _origin = null;
35542     var _selector = "";
35543     var _targetNode;
35544     var _targetEntity;
35545     var _surface;
35546     var _pointerId;
35547     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
35548     var d3_event_userSelectProperty = utilPrefixCSSProperty("UserSelect");
35549     var d3_event_userSelectSuppress = function() {
35550       var selection2 = selection_default();
35551       var select = selection2.style(d3_event_userSelectProperty);
35552       selection2.style(d3_event_userSelectProperty, "none");
35553       return function() {
35554         selection2.style(d3_event_userSelectProperty, select);
35555       };
35556     };
35557     function pointerdown(d3_event) {
35558       if (_pointerId)
35559         return;
35560       _pointerId = d3_event.pointerId || "mouse";
35561       _targetNode = this;
35562       var pointerLocGetter = utilFastMouse(_surface || _targetNode.parentNode);
35563       var offset;
35564       var startOrigin = pointerLocGetter(d3_event);
35565       var started = false;
35566       var selectEnable = d3_event_userSelectSuppress();
35567       select_default2(window).on(_pointerPrefix + "move.drag", pointermove).on(_pointerPrefix + "up.drag pointercancel.drag", pointerup, true);
35568       if (_origin) {
35569         offset = _origin.call(_targetNode, _targetEntity);
35570         offset = [offset[0] - startOrigin[0], offset[1] - startOrigin[1]];
35571       } else {
35572         offset = [0, 0];
35573       }
35574       d3_event.stopPropagation();
35575       function pointermove(d3_event2) {
35576         if (_pointerId !== (d3_event2.pointerId || "mouse"))
35577           return;
35578         var p = pointerLocGetter(d3_event2);
35579         if (!started) {
35580           var dist = geoVecLength(startOrigin, p);
35581           var tolerance = d3_event2.pointerType === "pen" ? _penTolerancePx : _tolerancePx;
35582           if (dist < tolerance)
35583             return;
35584           started = true;
35585           dispatch10.call("start", this, d3_event2, _targetEntity);
35586         } else {
35587           startOrigin = p;
35588           d3_event2.stopPropagation();
35589           d3_event2.preventDefault();
35590           var dx = p[0] - startOrigin[0];
35591           var dy = p[1] - startOrigin[1];
35592           dispatch10.call("move", this, d3_event2, _targetEntity, [p[0] + offset[0], p[1] + offset[1]], [dx, dy]);
35593         }
35594       }
35595       function pointerup(d3_event2) {
35596         if (_pointerId !== (d3_event2.pointerId || "mouse"))
35597           return;
35598         _pointerId = null;
35599         if (started) {
35600           dispatch10.call("end", this, d3_event2, _targetEntity);
35601           d3_event2.preventDefault();
35602         }
35603         select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
35604         selectEnable();
35605       }
35606     }
35607     function behavior(selection2) {
35608       var matchesSelector = utilPrefixDOMProperty("matchesSelector");
35609       var delegate = pointerdown;
35610       if (_selector) {
35611         delegate = function(d3_event) {
35612           var root3 = this;
35613           var target = d3_event.target;
35614           for (; target && target !== root3; target = target.parentNode) {
35615             var datum2 = target.__data__;
35616             _targetEntity = datum2 instanceof osmNote ? datum2 : datum2 && datum2.properties && datum2.properties.entity;
35617             if (_targetEntity && target[matchesSelector](_selector)) {
35618               return pointerdown.call(target, d3_event);
35619             }
35620           }
35621         };
35622       }
35623       selection2.on(_pointerPrefix + "down.drag" + _selector, delegate);
35624     }
35625     behavior.off = function(selection2) {
35626       selection2.on(_pointerPrefix + "down.drag" + _selector, null);
35627     };
35628     behavior.selector = function(_) {
35629       if (!arguments.length)
35630         return _selector;
35631       _selector = _;
35632       return behavior;
35633     };
35634     behavior.origin = function(_) {
35635       if (!arguments.length)
35636         return _origin;
35637       _origin = _;
35638       return behavior;
35639     };
35640     behavior.cancel = function() {
35641       select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
35642       return behavior;
35643     };
35644     behavior.targetNode = function(_) {
35645       if (!arguments.length)
35646         return _targetNode;
35647       _targetNode = _;
35648       return behavior;
35649     };
35650     behavior.targetEntity = function(_) {
35651       if (!arguments.length)
35652         return _targetEntity;
35653       _targetEntity = _;
35654       return behavior;
35655     };
35656     behavior.surface = function(_) {
35657       if (!arguments.length)
35658         return _surface;
35659       _surface = _;
35660       return behavior;
35661     };
35662     return utilRebind(behavior, dispatch10, "on");
35663   }
35664
35665   // modules/modes/drag_node.js
35666   function modeDragNode(context) {
35667     var mode = {
35668       id: "drag-node",
35669       button: "browse"
35670     };
35671     var hover = behaviorHover(context).altDisables(true).on("hover", context.ui().sidebar.hover);
35672     var edit2 = behaviorEdit(context);
35673     var _nudgeInterval;
35674     var _restoreSelectedIDs = [];
35675     var _wasMidpoint = false;
35676     var _isCancelled = false;
35677     var _activeEntity;
35678     var _startLoc;
35679     var _lastLoc;
35680     function startNudge(d3_event, entity, nudge) {
35681       if (_nudgeInterval)
35682         window.clearInterval(_nudgeInterval);
35683       _nudgeInterval = window.setInterval(function() {
35684         context.map().pan(nudge);
35685         doMove(d3_event, entity, nudge);
35686       }, 50);
35687     }
35688     function stopNudge() {
35689       if (_nudgeInterval) {
35690         window.clearInterval(_nudgeInterval);
35691         _nudgeInterval = null;
35692       }
35693     }
35694     function moveAnnotation(entity) {
35695       return _t("operations.move.annotation." + entity.geometry(context.graph()));
35696     }
35697     function connectAnnotation(nodeEntity, targetEntity) {
35698       var nodeGeometry = nodeEntity.geometry(context.graph());
35699       var targetGeometry = targetEntity.geometry(context.graph());
35700       if (nodeGeometry === "vertex" && targetGeometry === "vertex") {
35701         var nodeParentWayIDs = context.graph().parentWays(nodeEntity);
35702         var targetParentWayIDs = context.graph().parentWays(targetEntity);
35703         var sharedParentWays = utilArrayIntersection(nodeParentWayIDs, targetParentWayIDs);
35704         if (sharedParentWays.length !== 0) {
35705           if (sharedParentWays[0].areAdjacent(nodeEntity.id, targetEntity.id)) {
35706             return _t("operations.connect.annotation.from_vertex.to_adjacent_vertex");
35707           }
35708           return _t("operations.connect.annotation.from_vertex.to_sibling_vertex");
35709         }
35710       }
35711       return _t("operations.connect.annotation.from_" + nodeGeometry + ".to_" + targetGeometry);
35712     }
35713     function shouldSnapToNode(target) {
35714       if (!_activeEntity)
35715         return false;
35716       return _activeEntity.geometry(context.graph()) !== "vertex" || (target.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(target, context.graph()));
35717     }
35718     function origin(entity) {
35719       return context.projection(entity.loc);
35720     }
35721     function keydown(d3_event) {
35722       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
35723         if (context.surface().classed("nope")) {
35724           context.surface().classed("nope-suppressed", true);
35725         }
35726         context.surface().classed("nope", false).classed("nope-disabled", true);
35727       }
35728     }
35729     function keyup(d3_event) {
35730       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
35731         if (context.surface().classed("nope-suppressed")) {
35732           context.surface().classed("nope", true);
35733         }
35734         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
35735       }
35736     }
35737     function start2(d3_event, entity) {
35738       _wasMidpoint = entity.type === "midpoint";
35739       var hasHidden = context.features().hasHiddenConnections(entity, context.graph());
35740       _isCancelled = !context.editable() || d3_event.shiftKey || hasHidden;
35741       if (_isCancelled) {
35742         if (hasHidden) {
35743           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("modes.drag_node.connected_to_hidden"))();
35744         }
35745         return drag.cancel();
35746       }
35747       if (_wasMidpoint) {
35748         var midpoint = entity;
35749         entity = osmNode();
35750         context.perform(actionAddMidpoint(midpoint, entity));
35751         entity = context.entity(entity.id);
35752         var vertex = context.surface().selectAll("." + entity.id);
35753         drag.targetNode(vertex.node()).targetEntity(entity);
35754       } else {
35755         context.perform(actionNoop());
35756       }
35757       _activeEntity = entity;
35758       _startLoc = entity.loc;
35759       hover.ignoreVertex(entity.geometry(context.graph()) === "vertex");
35760       context.surface().selectAll("." + _activeEntity.id).classed("active", true);
35761       context.enter(mode);
35762     }
35763     function datum2(d3_event) {
35764       if (!d3_event || d3_event.altKey) {
35765         return {};
35766       } else {
35767         var d = d3_event.target.__data__;
35768         return d && d.properties && d.properties.target ? d : {};
35769       }
35770     }
35771     function doMove(d3_event, entity, nudge) {
35772       nudge = nudge || [0, 0];
35773       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
35774       var currMouse = geoVecSubtract(currPoint, nudge);
35775       var loc = context.projection.invert(currMouse);
35776       var target, edge;
35777       if (!_nudgeInterval) {
35778         var d = datum2(d3_event);
35779         target = d && d.properties && d.properties.entity;
35780         var targetLoc = target && target.loc;
35781         var targetNodes = d && d.properties && d.properties.nodes;
35782         if (targetLoc) {
35783           if (shouldSnapToNode(target)) {
35784             loc = targetLoc;
35785           }
35786         } else if (targetNodes) {
35787           edge = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, end.id);
35788           if (edge) {
35789             loc = edge.loc;
35790           }
35791         }
35792       }
35793       context.replace(
35794         actionMoveNode(entity.id, loc)
35795       );
35796       var isInvalid = false;
35797       if (target) {
35798         isInvalid = hasRelationConflict(entity, target, edge, context.graph());
35799       }
35800       if (!isInvalid) {
35801         isInvalid = hasInvalidGeometry(entity, context.graph());
35802       }
35803       var nope = context.surface().classed("nope");
35804       if (isInvalid === "relation" || isInvalid === "restriction") {
35805         if (!nope) {
35806           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(
35807             "operations.connect." + isInvalid,
35808             { relation: _mainPresetIndex.item("type/restriction").name() }
35809           ))();
35810         }
35811       } else if (isInvalid) {
35812         var errorID = isInvalid === "line" ? "lines" : "areas";
35813         context.ui().flash.duration(3e3).iconName("#iD-icon-no").label(_t.append("self_intersection.error." + errorID))();
35814       } else {
35815         if (nope) {
35816           context.ui().flash.duration(1).label("")();
35817         }
35818       }
35819       var nopeDisabled = context.surface().classed("nope-disabled");
35820       if (nopeDisabled) {
35821         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
35822       } else {
35823         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
35824       }
35825       _lastLoc = loc;
35826     }
35827     function hasRelationConflict(entity, target, edge, graph) {
35828       var testGraph = graph.update();
35829       if (edge) {
35830         var midpoint = osmNode();
35831         var action = actionAddMidpoint({
35832           loc: edge.loc,
35833           edge: [target.nodes[edge.index - 1], target.nodes[edge.index]]
35834         }, midpoint);
35835         testGraph = action(testGraph);
35836         target = midpoint;
35837       }
35838       var ids = [entity.id, target.id];
35839       return actionConnect(ids).disabled(testGraph);
35840     }
35841     function hasInvalidGeometry(entity, graph) {
35842       var parents = graph.parentWays(entity);
35843       var i2, j2, k;
35844       for (i2 = 0; i2 < parents.length; i2++) {
35845         var parent = parents[i2];
35846         var nodes = [];
35847         var activeIndex = null;
35848         var relations = graph.parentRelations(parent);
35849         for (j2 = 0; j2 < relations.length; j2++) {
35850           if (!relations[j2].isMultipolygon())
35851             continue;
35852           var rings = osmJoinWays(relations[j2].members, graph);
35853           for (k = 0; k < rings.length; k++) {
35854             nodes = rings[k].nodes;
35855             if (nodes.find(function(n2) {
35856               return n2.id === entity.id;
35857             })) {
35858               activeIndex = k;
35859               if (geoHasSelfIntersections(nodes, entity.id)) {
35860                 return "multipolygonMember";
35861               }
35862             }
35863             rings[k].coords = nodes.map(function(n2) {
35864               return n2.loc;
35865             });
35866           }
35867           for (k = 0; k < rings.length; k++) {
35868             if (k === activeIndex)
35869               continue;
35870             if (geoHasLineIntersections(rings[activeIndex].nodes, rings[k].nodes, entity.id)) {
35871               return "multipolygonRing";
35872             }
35873           }
35874         }
35875         if (activeIndex === null) {
35876           nodes = parent.nodes.map(function(nodeID) {
35877             return graph.entity(nodeID);
35878           });
35879           if (nodes.length && geoHasSelfIntersections(nodes, entity.id)) {
35880             return parent.geometry(graph);
35881           }
35882         }
35883       }
35884       return false;
35885     }
35886     function move(d3_event, entity, point2) {
35887       if (_isCancelled)
35888         return;
35889       d3_event.stopPropagation();
35890       context.surface().classed("nope-disabled", d3_event.altKey);
35891       _lastLoc = context.projection.invert(point2);
35892       doMove(d3_event, entity);
35893       var nudge = geoViewportEdge(point2, context.map().dimensions());
35894       if (nudge) {
35895         startNudge(d3_event, entity, nudge);
35896       } else {
35897         stopNudge();
35898       }
35899     }
35900     function end(d3_event, entity) {
35901       if (_isCancelled)
35902         return;
35903       var wasPoint = entity.geometry(context.graph()) === "point";
35904       var d = datum2(d3_event);
35905       var nope = d && d.properties && d.properties.nope || context.surface().classed("nope");
35906       var target = d && d.properties && d.properties.entity;
35907       if (nope) {
35908         context.perform(
35909           _actionBounceBack(entity.id, _startLoc)
35910         );
35911       } else if (target && target.type === "way") {
35912         var choice = geoChooseEdge(context.graph().childNodes(target), context.map().mouse(), context.projection, entity.id);
35913         context.replace(
35914           actionAddMidpoint({
35915             loc: choice.loc,
35916             edge: [target.nodes[choice.index - 1], target.nodes[choice.index]]
35917           }, entity),
35918           connectAnnotation(entity, target)
35919         );
35920       } else if (target && target.type === "node" && shouldSnapToNode(target)) {
35921         context.replace(
35922           actionConnect([target.id, entity.id]),
35923           connectAnnotation(entity, target)
35924         );
35925       } else if (_wasMidpoint) {
35926         context.replace(
35927           actionNoop(),
35928           _t("operations.add.annotation.vertex")
35929         );
35930       } else {
35931         context.replace(
35932           actionNoop(),
35933           moveAnnotation(entity)
35934         );
35935       }
35936       if (wasPoint) {
35937         context.enter(modeSelect(context, [entity.id]));
35938       } else {
35939         var reselection = _restoreSelectedIDs.filter(function(id2) {
35940           return context.graph().hasEntity(id2);
35941         });
35942         if (reselection.length) {
35943           context.enter(modeSelect(context, reselection));
35944         } else {
35945           context.enter(modeBrowse(context));
35946         }
35947       }
35948     }
35949     function _actionBounceBack(nodeID, toLoc) {
35950       var moveNode = actionMoveNode(nodeID, toLoc);
35951       var action = function(graph, t) {
35952         if (t === 1)
35953           context.pop();
35954         return moveNode(graph, t);
35955       };
35956       action.transitionable = true;
35957       return action;
35958     }
35959     function cancel() {
35960       drag.cancel();
35961       context.enter(modeBrowse(context));
35962     }
35963     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);
35964     mode.enter = function() {
35965       context.install(hover);
35966       context.install(edit2);
35967       select_default2(window).on("keydown.dragNode", keydown).on("keyup.dragNode", keyup);
35968       context.history().on("undone.drag-node", cancel);
35969     };
35970     mode.exit = function() {
35971       context.ui().sidebar.hover.cancel();
35972       context.uninstall(hover);
35973       context.uninstall(edit2);
35974       select_default2(window).on("keydown.dragNode", null).on("keyup.dragNode", null);
35975       context.history().on("undone.drag-node", null);
35976       _activeEntity = null;
35977       context.surface().classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false).selectAll(".active").classed("active", false);
35978       stopNudge();
35979     };
35980     mode.selectedIDs = function() {
35981       if (!arguments.length)
35982         return _activeEntity ? [_activeEntity.id] : [];
35983       return mode;
35984     };
35985     mode.activeID = function() {
35986       if (!arguments.length)
35987         return _activeEntity && _activeEntity.id;
35988       return mode;
35989     };
35990     mode.restoreSelectedIDs = function(_) {
35991       if (!arguments.length)
35992         return _restoreSelectedIDs;
35993       _restoreSelectedIDs = _;
35994       return mode;
35995     };
35996     mode.behavior = drag;
35997     return mode;
35998   }
35999
36000   // modules/services/keepRight.js
36001   var import_rbush = __toESM(require_rbush_min());
36002
36003   // node_modules/d3-fetch/src/text.js
36004   function responseText(response) {
36005     if (!response.ok)
36006       throw new Error(response.status + " " + response.statusText);
36007     return response.text();
36008   }
36009   function text_default3(input, init2) {
36010     return fetch(input, init2).then(responseText);
36011   }
36012
36013   // node_modules/d3-fetch/src/json.js
36014   function responseJson(response) {
36015     if (!response.ok)
36016       throw new Error(response.status + " " + response.statusText);
36017     if (response.status === 204 || response.status === 205)
36018       return;
36019     return response.json();
36020   }
36021   function json_default(input, init2) {
36022     return fetch(input, init2).then(responseJson);
36023   }
36024
36025   // node_modules/d3-fetch/src/xml.js
36026   function parser(type2) {
36027     return (input, init2) => text_default3(input, init2).then((text2) => new DOMParser().parseFromString(text2, type2));
36028   }
36029   var xml_default = parser("application/xml");
36030   var html = parser("text/html");
36031   var svg = parser("image/svg+xml");
36032
36033   // modules/services/keepRight.js
36034   var tiler = utilTiler();
36035   var dispatch2 = dispatch_default("loaded");
36036   var _tileZoom = 14;
36037   var _krUrlRoot = "https://www.keepright.at";
36038   var _krData = { errorTypes: {}, localizeStrings: {} };
36039   var _cache;
36040   var _krRuleset = [
36041     // no 20 - multiple node on same spot - these are mostly boundaries overlapping roads
36042     30,
36043     40,
36044     50,
36045     60,
36046     70,
36047     90,
36048     100,
36049     110,
36050     120,
36051     130,
36052     150,
36053     160,
36054     170,
36055     180,
36056     190,
36057     191,
36058     192,
36059     193,
36060     194,
36061     195,
36062     196,
36063     197,
36064     198,
36065     200,
36066     201,
36067     202,
36068     203,
36069     204,
36070     205,
36071     206,
36072     207,
36073     208,
36074     210,
36075     220,
36076     230,
36077     231,
36078     232,
36079     270,
36080     280,
36081     281,
36082     282,
36083     283,
36084     284,
36085     285,
36086     290,
36087     291,
36088     292,
36089     293,
36090     294,
36091     295,
36092     296,
36093     297,
36094     298,
36095     300,
36096     310,
36097     311,
36098     312,
36099     313,
36100     320,
36101     350,
36102     360,
36103     370,
36104     380,
36105     390,
36106     400,
36107     401,
36108     402,
36109     410,
36110     411,
36111     412,
36112     413
36113   ];
36114   function abortRequest(controller) {
36115     if (controller) {
36116       controller.abort();
36117     }
36118   }
36119   function abortUnwantedRequests(cache, tiles) {
36120     Object.keys(cache.inflightTile).forEach((k) => {
36121       const wanted = tiles.find((tile) => k === tile.id);
36122       if (!wanted) {
36123         abortRequest(cache.inflightTile[k]);
36124         delete cache.inflightTile[k];
36125       }
36126     });
36127   }
36128   function encodeIssueRtree(d) {
36129     return { minX: d.loc[0], minY: d.loc[1], maxX: d.loc[0], maxY: d.loc[1], data: d };
36130   }
36131   function updateRtree(item, replace) {
36132     _cache.rtree.remove(item, (a, b) => a.data.id === b.data.id);
36133     if (replace) {
36134       _cache.rtree.insert(item);
36135     }
36136   }
36137   function tokenReplacements(d) {
36138     if (!(d instanceof QAItem))
36139       return;
36140     const replacements = {};
36141     const issueTemplate = _krData.errorTypes[d.whichType];
36142     if (!issueTemplate) {
36143       console.log("No Template: ", d.whichType);
36144       console.log("  ", d.description);
36145       return;
36146     }
36147     if (!issueTemplate.regex)
36148       return;
36149     const errorRegex = new RegExp(issueTemplate.regex, "i");
36150     const errorMatch = errorRegex.exec(d.description);
36151     if (!errorMatch) {
36152       console.log("Unmatched: ", d.whichType);
36153       console.log("  ", d.description);
36154       console.log("  ", errorRegex);
36155       return;
36156     }
36157     for (let i2 = 1; i2 < errorMatch.length; i2++) {
36158       let capture = errorMatch[i2];
36159       let idType;
36160       idType = "IDs" in issueTemplate ? issueTemplate.IDs[i2 - 1] : "";
36161       if (idType && capture) {
36162         capture = parseError(capture, idType);
36163       } else {
36164         const compare = capture.toLowerCase();
36165         if (_krData.localizeStrings[compare]) {
36166           capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare]);
36167         } else {
36168           capture = unescape_default(capture);
36169         }
36170       }
36171       replacements["var" + i2] = capture;
36172     }
36173     return replacements;
36174   }
36175   function parseError(capture, idType) {
36176     const compare = capture.toLowerCase();
36177     if (_krData.localizeStrings[compare]) {
36178       capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare]);
36179     }
36180     switch (idType) {
36181       case "this":
36182         capture = linkErrorObject2(capture);
36183         break;
36184       case "url":
36185         capture = linkURL(capture);
36186         break;
36187       case "n":
36188       case "w":
36189       case "r":
36190         capture = linkEntity2(idType + capture);
36191         break;
36192       case "20":
36193         capture = parse20(capture);
36194         break;
36195       case "211":
36196         capture = parse211(capture);
36197         break;
36198       case "231":
36199         capture = parse231(capture);
36200         break;
36201       case "294":
36202         capture = parse294(capture);
36203         break;
36204       case "370":
36205         capture = parse370(capture);
36206         break;
36207     }
36208     return capture;
36209     function linkErrorObject2(d) {
36210       return { html: `<a class="error_object_link">${d}</a>` };
36211     }
36212     function linkEntity2(d) {
36213       return { html: `<a class="error_entity_link">${d}</a>` };
36214     }
36215     function linkURL(d) {
36216       return { html: `<a class="kr_external_link" target="_blank" href="${d}">${d}</a>` };
36217     }
36218     function parse211(capture2) {
36219       let newList = [];
36220       const items = capture2.split(", ");
36221       items.forEach((item) => {
36222         let id2 = linkEntity2("n" + item.slice(1));
36223         newList.push(id2);
36224       });
36225       return newList.join(", ");
36226     }
36227     function parse231(capture2) {
36228       let newList = [];
36229       const items = capture2.split("),");
36230       items.forEach((item) => {
36231         const match = item.match(/\#(\d+)\((.+)\)?/);
36232         if (match !== null && match.length > 2) {
36233           newList.push(
36234             linkEntity2("w" + match[1]) + " " + _t("QA.keepRight.errorTypes.231.layer", { layer: match[2] })
36235           );
36236         }
36237       });
36238       return newList.join(", ");
36239     }
36240     function parse294(capture2) {
36241       let newList = [];
36242       const items = capture2.split(",");
36243       items.forEach((item) => {
36244         item = item.split(" ");
36245         const role = `"${item[0]}"`;
36246         const idType2 = item[1].slice(0, 1);
36247         let id2 = item[2].slice(1);
36248         id2 = linkEntity2(idType2 + id2);
36249         newList.push(`${role} ${item[1]} ${id2}`);
36250       });
36251       return newList.join(", ");
36252     }
36253     function parse370(capture2) {
36254       if (!capture2)
36255         return "";
36256       const match = capture2.match(/\(including the name (\'.+\')\)/);
36257       if (match && match.length) {
36258         return _t("QA.keepRight.errorTypes.370.including_the_name", { name: match[1] });
36259       }
36260       return "";
36261     }
36262     function parse20(capture2) {
36263       let newList = [];
36264       const items = capture2.split(",");
36265       items.forEach((item) => {
36266         const id2 = linkEntity2("n" + item.slice(1));
36267         newList.push(id2);
36268       });
36269       return newList.join(", ");
36270     }
36271   }
36272   var keepRight_default = {
36273     title: "keepRight",
36274     init() {
36275       _mainFileFetcher.get("keepRight").then((d) => _krData = d);
36276       if (!_cache) {
36277         this.reset();
36278       }
36279       this.event = utilRebind(this, dispatch2, "on");
36280     },
36281     reset() {
36282       if (_cache) {
36283         Object.values(_cache.inflightTile).forEach(abortRequest);
36284       }
36285       _cache = {
36286         data: {},
36287         loadedTile: {},
36288         inflightTile: {},
36289         inflightPost: {},
36290         closed: {},
36291         rtree: new import_rbush.default()
36292       };
36293     },
36294     // KeepRight API:  http://osm.mueschelsoft.de/keepright/interfacing.php
36295     loadIssues(projection2) {
36296       const options2 = {
36297         format: "geojson",
36298         ch: _krRuleset
36299       };
36300       const tiles = tiler.zoomExtent([_tileZoom, _tileZoom]).getTiles(projection2);
36301       abortUnwantedRequests(_cache, tiles);
36302       tiles.forEach((tile) => {
36303         if (_cache.loadedTile[tile.id] || _cache.inflightTile[tile.id])
36304           return;
36305         const [left, top, right, bottom] = tile.extent.rectangle();
36306         const params = Object.assign({}, options2, { left, bottom, right, top });
36307         const url = `${_krUrlRoot}/export.php?` + utilQsString(params);
36308         const controller = new AbortController();
36309         _cache.inflightTile[tile.id] = controller;
36310         json_default(url, { signal: controller.signal }).then((data) => {
36311           delete _cache.inflightTile[tile.id];
36312           _cache.loadedTile[tile.id] = true;
36313           if (!data || !data.features || !data.features.length) {
36314             throw new Error("No Data");
36315           }
36316           data.features.forEach((feature3) => {
36317             const {
36318               properties: {
36319                 error_type: itemType,
36320                 error_id: id2,
36321                 comment = null,
36322                 object_id: objectId,
36323                 object_type: objectType,
36324                 schema,
36325                 title
36326               }
36327             } = feature3;
36328             let {
36329               geometry: { coordinates: loc },
36330               properties: { description = "" }
36331             } = feature3;
36332             const issueTemplate = _krData.errorTypes[itemType];
36333             const parentIssueType = (Math.floor(itemType / 10) * 10).toString();
36334             const whichType = issueTemplate ? itemType : parentIssueType;
36335             const whichTemplate = _krData.errorTypes[whichType];
36336             switch (whichType) {
36337               case "170":
36338                 description = `This feature has a FIXME tag: ${description}`;
36339                 break;
36340               case "292":
36341               case "293":
36342                 description = description.replace("A turn-", "This turn-");
36343                 break;
36344               case "294":
36345               case "295":
36346               case "296":
36347               case "297":
36348               case "298":
36349                 description = `This turn-restriction~${description}`;
36350                 break;
36351               case "300":
36352                 description = "This highway is missing a maxspeed tag";
36353                 break;
36354               case "411":
36355               case "412":
36356               case "413":
36357                 description = `This feature~${description}`;
36358                 break;
36359             }
36360             let coincident = false;
36361             do {
36362               let delta = coincident ? [1e-5, 0] : [0, 1e-5];
36363               loc = geoVecAdd(loc, delta);
36364               let bbox2 = geoExtent(loc).bbox();
36365               coincident = _cache.rtree.search(bbox2).length;
36366             } while (coincident);
36367             let d = new QAItem(loc, this, itemType, id2, {
36368               comment,
36369               description,
36370               whichType,
36371               parentIssueType,
36372               severity: whichTemplate.severity || "error",
36373               objectId,
36374               objectType,
36375               schema,
36376               title
36377             });
36378             d.replacements = tokenReplacements(d);
36379             _cache.data[id2] = d;
36380             _cache.rtree.insert(encodeIssueRtree(d));
36381           });
36382           dispatch2.call("loaded");
36383         }).catch(() => {
36384           delete _cache.inflightTile[tile.id];
36385           _cache.loadedTile[tile.id] = true;
36386         });
36387       });
36388     },
36389     postUpdate(d, callback) {
36390       if (_cache.inflightPost[d.id]) {
36391         return callback({ message: "Error update already inflight", status: -2 }, d);
36392       }
36393       const params = { schema: d.schema, id: d.id };
36394       if (d.newStatus) {
36395         params.st = d.newStatus;
36396       }
36397       if (d.newComment !== void 0) {
36398         params.co = d.newComment;
36399       }
36400       const url = `${_krUrlRoot}/comment.php?` + utilQsString(params);
36401       const controller = new AbortController();
36402       _cache.inflightPost[d.id] = controller;
36403       json_default(url, { signal: controller.signal }).finally(() => {
36404         delete _cache.inflightPost[d.id];
36405         if (d.newStatus === "ignore") {
36406           this.removeItem(d);
36407         } else if (d.newStatus === "ignore_t") {
36408           this.removeItem(d);
36409           _cache.closed[`${d.schema}:${d.id}`] = true;
36410         } else {
36411           d = this.replaceItem(d.update({
36412             comment: d.newComment,
36413             newComment: void 0,
36414             newState: void 0
36415           }));
36416         }
36417         if (callback)
36418           callback(null, d);
36419       });
36420     },
36421     // Get all cached QAItems covering the viewport
36422     getItems(projection2) {
36423       const viewport = projection2.clipExtent();
36424       const min3 = [viewport[0][0], viewport[1][1]];
36425       const max3 = [viewport[1][0], viewport[0][1]];
36426       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
36427       return _cache.rtree.search(bbox2).map((d) => d.data);
36428     },
36429     // Get a QAItem from cache
36430     // NOTE: Don't change method name until UI v3 is merged
36431     getError(id2) {
36432       return _cache.data[id2];
36433     },
36434     // Replace a single QAItem in the cache
36435     replaceItem(item) {
36436       if (!(item instanceof QAItem) || !item.id)
36437         return;
36438       _cache.data[item.id] = item;
36439       updateRtree(encodeIssueRtree(item), true);
36440       return item;
36441     },
36442     // Remove a single QAItem from the cache
36443     removeItem(item) {
36444       if (!(item instanceof QAItem) || !item.id)
36445         return;
36446       delete _cache.data[item.id];
36447       updateRtree(encodeIssueRtree(item), false);
36448     },
36449     issueURL(item) {
36450       return `${_krUrlRoot}/report_map.php?schema=${item.schema}&error=${item.id}`;
36451     },
36452     // Get an array of issues closed during this session.
36453     // Used to populate `closed:keepright` changeset tag
36454     getClosedIDs() {
36455       return Object.keys(_cache.closed).sort();
36456     }
36457   };
36458
36459   // modules/services/improveOSM.js
36460   var import_rbush2 = __toESM(require_rbush_min());
36461   var tiler2 = utilTiler();
36462   var dispatch3 = dispatch_default("loaded");
36463   var _tileZoom2 = 14;
36464   var _impOsmUrls = {
36465     ow: "https://grab.community.improve-osm.org/directionOfFlowService",
36466     mr: "https://grab.community.improve-osm.org/missingGeoService",
36467     tr: "https://grab.community.improve-osm.org/turnRestrictionService"
36468   };
36469   var _impOsmData = { icons: {} };
36470   var _cache2;
36471   function abortRequest2(i2) {
36472     Object.values(i2).forEach((controller) => {
36473       if (controller) {
36474         controller.abort();
36475       }
36476     });
36477   }
36478   function abortUnwantedRequests2(cache, tiles) {
36479     Object.keys(cache.inflightTile).forEach((k) => {
36480       const wanted = tiles.find((tile) => k === tile.id);
36481       if (!wanted) {
36482         abortRequest2(cache.inflightTile[k]);
36483         delete cache.inflightTile[k];
36484       }
36485     });
36486   }
36487   function encodeIssueRtree2(d) {
36488     return { minX: d.loc[0], minY: d.loc[1], maxX: d.loc[0], maxY: d.loc[1], data: d };
36489   }
36490   function updateRtree2(item, replace) {
36491     _cache2.rtree.remove(item, (a, b) => a.data.id === b.data.id);
36492     if (replace) {
36493       _cache2.rtree.insert(item);
36494     }
36495   }
36496   function linkErrorObject(d) {
36497     return { html: `<a class="error_object_link">${d}</a>` };
36498   }
36499   function linkEntity(d) {
36500     return { html: `<a class="error_entity_link">${d}</a>` };
36501   }
36502   function pointAverage(points) {
36503     if (points.length) {
36504       const sum = points.reduce(
36505         (acc, point2) => geoVecAdd(acc, [point2.lon, point2.lat]),
36506         [0, 0]
36507       );
36508       return geoVecScale(sum, 1 / points.length);
36509     } else {
36510       return [0, 0];
36511     }
36512   }
36513   function relativeBearing(p1, p2) {
36514     let angle2 = Math.atan2(p2.lon - p1.lon, p2.lat - p1.lat);
36515     if (angle2 < 0) {
36516       angle2 += 2 * Math.PI;
36517     }
36518     return angle2 * 180 / Math.PI;
36519   }
36520   function cardinalDirection(bearing) {
36521     const dir = 45 * Math.round(bearing / 45);
36522     const compass = {
36523       0: "north",
36524       45: "northeast",
36525       90: "east",
36526       135: "southeast",
36527       180: "south",
36528       225: "southwest",
36529       270: "west",
36530       315: "northwest",
36531       360: "north"
36532     };
36533     return _t(`QA.improveOSM.directions.${compass[dir]}`);
36534   }
36535   function preventCoincident(loc, bumpUp) {
36536     let coincident = false;
36537     do {
36538       let delta = coincident ? [1e-5, 0] : bumpUp ? [0, 1e-5] : [0, 0];
36539       loc = geoVecAdd(loc, delta);
36540       let bbox2 = geoExtent(loc).bbox();
36541       coincident = _cache2.rtree.search(bbox2).length;
36542     } while (coincident);
36543     return loc;
36544   }
36545   var improveOSM_default = {
36546     title: "improveOSM",
36547     init() {
36548       _mainFileFetcher.get("qa_data").then((d) => _impOsmData = d.improveOSM);
36549       if (!_cache2) {
36550         this.reset();
36551       }
36552       this.event = utilRebind(this, dispatch3, "on");
36553     },
36554     reset() {
36555       if (_cache2) {
36556         Object.values(_cache2.inflightTile).forEach(abortRequest2);
36557       }
36558       _cache2 = {
36559         data: {},
36560         loadedTile: {},
36561         inflightTile: {},
36562         inflightPost: {},
36563         closed: {},
36564         rtree: new import_rbush2.default()
36565       };
36566     },
36567     loadIssues(projection2) {
36568       const options2 = {
36569         client: "iD",
36570         status: "OPEN",
36571         zoom: "19"
36572         // Use a high zoom so that clusters aren't returned
36573       };
36574       const tiles = tiler2.zoomExtent([_tileZoom2, _tileZoom2]).getTiles(projection2);
36575       abortUnwantedRequests2(_cache2, tiles);
36576       tiles.forEach((tile) => {
36577         if (_cache2.loadedTile[tile.id] || _cache2.inflightTile[tile.id])
36578           return;
36579         const [east, north, west, south] = tile.extent.rectangle();
36580         const params = Object.assign({}, options2, { east, south, west, north });
36581         const requests = {};
36582         Object.keys(_impOsmUrls).forEach((k) => {
36583           const kParams = Object.assign(
36584             {},
36585             params,
36586             k === "mr" ? { type: "PARKING,ROAD,BOTH,PATH" } : { confidenceLevel: "C1" }
36587           );
36588           const url = `${_impOsmUrls[k]}/search?` + utilQsString(kParams);
36589           const controller = new AbortController();
36590           requests[k] = controller;
36591           json_default(url, { signal: controller.signal }).then((data) => {
36592             delete _cache2.inflightTile[tile.id][k];
36593             if (!Object.keys(_cache2.inflightTile[tile.id]).length) {
36594               delete _cache2.inflightTile[tile.id];
36595               _cache2.loadedTile[tile.id] = true;
36596             }
36597             if (data.roadSegments) {
36598               data.roadSegments.forEach((feature3) => {
36599                 const { points, wayId, fromNodeId, toNodeId } = feature3;
36600                 const itemId = `${wayId}${fromNodeId}${toNodeId}`;
36601                 let mid = points.length / 2;
36602                 let loc;
36603                 if (mid % 1 === 0) {
36604                   loc = pointAverage([points[mid - 1], points[mid]]);
36605                 } else {
36606                   mid = points[Math.floor(mid)];
36607                   loc = [mid.lon, mid.lat];
36608                 }
36609                 loc = preventCoincident(loc, false);
36610                 let d = new QAItem(loc, this, k, itemId, {
36611                   issueKey: k,
36612                   // used as a category
36613                   identifier: {
36614                     // used to post changes
36615                     wayId,
36616                     fromNodeId,
36617                     toNodeId
36618                   },
36619                   objectId: wayId,
36620                   objectType: "way"
36621                 });
36622                 d.replacements = {
36623                   percentage: feature3.percentOfTrips,
36624                   num_trips: feature3.numberOfTrips,
36625                   highway: linkErrorObject(_t("QA.keepRight.error_parts.highway")),
36626                   from_node: linkEntity("n" + feature3.fromNodeId),
36627                   to_node: linkEntity("n" + feature3.toNodeId)
36628                 };
36629                 _cache2.data[d.id] = d;
36630                 _cache2.rtree.insert(encodeIssueRtree2(d));
36631               });
36632             }
36633             if (data.tiles) {
36634               data.tiles.forEach((feature3) => {
36635                 const { type: type2, x, y, numberOfTrips } = feature3;
36636                 const geoType = type2.toLowerCase();
36637                 const itemId = `${geoType}${x}${y}${numberOfTrips}`;
36638                 let loc = pointAverage(feature3.points);
36639                 loc = preventCoincident(loc, false);
36640                 let d = new QAItem(loc, this, `${k}-${geoType}`, itemId, {
36641                   issueKey: k,
36642                   identifier: { x, y }
36643                 });
36644                 d.replacements = {
36645                   num_trips: numberOfTrips,
36646                   geometry_type: _t(`QA.improveOSM.geometry_types.${geoType}`)
36647                 };
36648                 if (numberOfTrips === -1) {
36649                   d.desc = _t("QA.improveOSM.error_types.mr.description_alt", d.replacements);
36650                 }
36651                 _cache2.data[d.id] = d;
36652                 _cache2.rtree.insert(encodeIssueRtree2(d));
36653               });
36654             }
36655             if (data.entities) {
36656               data.entities.forEach((feature3) => {
36657                 const { point: point2, id: id2, segments, numberOfPasses, turnType } = feature3;
36658                 const itemId = `${id2.replace(/[,:+#]/g, "_")}`;
36659                 const loc = preventCoincident([point2.lon, point2.lat], true);
36660                 const ids = id2.split(",");
36661                 const from_way = ids[0];
36662                 const via_node = ids[3];
36663                 const to_way = ids[2].split(":")[1];
36664                 let d = new QAItem(loc, this, k, itemId, {
36665                   issueKey: k,
36666                   identifier: id2,
36667                   objectId: via_node,
36668                   objectType: "node"
36669                 });
36670                 const [p1, p2] = segments[0].points;
36671                 const dir_of_travel = cardinalDirection(relativeBearing(p1, p2));
36672                 d.replacements = {
36673                   num_passed: numberOfPasses,
36674                   num_trips: segments[0].numberOfTrips,
36675                   turn_restriction: turnType.toLowerCase(),
36676                   from_way: linkEntity("w" + from_way),
36677                   to_way: linkEntity("w" + to_way),
36678                   travel_direction: dir_of_travel,
36679                   junction: linkErrorObject(_t("QA.keepRight.error_parts.this_node"))
36680                 };
36681                 _cache2.data[d.id] = d;
36682                 _cache2.rtree.insert(encodeIssueRtree2(d));
36683                 dispatch3.call("loaded");
36684               });
36685             }
36686           }).catch(() => {
36687             delete _cache2.inflightTile[tile.id][k];
36688             if (!Object.keys(_cache2.inflightTile[tile.id]).length) {
36689               delete _cache2.inflightTile[tile.id];
36690               _cache2.loadedTile[tile.id] = true;
36691             }
36692           });
36693         });
36694         _cache2.inflightTile[tile.id] = requests;
36695       });
36696     },
36697     getComments(item) {
36698       if (item.comments) {
36699         return Promise.resolve(item);
36700       }
36701       const key = item.issueKey;
36702       let qParams = {};
36703       if (key === "ow") {
36704         qParams = item.identifier;
36705       } else if (key === "mr") {
36706         qParams.tileX = item.identifier.x;
36707         qParams.tileY = item.identifier.y;
36708       } else if (key === "tr") {
36709         qParams.targetId = item.identifier;
36710       }
36711       const url = `${_impOsmUrls[key]}/retrieveComments?` + utilQsString(qParams);
36712       const cacheComments = (data) => {
36713         item.comments = data.comments ? data.comments.reverse() : [];
36714         this.replaceItem(item);
36715       };
36716       return json_default(url).then(cacheComments).then(() => item);
36717     },
36718     postUpdate(d, callback) {
36719       if (!osm_default.authenticated()) {
36720         return callback({ message: "Not Authenticated", status: -3 }, d);
36721       }
36722       if (_cache2.inflightPost[d.id]) {
36723         return callback({ message: "Error update already inflight", status: -2 }, d);
36724       }
36725       osm_default.userDetails(sendPayload.bind(this));
36726       function sendPayload(err, user) {
36727         if (err) {
36728           return callback(err, d);
36729         }
36730         const key = d.issueKey;
36731         const url = `${_impOsmUrls[key]}/comment`;
36732         const payload = {
36733           username: user.display_name,
36734           targetIds: [d.identifier]
36735         };
36736         if (d.newStatus) {
36737           payload.status = d.newStatus;
36738           payload.text = "status changed";
36739         }
36740         if (d.newComment) {
36741           payload.text = d.newComment;
36742         }
36743         const controller = new AbortController();
36744         _cache2.inflightPost[d.id] = controller;
36745         const options2 = {
36746           method: "POST",
36747           signal: controller.signal,
36748           body: JSON.stringify(payload)
36749         };
36750         json_default(url, options2).then(() => {
36751           delete _cache2.inflightPost[d.id];
36752           if (!d.newStatus) {
36753             const now3 = /* @__PURE__ */ new Date();
36754             let comments = d.comments ? d.comments : [];
36755             comments.push({
36756               username: payload.username,
36757               text: payload.text,
36758               timestamp: now3.getTime() / 1e3
36759             });
36760             this.replaceItem(d.update({
36761               comments,
36762               newComment: void 0
36763             }));
36764           } else {
36765             this.removeItem(d);
36766             if (d.newStatus === "SOLVED") {
36767               if (!(d.issueKey in _cache2.closed)) {
36768                 _cache2.closed[d.issueKey] = 0;
36769               }
36770               _cache2.closed[d.issueKey] += 1;
36771             }
36772           }
36773           if (callback)
36774             callback(null, d);
36775         }).catch((err2) => {
36776           delete _cache2.inflightPost[d.id];
36777           if (callback)
36778             callback(err2.message);
36779         });
36780       }
36781     },
36782     // Get all cached QAItems covering the viewport
36783     getItems(projection2) {
36784       const viewport = projection2.clipExtent();
36785       const min3 = [viewport[0][0], viewport[1][1]];
36786       const max3 = [viewport[1][0], viewport[0][1]];
36787       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
36788       return _cache2.rtree.search(bbox2).map((d) => d.data);
36789     },
36790     // Get a QAItem from cache
36791     // NOTE: Don't change method name until UI v3 is merged
36792     getError(id2) {
36793       return _cache2.data[id2];
36794     },
36795     // get the name of the icon to display for this item
36796     getIcon(itemType) {
36797       return _impOsmData.icons[itemType];
36798     },
36799     // Replace a single QAItem in the cache
36800     replaceItem(issue) {
36801       if (!(issue instanceof QAItem) || !issue.id)
36802         return;
36803       _cache2.data[issue.id] = issue;
36804       updateRtree2(encodeIssueRtree2(issue), true);
36805       return issue;
36806     },
36807     // Remove a single QAItem from the cache
36808     removeItem(issue) {
36809       if (!(issue instanceof QAItem) || !issue.id)
36810         return;
36811       delete _cache2.data[issue.id];
36812       updateRtree2(encodeIssueRtree2(issue), false);
36813     },
36814     // Used to populate `closed:improveosm:*` changeset tags
36815     getClosedCounts() {
36816       return _cache2.closed;
36817     }
36818   };
36819
36820   // modules/services/osmose.js
36821   var import_rbush3 = __toESM(require_rbush_min());
36822
36823   // node_modules/marked/lib/marked.esm.js
36824   function getDefaults() {
36825     return {
36826       async: false,
36827       baseUrl: null,
36828       breaks: false,
36829       extensions: null,
36830       gfm: true,
36831       headerIds: true,
36832       headerPrefix: "",
36833       highlight: null,
36834       hooks: null,
36835       langPrefix: "language-",
36836       mangle: true,
36837       pedantic: false,
36838       renderer: null,
36839       sanitize: false,
36840       sanitizer: null,
36841       silent: false,
36842       smartypants: false,
36843       tokenizer: null,
36844       walkTokens: null,
36845       xhtml: false
36846     };
36847   }
36848   var defaults = getDefaults();
36849   function changeDefaults(newDefaults) {
36850     defaults = newDefaults;
36851   }
36852   var escapeTest = /[&<>"']/;
36853   var escapeReplace = new RegExp(escapeTest.source, "g");
36854   var escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
36855   var escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, "g");
36856   var escapeReplacements = {
36857     "&": "&amp;",
36858     "<": "&lt;",
36859     ">": "&gt;",
36860     '"': "&quot;",
36861     "'": "&#39;"
36862   };
36863   var getEscapeReplacement = (ch) => escapeReplacements[ch];
36864   function escape4(html2, encode) {
36865     if (encode) {
36866       if (escapeTest.test(html2)) {
36867         return html2.replace(escapeReplace, getEscapeReplacement);
36868       }
36869     } else {
36870       if (escapeTestNoEncode.test(html2)) {
36871         return html2.replace(escapeReplaceNoEncode, getEscapeReplacement);
36872       }
36873     }
36874     return html2;
36875   }
36876   var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
36877   function unescape3(html2) {
36878     return html2.replace(unescapeTest, (_, n2) => {
36879       n2 = n2.toLowerCase();
36880       if (n2 === "colon")
36881         return ":";
36882       if (n2.charAt(0) === "#") {
36883         return n2.charAt(1) === "x" ? String.fromCharCode(parseInt(n2.substring(2), 16)) : String.fromCharCode(+n2.substring(1));
36884       }
36885       return "";
36886     });
36887   }
36888   var caret = /(^|[^\[])\^/g;
36889   function edit(regex, opt) {
36890     regex = typeof regex === "string" ? regex : regex.source;
36891     opt = opt || "";
36892     const obj = {
36893       replace: (name, val) => {
36894         val = val.source || val;
36895         val = val.replace(caret, "$1");
36896         regex = regex.replace(name, val);
36897         return obj;
36898       },
36899       getRegex: () => {
36900         return new RegExp(regex, opt);
36901       }
36902     };
36903     return obj;
36904   }
36905   var nonWordAndColonTest = /[^\w:]/g;
36906   var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
36907   function cleanUrl(sanitize, base, href) {
36908     if (sanitize) {
36909       let prot;
36910       try {
36911         prot = decodeURIComponent(unescape3(href)).replace(nonWordAndColonTest, "").toLowerCase();
36912       } catch (e) {
36913         return null;
36914       }
36915       if (prot.indexOf("javascript:") === 0 || prot.indexOf("vbscript:") === 0 || prot.indexOf("data:") === 0) {
36916         return null;
36917       }
36918     }
36919     if (base && !originIndependentUrl.test(href)) {
36920       href = resolveUrl(base, href);
36921     }
36922     try {
36923       href = encodeURI(href).replace(/%25/g, "%");
36924     } catch (e) {
36925       return null;
36926     }
36927     return href;
36928   }
36929   var baseUrls = {};
36930   var justDomain = /^[^:]+:\/*[^/]*$/;
36931   var protocol = /^([^:]+:)[\s\S]*$/;
36932   var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
36933   function resolveUrl(base, href) {
36934     if (!baseUrls[" " + base]) {
36935       if (justDomain.test(base)) {
36936         baseUrls[" " + base] = base + "/";
36937       } else {
36938         baseUrls[" " + base] = rtrim(base, "/", true);
36939       }
36940     }
36941     base = baseUrls[" " + base];
36942     const relativeBase = base.indexOf(":") === -1;
36943     if (href.substring(0, 2) === "//") {
36944       if (relativeBase) {
36945         return href;
36946       }
36947       return base.replace(protocol, "$1") + href;
36948     } else if (href.charAt(0) === "/") {
36949       if (relativeBase) {
36950         return href;
36951       }
36952       return base.replace(domain, "$1") + href;
36953     } else {
36954       return base + href;
36955     }
36956   }
36957   var noopTest = { exec: function noopTest2() {
36958   } };
36959   function splitCells(tableRow, count) {
36960     const row = tableRow.replace(/\|/g, (match, offset, str2) => {
36961       let escaped = false, curr = offset;
36962       while (--curr >= 0 && str2[curr] === "\\")
36963         escaped = !escaped;
36964       if (escaped) {
36965         return "|";
36966       } else {
36967         return " |";
36968       }
36969     }), cells = row.split(/ \|/);
36970     let i2 = 0;
36971     if (!cells[0].trim()) {
36972       cells.shift();
36973     }
36974     if (cells.length > 0 && !cells[cells.length - 1].trim()) {
36975       cells.pop();
36976     }
36977     if (cells.length > count) {
36978       cells.splice(count);
36979     } else {
36980       while (cells.length < count)
36981         cells.push("");
36982     }
36983     for (; i2 < cells.length; i2++) {
36984       cells[i2] = cells[i2].trim().replace(/\\\|/g, "|");
36985     }
36986     return cells;
36987   }
36988   function rtrim(str2, c, invert) {
36989     const l = str2.length;
36990     if (l === 0) {
36991       return "";
36992     }
36993     let suffLen = 0;
36994     while (suffLen < l) {
36995       const currChar = str2.charAt(l - suffLen - 1);
36996       if (currChar === c && !invert) {
36997         suffLen++;
36998       } else if (currChar !== c && invert) {
36999         suffLen++;
37000       } else {
37001         break;
37002       }
37003     }
37004     return str2.slice(0, l - suffLen);
37005   }
37006   function findClosingBracket(str2, b) {
37007     if (str2.indexOf(b[1]) === -1) {
37008       return -1;
37009     }
37010     const l = str2.length;
37011     let level = 0, i2 = 0;
37012     for (; i2 < l; i2++) {
37013       if (str2[i2] === "\\") {
37014         i2++;
37015       } else if (str2[i2] === b[0]) {
37016         level++;
37017       } else if (str2[i2] === b[1]) {
37018         level--;
37019         if (level < 0) {
37020           return i2;
37021         }
37022       }
37023     }
37024     return -1;
37025   }
37026   function checkDeprecations(opt, callback) {
37027     if (!opt || opt.silent) {
37028       return;
37029     }
37030     if (callback) {
37031       console.warn("marked(): callback is deprecated since version 5.0.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/using_pro#async");
37032     }
37033     if (opt.sanitize || opt.sanitizer) {
37034       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");
37035     }
37036     if (opt.highlight || opt.langPrefix !== "language-") {
37037       console.warn("marked(): highlight and langPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-highlight.");
37038     }
37039     if (opt.mangle) {
37040       console.warn("marked(): mangle parameter is enabled by default, but is deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-mangle, or disable by setting `{mangle: false}`.");
37041     }
37042     if (opt.baseUrl) {
37043       console.warn("marked(): baseUrl parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-base-url.");
37044     }
37045     if (opt.smartypants) {
37046       console.warn("marked(): smartypants parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-smartypants.");
37047     }
37048     if (opt.xhtml) {
37049       console.warn("marked(): xhtml parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-xhtml.");
37050     }
37051     if (opt.headerIds || opt.headerPrefix) {
37052       console.warn("marked(): headerIds and headerPrefix parameters enabled by default, but are deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install  https://www.npmjs.com/package/marked-gfm-heading-id, or disable by setting `{headerIds: false}`.");
37053     }
37054   }
37055   function outputLink(cap, link2, raw, lexer2) {
37056     const href = link2.href;
37057     const title = link2.title ? escape4(link2.title) : null;
37058     const text2 = cap[1].replace(/\\([\[\]])/g, "$1");
37059     if (cap[0].charAt(0) !== "!") {
37060       lexer2.state.inLink = true;
37061       const token = {
37062         type: "link",
37063         raw,
37064         href,
37065         title,
37066         text: text2,
37067         tokens: lexer2.inlineTokens(text2)
37068       };
37069       lexer2.state.inLink = false;
37070       return token;
37071     }
37072     return {
37073       type: "image",
37074       raw,
37075       href,
37076       title,
37077       text: escape4(text2)
37078     };
37079   }
37080   function indentCodeCompensation(raw, text2) {
37081     const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
37082     if (matchIndentToCode === null) {
37083       return text2;
37084     }
37085     const indentToCode = matchIndentToCode[1];
37086     return text2.split("\n").map((node) => {
37087       const matchIndentInNode = node.match(/^\s+/);
37088       if (matchIndentInNode === null) {
37089         return node;
37090       }
37091       const [indentInNode] = matchIndentInNode;
37092       if (indentInNode.length >= indentToCode.length) {
37093         return node.slice(indentToCode.length);
37094       }
37095       return node;
37096     }).join("\n");
37097   }
37098   var Tokenizer = class {
37099     constructor(options2) {
37100       this.options = options2 || defaults;
37101     }
37102     space(src) {
37103       const cap = this.rules.block.newline.exec(src);
37104       if (cap && cap[0].length > 0) {
37105         return {
37106           type: "space",
37107           raw: cap[0]
37108         };
37109       }
37110     }
37111     code(src) {
37112       const cap = this.rules.block.code.exec(src);
37113       if (cap) {
37114         const text2 = cap[0].replace(/^ {1,4}/gm, "");
37115         return {
37116           type: "code",
37117           raw: cap[0],
37118           codeBlockStyle: "indented",
37119           text: !this.options.pedantic ? rtrim(text2, "\n") : text2
37120         };
37121       }
37122     }
37123     fences(src) {
37124       const cap = this.rules.block.fences.exec(src);
37125       if (cap) {
37126         const raw = cap[0];
37127         const text2 = indentCodeCompensation(raw, cap[3] || "");
37128         return {
37129           type: "code",
37130           raw,
37131           lang: cap[2] ? cap[2].trim().replace(this.rules.inline._escapes, "$1") : cap[2],
37132           text: text2
37133         };
37134       }
37135     }
37136     heading(src) {
37137       const cap = this.rules.block.heading.exec(src);
37138       if (cap) {
37139         let text2 = cap[2].trim();
37140         if (/#$/.test(text2)) {
37141           const trimmed = rtrim(text2, "#");
37142           if (this.options.pedantic) {
37143             text2 = trimmed.trim();
37144           } else if (!trimmed || / $/.test(trimmed)) {
37145             text2 = trimmed.trim();
37146           }
37147         }
37148         return {
37149           type: "heading",
37150           raw: cap[0],
37151           depth: cap[1].length,
37152           text: text2,
37153           tokens: this.lexer.inline(text2)
37154         };
37155       }
37156     }
37157     hr(src) {
37158       const cap = this.rules.block.hr.exec(src);
37159       if (cap) {
37160         return {
37161           type: "hr",
37162           raw: cap[0]
37163         };
37164       }
37165     }
37166     blockquote(src) {
37167       const cap = this.rules.block.blockquote.exec(src);
37168       if (cap) {
37169         const text2 = cap[0].replace(/^ *>[ \t]?/gm, "");
37170         const top = this.lexer.state.top;
37171         this.lexer.state.top = true;
37172         const tokens = this.lexer.blockTokens(text2);
37173         this.lexer.state.top = top;
37174         return {
37175           type: "blockquote",
37176           raw: cap[0],
37177           tokens,
37178           text: text2
37179         };
37180       }
37181     }
37182     list(src) {
37183       let cap = this.rules.block.list.exec(src);
37184       if (cap) {
37185         let raw, istask, ischecked, indent2, i2, blankLine, endsWithBlankLine, line, nextLine, rawLine, itemContents, endEarly;
37186         let bull = cap[1].trim();
37187         const isordered = bull.length > 1;
37188         const list = {
37189           type: "list",
37190           raw: "",
37191           ordered: isordered,
37192           start: isordered ? +bull.slice(0, -1) : "",
37193           loose: false,
37194           items: []
37195         };
37196         bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
37197         if (this.options.pedantic) {
37198           bull = isordered ? bull : "[*+-]";
37199         }
37200         const itemRegex = new RegExp(`^( {0,3}${bull})((?:[      ][^\\n]*)?(?:\\n|$))`);
37201         while (src) {
37202           endEarly = false;
37203           if (!(cap = itemRegex.exec(src))) {
37204             break;
37205           }
37206           if (this.rules.block.hr.test(src)) {
37207             break;
37208           }
37209           raw = cap[0];
37210           src = src.substring(raw.length);
37211           line = cap[2].split("\n", 1)[0].replace(/^\t+/, (t) => " ".repeat(3 * t.length));
37212           nextLine = src.split("\n", 1)[0];
37213           if (this.options.pedantic) {
37214             indent2 = 2;
37215             itemContents = line.trimLeft();
37216           } else {
37217             indent2 = cap[2].search(/[^ ]/);
37218             indent2 = indent2 > 4 ? 1 : indent2;
37219             itemContents = line.slice(indent2);
37220             indent2 += cap[1].length;
37221           }
37222           blankLine = false;
37223           if (!line && /^ *$/.test(nextLine)) {
37224             raw += nextLine + "\n";
37225             src = src.substring(nextLine.length + 1);
37226             endEarly = true;
37227           }
37228           if (!endEarly) {
37229             const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[    ][^\\n]*)?(?:\\n|$))`);
37230             const hrRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
37231             const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}(?:\`\`\`|~~~)`);
37232             const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}#`);
37233             while (src) {
37234               rawLine = src.split("\n", 1)[0];
37235               nextLine = rawLine;
37236               if (this.options.pedantic) {
37237                 nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, "  ");
37238               }
37239               if (fencesBeginRegex.test(nextLine)) {
37240                 break;
37241               }
37242               if (headingBeginRegex.test(nextLine)) {
37243                 break;
37244               }
37245               if (nextBulletRegex.test(nextLine)) {
37246                 break;
37247               }
37248               if (hrRegex.test(src)) {
37249                 break;
37250               }
37251               if (nextLine.search(/[^ ]/) >= indent2 || !nextLine.trim()) {
37252                 itemContents += "\n" + nextLine.slice(indent2);
37253               } else {
37254                 if (blankLine) {
37255                   break;
37256                 }
37257                 if (line.search(/[^ ]/) >= 4) {
37258                   break;
37259                 }
37260                 if (fencesBeginRegex.test(line)) {
37261                   break;
37262                 }
37263                 if (headingBeginRegex.test(line)) {
37264                   break;
37265                 }
37266                 if (hrRegex.test(line)) {
37267                   break;
37268                 }
37269                 itemContents += "\n" + nextLine;
37270               }
37271               if (!blankLine && !nextLine.trim()) {
37272                 blankLine = true;
37273               }
37274               raw += rawLine + "\n";
37275               src = src.substring(rawLine.length + 1);
37276               line = nextLine.slice(indent2);
37277             }
37278           }
37279           if (!list.loose) {
37280             if (endsWithBlankLine) {
37281               list.loose = true;
37282             } else if (/\n *\n *$/.test(raw)) {
37283               endsWithBlankLine = true;
37284             }
37285           }
37286           if (this.options.gfm) {
37287             istask = /^\[[ xX]\] /.exec(itemContents);
37288             if (istask) {
37289               ischecked = istask[0] !== "[ ] ";
37290               itemContents = itemContents.replace(/^\[[ xX]\] +/, "");
37291             }
37292           }
37293           list.items.push({
37294             type: "list_item",
37295             raw,
37296             task: !!istask,
37297             checked: ischecked,
37298             loose: false,
37299             text: itemContents
37300           });
37301           list.raw += raw;
37302         }
37303         list.items[list.items.length - 1].raw = raw.trimRight();
37304         list.items[list.items.length - 1].text = itemContents.trimRight();
37305         list.raw = list.raw.trimRight();
37306         const l = list.items.length;
37307         for (i2 = 0; i2 < l; i2++) {
37308           this.lexer.state.top = false;
37309           list.items[i2].tokens = this.lexer.blockTokens(list.items[i2].text, []);
37310           if (!list.loose) {
37311             const spacers = list.items[i2].tokens.filter((t) => t.type === "space");
37312             const hasMultipleLineBreaks = spacers.length > 0 && spacers.some((t) => /\n.*\n/.test(t.raw));
37313             list.loose = hasMultipleLineBreaks;
37314           }
37315         }
37316         if (list.loose) {
37317           for (i2 = 0; i2 < l; i2++) {
37318             list.items[i2].loose = true;
37319           }
37320         }
37321         return list;
37322       }
37323     }
37324     html(src) {
37325       const cap = this.rules.block.html.exec(src);
37326       if (cap) {
37327         const token = {
37328           type: "html",
37329           block: true,
37330           raw: cap[0],
37331           pre: !this.options.sanitizer && (cap[1] === "pre" || cap[1] === "script" || cap[1] === "style"),
37332           text: cap[0]
37333         };
37334         if (this.options.sanitize) {
37335           const text2 = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]);
37336           token.type = "paragraph";
37337           token.text = text2;
37338           token.tokens = this.lexer.inline(text2);
37339         }
37340         return token;
37341       }
37342     }
37343     def(src) {
37344       const cap = this.rules.block.def.exec(src);
37345       if (cap) {
37346         const tag = cap[1].toLowerCase().replace(/\s+/g, " ");
37347         const href = cap[2] ? cap[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline._escapes, "$1") : "";
37348         const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline._escapes, "$1") : cap[3];
37349         return {
37350           type: "def",
37351           tag,
37352           raw: cap[0],
37353           href,
37354           title
37355         };
37356       }
37357     }
37358     table(src) {
37359       const cap = this.rules.block.table.exec(src);
37360       if (cap) {
37361         const item = {
37362           type: "table",
37363           header: splitCells(cap[1]).map((c) => {
37364             return { text: c };
37365           }),
37366           align: cap[2].replace(/^ *|\| *$/g, "").split(/ *\| */),
37367           rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, "").split("\n") : []
37368         };
37369         if (item.header.length === item.align.length) {
37370           item.raw = cap[0];
37371           let l = item.align.length;
37372           let i2, j2, k, row;
37373           for (i2 = 0; i2 < l; i2++) {
37374             if (/^ *-+: *$/.test(item.align[i2])) {
37375               item.align[i2] = "right";
37376             } else if (/^ *:-+: *$/.test(item.align[i2])) {
37377               item.align[i2] = "center";
37378             } else if (/^ *:-+ *$/.test(item.align[i2])) {
37379               item.align[i2] = "left";
37380             } else {
37381               item.align[i2] = null;
37382             }
37383           }
37384           l = item.rows.length;
37385           for (i2 = 0; i2 < l; i2++) {
37386             item.rows[i2] = splitCells(item.rows[i2], item.header.length).map((c) => {
37387               return { text: c };
37388             });
37389           }
37390           l = item.header.length;
37391           for (j2 = 0; j2 < l; j2++) {
37392             item.header[j2].tokens = this.lexer.inline(item.header[j2].text);
37393           }
37394           l = item.rows.length;
37395           for (j2 = 0; j2 < l; j2++) {
37396             row = item.rows[j2];
37397             for (k = 0; k < row.length; k++) {
37398               row[k].tokens = this.lexer.inline(row[k].text);
37399             }
37400           }
37401           return item;
37402         }
37403       }
37404     }
37405     lheading(src) {
37406       const cap = this.rules.block.lheading.exec(src);
37407       if (cap) {
37408         return {
37409           type: "heading",
37410           raw: cap[0],
37411           depth: cap[2].charAt(0) === "=" ? 1 : 2,
37412           text: cap[1],
37413           tokens: this.lexer.inline(cap[1])
37414         };
37415       }
37416     }
37417     paragraph(src) {
37418       const cap = this.rules.block.paragraph.exec(src);
37419       if (cap) {
37420         const text2 = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1];
37421         return {
37422           type: "paragraph",
37423           raw: cap[0],
37424           text: text2,
37425           tokens: this.lexer.inline(text2)
37426         };
37427       }
37428     }
37429     text(src) {
37430       const cap = this.rules.block.text.exec(src);
37431       if (cap) {
37432         return {
37433           type: "text",
37434           raw: cap[0],
37435           text: cap[0],
37436           tokens: this.lexer.inline(cap[0])
37437         };
37438       }
37439     }
37440     escape(src) {
37441       const cap = this.rules.inline.escape.exec(src);
37442       if (cap) {
37443         return {
37444           type: "escape",
37445           raw: cap[0],
37446           text: escape4(cap[1])
37447         };
37448       }
37449     }
37450     tag(src) {
37451       const cap = this.rules.inline.tag.exec(src);
37452       if (cap) {
37453         if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
37454           this.lexer.state.inLink = true;
37455         } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
37456           this.lexer.state.inLink = false;
37457         }
37458         if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
37459           this.lexer.state.inRawBlock = true;
37460         } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
37461           this.lexer.state.inRawBlock = false;
37462         }
37463         return {
37464           type: this.options.sanitize ? "text" : "html",
37465           raw: cap[0],
37466           inLink: this.lexer.state.inLink,
37467           inRawBlock: this.lexer.state.inRawBlock,
37468           block: false,
37469           text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]) : cap[0]
37470         };
37471       }
37472     }
37473     link(src) {
37474       const cap = this.rules.inline.link.exec(src);
37475       if (cap) {
37476         const trimmedUrl = cap[2].trim();
37477         if (!this.options.pedantic && /^</.test(trimmedUrl)) {
37478           if (!/>$/.test(trimmedUrl)) {
37479             return;
37480           }
37481           const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
37482           if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
37483             return;
37484           }
37485         } else {
37486           const lastParenIndex = findClosingBracket(cap[2], "()");
37487           if (lastParenIndex > -1) {
37488             const start2 = cap[0].indexOf("!") === 0 ? 5 : 4;
37489             const linkLen = start2 + cap[1].length + lastParenIndex;
37490             cap[2] = cap[2].substring(0, lastParenIndex);
37491             cap[0] = cap[0].substring(0, linkLen).trim();
37492             cap[3] = "";
37493           }
37494         }
37495         let href = cap[2];
37496         let title = "";
37497         if (this.options.pedantic) {
37498           const link2 = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
37499           if (link2) {
37500             href = link2[1];
37501             title = link2[3];
37502           }
37503         } else {
37504           title = cap[3] ? cap[3].slice(1, -1) : "";
37505         }
37506         href = href.trim();
37507         if (/^</.test(href)) {
37508           if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
37509             href = href.slice(1);
37510           } else {
37511             href = href.slice(1, -1);
37512           }
37513         }
37514         return outputLink(cap, {
37515           href: href ? href.replace(this.rules.inline._escapes, "$1") : href,
37516           title: title ? title.replace(this.rules.inline._escapes, "$1") : title
37517         }, cap[0], this.lexer);
37518       }
37519     }
37520     reflink(src, links) {
37521       let cap;
37522       if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
37523         let link2 = (cap[2] || cap[1]).replace(/\s+/g, " ");
37524         link2 = links[link2.toLowerCase()];
37525         if (!link2) {
37526           const text2 = cap[0].charAt(0);
37527           return {
37528             type: "text",
37529             raw: text2,
37530             text: text2
37531           };
37532         }
37533         return outputLink(cap, link2, cap[0], this.lexer);
37534       }
37535     }
37536     emStrong(src, maskedSrc, prevChar = "") {
37537       let match = this.rules.inline.emStrong.lDelim.exec(src);
37538       if (!match)
37539         return;
37540       if (match[3] && prevChar.match(/[\p{L}\p{N}]/u))
37541         return;
37542       const nextChar = match[1] || match[2] || "";
37543       if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
37544         const lLength = match[0].length - 1;
37545         let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
37546         const endReg = match[0][0] === "*" ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
37547         endReg.lastIndex = 0;
37548         maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
37549         while ((match = endReg.exec(maskedSrc)) != null) {
37550           rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
37551           if (!rDelim)
37552             continue;
37553           rLength = rDelim.length;
37554           if (match[3] || match[4]) {
37555             delimTotal += rLength;
37556             continue;
37557           } else if (match[5] || match[6]) {
37558             if (lLength % 3 && !((lLength + rLength) % 3)) {
37559               midDelimTotal += rLength;
37560               continue;
37561             }
37562           }
37563           delimTotal -= rLength;
37564           if (delimTotal > 0)
37565             continue;
37566           rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
37567           const raw = src.slice(0, lLength + match.index + rLength + 1);
37568           if (Math.min(lLength, rLength) % 2) {
37569             const text3 = raw.slice(1, -1);
37570             return {
37571               type: "em",
37572               raw,
37573               text: text3,
37574               tokens: this.lexer.inlineTokens(text3)
37575             };
37576           }
37577           const text2 = raw.slice(2, -2);
37578           return {
37579             type: "strong",
37580             raw,
37581             text: text2,
37582             tokens: this.lexer.inlineTokens(text2)
37583           };
37584         }
37585       }
37586     }
37587     codespan(src) {
37588       const cap = this.rules.inline.code.exec(src);
37589       if (cap) {
37590         let text2 = cap[2].replace(/\n/g, " ");
37591         const hasNonSpaceChars = /[^ ]/.test(text2);
37592         const hasSpaceCharsOnBothEnds = /^ /.test(text2) && / $/.test(text2);
37593         if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
37594           text2 = text2.substring(1, text2.length - 1);
37595         }
37596         text2 = escape4(text2, true);
37597         return {
37598           type: "codespan",
37599           raw: cap[0],
37600           text: text2
37601         };
37602       }
37603     }
37604     br(src) {
37605       const cap = this.rules.inline.br.exec(src);
37606       if (cap) {
37607         return {
37608           type: "br",
37609           raw: cap[0]
37610         };
37611       }
37612     }
37613     del(src) {
37614       const cap = this.rules.inline.del.exec(src);
37615       if (cap) {
37616         return {
37617           type: "del",
37618           raw: cap[0],
37619           text: cap[2],
37620           tokens: this.lexer.inlineTokens(cap[2])
37621         };
37622       }
37623     }
37624     autolink(src, mangle2) {
37625       const cap = this.rules.inline.autolink.exec(src);
37626       if (cap) {
37627         let text2, href;
37628         if (cap[2] === "@") {
37629           text2 = escape4(this.options.mangle ? mangle2(cap[1]) : cap[1]);
37630           href = "mailto:" + text2;
37631         } else {
37632           text2 = escape4(cap[1]);
37633           href = text2;
37634         }
37635         return {
37636           type: "link",
37637           raw: cap[0],
37638           text: text2,
37639           href,
37640           tokens: [
37641             {
37642               type: "text",
37643               raw: text2,
37644               text: text2
37645             }
37646           ]
37647         };
37648       }
37649     }
37650     url(src, mangle2) {
37651       let cap;
37652       if (cap = this.rules.inline.url.exec(src)) {
37653         let text2, href;
37654         if (cap[2] === "@") {
37655           text2 = escape4(this.options.mangle ? mangle2(cap[0]) : cap[0]);
37656           href = "mailto:" + text2;
37657         } else {
37658           let prevCapZero;
37659           do {
37660             prevCapZero = cap[0];
37661             cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
37662           } while (prevCapZero !== cap[0]);
37663           text2 = escape4(cap[0]);
37664           if (cap[1] === "www.") {
37665             href = "http://" + cap[0];
37666           } else {
37667             href = cap[0];
37668           }
37669         }
37670         return {
37671           type: "link",
37672           raw: cap[0],
37673           text: text2,
37674           href,
37675           tokens: [
37676             {
37677               type: "text",
37678               raw: text2,
37679               text: text2
37680             }
37681           ]
37682         };
37683       }
37684     }
37685     inlineText(src, smartypants2) {
37686       const cap = this.rules.inline.text.exec(src);
37687       if (cap) {
37688         let text2;
37689         if (this.lexer.state.inRawBlock) {
37690           text2 = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]) : cap[0];
37691         } else {
37692           text2 = escape4(this.options.smartypants ? smartypants2(cap[0]) : cap[0]);
37693         }
37694         return {
37695           type: "text",
37696           raw: cap[0],
37697           text: text2
37698         };
37699       }
37700     }
37701   };
37702   var block = {
37703     newline: /^(?: *(?:\n|$))+/,
37704     code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
37705     fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
37706     hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
37707     heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
37708     blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
37709     list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
37710     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|$))",
37711     def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
37712     table: noopTest,
37713     lheading: /^((?:(?!^bull ).|\n(?!\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
37714     // regex template, placeholders will be replaced according to different paragraph
37715     // interruption rules of commonmark and the original markdown spec:
37716     _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
37717     text: /^[^\n]+/
37718   };
37719   block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
37720   block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
37721   block.def = edit(block.def).replace("label", block._label).replace("title", block._title).getRegex();
37722   block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
37723   block.listItemStart = edit(/^( *)(bull) */).replace("bull", block.bullet).getRegex();
37724   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();
37725   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";
37726   block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
37727   block.html = edit(block.html, "i").replace("comment", block._comment).replace("tag", block._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
37728   block.lheading = edit(block.lheading).replace(/bull/g, block.bullet).getRegex();
37729   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();
37730   block.blockquote = edit(block.blockquote).replace("paragraph", block.paragraph).getRegex();
37731   block.normal = { ...block };
37732   block.gfm = {
37733     ...block.normal,
37734     table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
37735     // Cells
37736   };
37737   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();
37738   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();
37739   block.pedantic = {
37740     ...block.normal,
37741     html: edit(
37742       `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
37743     ).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(),
37744     def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
37745     heading: /^(#{1,6})(.*)(?:\n+|$)/,
37746     fences: noopTest,
37747     // fences not supported
37748     lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
37749     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()
37750   };
37751   var inline = {
37752     escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
37753     autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
37754     url: noopTest,
37755     tag: "^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",
37756     // CDATA section
37757     link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
37758     reflink: /^!?\[(label)\]\[(ref)\]/,
37759     nolink: /^!?\[(ref)\](?:\[\])?/,
37760     reflinkSearch: "reflink|nolink(?!\\()",
37761     emStrong: {
37762       lDelim: /^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,
37763       //         (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left.  (5) and (6) can be either Left or Right.
37764       //         | Skip orphan inside strong      | Consume to delim | (1) #***              | (2) a***#, a***                    | (3) #***a, ***a                  | (4) ***#                 | (5) #***#                         | (6) a***a
37765       rDelimAst: /^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/,
37766       rDelimUnd: /^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/
37767       // ^- Not allowed for _
37768     },
37769     code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
37770     br: /^( {2,}|\\)\n(?!\s*$)/,
37771     del: noopTest,
37772     text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
37773     punctuation: /^((?![*_])[\spunctuation])/
37774   };
37775   inline._punctuation = "\\p{P}$+<=>`^|~";
37776   inline.punctuation = edit(inline.punctuation, "u").replace(/punctuation/g, inline._punctuation).getRegex();
37777   inline.blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;
37778   inline.anyPunctuation = /\\[punct]/g;
37779   inline._escapes = /\\([punct])/g;
37780   inline._comment = edit(block._comment).replace("(?:-->|$)", "-->").getRegex();
37781   inline.emStrong.lDelim = edit(inline.emStrong.lDelim, "u").replace(/punct/g, inline._punctuation).getRegex();
37782   inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, "gu").replace(/punct/g, inline._punctuation).getRegex();
37783   inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, "gu").replace(/punct/g, inline._punctuation).getRegex();
37784   inline.anyPunctuation = edit(inline.anyPunctuation, "gu").replace(/punct/g, inline._punctuation).getRegex();
37785   inline._escapes = edit(inline._escapes, "gu").replace(/punct/g, inline._punctuation).getRegex();
37786   inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
37787   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])?)+(?![-_])/;
37788   inline.autolink = edit(inline.autolink).replace("scheme", inline._scheme).replace("email", inline._email).getRegex();
37789   inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
37790   inline.tag = edit(inline.tag).replace("comment", inline._comment).replace("attribute", inline._attribute).getRegex();
37791   inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
37792   inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
37793   inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
37794   inline.link = edit(inline.link).replace("label", inline._label).replace("href", inline._href).replace("title", inline._title).getRegex();
37795   inline.reflink = edit(inline.reflink).replace("label", inline._label).replace("ref", block._label).getRegex();
37796   inline.nolink = edit(inline.nolink).replace("ref", block._label).getRegex();
37797   inline.reflinkSearch = edit(inline.reflinkSearch, "g").replace("reflink", inline.reflink).replace("nolink", inline.nolink).getRegex();
37798   inline.normal = { ...inline };
37799   inline.pedantic = {
37800     ...inline.normal,
37801     strong: {
37802       start: /^__|\*\*/,
37803       middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
37804       endAst: /\*\*(?!\*)/g,
37805       endUnd: /__(?!_)/g
37806     },
37807     em: {
37808       start: /^_|\*/,
37809       middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
37810       endAst: /\*(?!\*)/g,
37811       endUnd: /_(?!_)/g
37812     },
37813     link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", inline._label).getRegex(),
37814     reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", inline._label).getRegex()
37815   };
37816   inline.gfm = {
37817     ...inline.normal,
37818     escape: edit(inline.escape).replace("])", "~|])").getRegex(),
37819     _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
37820     url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
37821     _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
37822     del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
37823     text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
37824   };
37825   inline.gfm.url = edit(inline.gfm.url, "i").replace("email", inline.gfm._extended_email).getRegex();
37826   inline.breaks = {
37827     ...inline.gfm,
37828     br: edit(inline.br).replace("{2,}", "*").getRegex(),
37829     text: edit(inline.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
37830   };
37831   function smartypants(text2) {
37832     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");
37833   }
37834   function mangle(text2) {
37835     let out = "", i2, ch;
37836     const l = text2.length;
37837     for (i2 = 0; i2 < l; i2++) {
37838       ch = text2.charCodeAt(i2);
37839       if (Math.random() > 0.5) {
37840         ch = "x" + ch.toString(16);
37841       }
37842       out += "&#" + ch + ";";
37843     }
37844     return out;
37845   }
37846   var Lexer = class _Lexer {
37847     constructor(options2) {
37848       this.tokens = [];
37849       this.tokens.links = /* @__PURE__ */ Object.create(null);
37850       this.options = options2 || defaults;
37851       this.options.tokenizer = this.options.tokenizer || new Tokenizer();
37852       this.tokenizer = this.options.tokenizer;
37853       this.tokenizer.options = this.options;
37854       this.tokenizer.lexer = this;
37855       this.inlineQueue = [];
37856       this.state = {
37857         inLink: false,
37858         inRawBlock: false,
37859         top: true
37860       };
37861       const rules = {
37862         block: block.normal,
37863         inline: inline.normal
37864       };
37865       if (this.options.pedantic) {
37866         rules.block = block.pedantic;
37867         rules.inline = inline.pedantic;
37868       } else if (this.options.gfm) {
37869         rules.block = block.gfm;
37870         if (this.options.breaks) {
37871           rules.inline = inline.breaks;
37872         } else {
37873           rules.inline = inline.gfm;
37874         }
37875       }
37876       this.tokenizer.rules = rules;
37877     }
37878     /**
37879      * Expose Rules
37880      */
37881     static get rules() {
37882       return {
37883         block,
37884         inline
37885       };
37886     }
37887     /**
37888      * Static Lex Method
37889      */
37890     static lex(src, options2) {
37891       const lexer2 = new _Lexer(options2);
37892       return lexer2.lex(src);
37893     }
37894     /**
37895      * Static Lex Inline Method
37896      */
37897     static lexInline(src, options2) {
37898       const lexer2 = new _Lexer(options2);
37899       return lexer2.inlineTokens(src);
37900     }
37901     /**
37902      * Preprocessing
37903      */
37904     lex(src) {
37905       src = src.replace(/\r\n|\r/g, "\n");
37906       this.blockTokens(src, this.tokens);
37907       let next;
37908       while (next = this.inlineQueue.shift()) {
37909         this.inlineTokens(next.src, next.tokens);
37910       }
37911       return this.tokens;
37912     }
37913     /**
37914      * Lexing
37915      */
37916     blockTokens(src, tokens = []) {
37917       if (this.options.pedantic) {
37918         src = src.replace(/\t/g, "    ").replace(/^ +$/gm, "");
37919       } else {
37920         src = src.replace(/^( *)(\t+)/gm, (_, leading, tabs) => {
37921           return leading + "    ".repeat(tabs.length);
37922         });
37923       }
37924       let token, lastToken, cutSrc, lastParagraphClipped;
37925       while (src) {
37926         if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((extTokenizer) => {
37927           if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
37928             src = src.substring(token.raw.length);
37929             tokens.push(token);
37930             return true;
37931           }
37932           return false;
37933         })) {
37934           continue;
37935         }
37936         if (token = this.tokenizer.space(src)) {
37937           src = src.substring(token.raw.length);
37938           if (token.raw.length === 1 && tokens.length > 0) {
37939             tokens[tokens.length - 1].raw += "\n";
37940           } else {
37941             tokens.push(token);
37942           }
37943           continue;
37944         }
37945         if (token = this.tokenizer.code(src)) {
37946           src = src.substring(token.raw.length);
37947           lastToken = tokens[tokens.length - 1];
37948           if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
37949             lastToken.raw += "\n" + token.raw;
37950             lastToken.text += "\n" + token.text;
37951             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
37952           } else {
37953             tokens.push(token);
37954           }
37955           continue;
37956         }
37957         if (token = this.tokenizer.fences(src)) {
37958           src = src.substring(token.raw.length);
37959           tokens.push(token);
37960           continue;
37961         }
37962         if (token = this.tokenizer.heading(src)) {
37963           src = src.substring(token.raw.length);
37964           tokens.push(token);
37965           continue;
37966         }
37967         if (token = this.tokenizer.hr(src)) {
37968           src = src.substring(token.raw.length);
37969           tokens.push(token);
37970           continue;
37971         }
37972         if (token = this.tokenizer.blockquote(src)) {
37973           src = src.substring(token.raw.length);
37974           tokens.push(token);
37975           continue;
37976         }
37977         if (token = this.tokenizer.list(src)) {
37978           src = src.substring(token.raw.length);
37979           tokens.push(token);
37980           continue;
37981         }
37982         if (token = this.tokenizer.html(src)) {
37983           src = src.substring(token.raw.length);
37984           tokens.push(token);
37985           continue;
37986         }
37987         if (token = this.tokenizer.def(src)) {
37988           src = src.substring(token.raw.length);
37989           lastToken = tokens[tokens.length - 1];
37990           if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
37991             lastToken.raw += "\n" + token.raw;
37992             lastToken.text += "\n" + token.raw;
37993             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
37994           } else if (!this.tokens.links[token.tag]) {
37995             this.tokens.links[token.tag] = {
37996               href: token.href,
37997               title: token.title
37998             };
37999           }
38000           continue;
38001         }
38002         if (token = this.tokenizer.table(src)) {
38003           src = src.substring(token.raw.length);
38004           tokens.push(token);
38005           continue;
38006         }
38007         if (token = this.tokenizer.lheading(src)) {
38008           src = src.substring(token.raw.length);
38009           tokens.push(token);
38010           continue;
38011         }
38012         cutSrc = src;
38013         if (this.options.extensions && this.options.extensions.startBlock) {
38014           let startIndex = Infinity;
38015           const tempSrc = src.slice(1);
38016           let tempStart;
38017           this.options.extensions.startBlock.forEach(function(getStartIndex) {
38018             tempStart = getStartIndex.call({ lexer: this }, tempSrc);
38019             if (typeof tempStart === "number" && tempStart >= 0) {
38020               startIndex = Math.min(startIndex, tempStart);
38021             }
38022           });
38023           if (startIndex < Infinity && startIndex >= 0) {
38024             cutSrc = src.substring(0, startIndex + 1);
38025           }
38026         }
38027         if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
38028           lastToken = tokens[tokens.length - 1];
38029           if (lastParagraphClipped && lastToken.type === "paragraph") {
38030             lastToken.raw += "\n" + token.raw;
38031             lastToken.text += "\n" + token.text;
38032             this.inlineQueue.pop();
38033             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
38034           } else {
38035             tokens.push(token);
38036           }
38037           lastParagraphClipped = cutSrc.length !== src.length;
38038           src = src.substring(token.raw.length);
38039           continue;
38040         }
38041         if (token = this.tokenizer.text(src)) {
38042           src = src.substring(token.raw.length);
38043           lastToken = tokens[tokens.length - 1];
38044           if (lastToken && lastToken.type === "text") {
38045             lastToken.raw += "\n" + token.raw;
38046             lastToken.text += "\n" + token.text;
38047             this.inlineQueue.pop();
38048             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
38049           } else {
38050             tokens.push(token);
38051           }
38052           continue;
38053         }
38054         if (src) {
38055           const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
38056           if (this.options.silent) {
38057             console.error(errMsg);
38058             break;
38059           } else {
38060             throw new Error(errMsg);
38061           }
38062         }
38063       }
38064       this.state.top = true;
38065       return tokens;
38066     }
38067     inline(src, tokens = []) {
38068       this.inlineQueue.push({ src, tokens });
38069       return tokens;
38070     }
38071     /**
38072      * Lexing/Compiling
38073      */
38074     inlineTokens(src, tokens = []) {
38075       let token, lastToken, cutSrc;
38076       let maskedSrc = src;
38077       let match;
38078       let keepPrevChar, prevChar;
38079       if (this.tokens.links) {
38080         const links = Object.keys(this.tokens.links);
38081         if (links.length > 0) {
38082           while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
38083             if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) {
38084               maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
38085             }
38086           }
38087         }
38088       }
38089       while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
38090         maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
38091       }
38092       while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
38093         maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
38094       }
38095       while (src) {
38096         if (!keepPrevChar) {
38097           prevChar = "";
38098         }
38099         keepPrevChar = false;
38100         if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((extTokenizer) => {
38101           if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
38102             src = src.substring(token.raw.length);
38103             tokens.push(token);
38104             return true;
38105           }
38106           return false;
38107         })) {
38108           continue;
38109         }
38110         if (token = this.tokenizer.escape(src)) {
38111           src = src.substring(token.raw.length);
38112           tokens.push(token);
38113           continue;
38114         }
38115         if (token = this.tokenizer.tag(src)) {
38116           src = src.substring(token.raw.length);
38117           lastToken = tokens[tokens.length - 1];
38118           if (lastToken && token.type === "text" && lastToken.type === "text") {
38119             lastToken.raw += token.raw;
38120             lastToken.text += token.text;
38121           } else {
38122             tokens.push(token);
38123           }
38124           continue;
38125         }
38126         if (token = this.tokenizer.link(src)) {
38127           src = src.substring(token.raw.length);
38128           tokens.push(token);
38129           continue;
38130         }
38131         if (token = this.tokenizer.reflink(src, this.tokens.links)) {
38132           src = src.substring(token.raw.length);
38133           lastToken = tokens[tokens.length - 1];
38134           if (lastToken && token.type === "text" && lastToken.type === "text") {
38135             lastToken.raw += token.raw;
38136             lastToken.text += token.text;
38137           } else {
38138             tokens.push(token);
38139           }
38140           continue;
38141         }
38142         if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
38143           src = src.substring(token.raw.length);
38144           tokens.push(token);
38145           continue;
38146         }
38147         if (token = this.tokenizer.codespan(src)) {
38148           src = src.substring(token.raw.length);
38149           tokens.push(token);
38150           continue;
38151         }
38152         if (token = this.tokenizer.br(src)) {
38153           src = src.substring(token.raw.length);
38154           tokens.push(token);
38155           continue;
38156         }
38157         if (token = this.tokenizer.del(src)) {
38158           src = src.substring(token.raw.length);
38159           tokens.push(token);
38160           continue;
38161         }
38162         if (token = this.tokenizer.autolink(src, mangle)) {
38163           src = src.substring(token.raw.length);
38164           tokens.push(token);
38165           continue;
38166         }
38167         if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
38168           src = src.substring(token.raw.length);
38169           tokens.push(token);
38170           continue;
38171         }
38172         cutSrc = src;
38173         if (this.options.extensions && this.options.extensions.startInline) {
38174           let startIndex = Infinity;
38175           const tempSrc = src.slice(1);
38176           let tempStart;
38177           this.options.extensions.startInline.forEach(function(getStartIndex) {
38178             tempStart = getStartIndex.call({ lexer: this }, tempSrc);
38179             if (typeof tempStart === "number" && tempStart >= 0) {
38180               startIndex = Math.min(startIndex, tempStart);
38181             }
38182           });
38183           if (startIndex < Infinity && startIndex >= 0) {
38184             cutSrc = src.substring(0, startIndex + 1);
38185           }
38186         }
38187         if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
38188           src = src.substring(token.raw.length);
38189           if (token.raw.slice(-1) !== "_") {
38190             prevChar = token.raw.slice(-1);
38191           }
38192           keepPrevChar = true;
38193           lastToken = tokens[tokens.length - 1];
38194           if (lastToken && lastToken.type === "text") {
38195             lastToken.raw += token.raw;
38196             lastToken.text += token.text;
38197           } else {
38198             tokens.push(token);
38199           }
38200           continue;
38201         }
38202         if (src) {
38203           const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
38204           if (this.options.silent) {
38205             console.error(errMsg);
38206             break;
38207           } else {
38208             throw new Error(errMsg);
38209           }
38210         }
38211       }
38212       return tokens;
38213     }
38214   };
38215   var Renderer = class {
38216     constructor(options2) {
38217       this.options = options2 || defaults;
38218     }
38219     code(code, infostring, escaped) {
38220       const lang = (infostring || "").match(/\S*/)[0];
38221       if (this.options.highlight) {
38222         const out = this.options.highlight(code, lang);
38223         if (out != null && out !== code) {
38224           escaped = true;
38225           code = out;
38226         }
38227       }
38228       code = code.replace(/\n$/, "") + "\n";
38229       if (!lang) {
38230         return "<pre><code>" + (escaped ? code : escape4(code, true)) + "</code></pre>\n";
38231       }
38232       return '<pre><code class="' + this.options.langPrefix + escape4(lang) + '">' + (escaped ? code : escape4(code, true)) + "</code></pre>\n";
38233     }
38234     /**
38235      * @param {string} quote
38236      */
38237     blockquote(quote2) {
38238       return `<blockquote>
38239 ${quote2}</blockquote>
38240 `;
38241     }
38242     html(html2, block2) {
38243       return html2;
38244     }
38245     /**
38246      * @param {string} text
38247      * @param {string} level
38248      * @param {string} raw
38249      * @param {any} slugger
38250      */
38251     heading(text2, level, raw, slugger) {
38252       if (this.options.headerIds) {
38253         const id2 = this.options.headerPrefix + slugger.slug(raw);
38254         return `<h${level} id="${id2}">${text2}</h${level}>
38255 `;
38256       }
38257       return `<h${level}>${text2}</h${level}>
38258 `;
38259     }
38260     hr() {
38261       return this.options.xhtml ? "<hr/>\n" : "<hr>\n";
38262     }
38263     list(body, ordered, start2) {
38264       const type2 = ordered ? "ol" : "ul", startatt = ordered && start2 !== 1 ? ' start="' + start2 + '"' : "";
38265       return "<" + type2 + startatt + ">\n" + body + "</" + type2 + ">\n";
38266     }
38267     /**
38268      * @param {string} text
38269      */
38270     listitem(text2) {
38271       return `<li>${text2}</li>
38272 `;
38273     }
38274     checkbox(checked) {
38275       return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox"' + (this.options.xhtml ? " /" : "") + "> ";
38276     }
38277     /**
38278      * @param {string} text
38279      */
38280     paragraph(text2) {
38281       return `<p>${text2}</p>
38282 `;
38283     }
38284     /**
38285      * @param {string} header
38286      * @param {string} body
38287      */
38288     table(header, body) {
38289       if (body)
38290         body = `<tbody>${body}</tbody>`;
38291       return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
38292     }
38293     /**
38294      * @param {string} content
38295      */
38296     tablerow(content) {
38297       return `<tr>
38298 ${content}</tr>
38299 `;
38300     }
38301     tablecell(content, flags) {
38302       const type2 = flags.header ? "th" : "td";
38303       const tag = flags.align ? `<${type2} align="${flags.align}">` : `<${type2}>`;
38304       return tag + content + `</${type2}>
38305 `;
38306     }
38307     /**
38308      * span level renderer
38309      * @param {string} text
38310      */
38311     strong(text2) {
38312       return `<strong>${text2}</strong>`;
38313     }
38314     /**
38315      * @param {string} text
38316      */
38317     em(text2) {
38318       return `<em>${text2}</em>`;
38319     }
38320     /**
38321      * @param {string} text
38322      */
38323     codespan(text2) {
38324       return `<code>${text2}</code>`;
38325     }
38326     br() {
38327       return this.options.xhtml ? "<br/>" : "<br>";
38328     }
38329     /**
38330      * @param {string} text
38331      */
38332     del(text2) {
38333       return `<del>${text2}</del>`;
38334     }
38335     /**
38336      * @param {string} href
38337      * @param {string} title
38338      * @param {string} text
38339      */
38340     link(href, title, text2) {
38341       href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
38342       if (href === null) {
38343         return text2;
38344       }
38345       let out = '<a href="' + href + '"';
38346       if (title) {
38347         out += ' title="' + title + '"';
38348       }
38349       out += ">" + text2 + "</a>";
38350       return out;
38351     }
38352     /**
38353      * @param {string} href
38354      * @param {string} title
38355      * @param {string} text
38356      */
38357     image(href, title, text2) {
38358       href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
38359       if (href === null) {
38360         return text2;
38361       }
38362       let out = `<img src="${href}" alt="${text2}"`;
38363       if (title) {
38364         out += ` title="${title}"`;
38365       }
38366       out += this.options.xhtml ? "/>" : ">";
38367       return out;
38368     }
38369     text(text2) {
38370       return text2;
38371     }
38372   };
38373   var TextRenderer = class {
38374     // no need for block level renderers
38375     strong(text2) {
38376       return text2;
38377     }
38378     em(text2) {
38379       return text2;
38380     }
38381     codespan(text2) {
38382       return text2;
38383     }
38384     del(text2) {
38385       return text2;
38386     }
38387     html(text2) {
38388       return text2;
38389     }
38390     text(text2) {
38391       return text2;
38392     }
38393     link(href, title, text2) {
38394       return "" + text2;
38395     }
38396     image(href, title, text2) {
38397       return "" + text2;
38398     }
38399     br() {
38400       return "";
38401     }
38402   };
38403   var Slugger = class {
38404     constructor() {
38405       this.seen = {};
38406     }
38407     /**
38408      * @param {string} value
38409      */
38410     serialize(value) {
38411       return value.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig, "").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, "").replace(/\s/g, "-");
38412     }
38413     /**
38414      * Finds the next safe (unique) slug to use
38415      * @param {string} originalSlug
38416      * @param {boolean} isDryRun
38417      */
38418     getNextSafeSlug(originalSlug, isDryRun) {
38419       let slug = originalSlug;
38420       let occurenceAccumulator = 0;
38421       if (this.seen.hasOwnProperty(slug)) {
38422         occurenceAccumulator = this.seen[originalSlug];
38423         do {
38424           occurenceAccumulator++;
38425           slug = originalSlug + "-" + occurenceAccumulator;
38426         } while (this.seen.hasOwnProperty(slug));
38427       }
38428       if (!isDryRun) {
38429         this.seen[originalSlug] = occurenceAccumulator;
38430         this.seen[slug] = 0;
38431       }
38432       return slug;
38433     }
38434     /**
38435      * Convert string to unique id
38436      * @param {object} [options]
38437      * @param {boolean} [options.dryrun] Generates the next unique slug without
38438      * updating the internal accumulator.
38439      */
38440     slug(value, options2 = {}) {
38441       const slug = this.serialize(value);
38442       return this.getNextSafeSlug(slug, options2.dryrun);
38443     }
38444   };
38445   var Parser = class _Parser {
38446     constructor(options2) {
38447       this.options = options2 || defaults;
38448       this.options.renderer = this.options.renderer || new Renderer();
38449       this.renderer = this.options.renderer;
38450       this.renderer.options = this.options;
38451       this.textRenderer = new TextRenderer();
38452       this.slugger = new Slugger();
38453     }
38454     /**
38455      * Static Parse Method
38456      */
38457     static parse(tokens, options2) {
38458       const parser3 = new _Parser(options2);
38459       return parser3.parse(tokens);
38460     }
38461     /**
38462      * Static Parse Inline Method
38463      */
38464     static parseInline(tokens, options2) {
38465       const parser3 = new _Parser(options2);
38466       return parser3.parseInline(tokens);
38467     }
38468     /**
38469      * Parse Loop
38470      */
38471     parse(tokens, top = true) {
38472       let out = "", i2, j2, k, l2, l3, row, cell, header, body, token, ordered, start2, loose, itemBody, item, checked, task, checkbox, ret;
38473       const l = tokens.length;
38474       for (i2 = 0; i2 < l; i2++) {
38475         token = tokens[i2];
38476         if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
38477           ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
38478           if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(token.type)) {
38479             out += ret || "";
38480             continue;
38481           }
38482         }
38483         switch (token.type) {
38484           case "space": {
38485             continue;
38486           }
38487           case "hr": {
38488             out += this.renderer.hr();
38489             continue;
38490           }
38491           case "heading": {
38492             out += this.renderer.heading(
38493               this.parseInline(token.tokens),
38494               token.depth,
38495               unescape3(this.parseInline(token.tokens, this.textRenderer)),
38496               this.slugger
38497             );
38498             continue;
38499           }
38500           case "code": {
38501             out += this.renderer.code(
38502               token.text,
38503               token.lang,
38504               token.escaped
38505             );
38506             continue;
38507           }
38508           case "table": {
38509             header = "";
38510             cell = "";
38511             l2 = token.header.length;
38512             for (j2 = 0; j2 < l2; j2++) {
38513               cell += this.renderer.tablecell(
38514                 this.parseInline(token.header[j2].tokens),
38515                 { header: true, align: token.align[j2] }
38516               );
38517             }
38518             header += this.renderer.tablerow(cell);
38519             body = "";
38520             l2 = token.rows.length;
38521             for (j2 = 0; j2 < l2; j2++) {
38522               row = token.rows[j2];
38523               cell = "";
38524               l3 = row.length;
38525               for (k = 0; k < l3; k++) {
38526                 cell += this.renderer.tablecell(
38527                   this.parseInline(row[k].tokens),
38528                   { header: false, align: token.align[k] }
38529                 );
38530               }
38531               body += this.renderer.tablerow(cell);
38532             }
38533             out += this.renderer.table(header, body);
38534             continue;
38535           }
38536           case "blockquote": {
38537             body = this.parse(token.tokens);
38538             out += this.renderer.blockquote(body);
38539             continue;
38540           }
38541           case "list": {
38542             ordered = token.ordered;
38543             start2 = token.start;
38544             loose = token.loose;
38545             l2 = token.items.length;
38546             body = "";
38547             for (j2 = 0; j2 < l2; j2++) {
38548               item = token.items[j2];
38549               checked = item.checked;
38550               task = item.task;
38551               itemBody = "";
38552               if (item.task) {
38553                 checkbox = this.renderer.checkbox(checked);
38554                 if (loose) {
38555                   if (item.tokens.length > 0 && item.tokens[0].type === "paragraph") {
38556                     item.tokens[0].text = checkbox + " " + item.tokens[0].text;
38557                     if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
38558                       item.tokens[0].tokens[0].text = checkbox + " " + item.tokens[0].tokens[0].text;
38559                     }
38560                   } else {
38561                     item.tokens.unshift({
38562                       type: "text",
38563                       text: checkbox
38564                     });
38565                   }
38566                 } else {
38567                   itemBody += checkbox;
38568                 }
38569               }
38570               itemBody += this.parse(item.tokens, loose);
38571               body += this.renderer.listitem(itemBody, task, checked);
38572             }
38573             out += this.renderer.list(body, ordered, start2);
38574             continue;
38575           }
38576           case "html": {
38577             out += this.renderer.html(token.text, token.block);
38578             continue;
38579           }
38580           case "paragraph": {
38581             out += this.renderer.paragraph(this.parseInline(token.tokens));
38582             continue;
38583           }
38584           case "text": {
38585             body = token.tokens ? this.parseInline(token.tokens) : token.text;
38586             while (i2 + 1 < l && tokens[i2 + 1].type === "text") {
38587               token = tokens[++i2];
38588               body += "\n" + (token.tokens ? this.parseInline(token.tokens) : token.text);
38589             }
38590             out += top ? this.renderer.paragraph(body) : body;
38591             continue;
38592           }
38593           default: {
38594             const errMsg = 'Token with "' + token.type + '" type was not found.';
38595             if (this.options.silent) {
38596               console.error(errMsg);
38597               return;
38598             } else {
38599               throw new Error(errMsg);
38600             }
38601           }
38602         }
38603       }
38604       return out;
38605     }
38606     /**
38607      * Parse Inline Tokens
38608      */
38609     parseInline(tokens, renderer) {
38610       renderer = renderer || this.renderer;
38611       let out = "", i2, token, ret;
38612       const l = tokens.length;
38613       for (i2 = 0; i2 < l; i2++) {
38614         token = tokens[i2];
38615         if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
38616           ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
38617           if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(token.type)) {
38618             out += ret || "";
38619             continue;
38620           }
38621         }
38622         switch (token.type) {
38623           case "escape": {
38624             out += renderer.text(token.text);
38625             break;
38626           }
38627           case "html": {
38628             out += renderer.html(token.text);
38629             break;
38630           }
38631           case "link": {
38632             out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
38633             break;
38634           }
38635           case "image": {
38636             out += renderer.image(token.href, token.title, token.text);
38637             break;
38638           }
38639           case "strong": {
38640             out += renderer.strong(this.parseInline(token.tokens, renderer));
38641             break;
38642           }
38643           case "em": {
38644             out += renderer.em(this.parseInline(token.tokens, renderer));
38645             break;
38646           }
38647           case "codespan": {
38648             out += renderer.codespan(token.text);
38649             break;
38650           }
38651           case "br": {
38652             out += renderer.br();
38653             break;
38654           }
38655           case "del": {
38656             out += renderer.del(this.parseInline(token.tokens, renderer));
38657             break;
38658           }
38659           case "text": {
38660             out += renderer.text(token.text);
38661             break;
38662           }
38663           default: {
38664             const errMsg = 'Token with "' + token.type + '" type was not found.';
38665             if (this.options.silent) {
38666               console.error(errMsg);
38667               return;
38668             } else {
38669               throw new Error(errMsg);
38670             }
38671           }
38672         }
38673       }
38674       return out;
38675     }
38676   };
38677   var Hooks = class {
38678     constructor(options2) {
38679       this.options = options2 || defaults;
38680     }
38681     static passThroughHooks = /* @__PURE__ */ new Set([
38682       "preprocess",
38683       "postprocess"
38684     ]);
38685     /**
38686      * Process markdown before marked
38687      */
38688     preprocess(markdown) {
38689       return markdown;
38690     }
38691     /**
38692      * Process HTML after marked is finished
38693      */
38694     postprocess(html2) {
38695       return html2;
38696     }
38697   };
38698   var Marked = class {
38699     defaults = getDefaults();
38700     options = this.setOptions;
38701     parse = this.#parseMarkdown(Lexer.lex, Parser.parse);
38702     parseInline = this.#parseMarkdown(Lexer.lexInline, Parser.parseInline);
38703     Parser = Parser;
38704     parser = Parser.parse;
38705     Renderer = Renderer;
38706     TextRenderer = TextRenderer;
38707     Lexer = Lexer;
38708     lexer = Lexer.lex;
38709     Tokenizer = Tokenizer;
38710     Slugger = Slugger;
38711     Hooks = Hooks;
38712     constructor(...args) {
38713       this.use(...args);
38714     }
38715     walkTokens(tokens, callback) {
38716       let values = [];
38717       for (const token of tokens) {
38718         values = values.concat(callback.call(this, token));
38719         switch (token.type) {
38720           case "table": {
38721             for (const cell of token.header) {
38722               values = values.concat(this.walkTokens(cell.tokens, callback));
38723             }
38724             for (const row of token.rows) {
38725               for (const cell of row) {
38726                 values = values.concat(this.walkTokens(cell.tokens, callback));
38727               }
38728             }
38729             break;
38730           }
38731           case "list": {
38732             values = values.concat(this.walkTokens(token.items, callback));
38733             break;
38734           }
38735           default: {
38736             if (this.defaults.extensions && this.defaults.extensions.childTokens && this.defaults.extensions.childTokens[token.type]) {
38737               this.defaults.extensions.childTokens[token.type].forEach((childTokens) => {
38738                 values = values.concat(this.walkTokens(token[childTokens], callback));
38739               });
38740             } else if (token.tokens) {
38741               values = values.concat(this.walkTokens(token.tokens, callback));
38742             }
38743           }
38744         }
38745       }
38746       return values;
38747     }
38748     use(...args) {
38749       const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} };
38750       args.forEach((pack) => {
38751         const opts = { ...pack };
38752         opts.async = this.defaults.async || opts.async || false;
38753         if (pack.extensions) {
38754           pack.extensions.forEach((ext) => {
38755             if (!ext.name) {
38756               throw new Error("extension name required");
38757             }
38758             if (ext.renderer) {
38759               const prevRenderer = extensions.renderers[ext.name];
38760               if (prevRenderer) {
38761                 extensions.renderers[ext.name] = function(...args2) {
38762                   let ret = ext.renderer.apply(this, args2);
38763                   if (ret === false) {
38764                     ret = prevRenderer.apply(this, args2);
38765                   }
38766                   return ret;
38767                 };
38768               } else {
38769                 extensions.renderers[ext.name] = ext.renderer;
38770               }
38771             }
38772             if (ext.tokenizer) {
38773               if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
38774                 throw new Error("extension level must be 'block' or 'inline'");
38775               }
38776               if (extensions[ext.level]) {
38777                 extensions[ext.level].unshift(ext.tokenizer);
38778               } else {
38779                 extensions[ext.level] = [ext.tokenizer];
38780               }
38781               if (ext.start) {
38782                 if (ext.level === "block") {
38783                   if (extensions.startBlock) {
38784                     extensions.startBlock.push(ext.start);
38785                   } else {
38786                     extensions.startBlock = [ext.start];
38787                   }
38788                 } else if (ext.level === "inline") {
38789                   if (extensions.startInline) {
38790                     extensions.startInline.push(ext.start);
38791                   } else {
38792                     extensions.startInline = [ext.start];
38793                   }
38794                 }
38795               }
38796             }
38797             if (ext.childTokens) {
38798               extensions.childTokens[ext.name] = ext.childTokens;
38799             }
38800           });
38801           opts.extensions = extensions;
38802         }
38803         if (pack.renderer) {
38804           const renderer = this.defaults.renderer || new Renderer(this.defaults);
38805           for (const prop in pack.renderer) {
38806             const prevRenderer = renderer[prop];
38807             renderer[prop] = (...args2) => {
38808               let ret = pack.renderer[prop].apply(renderer, args2);
38809               if (ret === false) {
38810                 ret = prevRenderer.apply(renderer, args2);
38811               }
38812               return ret;
38813             };
38814           }
38815           opts.renderer = renderer;
38816         }
38817         if (pack.tokenizer) {
38818           const tokenizer = this.defaults.tokenizer || new Tokenizer(this.defaults);
38819           for (const prop in pack.tokenizer) {
38820             const prevTokenizer = tokenizer[prop];
38821             tokenizer[prop] = (...args2) => {
38822               let ret = pack.tokenizer[prop].apply(tokenizer, args2);
38823               if (ret === false) {
38824                 ret = prevTokenizer.apply(tokenizer, args2);
38825               }
38826               return ret;
38827             };
38828           }
38829           opts.tokenizer = tokenizer;
38830         }
38831         if (pack.hooks) {
38832           const hooks = this.defaults.hooks || new Hooks();
38833           for (const prop in pack.hooks) {
38834             const prevHook = hooks[prop];
38835             if (Hooks.passThroughHooks.has(prop)) {
38836               hooks[prop] = (arg) => {
38837                 if (this.defaults.async) {
38838                   return Promise.resolve(pack.hooks[prop].call(hooks, arg)).then((ret2) => {
38839                     return prevHook.call(hooks, ret2);
38840                   });
38841                 }
38842                 const ret = pack.hooks[prop].call(hooks, arg);
38843                 return prevHook.call(hooks, ret);
38844               };
38845             } else {
38846               hooks[prop] = (...args2) => {
38847                 let ret = pack.hooks[prop].apply(hooks, args2);
38848                 if (ret === false) {
38849                   ret = prevHook.apply(hooks, args2);
38850                 }
38851                 return ret;
38852               };
38853             }
38854           }
38855           opts.hooks = hooks;
38856         }
38857         if (pack.walkTokens) {
38858           const walkTokens2 = this.defaults.walkTokens;
38859           opts.walkTokens = function(token) {
38860             let values = [];
38861             values.push(pack.walkTokens.call(this, token));
38862             if (walkTokens2) {
38863               values = values.concat(walkTokens2.call(this, token));
38864             }
38865             return values;
38866           };
38867         }
38868         this.defaults = { ...this.defaults, ...opts };
38869       });
38870       return this;
38871     }
38872     setOptions(opt) {
38873       this.defaults = { ...this.defaults, ...opt };
38874       return this;
38875     }
38876     #parseMarkdown(lexer2, parser3) {
38877       return (src, opt, callback) => {
38878         if (typeof opt === "function") {
38879           callback = opt;
38880           opt = null;
38881         }
38882         const origOpt = { ...opt };
38883         opt = { ...this.defaults, ...origOpt };
38884         const throwError = this.#onError(opt.silent, opt.async, callback);
38885         if (typeof src === "undefined" || src === null) {
38886           return throwError(new Error("marked(): input parameter is undefined or null"));
38887         }
38888         if (typeof src !== "string") {
38889           return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"));
38890         }
38891         checkDeprecations(opt, callback);
38892         if (opt.hooks) {
38893           opt.hooks.options = opt;
38894         }
38895         if (callback) {
38896           const highlight = opt.highlight;
38897           let tokens;
38898           try {
38899             if (opt.hooks) {
38900               src = opt.hooks.preprocess(src);
38901             }
38902             tokens = lexer2(src, opt);
38903           } catch (e) {
38904             return throwError(e);
38905           }
38906           const done = (err) => {
38907             let out;
38908             if (!err) {
38909               try {
38910                 if (opt.walkTokens) {
38911                   this.walkTokens(tokens, opt.walkTokens);
38912                 }
38913                 out = parser3(tokens, opt);
38914                 if (opt.hooks) {
38915                   out = opt.hooks.postprocess(out);
38916                 }
38917               } catch (e) {
38918                 err = e;
38919               }
38920             }
38921             opt.highlight = highlight;
38922             return err ? throwError(err) : callback(null, out);
38923           };
38924           if (!highlight || highlight.length < 3) {
38925             return done();
38926           }
38927           delete opt.highlight;
38928           if (!tokens.length)
38929             return done();
38930           let pending = 0;
38931           this.walkTokens(tokens, (token) => {
38932             if (token.type === "code") {
38933               pending++;
38934               setTimeout(() => {
38935                 highlight(token.text, token.lang, (err, code) => {
38936                   if (err) {
38937                     return done(err);
38938                   }
38939                   if (code != null && code !== token.text) {
38940                     token.text = code;
38941                     token.escaped = true;
38942                   }
38943                   pending--;
38944                   if (pending === 0) {
38945                     done();
38946                   }
38947                 });
38948               }, 0);
38949             }
38950           });
38951           if (pending === 0) {
38952             done();
38953           }
38954           return;
38955         }
38956         if (opt.async) {
38957           return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens) => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser3(tokens, opt)).then((html2) => opt.hooks ? opt.hooks.postprocess(html2) : html2).catch(throwError);
38958         }
38959         try {
38960           if (opt.hooks) {
38961             src = opt.hooks.preprocess(src);
38962           }
38963           const tokens = lexer2(src, opt);
38964           if (opt.walkTokens) {
38965             this.walkTokens(tokens, opt.walkTokens);
38966           }
38967           let html2 = parser3(tokens, opt);
38968           if (opt.hooks) {
38969             html2 = opt.hooks.postprocess(html2);
38970           }
38971           return html2;
38972         } catch (e) {
38973           return throwError(e);
38974         }
38975       };
38976     }
38977     #onError(silent, async, callback) {
38978       return (e) => {
38979         e.message += "\nPlease report this to https://github.com/markedjs/marked.";
38980         if (silent) {
38981           const msg = "<p>An error occurred:</p><pre>" + escape4(e.message + "", true) + "</pre>";
38982           if (async) {
38983             return Promise.resolve(msg);
38984           }
38985           if (callback) {
38986             callback(null, msg);
38987             return;
38988           }
38989           return msg;
38990         }
38991         if (async) {
38992           return Promise.reject(e);
38993         }
38994         if (callback) {
38995           callback(e);
38996           return;
38997         }
38998         throw e;
38999       };
39000     }
39001   };
39002   var markedInstance = new Marked(defaults);
39003   function marked(src, opt, callback) {
39004     return markedInstance.parse(src, opt, callback);
39005   }
39006   marked.options = marked.setOptions = function(opt) {
39007     markedInstance.setOptions(opt);
39008     marked.defaults = markedInstance.defaults;
39009     changeDefaults(marked.defaults);
39010     return marked;
39011   };
39012   marked.getDefaults = getDefaults;
39013   marked.defaults = defaults;
39014   marked.use = function(...args) {
39015     markedInstance.use(...args);
39016     marked.defaults = markedInstance.defaults;
39017     changeDefaults(marked.defaults);
39018     return marked;
39019   };
39020   marked.walkTokens = function(tokens, callback) {
39021     return markedInstance.walkTokens(tokens, callback);
39022   };
39023   marked.parseInline = markedInstance.parseInline;
39024   marked.Parser = Parser;
39025   marked.parser = Parser.parse;
39026   marked.Renderer = Renderer;
39027   marked.TextRenderer = TextRenderer;
39028   marked.Lexer = Lexer;
39029   marked.lexer = Lexer.lex;
39030   marked.Tokenizer = Tokenizer;
39031   marked.Slugger = Slugger;
39032   marked.Hooks = Hooks;
39033   marked.parse = marked;
39034   var options = marked.options;
39035   var setOptions = marked.setOptions;
39036   var use = marked.use;
39037   var walkTokens = marked.walkTokens;
39038   var parseInline = marked.parseInline;
39039   var parser2 = Parser.parse;
39040   var lexer = Lexer.lex;
39041
39042   // modules/services/osmose.js
39043   var tiler3 = utilTiler();
39044   var dispatch4 = dispatch_default("loaded");
39045   var _tileZoom3 = 14;
39046   var _osmoseUrlRoot = "https://osmose.openstreetmap.fr/api/0.3";
39047   var _osmoseData = { icons: {}, items: [] };
39048   var _cache3;
39049   function abortRequest3(controller) {
39050     if (controller) {
39051       controller.abort();
39052     }
39053   }
39054   function abortUnwantedRequests3(cache, tiles) {
39055     Object.keys(cache.inflightTile).forEach((k) => {
39056       let wanted = tiles.find((tile) => k === tile.id);
39057       if (!wanted) {
39058         abortRequest3(cache.inflightTile[k]);
39059         delete cache.inflightTile[k];
39060       }
39061     });
39062   }
39063   function encodeIssueRtree3(d) {
39064     return { minX: d.loc[0], minY: d.loc[1], maxX: d.loc[0], maxY: d.loc[1], data: d };
39065   }
39066   function updateRtree3(item, replace) {
39067     _cache3.rtree.remove(item, (a, b) => a.data.id === b.data.id);
39068     if (replace) {
39069       _cache3.rtree.insert(item);
39070     }
39071   }
39072   function preventCoincident2(loc) {
39073     let coincident = false;
39074     do {
39075       let delta = coincident ? [1e-5, 0] : [0, 1e-5];
39076       loc = geoVecAdd(loc, delta);
39077       let bbox2 = geoExtent(loc).bbox();
39078       coincident = _cache3.rtree.search(bbox2).length;
39079     } while (coincident);
39080     return loc;
39081   }
39082   var osmose_default = {
39083     title: "osmose",
39084     init() {
39085       _mainFileFetcher.get("qa_data").then((d) => {
39086         _osmoseData = d.osmose;
39087         _osmoseData.items = Object.keys(d.osmose.icons).map((s) => s.split("-")[0]).reduce((unique, item) => unique.indexOf(item) !== -1 ? unique : [...unique, item], []);
39088       });
39089       if (!_cache3) {
39090         this.reset();
39091       }
39092       this.event = utilRebind(this, dispatch4, "on");
39093     },
39094     reset() {
39095       let _strings = {};
39096       let _colors = {};
39097       if (_cache3) {
39098         Object.values(_cache3.inflightTile).forEach(abortRequest3);
39099         _strings = _cache3.strings;
39100         _colors = _cache3.colors;
39101       }
39102       _cache3 = {
39103         data: {},
39104         loadedTile: {},
39105         inflightTile: {},
39106         inflightPost: {},
39107         closed: {},
39108         rtree: new import_rbush3.default(),
39109         strings: _strings,
39110         colors: _colors
39111       };
39112     },
39113     loadIssues(projection2) {
39114       let params = {
39115         // Tiles return a maximum # of issues
39116         // So we want to filter our request for only types iD supports
39117         item: _osmoseData.items
39118       };
39119       let tiles = tiler3.zoomExtent([_tileZoom3, _tileZoom3]).getTiles(projection2);
39120       abortUnwantedRequests3(_cache3, tiles);
39121       tiles.forEach((tile) => {
39122         if (_cache3.loadedTile[tile.id] || _cache3.inflightTile[tile.id])
39123           return;
39124         let [x, y, z] = tile.xyz;
39125         let url = `${_osmoseUrlRoot}/issues/${z}/${x}/${y}.geojson?` + utilQsString(params);
39126         let controller = new AbortController();
39127         _cache3.inflightTile[tile.id] = controller;
39128         json_default(url, { signal: controller.signal }).then((data) => {
39129           delete _cache3.inflightTile[tile.id];
39130           _cache3.loadedTile[tile.id] = true;
39131           if (data.features) {
39132             data.features.forEach((issue) => {
39133               const { item, class: cl, uuid: id2 } = issue.properties;
39134               const itemType = `${item}-${cl}`;
39135               if (itemType in _osmoseData.icons) {
39136                 let loc = issue.geometry.coordinates;
39137                 loc = preventCoincident2(loc);
39138                 let d = new QAItem(loc, this, itemType, id2, { item });
39139                 if (item === 8300 || item === 8360) {
39140                   d.elems = [];
39141                 }
39142                 _cache3.data[d.id] = d;
39143                 _cache3.rtree.insert(encodeIssueRtree3(d));
39144               }
39145             });
39146           }
39147           dispatch4.call("loaded");
39148         }).catch(() => {
39149           delete _cache3.inflightTile[tile.id];
39150           _cache3.loadedTile[tile.id] = true;
39151         });
39152       });
39153     },
39154     loadIssueDetail(issue) {
39155       if (issue.elems !== void 0) {
39156         return Promise.resolve(issue);
39157       }
39158       const url = `${_osmoseUrlRoot}/issue/${issue.id}?langs=${_mainLocalizer.localeCode()}`;
39159       const cacheDetails = (data) => {
39160         issue.elems = data.elems.map((e) => e.type.substring(0, 1) + e.id);
39161         issue.detail = data.subtitle ? marked(data.subtitle.auto) : "";
39162         this.replaceItem(issue);
39163       };
39164       return json_default(url).then(cacheDetails).then(() => issue);
39165     },
39166     loadStrings(locale2 = _mainLocalizer.localeCode()) {
39167       const items = Object.keys(_osmoseData.icons);
39168       if (locale2 in _cache3.strings && Object.keys(_cache3.strings[locale2]).length === items.length) {
39169         return Promise.resolve(_cache3.strings[locale2]);
39170       }
39171       if (!(locale2 in _cache3.strings)) {
39172         _cache3.strings[locale2] = {};
39173       }
39174       const allRequests = items.map((itemType) => {
39175         if (itemType in _cache3.strings[locale2])
39176           return null;
39177         const cacheData = (data) => {
39178           const [cat = { items: [] }] = data.categories;
39179           const [item2 = { class: [] }] = cat.items;
39180           const [cl2 = null] = item2.class;
39181           if (!cl2) {
39182             console.log(`Osmose strings request (${itemType}) had unexpected data`);
39183             return;
39184           }
39185           const { item: itemInt, color: color2 } = item2;
39186           if (/^#[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/.test(color2)) {
39187             _cache3.colors[itemInt] = color2;
39188           }
39189           const { title, detail, fix, trap } = cl2;
39190           let issueStrings = {};
39191           if (title)
39192             issueStrings.title = title.auto;
39193           if (detail)
39194             issueStrings.detail = marked(detail.auto);
39195           if (trap)
39196             issueStrings.trap = marked(trap.auto);
39197           if (fix)
39198             issueStrings.fix = marked(fix.auto);
39199           _cache3.strings[locale2][itemType] = issueStrings;
39200         };
39201         const [item, cl] = itemType.split("-");
39202         const url = `${_osmoseUrlRoot}/items/${item}/class/${cl}?langs=${locale2}`;
39203         return json_default(url).then(cacheData);
39204       }).filter(Boolean);
39205       return Promise.all(allRequests).then(() => _cache3.strings[locale2]);
39206     },
39207     getStrings(itemType, locale2 = _mainLocalizer.localeCode()) {
39208       return locale2 in _cache3.strings ? _cache3.strings[locale2][itemType] : {};
39209     },
39210     getColor(itemType) {
39211       return itemType in _cache3.colors ? _cache3.colors[itemType] : "#FFFFFF";
39212     },
39213     postUpdate(issue, callback) {
39214       if (_cache3.inflightPost[issue.id]) {
39215         return callback({ message: "Issue update already inflight", status: -2 }, issue);
39216       }
39217       const url = `${_osmoseUrlRoot}/issue/${issue.id}/${issue.newStatus}`;
39218       const controller = new AbortController();
39219       const after = () => {
39220         delete _cache3.inflightPost[issue.id];
39221         this.removeItem(issue);
39222         if (issue.newStatus === "done") {
39223           if (!(issue.item in _cache3.closed)) {
39224             _cache3.closed[issue.item] = 0;
39225           }
39226           _cache3.closed[issue.item] += 1;
39227         }
39228         if (callback)
39229           callback(null, issue);
39230       };
39231       _cache3.inflightPost[issue.id] = controller;
39232       fetch(url, { signal: controller.signal }).then(after).catch((err) => {
39233         delete _cache3.inflightPost[issue.id];
39234         if (callback)
39235           callback(err.message);
39236       });
39237     },
39238     // Get all cached QAItems covering the viewport
39239     getItems(projection2) {
39240       const viewport = projection2.clipExtent();
39241       const min3 = [viewport[0][0], viewport[1][1]];
39242       const max3 = [viewport[1][0], viewport[0][1]];
39243       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
39244       return _cache3.rtree.search(bbox2).map((d) => d.data);
39245     },
39246     // Get a QAItem from cache
39247     // NOTE: Don't change method name until UI v3 is merged
39248     getError(id2) {
39249       return _cache3.data[id2];
39250     },
39251     // get the name of the icon to display for this item
39252     getIcon(itemType) {
39253       return _osmoseData.icons[itemType];
39254     },
39255     // Replace a single QAItem in the cache
39256     replaceItem(item) {
39257       if (!(item instanceof QAItem) || !item.id)
39258         return;
39259       _cache3.data[item.id] = item;
39260       updateRtree3(encodeIssueRtree3(item), true);
39261       return item;
39262     },
39263     // Remove a single QAItem from the cache
39264     removeItem(item) {
39265       if (!(item instanceof QAItem) || !item.id)
39266         return;
39267       delete _cache3.data[item.id];
39268       updateRtree3(encodeIssueRtree3(item), false);
39269     },
39270     // Used to populate `closed:osmose:*` changeset tags
39271     getClosedCounts() {
39272       return _cache3.closed;
39273     },
39274     itemURL(item) {
39275       return `https://osmose.openstreetmap.fr/en/error/${item.id}`;
39276     }
39277   };
39278
39279   // modules/services/mapillary.js
39280   var import_pbf = __toESM(require_pbf());
39281   var import_rbush4 = __toESM(require_rbush_min());
39282   var import_vector_tile = __toESM(require_vector_tile());
39283   var accessToken = "MLY|4100327730013843|5bb78b81720791946a9a7b956c57b7cf";
39284   var apiUrl = "https://graph.mapillary.com/";
39285   var baseTileUrl = "https://tiles.mapillary.com/maps/vtp";
39286   var mapFeatureTileUrl = `${baseTileUrl}/mly_map_feature_point/2/{z}/{x}/{y}?access_token=${accessToken}`;
39287   var tileUrl = `${baseTileUrl}/mly1_public/2/{z}/{x}/{y}?access_token=${accessToken}`;
39288   var trafficSignTileUrl = `${baseTileUrl}/mly_map_feature_traffic_sign/2/{z}/{x}/{y}?access_token=${accessToken}`;
39289   var viewercss = "mapillary-js/mapillary.css";
39290   var viewerjs = "mapillary-js/mapillary.js";
39291   var minZoom = 14;
39292   var dispatch5 = dispatch_default("change", "loadedImages", "loadedSigns", "loadedMapFeatures", "bearingChanged", "imageChanged");
39293   var _loadViewerPromise;
39294   var _mlyActiveImage;
39295   var _mlyCache;
39296   var _mlyFallback = false;
39297   var _mlyHighlightedDetection;
39298   var _mlyShowFeatureDetections = false;
39299   var _mlyShowSignDetections = false;
39300   var _mlyViewer;
39301   var _mlyViewerFilter = ["all"];
39302   function loadTiles(which, url, maxZoom2, projection2) {
39303     const tiler8 = utilTiler().zoomExtent([minZoom, maxZoom2]).skipNullIsland(true);
39304     const tiles = tiler8.getTiles(projection2);
39305     tiles.forEach(function(tile) {
39306       loadTile(which, url, tile);
39307     });
39308   }
39309   function loadTile(which, url, tile) {
39310     const cache = _mlyCache.requests;
39311     const tileId = `${tile.id}-${which}`;
39312     if (cache.loaded[tileId] || cache.inflight[tileId])
39313       return;
39314     const controller = new AbortController();
39315     cache.inflight[tileId] = controller;
39316     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
39317     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
39318       if (!response.ok) {
39319         throw new Error(response.status + " " + response.statusText);
39320       }
39321       cache.loaded[tileId] = true;
39322       delete cache.inflight[tileId];
39323       return response.arrayBuffer();
39324     }).then(function(data) {
39325       if (!data) {
39326         throw new Error("No Data");
39327       }
39328       loadTileDataToCache(data, tile, which);
39329       if (which === "images") {
39330         dispatch5.call("loadedImages");
39331       } else if (which === "signs") {
39332         dispatch5.call("loadedSigns");
39333       } else if (which === "points") {
39334         dispatch5.call("loadedMapFeatures");
39335       }
39336     }).catch(function() {
39337       cache.loaded[tileId] = true;
39338       delete cache.inflight[tileId];
39339     });
39340   }
39341   function loadTileDataToCache(data, tile, which) {
39342     const vectorTile = new import_vector_tile.VectorTile(new import_pbf.default(data));
39343     let features, cache, layer, i2, feature3, loc, d;
39344     if (vectorTile.layers.hasOwnProperty("image")) {
39345       features = [];
39346       cache = _mlyCache.images;
39347       layer = vectorTile.layers.image;
39348       for (i2 = 0; i2 < layer.length; i2++) {
39349         feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
39350         loc = feature3.geometry.coordinates;
39351         d = {
39352           loc,
39353           captured_at: feature3.properties.captured_at,
39354           ca: feature3.properties.compass_angle,
39355           id: feature3.properties.id,
39356           is_pano: feature3.properties.is_pano,
39357           sequence_id: feature3.properties.sequence_id
39358         };
39359         cache.forImageId[d.id] = d;
39360         features.push({
39361           minX: loc[0],
39362           minY: loc[1],
39363           maxX: loc[0],
39364           maxY: loc[1],
39365           data: d
39366         });
39367       }
39368       if (cache.rtree) {
39369         cache.rtree.load(features);
39370       }
39371     }
39372     if (vectorTile.layers.hasOwnProperty("sequence")) {
39373       features = [];
39374       cache = _mlyCache.sequences;
39375       layer = vectorTile.layers.sequence;
39376       for (i2 = 0; i2 < layer.length; i2++) {
39377         feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
39378         if (cache.lineString[feature3.properties.id]) {
39379           cache.lineString[feature3.properties.id].push(feature3);
39380         } else {
39381           cache.lineString[feature3.properties.id] = [feature3];
39382         }
39383       }
39384     }
39385     if (vectorTile.layers.hasOwnProperty("point")) {
39386       features = [];
39387       cache = _mlyCache[which];
39388       layer = vectorTile.layers.point;
39389       for (i2 = 0; i2 < layer.length; i2++) {
39390         feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
39391         loc = feature3.geometry.coordinates;
39392         d = {
39393           loc,
39394           id: feature3.properties.id,
39395           first_seen_at: feature3.properties.first_seen_at,
39396           last_seen_at: feature3.properties.last_seen_at,
39397           value: feature3.properties.value
39398         };
39399         features.push({
39400           minX: loc[0],
39401           minY: loc[1],
39402           maxX: loc[0],
39403           maxY: loc[1],
39404           data: d
39405         });
39406       }
39407       if (cache.rtree) {
39408         cache.rtree.load(features);
39409       }
39410     }
39411     if (vectorTile.layers.hasOwnProperty("traffic_sign")) {
39412       features = [];
39413       cache = _mlyCache[which];
39414       layer = vectorTile.layers.traffic_sign;
39415       for (i2 = 0; i2 < layer.length; i2++) {
39416         feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
39417         loc = feature3.geometry.coordinates;
39418         d = {
39419           loc,
39420           id: feature3.properties.id,
39421           first_seen_at: feature3.properties.first_seen_at,
39422           last_seen_at: feature3.properties.last_seen_at,
39423           value: feature3.properties.value
39424         };
39425         features.push({
39426           minX: loc[0],
39427           minY: loc[1],
39428           maxX: loc[0],
39429           maxY: loc[1],
39430           data: d
39431         });
39432       }
39433       if (cache.rtree) {
39434         cache.rtree.load(features);
39435       }
39436     }
39437   }
39438   function loadData(url) {
39439     return fetch(url).then(function(response) {
39440       if (!response.ok) {
39441         throw new Error(response.status + " " + response.statusText);
39442       }
39443       return response.json();
39444     }).then(function(result) {
39445       if (!result) {
39446         return [];
39447       }
39448       return result.data || [];
39449     });
39450   }
39451   function partitionViewport(projection2) {
39452     const z = geoScaleToZoom(projection2.scale());
39453     const z2 = Math.ceil(z * 2) / 2 + 2.5;
39454     const tiler8 = utilTiler().zoomExtent([z2, z2]);
39455     return tiler8.getTiles(projection2).map(function(tile) {
39456       return tile.extent;
39457     });
39458   }
39459   function searchLimited(limit, projection2, rtree) {
39460     limit = limit || 5;
39461     return partitionViewport(projection2).reduce(function(result, extent) {
39462       const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d) {
39463         return d.data;
39464       });
39465       return found.length ? result.concat(found) : result;
39466     }, []);
39467   }
39468   var mapillary_default = {
39469     // Initialize Mapillary
39470     init: function() {
39471       if (!_mlyCache) {
39472         this.reset();
39473       }
39474       this.event = utilRebind(this, dispatch5, "on");
39475     },
39476     // Reset cache and state
39477     reset: function() {
39478       if (_mlyCache) {
39479         Object.values(_mlyCache.requests.inflight).forEach(function(request3) {
39480           request3.abort();
39481         });
39482       }
39483       _mlyCache = {
39484         images: { rtree: new import_rbush4.default(), forImageId: {} },
39485         image_detections: { forImageId: {} },
39486         signs: { rtree: new import_rbush4.default() },
39487         points: { rtree: new import_rbush4.default() },
39488         sequences: { rtree: new import_rbush4.default(), lineString: {} },
39489         requests: { loaded: {}, inflight: {} }
39490       };
39491       _mlyActiveImage = null;
39492     },
39493     // Get visible images
39494     images: function(projection2) {
39495       const limit = 5;
39496       return searchLimited(limit, projection2, _mlyCache.images.rtree);
39497     },
39498     // Get visible traffic signs
39499     signs: function(projection2) {
39500       const limit = 5;
39501       return searchLimited(limit, projection2, _mlyCache.signs.rtree);
39502     },
39503     // Get visible map (point) features
39504     mapFeatures: function(projection2) {
39505       const limit = 5;
39506       return searchLimited(limit, projection2, _mlyCache.points.rtree);
39507     },
39508     // Get cached image by id
39509     cachedImage: function(imageId) {
39510       return _mlyCache.images.forImageId[imageId];
39511     },
39512     // Get visible sequences
39513     sequences: function(projection2) {
39514       const viewport = projection2.clipExtent();
39515       const min3 = [viewport[0][0], viewport[1][1]];
39516       const max3 = [viewport[1][0], viewport[0][1]];
39517       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
39518       const sequenceIds = {};
39519       let lineStrings = [];
39520       _mlyCache.images.rtree.search(bbox2).forEach(function(d) {
39521         if (d.data.sequence_id) {
39522           sequenceIds[d.data.sequence_id] = true;
39523         }
39524       });
39525       Object.keys(sequenceIds).forEach(function(sequenceId) {
39526         if (_mlyCache.sequences.lineString[sequenceId]) {
39527           lineStrings = lineStrings.concat(_mlyCache.sequences.lineString[sequenceId]);
39528         }
39529       });
39530       return lineStrings;
39531     },
39532     // Load images in the visible area
39533     loadImages: function(projection2) {
39534       loadTiles("images", tileUrl, 14, projection2);
39535     },
39536     // Load traffic signs in the visible area
39537     loadSigns: function(projection2) {
39538       loadTiles("signs", trafficSignTileUrl, 14, projection2);
39539     },
39540     // Load map (point) features in the visible area
39541     loadMapFeatures: function(projection2) {
39542       loadTiles("points", mapFeatureTileUrl, 14, projection2);
39543     },
39544     // Return a promise that resolves when the image viewer (Mapillary JS) library has finished loading
39545     ensureViewerLoaded: function(context) {
39546       if (_loadViewerPromise)
39547         return _loadViewerPromise;
39548       const wrap2 = context.container().select(".photoviewer").selectAll(".mly-wrapper").data([0]);
39549       wrap2.enter().append("div").attr("id", "ideditor-mly").attr("class", "photo-wrapper mly-wrapper").classed("hide", true);
39550       const that = this;
39551       _loadViewerPromise = new Promise((resolve, reject) => {
39552         let loadedCount = 0;
39553         function loaded() {
39554           loadedCount += 1;
39555           if (loadedCount === 2)
39556             resolve();
39557         }
39558         const head = select_default2("head");
39559         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() {
39560           reject();
39561         });
39562         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() {
39563           reject();
39564         });
39565       }).catch(function() {
39566         _loadViewerPromise = null;
39567       }).then(function() {
39568         that.initViewer(context);
39569       });
39570       return _loadViewerPromise;
39571     },
39572     // Load traffic sign image sprites
39573     loadSignResources: function(context) {
39574       context.ui().svgDefs.addSprites(
39575         ["mapillary-sprite"],
39576         false
39577         /* don't override colors */
39578       );
39579       return this;
39580     },
39581     // Load map (point) feature image sprites
39582     loadObjectResources: function(context) {
39583       context.ui().svgDefs.addSprites(
39584         ["mapillary-object-sprite"],
39585         false
39586         /* don't override colors */
39587       );
39588       return this;
39589     },
39590     // Remove previous detections in image viewer
39591     resetTags: function() {
39592       if (_mlyViewer && !_mlyFallback) {
39593         _mlyViewer.getComponent("tag").removeAll();
39594       }
39595     },
39596     // Show map feature detections in image viewer
39597     showFeatureDetections: function(value) {
39598       _mlyShowFeatureDetections = value;
39599       if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
39600         this.resetTags();
39601       }
39602     },
39603     // Show traffic sign detections in image viewer
39604     showSignDetections: function(value) {
39605       _mlyShowSignDetections = value;
39606       if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
39607         this.resetTags();
39608       }
39609     },
39610     // Apply filter to image viewer
39611     filterViewer: function(context) {
39612       const showsPano = context.photos().showsPanoramic();
39613       const showsFlat = context.photos().showsFlat();
39614       const fromDate = context.photos().fromDate();
39615       const toDate = context.photos().toDate();
39616       const filter2 = ["all"];
39617       if (!showsPano)
39618         filter2.push(["!=", "cameraType", "spherical"]);
39619       if (!showsFlat && showsPano)
39620         filter2.push(["==", "pano", true]);
39621       if (fromDate) {
39622         filter2.push([">=", "capturedAt", new Date(fromDate).getTime()]);
39623       }
39624       if (toDate) {
39625         filter2.push([">=", "capturedAt", new Date(toDate).getTime()]);
39626       }
39627       if (_mlyViewer) {
39628         _mlyViewer.setFilter(filter2);
39629       }
39630       _mlyViewerFilter = filter2;
39631       return filter2;
39632     },
39633     // Make the image viewer visible
39634     showViewer: function(context) {
39635       const wrap2 = context.container().select(".photoviewer").classed("hide", false);
39636       const isHidden = wrap2.selectAll(".photo-wrapper.mly-wrapper.hide").size();
39637       if (isHidden && _mlyViewer) {
39638         wrap2.selectAll(".photo-wrapper:not(.mly-wrapper)").classed("hide", true);
39639         wrap2.selectAll(".photo-wrapper.mly-wrapper").classed("hide", false);
39640         _mlyViewer.resize();
39641       }
39642       return this;
39643     },
39644     // Hide the image viewer and resets map markers
39645     hideViewer: function(context) {
39646       _mlyActiveImage = null;
39647       if (!_mlyFallback && _mlyViewer) {
39648         _mlyViewer.getComponent("sequence").stop();
39649       }
39650       const viewer = context.container().select(".photoviewer");
39651       if (!viewer.empty())
39652         viewer.datum(null);
39653       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
39654       this.updateUrlImage(null);
39655       dispatch5.call("imageChanged");
39656       dispatch5.call("loadedMapFeatures");
39657       dispatch5.call("loadedSigns");
39658       return this.setStyles(context, null);
39659     },
39660     // Update the URL with current image id
39661     updateUrlImage: function(imageId) {
39662       if (!window.mocha) {
39663         const hash = utilStringQs(window.location.hash);
39664         if (imageId) {
39665           hash.photo = "mapillary/" + imageId;
39666         } else {
39667           delete hash.photo;
39668         }
39669         window.location.replace("#" + utilQsString(hash, true));
39670       }
39671     },
39672     // Highlight the detection in the viewer that is related to the clicked map feature
39673     highlightDetection: function(detection) {
39674       if (detection) {
39675         _mlyHighlightedDetection = detection.id;
39676       }
39677       return this;
39678     },
39679     // Initialize image viewer (Mapillar JS)
39680     initViewer: function(context) {
39681       const that = this;
39682       if (!window.mapillary)
39683         return;
39684       const opts = {
39685         accessToken,
39686         component: {
39687           cover: false,
39688           keyboard: false,
39689           tag: true
39690         },
39691         container: "ideditor-mly"
39692       };
39693       if (!mapillary.isSupported() && mapillary.isFallbackSupported()) {
39694         _mlyFallback = true;
39695         opts.component = {
39696           cover: false,
39697           direction: false,
39698           imagePlane: false,
39699           keyboard: false,
39700           mouse: false,
39701           sequence: false,
39702           tag: false,
39703           image: true,
39704           // fallback
39705           navigation: true
39706           // fallback
39707         };
39708       }
39709       _mlyViewer = new mapillary.Viewer(opts);
39710       _mlyViewer.on("image", imageChanged);
39711       _mlyViewer.on("bearing", bearingChanged);
39712       if (_mlyViewerFilter) {
39713         _mlyViewer.setFilter(_mlyViewerFilter);
39714       }
39715       context.ui().photoviewer.on("resize.mapillary", function() {
39716         if (_mlyViewer)
39717           _mlyViewer.resize();
39718       });
39719       function imageChanged(node) {
39720         that.resetTags();
39721         const image = node.image;
39722         that.setActiveImage(image);
39723         that.setStyles(context, null);
39724         const loc = [image.originalLngLat.lng, image.originalLngLat.lat];
39725         context.map().centerEase(loc);
39726         that.updateUrlImage(image.id);
39727         if (_mlyShowFeatureDetections || _mlyShowSignDetections) {
39728           that.updateDetections(image.id, `${apiUrl}/${image.id}/detections?access_token=${accessToken}&fields=id,image,geometry,value`);
39729         }
39730         dispatch5.call("imageChanged");
39731       }
39732       function bearingChanged(e) {
39733         dispatch5.call("bearingChanged", void 0, e);
39734       }
39735     },
39736     // Move to an image
39737     selectImage: function(context, imageId) {
39738       if (_mlyViewer && imageId) {
39739         _mlyViewer.moveTo(imageId).catch(function(e) {
39740           console.error("mly3", e);
39741         });
39742       }
39743       return this;
39744     },
39745     // Return the currently displayed image
39746     getActiveImage: function() {
39747       return _mlyActiveImage;
39748     },
39749     // Return a list of detection objects for the given id
39750     getDetections: function(id2) {
39751       return loadData(`${apiUrl}/${id2}/detections?access_token=${accessToken}&fields=id,value,image`);
39752     },
39753     // Set the currently visible image
39754     setActiveImage: function(image) {
39755       if (image) {
39756         _mlyActiveImage = {
39757           ca: image.originalCompassAngle,
39758           id: image.id,
39759           loc: [image.originalLngLat.lng, image.originalLngLat.lat],
39760           is_pano: image.cameraType === "spherical",
39761           sequence_id: image.sequenceId
39762         };
39763       } else {
39764         _mlyActiveImage = null;
39765       }
39766     },
39767     // Update the currently highlighted sequence and selected bubble.
39768     setStyles: function(context, hovered) {
39769       const hoveredImageId = hovered && hovered.id;
39770       const hoveredSequenceId = hovered && hovered.sequence_id;
39771       const selectedSequenceId = _mlyActiveImage && _mlyActiveImage.sequence_id;
39772       context.container().selectAll(".layer-mapillary .viewfield-group").classed("highlighted", function(d) {
39773         return d.sequence_id === selectedSequenceId || d.id === hoveredImageId;
39774       }).classed("hovered", function(d) {
39775         return d.id === hoveredImageId;
39776       });
39777       context.container().selectAll(".layer-mapillary .sequence").classed("highlighted", function(d) {
39778         return d.properties.id === hoveredSequenceId;
39779       }).classed("currentView", function(d) {
39780         return d.properties.id === selectedSequenceId;
39781       });
39782       return this;
39783     },
39784     // Get detections for the current image and shows them in the image viewer
39785     updateDetections: function(imageId, url) {
39786       if (!_mlyViewer || _mlyFallback)
39787         return;
39788       if (!imageId)
39789         return;
39790       const cache = _mlyCache.image_detections;
39791       if (cache.forImageId[imageId]) {
39792         showDetections(_mlyCache.image_detections.forImageId[imageId]);
39793       } else {
39794         loadData(url).then((detections) => {
39795           detections.forEach(function(detection) {
39796             if (!cache.forImageId[imageId]) {
39797               cache.forImageId[imageId] = [];
39798             }
39799             cache.forImageId[imageId].push({
39800               geometry: detection.geometry,
39801               id: detection.id,
39802               image_id: imageId,
39803               value: detection.value
39804             });
39805           });
39806           showDetections(_mlyCache.image_detections.forImageId[imageId] || []);
39807         });
39808       }
39809       function showDetections(detections) {
39810         const tagComponent = _mlyViewer.getComponent("tag");
39811         detections.forEach(function(data) {
39812           const tag = makeTag(data);
39813           if (tag) {
39814             tagComponent.add([tag]);
39815           }
39816         });
39817       }
39818       function makeTag(data) {
39819         const valueParts = data.value.split("--");
39820         if (!valueParts.length)
39821           return;
39822         let tag;
39823         let text2;
39824         let color2 = 16777215;
39825         if (_mlyHighlightedDetection === data.id) {
39826           color2 = 16776960;
39827           text2 = valueParts[1];
39828           if (text2 === "flat" || text2 === "discrete" || text2 === "sign") {
39829             text2 = valueParts[2];
39830           }
39831           text2 = text2.replace(/-/g, " ");
39832           text2 = text2.charAt(0).toUpperCase() + text2.slice(1);
39833           _mlyHighlightedDetection = null;
39834         }
39835         var decodedGeometry = window.atob(data.geometry);
39836         var uintArray = new Uint8Array(decodedGeometry.length);
39837         for (var i2 = 0; i2 < decodedGeometry.length; i2++) {
39838           uintArray[i2] = decodedGeometry.charCodeAt(i2);
39839         }
39840         const tile = new import_vector_tile.VectorTile(new import_pbf.default(uintArray.buffer));
39841         const layer = tile.layers["mpy-or"];
39842         const geometries = layer.feature(0).loadGeometry();
39843         const polygon2 = geometries.map((ring) => ring.map((point2) => [point2.x / layer.extent, point2.y / layer.extent]));
39844         tag = new mapillary.OutlineTag(
39845           data.id,
39846           new mapillary.PolygonGeometry(polygon2[0]),
39847           {
39848             text: text2,
39849             textColor: color2,
39850             lineColor: color2,
39851             lineWidth: 2,
39852             fillColor: color2,
39853             fillOpacity: 0.3
39854           }
39855         );
39856         return tag;
39857       }
39858     },
39859     // Return the current cache
39860     cache: function() {
39861       return _mlyCache;
39862     }
39863   };
39864
39865   // modules/core/validation/models.js
39866   function validationIssue(attrs) {
39867     this.type = attrs.type;
39868     this.subtype = attrs.subtype;
39869     this.severity = attrs.severity;
39870     this.message = attrs.message;
39871     this.reference = attrs.reference;
39872     this.entityIds = attrs.entityIds;
39873     this.loc = attrs.loc;
39874     this.data = attrs.data;
39875     this.dynamicFixes = attrs.dynamicFixes;
39876     this.hash = attrs.hash;
39877     this.id = generateID.apply(this);
39878     this.key = generateKey.apply(this);
39879     this.autoFix = null;
39880     function generateID() {
39881       var parts = [this.type];
39882       if (this.hash) {
39883         parts.push(this.hash);
39884       }
39885       if (this.subtype) {
39886         parts.push(this.subtype);
39887       }
39888       if (this.entityIds) {
39889         var entityKeys = this.entityIds.slice().sort();
39890         parts.push.apply(parts, entityKeys);
39891       }
39892       return parts.join(":");
39893     }
39894     function generateKey() {
39895       return this.id + ":" + Date.now().toString();
39896     }
39897     this.extent = function(resolver) {
39898       if (this.loc) {
39899         return geoExtent(this.loc);
39900       }
39901       if (this.entityIds && this.entityIds.length) {
39902         return this.entityIds.reduce(function(extent, entityId) {
39903           return extent.extend(resolver.entity(entityId).extent(resolver));
39904         }, geoExtent());
39905       }
39906       return null;
39907     };
39908     this.fixes = function(context) {
39909       var fixes = this.dynamicFixes ? this.dynamicFixes(context) : [];
39910       var issue = this;
39911       if (issue.severity === "warning") {
39912         fixes.push(new validationIssueFix({
39913           title: _t.append("issues.fix.ignore_issue.title"),
39914           icon: "iD-icon-close",
39915           onClick: function() {
39916             context.validator().ignoreIssue(this.issue.id);
39917           }
39918         }));
39919       }
39920       fixes.forEach(function(fix) {
39921         fix.id = fix.title.stringId;
39922         fix.issue = issue;
39923         if (fix.autoArgs) {
39924           issue.autoFix = fix;
39925         }
39926       });
39927       return fixes;
39928     };
39929   }
39930   function validationIssueFix(attrs) {
39931     this.title = attrs.title;
39932     this.onClick = attrs.onClick;
39933     this.disabledReason = attrs.disabledReason;
39934     this.icon = attrs.icon;
39935     this.entityIds = attrs.entityIds || [];
39936     this.autoArgs = attrs.autoArgs;
39937     this.issue = null;
39938   }
39939
39940   // modules/services/maprules.js
39941   var buildRuleChecks = function() {
39942     return {
39943       equals: function(equals) {
39944         return function(tags) {
39945           return Object.keys(equals).every(function(k) {
39946             return equals[k] === tags[k];
39947           });
39948         };
39949       },
39950       notEquals: function(notEquals) {
39951         return function(tags) {
39952           return Object.keys(notEquals).some(function(k) {
39953             return notEquals[k] !== tags[k];
39954           });
39955         };
39956       },
39957       absence: function(absence) {
39958         return function(tags) {
39959           return Object.keys(tags).indexOf(absence) === -1;
39960         };
39961       },
39962       presence: function(presence) {
39963         return function(tags) {
39964           return Object.keys(tags).indexOf(presence) > -1;
39965         };
39966       },
39967       greaterThan: function(greaterThan) {
39968         var key = Object.keys(greaterThan)[0];
39969         var value = greaterThan[key];
39970         return function(tags) {
39971           return tags[key] > value;
39972         };
39973       },
39974       greaterThanEqual: function(greaterThanEqual) {
39975         var key = Object.keys(greaterThanEqual)[0];
39976         var value = greaterThanEqual[key];
39977         return function(tags) {
39978           return tags[key] >= value;
39979         };
39980       },
39981       lessThan: function(lessThan) {
39982         var key = Object.keys(lessThan)[0];
39983         var value = lessThan[key];
39984         return function(tags) {
39985           return tags[key] < value;
39986         };
39987       },
39988       lessThanEqual: function(lessThanEqual) {
39989         var key = Object.keys(lessThanEqual)[0];
39990         var value = lessThanEqual[key];
39991         return function(tags) {
39992           return tags[key] <= value;
39993         };
39994       },
39995       positiveRegex: function(positiveRegex) {
39996         var tagKey = Object.keys(positiveRegex)[0];
39997         var expression = positiveRegex[tagKey].join("|");
39998         var regex = new RegExp(expression);
39999         return function(tags) {
40000           return regex.test(tags[tagKey]);
40001         };
40002       },
40003       negativeRegex: function(negativeRegex) {
40004         var tagKey = Object.keys(negativeRegex)[0];
40005         var expression = negativeRegex[tagKey].join("|");
40006         var regex = new RegExp(expression);
40007         return function(tags) {
40008           return !regex.test(tags[tagKey]);
40009         };
40010       }
40011     };
40012   };
40013   var buildLineKeys = function() {
40014     return {
40015       highway: {
40016         rest_area: true,
40017         services: true
40018       },
40019       railway: {
40020         roundhouse: true,
40021         station: true,
40022         traverser: true,
40023         turntable: true,
40024         wash: true
40025       }
40026     };
40027   };
40028   var maprules_default = {
40029     init: function() {
40030       this._ruleChecks = buildRuleChecks();
40031       this._validationRules = [];
40032       this._areaKeys = osmAreaKeys;
40033       this._lineKeys = buildLineKeys();
40034     },
40035     // list of rules only relevant to tag checks...
40036     filterRuleChecks: function(selector) {
40037       var _ruleChecks = this._ruleChecks;
40038       return Object.keys(selector).reduce(function(rules, key) {
40039         if (["geometry", "error", "warning"].indexOf(key) === -1) {
40040           rules.push(_ruleChecks[key](selector[key]));
40041         }
40042         return rules;
40043       }, []);
40044     },
40045     // builds tagMap from mapcss-parse selector object...
40046     buildTagMap: function(selector) {
40047       var getRegexValues = function(regexes) {
40048         return regexes.map(function(regex) {
40049           return regex.replace(/\$|\^/g, "");
40050         });
40051       };
40052       var tagMap = Object.keys(selector).reduce(function(expectedTags, key) {
40053         var values;
40054         var isRegex = /regex/gi.test(key);
40055         var isEqual4 = /equals/gi.test(key);
40056         if (isRegex || isEqual4) {
40057           Object.keys(selector[key]).forEach(function(selectorKey) {
40058             values = isEqual4 ? [selector[key][selectorKey]] : getRegexValues(selector[key][selectorKey]);
40059             if (expectedTags.hasOwnProperty(selectorKey)) {
40060               values = values.concat(expectedTags[selectorKey]);
40061             }
40062             expectedTags[selectorKey] = values;
40063           });
40064         } else if (/(greater|less)Than(Equal)?|presence/g.test(key)) {
40065           var tagKey = /presence/.test(key) ? selector[key] : Object.keys(selector[key])[0];
40066           values = [selector[key][tagKey]];
40067           if (expectedTags.hasOwnProperty(tagKey)) {
40068             values = values.concat(expectedTags[tagKey]);
40069           }
40070           expectedTags[tagKey] = values;
40071         }
40072         return expectedTags;
40073       }, {});
40074       return tagMap;
40075     },
40076     // inspired by osmWay#isArea()
40077     inferGeometry: function(tagMap) {
40078       var _lineKeys = this._lineKeys;
40079       var _areaKeys = this._areaKeys;
40080       var keyValueDoesNotImplyArea = function(key2) {
40081         return utilArrayIntersection(tagMap[key2], Object.keys(_areaKeys[key2])).length > 0;
40082       };
40083       var keyValueImpliesLine = function(key2) {
40084         return utilArrayIntersection(tagMap[key2], Object.keys(_lineKeys[key2])).length > 0;
40085       };
40086       if (tagMap.hasOwnProperty("area")) {
40087         if (tagMap.area.indexOf("yes") > -1) {
40088           return "area";
40089         }
40090         if (tagMap.area.indexOf("no") > -1) {
40091           return "line";
40092         }
40093       }
40094       for (var key in tagMap) {
40095         if (key in _areaKeys && !keyValueDoesNotImplyArea(key)) {
40096           return "area";
40097         }
40098         if (key in _lineKeys && keyValueImpliesLine(key)) {
40099           return "area";
40100         }
40101       }
40102       return "line";
40103     },
40104     // adds from mapcss-parse selector check...
40105     addRule: function(selector) {
40106       var rule = {
40107         // checks relevant to mapcss-selector
40108         checks: this.filterRuleChecks(selector),
40109         // true if all conditions for a tag error are true..
40110         matches: function(entity) {
40111           return this.checks.every(function(check) {
40112             return check(entity.tags);
40113           });
40114         },
40115         // borrowed from Way#isArea()
40116         inferredGeometry: this.inferGeometry(this.buildTagMap(selector), this._areaKeys),
40117         geometryMatches: function(entity, graph) {
40118           if (entity.type === "node" || entity.type === "relation") {
40119             return selector.geometry === entity.type;
40120           } else if (entity.type === "way") {
40121             return this.inferredGeometry === entity.geometry(graph);
40122           }
40123         },
40124         // when geometries match and tag matches are present, return a warning...
40125         findIssues: function(entity, graph, issues) {
40126           if (this.geometryMatches(entity, graph) && this.matches(entity)) {
40127             var severity = Object.keys(selector).indexOf("error") > -1 ? "error" : "warning";
40128             var message = selector[severity];
40129             issues.push(new validationIssue({
40130               type: "maprules",
40131               severity,
40132               message: function() {
40133                 return message;
40134               },
40135               entityIds: [entity.id]
40136             }));
40137           }
40138         }
40139       };
40140       this._validationRules.push(rule);
40141     },
40142     clearRules: function() {
40143       this._validationRules = [];
40144     },
40145     // returns validationRules...
40146     validationRules: function() {
40147       return this._validationRules;
40148     },
40149     // returns ruleChecks
40150     ruleChecks: function() {
40151       return this._ruleChecks;
40152     }
40153   };
40154
40155   // modules/services/nominatim.js
40156   var import_rbush7 = __toESM(require_rbush_min());
40157
40158   // modules/core/difference.js
40159   var import_fast_deep_equal3 = __toESM(require_fast_deep_equal());
40160   function coreDifference(base, head) {
40161     var _changes = {};
40162     var _didChange = {};
40163     var _diff = {};
40164     function checkEntityID(id2) {
40165       var h = head.entities[id2];
40166       var b = base.entities[id2];
40167       if (h === b)
40168         return;
40169       if (_changes[id2])
40170         return;
40171       if (!h && b) {
40172         _changes[id2] = { base: b, head: h };
40173         _didChange.deletion = true;
40174         return;
40175       }
40176       if (h && !b) {
40177         _changes[id2] = { base: b, head: h };
40178         _didChange.addition = true;
40179         return;
40180       }
40181       if (h && b) {
40182         if (h.members && b.members && !(0, import_fast_deep_equal3.default)(h.members, b.members)) {
40183           _changes[id2] = { base: b, head: h };
40184           _didChange.geometry = true;
40185           _didChange.properties = true;
40186           return;
40187         }
40188         if (h.loc && b.loc && !geoVecEqual(h.loc, b.loc)) {
40189           _changes[id2] = { base: b, head: h };
40190           _didChange.geometry = true;
40191         }
40192         if (h.nodes && b.nodes && !(0, import_fast_deep_equal3.default)(h.nodes, b.nodes)) {
40193           _changes[id2] = { base: b, head: h };
40194           _didChange.geometry = true;
40195         }
40196         if (h.tags && b.tags && !(0, import_fast_deep_equal3.default)(h.tags, b.tags)) {
40197           _changes[id2] = { base: b, head: h };
40198           _didChange.properties = true;
40199         }
40200       }
40201     }
40202     function load() {
40203       var ids = utilArrayUniq(Object.keys(head.entities).concat(Object.keys(base.entities)));
40204       for (var i2 = 0; i2 < ids.length; i2++) {
40205         checkEntityID(ids[i2]);
40206       }
40207     }
40208     load();
40209     _diff.length = function length() {
40210       return Object.keys(_changes).length;
40211     };
40212     _diff.changes = function changes() {
40213       return _changes;
40214     };
40215     _diff.didChange = _didChange;
40216     _diff.extantIDs = function extantIDs(includeRelMembers) {
40217       var result = /* @__PURE__ */ new Set();
40218       Object.keys(_changes).forEach(function(id2) {
40219         if (_changes[id2].head) {
40220           result.add(id2);
40221         }
40222         var h = _changes[id2].head;
40223         var b = _changes[id2].base;
40224         var entity = h || b;
40225         if (includeRelMembers && entity.type === "relation") {
40226           var mh = h ? h.members.map(function(m) {
40227             return m.id;
40228           }) : [];
40229           var mb = b ? b.members.map(function(m) {
40230             return m.id;
40231           }) : [];
40232           utilArrayUnion(mh, mb).forEach(function(memberID) {
40233             if (head.hasEntity(memberID)) {
40234               result.add(memberID);
40235             }
40236           });
40237         }
40238       });
40239       return Array.from(result);
40240     };
40241     _diff.modified = function modified() {
40242       var result = [];
40243       Object.values(_changes).forEach(function(change) {
40244         if (change.base && change.head) {
40245           result.push(change.head);
40246         }
40247       });
40248       return result;
40249     };
40250     _diff.created = function created() {
40251       var result = [];
40252       Object.values(_changes).forEach(function(change) {
40253         if (!change.base && change.head) {
40254           result.push(change.head);
40255         }
40256       });
40257       return result;
40258     };
40259     _diff.deleted = function deleted() {
40260       var result = [];
40261       Object.values(_changes).forEach(function(change) {
40262         if (change.base && !change.head) {
40263           result.push(change.base);
40264         }
40265       });
40266       return result;
40267     };
40268     _diff.summary = function summary() {
40269       var relevant = {};
40270       var keys2 = Object.keys(_changes);
40271       for (var i2 = 0; i2 < keys2.length; i2++) {
40272         var change = _changes[keys2[i2]];
40273         if (change.head && change.head.geometry(head) !== "vertex") {
40274           addEntity(change.head, head, change.base ? "modified" : "created");
40275         } else if (change.base && change.base.geometry(base) !== "vertex") {
40276           addEntity(change.base, base, "deleted");
40277         } else if (change.base && change.head) {
40278           var moved = !(0, import_fast_deep_equal3.default)(change.base.loc, change.head.loc);
40279           var retagged = !(0, import_fast_deep_equal3.default)(change.base.tags, change.head.tags);
40280           if (moved) {
40281             addParents(change.head);
40282           }
40283           if (retagged || moved && change.head.hasInterestingTags()) {
40284             addEntity(change.head, head, "modified");
40285           }
40286         } else if (change.head && change.head.hasInterestingTags()) {
40287           addEntity(change.head, head, "created");
40288         } else if (change.base && change.base.hasInterestingTags()) {
40289           addEntity(change.base, base, "deleted");
40290         }
40291       }
40292       return Object.values(relevant);
40293       function addEntity(entity, graph, changeType) {
40294         relevant[entity.id] = {
40295           entity,
40296           graph,
40297           changeType
40298         };
40299       }
40300       function addParents(entity) {
40301         var parents = head.parentWays(entity);
40302         for (var j2 = parents.length - 1; j2 >= 0; j2--) {
40303           var parent = parents[j2];
40304           if (!(parent.id in relevant)) {
40305             addEntity(parent, head, "modified");
40306           }
40307         }
40308       }
40309     };
40310     _diff.complete = function complete(extent) {
40311       var result = {};
40312       var id2, change;
40313       for (id2 in _changes) {
40314         change = _changes[id2];
40315         var h = change.head;
40316         var b = change.base;
40317         var entity = h || b;
40318         var i2;
40319         if (extent && (!h || !h.intersects(extent, head)) && (!b || !b.intersects(extent, base))) {
40320           continue;
40321         }
40322         result[id2] = h;
40323         if (entity.type === "way") {
40324           var nh = h ? h.nodes : [];
40325           var nb = b ? b.nodes : [];
40326           var diff;
40327           diff = utilArrayDifference(nh, nb);
40328           for (i2 = 0; i2 < diff.length; i2++) {
40329             result[diff[i2]] = head.hasEntity(diff[i2]);
40330           }
40331           diff = utilArrayDifference(nb, nh);
40332           for (i2 = 0; i2 < diff.length; i2++) {
40333             result[diff[i2]] = head.hasEntity(diff[i2]);
40334           }
40335         }
40336         if (entity.type === "relation" && entity.isMultipolygon()) {
40337           var mh = h ? h.members.map(function(m) {
40338             return m.id;
40339           }) : [];
40340           var mb = b ? b.members.map(function(m) {
40341             return m.id;
40342           }) : [];
40343           var ids = utilArrayUnion(mh, mb);
40344           for (i2 = 0; i2 < ids.length; i2++) {
40345             var member = head.hasEntity(ids[i2]);
40346             if (!member)
40347               continue;
40348             if (extent && !member.intersects(extent, head))
40349               continue;
40350             result[ids[i2]] = member;
40351           }
40352         }
40353         addParents(head.parentWays(entity), result);
40354         addParents(head.parentRelations(entity), result);
40355       }
40356       return result;
40357       function addParents(parents, result2) {
40358         for (var i3 = 0; i3 < parents.length; i3++) {
40359           var parent = parents[i3];
40360           if (parent.id in result2)
40361             continue;
40362           result2[parent.id] = parent;
40363           addParents(head.parentRelations(parent), result2);
40364         }
40365       }
40366     };
40367     return _diff;
40368   }
40369
40370   // modules/core/tree.js
40371   var import_rbush5 = __toESM(require_rbush_min());
40372   function coreTree(head) {
40373     var _rtree = new import_rbush5.default();
40374     var _bboxes = {};
40375     var _segmentsRTree = new import_rbush5.default();
40376     var _segmentsBBoxes = {};
40377     var _segmentsByWayId = {};
40378     var tree = {};
40379     function entityBBox(entity) {
40380       var bbox2 = entity.extent(head).bbox();
40381       bbox2.id = entity.id;
40382       _bboxes[entity.id] = bbox2;
40383       return bbox2;
40384     }
40385     function segmentBBox(segment) {
40386       var extent = segment.extent(head);
40387       if (!extent)
40388         return null;
40389       var bbox2 = extent.bbox();
40390       bbox2.segment = segment;
40391       _segmentsBBoxes[segment.id] = bbox2;
40392       return bbox2;
40393     }
40394     function removeEntity(entity) {
40395       _rtree.remove(_bboxes[entity.id]);
40396       delete _bboxes[entity.id];
40397       if (_segmentsByWayId[entity.id]) {
40398         _segmentsByWayId[entity.id].forEach(function(segment) {
40399           _segmentsRTree.remove(_segmentsBBoxes[segment.id]);
40400           delete _segmentsBBoxes[segment.id];
40401         });
40402         delete _segmentsByWayId[entity.id];
40403       }
40404     }
40405     function loadEntities(entities) {
40406       _rtree.load(entities.map(entityBBox));
40407       var segments = [];
40408       entities.forEach(function(entity) {
40409         if (entity.segments) {
40410           var entitySegments = entity.segments(head);
40411           _segmentsByWayId[entity.id] = entitySegments;
40412           segments = segments.concat(entitySegments);
40413         }
40414       });
40415       if (segments.length)
40416         _segmentsRTree.load(segments.map(segmentBBox).filter(Boolean));
40417     }
40418     function updateParents(entity, insertions, memo) {
40419       head.parentWays(entity).forEach(function(way) {
40420         if (_bboxes[way.id]) {
40421           removeEntity(way);
40422           insertions[way.id] = way;
40423         }
40424         updateParents(way, insertions, memo);
40425       });
40426       head.parentRelations(entity).forEach(function(relation) {
40427         if (memo[entity.id])
40428           return;
40429         memo[entity.id] = true;
40430         if (_bboxes[relation.id]) {
40431           removeEntity(relation);
40432           insertions[relation.id] = relation;
40433         }
40434         updateParents(relation, insertions, memo);
40435       });
40436     }
40437     tree.rebase = function(entities, force) {
40438       var insertions = {};
40439       for (var i2 = 0; i2 < entities.length; i2++) {
40440         var entity = entities[i2];
40441         if (!entity.visible)
40442           continue;
40443         if (head.entities.hasOwnProperty(entity.id) || _bboxes[entity.id]) {
40444           if (!force) {
40445             continue;
40446           } else if (_bboxes[entity.id]) {
40447             removeEntity(entity);
40448           }
40449         }
40450         insertions[entity.id] = entity;
40451         updateParents(entity, insertions, {});
40452       }
40453       loadEntities(Object.values(insertions));
40454       return tree;
40455     };
40456     function updateToGraph(graph) {
40457       if (graph === head)
40458         return;
40459       var diff = coreDifference(head, graph);
40460       head = graph;
40461       var changed = diff.didChange;
40462       if (!changed.addition && !changed.deletion && !changed.geometry)
40463         return;
40464       var insertions = {};
40465       if (changed.deletion) {
40466         diff.deleted().forEach(function(entity) {
40467           removeEntity(entity);
40468         });
40469       }
40470       if (changed.geometry) {
40471         diff.modified().forEach(function(entity) {
40472           removeEntity(entity);
40473           insertions[entity.id] = entity;
40474           updateParents(entity, insertions, {});
40475         });
40476       }
40477       if (changed.addition) {
40478         diff.created().forEach(function(entity) {
40479           insertions[entity.id] = entity;
40480         });
40481       }
40482       loadEntities(Object.values(insertions));
40483     }
40484     tree.intersects = function(extent, graph) {
40485       updateToGraph(graph);
40486       return _rtree.search(extent.bbox()).map(function(bbox2) {
40487         return graph.entity(bbox2.id);
40488       });
40489     };
40490     tree.waySegments = function(extent, graph) {
40491       updateToGraph(graph);
40492       return _segmentsRTree.search(extent.bbox()).map(function(bbox2) {
40493         return bbox2.segment;
40494       });
40495     };
40496     return tree;
40497   }
40498
40499   // modules/svg/icon.js
40500   function svgIcon(name, svgklass, useklass) {
40501     return function drawIcon(selection2) {
40502       selection2.selectAll("svg.icon" + (svgklass ? "." + svgklass.split(" ")[0] : "")).data([0]).enter().append("svg").attr("class", "icon " + (svgklass || "")).append("use").attr("xlink:href", name).attr("class", useklass);
40503     };
40504   }
40505
40506   // modules/ui/modal.js
40507   function uiModal(selection2, blocking) {
40508     let keybinding = utilKeybinding("modal");
40509     let previous = selection2.select("div.modal");
40510     let animate = previous.empty();
40511     previous.transition().duration(200).style("opacity", 0).remove();
40512     let shaded = selection2.append("div").attr("class", "shaded").style("opacity", 0);
40513     shaded.close = () => {
40514       shaded.transition().duration(200).style("opacity", 0).remove();
40515       modal.transition().duration(200).style("top", "0px");
40516       select_default2(document).call(keybinding.unbind);
40517     };
40518     let modal = shaded.append("div").attr("class", "modal fillL");
40519     modal.append("input").attr("class", "keytrap keytrap-first").on("focus.keytrap", moveFocusToLast);
40520     if (!blocking) {
40521       shaded.on("click.remove-modal", (d3_event) => {
40522         if (d3_event.target === this) {
40523           shaded.close();
40524         }
40525       });
40526       modal.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", shaded.close).call(svgIcon("#iD-icon-close"));
40527       keybinding.on("\u232B", shaded.close).on("\u238B", shaded.close);
40528       select_default2(document).call(keybinding);
40529     }
40530     modal.append("div").attr("class", "content");
40531     modal.append("input").attr("class", "keytrap keytrap-last").on("focus.keytrap", moveFocusToFirst);
40532     if (animate) {
40533       shaded.transition().style("opacity", 1);
40534     } else {
40535       shaded.style("opacity", 1);
40536     }
40537     return shaded;
40538     function moveFocusToFirst() {
40539       let node = modal.select("a, button, input:not(.keytrap), select, textarea").node();
40540       if (node) {
40541         node.focus();
40542       } else {
40543         select_default2(this).node().blur();
40544       }
40545     }
40546     function moveFocusToLast() {
40547       let nodes = modal.selectAll("a, button, input:not(.keytrap), select, textarea").nodes();
40548       if (nodes.length) {
40549         nodes[nodes.length - 1].focus();
40550       } else {
40551         select_default2(this).node().blur();
40552       }
40553     }
40554   }
40555
40556   // modules/ui/loading.js
40557   function uiLoading(context) {
40558     let _modalSelection = select_default2(null);
40559     let _message = "";
40560     let _blocking = false;
40561     let loading = (selection2) => {
40562       _modalSelection = uiModal(selection2, _blocking);
40563       let loadertext = _modalSelection.select(".content").classed("loading-modal", true).append("div").attr("class", "modal-section fillL");
40564       loadertext.append("img").attr("class", "loader").attr("src", context.imagePath("loader-white.gif"));
40565       loadertext.append("h3").html(_message);
40566       _modalSelection.select("button.close").attr("class", "hide");
40567       return loading;
40568     };
40569     loading.message = function(val) {
40570       if (!arguments.length)
40571         return _message;
40572       _message = val;
40573       return loading;
40574     };
40575     loading.blocking = function(val) {
40576       if (!arguments.length)
40577         return _blocking;
40578       _blocking = val;
40579       return loading;
40580     };
40581     loading.close = () => {
40582       _modalSelection.remove();
40583     };
40584     loading.isShown = () => {
40585       return _modalSelection && !_modalSelection.empty() && _modalSelection.node().parentNode;
40586     };
40587     return loading;
40588   }
40589
40590   // modules/core/history.js
40591   function coreHistory(context) {
40592     var dispatch10 = dispatch_default("reset", "change", "merge", "restore", "undone", "redone", "storage_error");
40593     var lock = utilSessionMutex("lock");
40594     var _hasUnresolvedRestorableChanges = lock.lock() && !!corePreferences(getKey("saved_history"));
40595     var duration = 150;
40596     var _imageryUsed = [];
40597     var _photoOverlaysUsed = [];
40598     var _checkpoints = {};
40599     var _pausedGraph;
40600     var _stack;
40601     var _index;
40602     var _tree;
40603     function _act(actions, t) {
40604       actions = Array.prototype.slice.call(actions);
40605       var annotation;
40606       if (typeof actions[actions.length - 1] !== "function") {
40607         annotation = actions.pop();
40608       }
40609       var graph = _stack[_index].graph;
40610       for (var i2 = 0; i2 < actions.length; i2++) {
40611         graph = actions[i2](graph, t);
40612       }
40613       return {
40614         graph,
40615         annotation,
40616         imageryUsed: _imageryUsed,
40617         photoOverlaysUsed: _photoOverlaysUsed,
40618         transform: context.projection.transform(),
40619         selectedIDs: context.selectedIDs()
40620       };
40621     }
40622     function _perform(args, t) {
40623       var previous = _stack[_index].graph;
40624       _stack = _stack.slice(0, _index + 1);
40625       var actionResult = _act(args, t);
40626       _stack.push(actionResult);
40627       _index++;
40628       return change(previous);
40629     }
40630     function _replace(args, t) {
40631       var previous = _stack[_index].graph;
40632       var actionResult = _act(args, t);
40633       _stack[_index] = actionResult;
40634       return change(previous);
40635     }
40636     function _overwrite(args, t) {
40637       var previous = _stack[_index].graph;
40638       if (_index > 0) {
40639         _index--;
40640         _stack.pop();
40641       }
40642       _stack = _stack.slice(0, _index + 1);
40643       var actionResult = _act(args, t);
40644       _stack.push(actionResult);
40645       _index++;
40646       return change(previous);
40647     }
40648     function change(previous) {
40649       var difference = coreDifference(previous, history.graph());
40650       if (!_pausedGraph) {
40651         dispatch10.call("change", this, difference);
40652       }
40653       return difference;
40654     }
40655     function getKey(n2) {
40656       return "iD_" + window.location.origin + "_" + n2;
40657     }
40658     var history = {
40659       graph: function() {
40660         return _stack[_index].graph;
40661       },
40662       tree: function() {
40663         return _tree;
40664       },
40665       base: function() {
40666         return _stack[0].graph;
40667       },
40668       merge: function(entities) {
40669         var stack = _stack.map(function(state) {
40670           return state.graph;
40671         });
40672         _stack[0].graph.rebase(entities, stack, false);
40673         _tree.rebase(entities, false);
40674         dispatch10.call("merge", this, entities);
40675       },
40676       perform: function() {
40677         select_default2(document).interrupt("history.perform");
40678         var transitionable = false;
40679         var action0 = arguments[0];
40680         if (arguments.length === 1 || arguments.length === 2 && typeof arguments[1] !== "function") {
40681           transitionable = !!action0.transitionable;
40682         }
40683         if (transitionable) {
40684           var origArguments = arguments;
40685           select_default2(document).transition("history.perform").duration(duration).ease(linear2).tween("history.tween", function() {
40686             return function(t) {
40687               if (t < 1)
40688                 _overwrite([action0], t);
40689             };
40690           }).on("start", function() {
40691             _perform([action0], 0);
40692           }).on("end interrupt", function() {
40693             _overwrite(origArguments, 1);
40694           });
40695         } else {
40696           return _perform(arguments);
40697         }
40698       },
40699       replace: function() {
40700         select_default2(document).interrupt("history.perform");
40701         return _replace(arguments, 1);
40702       },
40703       // Same as calling pop and then perform
40704       overwrite: function() {
40705         select_default2(document).interrupt("history.perform");
40706         return _overwrite(arguments, 1);
40707       },
40708       pop: function(n2) {
40709         select_default2(document).interrupt("history.perform");
40710         var previous = _stack[_index].graph;
40711         if (isNaN(+n2) || +n2 < 0) {
40712           n2 = 1;
40713         }
40714         while (n2-- > 0 && _index > 0) {
40715           _index--;
40716           _stack.pop();
40717         }
40718         return change(previous);
40719       },
40720       // Back to the previous annotated state or _index = 0.
40721       undo: function() {
40722         select_default2(document).interrupt("history.perform");
40723         var previousStack = _stack[_index];
40724         var previous = previousStack.graph;
40725         while (_index > 0) {
40726           _index--;
40727           if (_stack[_index].annotation)
40728             break;
40729         }
40730         dispatch10.call("undone", this, _stack[_index], previousStack);
40731         return change(previous);
40732       },
40733       // Forward to the next annotated state.
40734       redo: function() {
40735         select_default2(document).interrupt("history.perform");
40736         var previousStack = _stack[_index];
40737         var previous = previousStack.graph;
40738         var tryIndex = _index;
40739         while (tryIndex < _stack.length - 1) {
40740           tryIndex++;
40741           if (_stack[tryIndex].annotation) {
40742             _index = tryIndex;
40743             dispatch10.call("redone", this, _stack[_index], previousStack);
40744             break;
40745           }
40746         }
40747         return change(previous);
40748       },
40749       pauseChangeDispatch: function() {
40750         if (!_pausedGraph) {
40751           _pausedGraph = _stack[_index].graph;
40752         }
40753       },
40754       resumeChangeDispatch: function() {
40755         if (_pausedGraph) {
40756           var previous = _pausedGraph;
40757           _pausedGraph = null;
40758           return change(previous);
40759         }
40760       },
40761       undoAnnotation: function() {
40762         var i2 = _index;
40763         while (i2 >= 0) {
40764           if (_stack[i2].annotation)
40765             return _stack[i2].annotation;
40766           i2--;
40767         }
40768       },
40769       redoAnnotation: function() {
40770         var i2 = _index + 1;
40771         while (i2 <= _stack.length - 1) {
40772           if (_stack[i2].annotation)
40773             return _stack[i2].annotation;
40774           i2++;
40775         }
40776       },
40777       // Returns the entities from the active graph with bounding boxes
40778       // overlapping the given `extent`.
40779       intersects: function(extent) {
40780         return _tree.intersects(extent, _stack[_index].graph);
40781       },
40782       difference: function() {
40783         var base = _stack[0].graph;
40784         var head = _stack[_index].graph;
40785         return coreDifference(base, head);
40786       },
40787       changes: function(action) {
40788         var base = _stack[0].graph;
40789         var head = _stack[_index].graph;
40790         if (action) {
40791           head = action(head);
40792         }
40793         var difference = coreDifference(base, head);
40794         return {
40795           modified: difference.modified(),
40796           created: difference.created(),
40797           deleted: difference.deleted()
40798         };
40799       },
40800       hasChanges: function() {
40801         return this.difference().length() > 0;
40802       },
40803       imageryUsed: function(sources) {
40804         if (sources) {
40805           _imageryUsed = sources;
40806           return history;
40807         } else {
40808           var s = /* @__PURE__ */ new Set();
40809           _stack.slice(1, _index + 1).forEach(function(state) {
40810             state.imageryUsed.forEach(function(source) {
40811               if (source !== "Custom") {
40812                 s.add(source);
40813               }
40814             });
40815           });
40816           return Array.from(s);
40817         }
40818       },
40819       photoOverlaysUsed: function(sources) {
40820         if (sources) {
40821           _photoOverlaysUsed = sources;
40822           return history;
40823         } else {
40824           var s = /* @__PURE__ */ new Set();
40825           _stack.slice(1, _index + 1).forEach(function(state) {
40826             if (state.photoOverlaysUsed && Array.isArray(state.photoOverlaysUsed)) {
40827               state.photoOverlaysUsed.forEach(function(photoOverlay) {
40828                 s.add(photoOverlay);
40829               });
40830             }
40831           });
40832           return Array.from(s);
40833         }
40834       },
40835       // save the current history state
40836       checkpoint: function(key) {
40837         _checkpoints[key] = {
40838           stack: _stack,
40839           index: _index
40840         };
40841         return history;
40842       },
40843       // restore history state to a given checkpoint or reset completely
40844       reset: function(key) {
40845         if (key !== void 0 && _checkpoints.hasOwnProperty(key)) {
40846           _stack = _checkpoints[key].stack;
40847           _index = _checkpoints[key].index;
40848         } else {
40849           _stack = [{ graph: coreGraph() }];
40850           _index = 0;
40851           _tree = coreTree(_stack[0].graph);
40852           _checkpoints = {};
40853         }
40854         dispatch10.call("reset");
40855         dispatch10.call("change");
40856         return history;
40857       },
40858       // `toIntroGraph()` is used to export the intro graph used by the walkthrough.
40859       //
40860       // To use it:
40861       //  1. Start the walkthrough.
40862       //  2. Get to a "free editing" tutorial step
40863       //  3. Make your edits to the walkthrough map
40864       //  4. In your browser dev console run:
40865       //        `id.history().toIntroGraph()`
40866       //  5. This outputs stringified JSON to the browser console
40867       //  6. Copy it to `data/intro_graph.json` and prettify it in your code editor
40868       toIntroGraph: function() {
40869         var nextID = { n: 0, r: 0, w: 0 };
40870         var permIDs = {};
40871         var graph = this.graph();
40872         var baseEntities = {};
40873         Object.values(graph.base().entities).forEach(function(entity) {
40874           var copy2 = copyIntroEntity(entity);
40875           baseEntities[copy2.id] = copy2;
40876         });
40877         Object.keys(graph.entities).forEach(function(id2) {
40878           var entity = graph.entities[id2];
40879           if (entity) {
40880             var copy2 = copyIntroEntity(entity);
40881             baseEntities[copy2.id] = copy2;
40882           } else {
40883             delete baseEntities[id2];
40884           }
40885         });
40886         Object.values(baseEntities).forEach(function(entity) {
40887           if (Array.isArray(entity.nodes)) {
40888             entity.nodes = entity.nodes.map(function(node) {
40889               return permIDs[node] || node;
40890             });
40891           }
40892           if (Array.isArray(entity.members)) {
40893             entity.members = entity.members.map(function(member) {
40894               member.id = permIDs[member.id] || member.id;
40895               return member;
40896             });
40897           }
40898         });
40899         return JSON.stringify({ dataIntroGraph: baseEntities });
40900         function copyIntroEntity(source) {
40901           var copy2 = utilObjectOmit(source, ["type", "user", "v", "version", "visible"]);
40902           if (copy2.tags && !Object.keys(copy2.tags)) {
40903             delete copy2.tags;
40904           }
40905           if (Array.isArray(copy2.loc)) {
40906             copy2.loc[0] = +copy2.loc[0].toFixed(6);
40907             copy2.loc[1] = +copy2.loc[1].toFixed(6);
40908           }
40909           var match = source.id.match(/([nrw])-\d*/);
40910           if (match !== null) {
40911             var nrw = match[1];
40912             var permID;
40913             do {
40914               permID = nrw + ++nextID[nrw];
40915             } while (baseEntities.hasOwnProperty(permID));
40916             copy2.id = permIDs[source.id] = permID;
40917           }
40918           return copy2;
40919         }
40920       },
40921       toJSON: function() {
40922         if (!this.hasChanges())
40923           return;
40924         var allEntities = {};
40925         var baseEntities = {};
40926         var base = _stack[0];
40927         var s = _stack.map(function(i2) {
40928           var modified = [];
40929           var deleted = [];
40930           Object.keys(i2.graph.entities).forEach(function(id2) {
40931             var entity = i2.graph.entities[id2];
40932             if (entity) {
40933               var key = osmEntity.key(entity);
40934               allEntities[key] = entity;
40935               modified.push(key);
40936             } else {
40937               deleted.push(id2);
40938             }
40939             if (id2 in base.graph.entities) {
40940               baseEntities[id2] = base.graph.entities[id2];
40941             }
40942             if (entity && entity.nodes) {
40943               entity.nodes.forEach(function(nodeID) {
40944                 if (nodeID in base.graph.entities) {
40945                   baseEntities[nodeID] = base.graph.entities[nodeID];
40946                 }
40947               });
40948             }
40949             var baseParents = base.graph._parentWays[id2];
40950             if (baseParents) {
40951               baseParents.forEach(function(parentID) {
40952                 if (parentID in base.graph.entities) {
40953                   baseEntities[parentID] = base.graph.entities[parentID];
40954                 }
40955               });
40956             }
40957           });
40958           var x = {};
40959           if (modified.length)
40960             x.modified = modified;
40961           if (deleted.length)
40962             x.deleted = deleted;
40963           if (i2.imageryUsed)
40964             x.imageryUsed = i2.imageryUsed;
40965           if (i2.photoOverlaysUsed)
40966             x.photoOverlaysUsed = i2.photoOverlaysUsed;
40967           if (i2.annotation)
40968             x.annotation = i2.annotation;
40969           if (i2.transform)
40970             x.transform = i2.transform;
40971           if (i2.selectedIDs)
40972             x.selectedIDs = i2.selectedIDs;
40973           return x;
40974         });
40975         return JSON.stringify({
40976           version: 3,
40977           entities: Object.values(allEntities),
40978           baseEntities: Object.values(baseEntities),
40979           stack: s,
40980           nextIDs: osmEntity.id.next,
40981           index: _index,
40982           // note the time the changes were saved
40983           timestamp: (/* @__PURE__ */ new Date()).getTime()
40984         });
40985       },
40986       fromJSON: function(json, loadChildNodes) {
40987         var h = JSON.parse(json);
40988         var loadComplete = true;
40989         osmEntity.id.next = h.nextIDs;
40990         _index = h.index;
40991         if (h.version === 2 || h.version === 3) {
40992           var allEntities = {};
40993           h.entities.forEach(function(entity) {
40994             allEntities[osmEntity.key(entity)] = osmEntity(entity);
40995           });
40996           if (h.version === 3) {
40997             var baseEntities = h.baseEntities.map(function(d) {
40998               return osmEntity(d);
40999             });
41000             var stack = _stack.map(function(state) {
41001               return state.graph;
41002             });
41003             _stack[0].graph.rebase(baseEntities, stack, true);
41004             _tree.rebase(baseEntities, true);
41005             if (loadChildNodes) {
41006               var osm = context.connection();
41007               var baseWays = baseEntities.filter(function(e) {
41008                 return e.type === "way";
41009               });
41010               var nodeIDs = baseWays.reduce(function(acc, way) {
41011                 return utilArrayUnion(acc, way.nodes);
41012               }, []);
41013               var missing = nodeIDs.filter(function(n2) {
41014                 return !_stack[0].graph.hasEntity(n2);
41015               });
41016               if (missing.length && osm) {
41017                 loadComplete = false;
41018                 context.map().redrawEnable(false);
41019                 var loading = uiLoading(context).blocking(true);
41020                 context.container().call(loading);
41021                 var childNodesLoaded = function(err, result) {
41022                   if (!err) {
41023                     var visibleGroups = utilArrayGroupBy(result.data, "visible");
41024                     var visibles = visibleGroups.true || [];
41025                     var invisibles = visibleGroups.false || [];
41026                     if (visibles.length) {
41027                       var visibleIDs = visibles.map(function(entity) {
41028                         return entity.id;
41029                       });
41030                       var stack2 = _stack.map(function(state) {
41031                         return state.graph;
41032                       });
41033                       missing = utilArrayDifference(missing, visibleIDs);
41034                       _stack[0].graph.rebase(visibles, stack2, true);
41035                       _tree.rebase(visibles, true);
41036                     }
41037                     invisibles.forEach(function(entity) {
41038                       osm.loadEntityVersion(entity.id, +entity.version - 1, childNodesLoaded);
41039                     });
41040                   }
41041                   if (err || !missing.length) {
41042                     loading.close();
41043                     context.map().redrawEnable(true);
41044                     dispatch10.call("change");
41045                     dispatch10.call("restore", this);
41046                   }
41047                 };
41048                 osm.loadMultiple(missing, childNodesLoaded);
41049               }
41050             }
41051           }
41052           _stack = h.stack.map(function(d) {
41053             var entities = {}, entity;
41054             if (d.modified) {
41055               d.modified.forEach(function(key) {
41056                 entity = allEntities[key];
41057                 entities[entity.id] = entity;
41058               });
41059             }
41060             if (d.deleted) {
41061               d.deleted.forEach(function(id2) {
41062                 entities[id2] = void 0;
41063               });
41064             }
41065             return {
41066               graph: coreGraph(_stack[0].graph).load(entities),
41067               annotation: d.annotation,
41068               imageryUsed: d.imageryUsed,
41069               photoOverlaysUsed: d.photoOverlaysUsed,
41070               transform: d.transform,
41071               selectedIDs: d.selectedIDs
41072             };
41073           });
41074         } else {
41075           _stack = h.stack.map(function(d) {
41076             var entities = {};
41077             for (var i2 in d.entities) {
41078               var entity = d.entities[i2];
41079               entities[i2] = entity === "undefined" ? void 0 : osmEntity(entity);
41080             }
41081             d.graph = coreGraph(_stack[0].graph).load(entities);
41082             return d;
41083           });
41084         }
41085         var transform2 = _stack[_index].transform;
41086         if (transform2) {
41087           context.map().transformEase(transform2, 0);
41088         }
41089         if (loadComplete) {
41090           dispatch10.call("change");
41091           dispatch10.call("restore", this);
41092         }
41093         return history;
41094       },
41095       lock: function() {
41096         return lock.lock();
41097       },
41098       unlock: function() {
41099         lock.unlock();
41100       },
41101       save: function() {
41102         if (lock.locked() && // don't overwrite existing, unresolved changes
41103         !_hasUnresolvedRestorableChanges) {
41104           const success = corePreferences(getKey("saved_history"), history.toJSON() || null);
41105           if (!success)
41106             dispatch10.call("storage_error");
41107         }
41108         return history;
41109       },
41110       // delete the history version saved in localStorage
41111       clearSaved: function() {
41112         context.debouncedSave.cancel();
41113         if (lock.locked()) {
41114           _hasUnresolvedRestorableChanges = false;
41115           corePreferences(getKey("saved_history"), null);
41116           corePreferences("comment", null);
41117           corePreferences("hashtags", null);
41118           corePreferences("source", null);
41119         }
41120         return history;
41121       },
41122       savedHistoryJSON: function() {
41123         return corePreferences(getKey("saved_history"));
41124       },
41125       hasRestorableChanges: function() {
41126         return _hasUnresolvedRestorableChanges;
41127       },
41128       // load history from a version stored in localStorage
41129       restore: function() {
41130         if (lock.locked()) {
41131           _hasUnresolvedRestorableChanges = false;
41132           var json = this.savedHistoryJSON();
41133           if (json)
41134             history.fromJSON(json, true);
41135         }
41136       },
41137       _getKey: getKey
41138     };
41139     history.reset();
41140     return utilRebind(history, dispatch10, "on");
41141   }
41142
41143   // modules/validations/index.js
41144   var validations_exports = {};
41145   __export(validations_exports, {
41146     validationAlmostJunction: () => validationAlmostJunction,
41147     validationCloseNodes: () => validationCloseNodes,
41148     validationCrossingWays: () => validationCrossingWays,
41149     validationDisconnectedWay: () => validationDisconnectedWay,
41150     validationFormatting: () => validationFormatting,
41151     validationHelpRequest: () => validationHelpRequest,
41152     validationImpossibleOneway: () => validationImpossibleOneway,
41153     validationIncompatibleSource: () => validationIncompatibleSource,
41154     validationMaprules: () => validationMaprules,
41155     validationMismatchedGeometry: () => validationMismatchedGeometry,
41156     validationMissingRole: () => validationMissingRole,
41157     validationMissingTag: () => validationMissingTag,
41158     validationOutdatedTags: () => validationOutdatedTags,
41159     validationPrivateData: () => validationPrivateData,
41160     validationSuspiciousName: () => validationSuspiciousName,
41161     validationUnsquareWay: () => validationUnsquareWay
41162   });
41163
41164   // modules/validations/almost_junction.js
41165   function validationAlmostJunction(context) {
41166     const type2 = "almost_junction";
41167     const EXTEND_TH_METERS = 5;
41168     const WELD_TH_METERS = 0.75;
41169     const CLOSE_NODE_TH = EXTEND_TH_METERS - WELD_TH_METERS;
41170     const SIG_ANGLE_TH = Math.atan(WELD_TH_METERS / EXTEND_TH_METERS);
41171     function isHighway(entity) {
41172       return entity.type === "way" && osmRoutableHighwayTagValues[entity.tags.highway];
41173     }
41174     function isTaggedAsNotContinuing(node) {
41175       return node.tags.noexit === "yes" || node.tags.amenity === "parking_entrance" || node.tags.entrance && node.tags.entrance !== "no";
41176     }
41177     const validation = function checkAlmostJunction(entity, graph) {
41178       if (!isHighway(entity))
41179         return [];
41180       if (entity.isDegenerate())
41181         return [];
41182       const tree = context.history().tree();
41183       const extendableNodeInfos = findConnectableEndNodesByExtension(entity);
41184       let issues = [];
41185       extendableNodeInfos.forEach((extendableNodeInfo) => {
41186         issues.push(new validationIssue({
41187           type: type2,
41188           subtype: "highway-highway",
41189           severity: "warning",
41190           message: function(context2) {
41191             const entity1 = context2.hasEntity(this.entityIds[0]);
41192             if (this.entityIds[0] === this.entityIds[2]) {
41193               return entity1 ? _t.append("issues.almost_junction.self.message", {
41194                 feature: utilDisplayLabel(entity1, context2.graph())
41195               }) : "";
41196             } else {
41197               const entity2 = context2.hasEntity(this.entityIds[2]);
41198               return entity1 && entity2 ? _t.append("issues.almost_junction.message", {
41199                 feature: utilDisplayLabel(entity1, context2.graph()),
41200                 feature2: utilDisplayLabel(entity2, context2.graph())
41201               }) : "";
41202             }
41203           },
41204           reference: showReference,
41205           entityIds: [
41206             entity.id,
41207             extendableNodeInfo.node.id,
41208             extendableNodeInfo.wid
41209           ],
41210           loc: extendableNodeInfo.node.loc,
41211           hash: JSON.stringify(extendableNodeInfo.node.loc),
41212           data: {
41213             midId: extendableNodeInfo.mid.id,
41214             edge: extendableNodeInfo.edge,
41215             cross_loc: extendableNodeInfo.cross_loc
41216           },
41217           dynamicFixes: makeFixes
41218         }));
41219       });
41220       return issues;
41221       function makeFixes(context2) {
41222         let fixes = [new validationIssueFix({
41223           icon: "iD-icon-abutment",
41224           title: _t.append("issues.fix.connect_features.title"),
41225           onClick: function(context3) {
41226             const annotation = _t("issues.fix.connect_almost_junction.annotation");
41227             const [, endNodeId, crossWayId] = this.issue.entityIds;
41228             const midNode = context3.entity(this.issue.data.midId);
41229             const endNode = context3.entity(endNodeId);
41230             const crossWay = context3.entity(crossWayId);
41231             const nearEndNodes = findNearbyEndNodes(endNode, crossWay);
41232             if (nearEndNodes.length > 0) {
41233               const collinear = findSmallJoinAngle(midNode, endNode, nearEndNodes);
41234               if (collinear) {
41235                 context3.perform(
41236                   actionMergeNodes([collinear.id, endNode.id], collinear.loc),
41237                   annotation
41238                 );
41239                 return;
41240               }
41241             }
41242             const targetEdge = this.issue.data.edge;
41243             const crossLoc = this.issue.data.cross_loc;
41244             const edgeNodes = [context3.entity(targetEdge[0]), context3.entity(targetEdge[1])];
41245             const closestNodeInfo = geoSphericalClosestNode(edgeNodes, crossLoc);
41246             if (closestNodeInfo.distance < WELD_TH_METERS) {
41247               context3.perform(
41248                 actionMergeNodes([closestNodeInfo.node.id, endNode.id], closestNodeInfo.node.loc),
41249                 annotation
41250               );
41251             } else {
41252               context3.perform(
41253                 actionAddMidpoint({ loc: crossLoc, edge: targetEdge }, endNode),
41254                 annotation
41255               );
41256             }
41257           }
41258         })];
41259         const node = context2.hasEntity(this.entityIds[1]);
41260         if (node && !node.hasInterestingTags()) {
41261           fixes.push(new validationIssueFix({
41262             icon: "maki-barrier",
41263             title: _t.append("issues.fix.tag_as_disconnected.title"),
41264             onClick: function(context3) {
41265               const nodeID = this.issue.entityIds[1];
41266               const tags = Object.assign({}, context3.entity(nodeID).tags);
41267               tags.noexit = "yes";
41268               context3.perform(
41269                 actionChangeTags(nodeID, tags),
41270                 _t("issues.fix.tag_as_disconnected.annotation")
41271               );
41272             }
41273           }));
41274         }
41275         return fixes;
41276       }
41277       function showReference(selection2) {
41278         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.almost_junction.highway-highway.reference"));
41279       }
41280       function isExtendableCandidate(node, way) {
41281         const osm = services.osm;
41282         if (osm && !osm.isDataLoaded(node.loc)) {
41283           return false;
41284         }
41285         if (isTaggedAsNotContinuing(node) || graph.parentWays(node).length !== 1) {
41286           return false;
41287         }
41288         let occurrences = 0;
41289         for (const index in way.nodes) {
41290           if (way.nodes[index] === node.id) {
41291             occurrences += 1;
41292             if (occurrences > 1) {
41293               return false;
41294             }
41295           }
41296         }
41297         return true;
41298       }
41299       function findConnectableEndNodesByExtension(way) {
41300         let results = [];
41301         if (way.isClosed())
41302           return results;
41303         let testNodes;
41304         const indices = [0, way.nodes.length - 1];
41305         indices.forEach((nodeIndex) => {
41306           const nodeID = way.nodes[nodeIndex];
41307           const node = graph.entity(nodeID);
41308           if (!isExtendableCandidate(node, way))
41309             return;
41310           const connectionInfo = canConnectByExtend(way, nodeIndex);
41311           if (!connectionInfo)
41312             return;
41313           testNodes = graph.childNodes(way).slice();
41314           testNodes[nodeIndex] = testNodes[nodeIndex].move(connectionInfo.cross_loc);
41315           if (geoHasSelfIntersections(testNodes, nodeID))
41316             return;
41317           results.push(connectionInfo);
41318         });
41319         return results;
41320       }
41321       function findNearbyEndNodes(node, way) {
41322         return [
41323           way.nodes[0],
41324           way.nodes[way.nodes.length - 1]
41325         ].map((d) => graph.entity(d)).filter((d) => {
41326           return d.id !== node.id && geoSphericalDistance(node.loc, d.loc) <= CLOSE_NODE_TH;
41327         });
41328       }
41329       function findSmallJoinAngle(midNode, tipNode, endNodes) {
41330         let joinTo;
41331         let minAngle = Infinity;
41332         endNodes.forEach((endNode) => {
41333           const a1 = geoAngle(midNode, tipNode, context.projection) + Math.PI;
41334           const a2 = geoAngle(midNode, endNode, context.projection) + Math.PI;
41335           const diff = Math.max(a1, a2) - Math.min(a1, a2);
41336           if (diff < minAngle) {
41337             joinTo = endNode;
41338             minAngle = diff;
41339           }
41340         });
41341         if (minAngle <= SIG_ANGLE_TH)
41342           return joinTo;
41343         return null;
41344       }
41345       function hasTag(tags, key) {
41346         return tags[key] !== void 0 && tags[key] !== "no";
41347       }
41348       function canConnectWays(way, way2) {
41349         if (way.id === way2.id)
41350           return true;
41351         if ((hasTag(way.tags, "bridge") || hasTag(way2.tags, "bridge")) && !(hasTag(way.tags, "bridge") && hasTag(way2.tags, "bridge")))
41352           return false;
41353         if ((hasTag(way.tags, "tunnel") || hasTag(way2.tags, "tunnel")) && !(hasTag(way.tags, "tunnel") && hasTag(way2.tags, "tunnel")))
41354           return false;
41355         const layer1 = way.tags.layer || "0", layer2 = way2.tags.layer || "0";
41356         if (layer1 !== layer2)
41357           return false;
41358         const level1 = way.tags.level || "0", level2 = way2.tags.level || "0";
41359         if (level1 !== level2)
41360           return false;
41361         return true;
41362       }
41363       function canConnectByExtend(way, endNodeIdx) {
41364         const tipNid = way.nodes[endNodeIdx];
41365         const midNid = endNodeIdx === 0 ? way.nodes[1] : way.nodes[way.nodes.length - 2];
41366         const tipNode = graph.entity(tipNid);
41367         const midNode = graph.entity(midNid);
41368         const lon = tipNode.loc[0];
41369         const lat = tipNode.loc[1];
41370         const lon_range = geoMetersToLon(EXTEND_TH_METERS, lat) / 2;
41371         const lat_range = geoMetersToLat(EXTEND_TH_METERS) / 2;
41372         const queryExtent = geoExtent([
41373           [lon - lon_range, lat - lat_range],
41374           [lon + lon_range, lat + lat_range]
41375         ]);
41376         const edgeLen = geoSphericalDistance(midNode.loc, tipNode.loc);
41377         const t = EXTEND_TH_METERS / edgeLen + 1;
41378         const extTipLoc = geoVecInterp(midNode.loc, tipNode.loc, t);
41379         const segmentInfos = tree.waySegments(queryExtent, graph);
41380         for (let i2 = 0; i2 < segmentInfos.length; i2++) {
41381           let segmentInfo = segmentInfos[i2];
41382           let way2 = graph.entity(segmentInfo.wayId);
41383           if (!isHighway(way2))
41384             continue;
41385           if (!canConnectWays(way, way2))
41386             continue;
41387           let nAid = segmentInfo.nodes[0], nBid = segmentInfo.nodes[1];
41388           if (nAid === tipNid || nBid === tipNid)
41389             continue;
41390           let nA = graph.entity(nAid), nB = graph.entity(nBid);
41391           let crossLoc = geoLineIntersection([tipNode.loc, extTipLoc], [nA.loc, nB.loc]);
41392           if (crossLoc) {
41393             return {
41394               mid: midNode,
41395               node: tipNode,
41396               wid: way2.id,
41397               edge: [nA.id, nB.id],
41398               cross_loc: crossLoc
41399             };
41400           }
41401         }
41402         return null;
41403       }
41404     };
41405     validation.type = type2;
41406     return validation;
41407   }
41408
41409   // modules/validations/close_nodes.js
41410   function validationCloseNodes(context) {
41411     var type2 = "close_nodes";
41412     var pointThresholdMeters = 0.2;
41413     var validation = function(entity, graph) {
41414       if (entity.type === "node") {
41415         return getIssuesForNode(entity);
41416       } else if (entity.type === "way") {
41417         return getIssuesForWay(entity);
41418       }
41419       return [];
41420       function getIssuesForNode(node) {
41421         var parentWays = graph.parentWays(node);
41422         if (parentWays.length) {
41423           return getIssuesForVertex(node, parentWays);
41424         } else {
41425           return getIssuesForDetachedPoint(node);
41426         }
41427       }
41428       function wayTypeFor(way) {
41429         if (way.tags.boundary && way.tags.boundary !== "no")
41430           return "boundary";
41431         if (way.tags.indoor && way.tags.indoor !== "no")
41432           return "indoor";
41433         if (way.tags.building && way.tags.building !== "no" || way.tags["building:part"] && way.tags["building:part"] !== "no")
41434           return "building";
41435         if (osmPathHighwayTagValues[way.tags.highway])
41436           return "path";
41437         var parentRelations = graph.parentRelations(way);
41438         for (var i2 in parentRelations) {
41439           var relation = parentRelations[i2];
41440           if (relation.tags.type === "boundary")
41441             return "boundary";
41442           if (relation.isMultipolygon()) {
41443             if (relation.tags.indoor && relation.tags.indoor !== "no")
41444               return "indoor";
41445             if (relation.tags.building && relation.tags.building !== "no" || relation.tags["building:part"] && relation.tags["building:part"] !== "no")
41446               return "building";
41447           }
41448         }
41449         return "other";
41450       }
41451       function shouldCheckWay(way) {
41452         if (way.nodes.length <= 2 || way.isClosed() && way.nodes.length <= 4)
41453           return false;
41454         var bbox2 = way.extent(graph).bbox();
41455         var hypotenuseMeters = geoSphericalDistance([bbox2.minX, bbox2.minY], [bbox2.maxX, bbox2.maxY]);
41456         if (hypotenuseMeters < 1.5)
41457           return false;
41458         return true;
41459       }
41460       function getIssuesForWay(way) {
41461         if (!shouldCheckWay(way))
41462           return [];
41463         var issues = [], nodes = graph.childNodes(way);
41464         for (var i2 = 0; i2 < nodes.length - 1; i2++) {
41465           var node1 = nodes[i2];
41466           var node2 = nodes[i2 + 1];
41467           var issue = getWayIssueIfAny(node1, node2, way);
41468           if (issue)
41469             issues.push(issue);
41470         }
41471         return issues;
41472       }
41473       function getIssuesForVertex(node, parentWays) {
41474         var issues = [];
41475         function checkForCloseness(node1, node2, way) {
41476           var issue = getWayIssueIfAny(node1, node2, way);
41477           if (issue)
41478             issues.push(issue);
41479         }
41480         for (var i2 = 0; i2 < parentWays.length; i2++) {
41481           var parentWay = parentWays[i2];
41482           if (!shouldCheckWay(parentWay))
41483             continue;
41484           var lastIndex = parentWay.nodes.length - 1;
41485           for (var j2 = 0; j2 < parentWay.nodes.length; j2++) {
41486             if (j2 !== 0) {
41487               if (parentWay.nodes[j2 - 1] === node.id) {
41488                 checkForCloseness(node, graph.entity(parentWay.nodes[j2]), parentWay);
41489               }
41490             }
41491             if (j2 !== lastIndex) {
41492               if (parentWay.nodes[j2 + 1] === node.id) {
41493                 checkForCloseness(graph.entity(parentWay.nodes[j2]), node, parentWay);
41494               }
41495             }
41496           }
41497         }
41498         return issues;
41499       }
41500       function thresholdMetersForWay(way) {
41501         if (!shouldCheckWay(way))
41502           return 0;
41503         var wayType = wayTypeFor(way);
41504         if (wayType === "boundary")
41505           return 0;
41506         if (wayType === "indoor")
41507           return 0.01;
41508         if (wayType === "building")
41509           return 0.05;
41510         if (wayType === "path")
41511           return 0.1;
41512         return 0.2;
41513       }
41514       function getIssuesForDetachedPoint(node) {
41515         var issues = [];
41516         var lon = node.loc[0];
41517         var lat = node.loc[1];
41518         var lon_range = geoMetersToLon(pointThresholdMeters, lat) / 2;
41519         var lat_range = geoMetersToLat(pointThresholdMeters) / 2;
41520         var queryExtent = geoExtent([
41521           [lon - lon_range, lat - lat_range],
41522           [lon + lon_range, lat + lat_range]
41523         ]);
41524         var intersected = context.history().tree().intersects(queryExtent, graph);
41525         for (var j2 = 0; j2 < intersected.length; j2++) {
41526           var nearby = intersected[j2];
41527           if (nearby.id === node.id)
41528             continue;
41529           if (nearby.type !== "node" || nearby.geometry(graph) !== "point")
41530             continue;
41531           if (nearby.loc === node.loc || geoSphericalDistance(node.loc, nearby.loc) < pointThresholdMeters) {
41532             if ("memorial:type" in node.tags && "memorial:type" in nearby.tags && node.tags["memorial:type"] === "stolperstein" && nearby.tags["memorial:type"] === "stolperstein")
41533               continue;
41534             if ("memorial" in node.tags && "memorial" in nearby.tags && node.tags.memorial === "stolperstein" && nearby.tags.memorial === "stolperstein")
41535               continue;
41536             var zAxisKeys = { layer: true, level: true, "addr:housenumber": true, "addr:unit": true };
41537             var zAxisDifferentiates = false;
41538             for (var key in zAxisKeys) {
41539               var nodeValue = node.tags[key] || "0";
41540               var nearbyValue = nearby.tags[key] || "0";
41541               if (nodeValue !== nearbyValue) {
41542                 zAxisDifferentiates = true;
41543                 break;
41544               }
41545             }
41546             if (zAxisDifferentiates)
41547               continue;
41548             issues.push(new validationIssue({
41549               type: type2,
41550               subtype: "detached",
41551               severity: "warning",
41552               message: function(context2) {
41553                 var entity2 = context2.hasEntity(this.entityIds[0]), entity22 = context2.hasEntity(this.entityIds[1]);
41554                 return entity2 && entity22 ? _t.append("issues.close_nodes.detached.message", {
41555                   feature: utilDisplayLabel(entity2, context2.graph()),
41556                   feature2: utilDisplayLabel(entity22, context2.graph())
41557                 }) : "";
41558               },
41559               reference: showReference,
41560               entityIds: [node.id, nearby.id],
41561               dynamicFixes: function() {
41562                 return [
41563                   new validationIssueFix({
41564                     icon: "iD-operation-disconnect",
41565                     title: _t.append("issues.fix.move_points_apart.title")
41566                   }),
41567                   new validationIssueFix({
41568                     icon: "iD-icon-layers",
41569                     title: _t.append("issues.fix.use_different_layers_or_levels.title")
41570                   })
41571                 ];
41572               }
41573             }));
41574           }
41575         }
41576         return issues;
41577         function showReference(selection2) {
41578           var referenceText = _t("issues.close_nodes.detached.reference");
41579           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
41580         }
41581       }
41582       function getWayIssueIfAny(node1, node2, way) {
41583         if (node1.id === node2.id || node1.hasInterestingTags() && node2.hasInterestingTags()) {
41584           return null;
41585         }
41586         if (node1.loc !== node2.loc) {
41587           var parentWays1 = graph.parentWays(node1);
41588           var parentWays2 = new Set(graph.parentWays(node2));
41589           var sharedWays = parentWays1.filter(function(parentWay) {
41590             return parentWays2.has(parentWay);
41591           });
41592           var thresholds = sharedWays.map(function(parentWay) {
41593             return thresholdMetersForWay(parentWay);
41594           });
41595           var threshold = Math.min(...thresholds);
41596           var distance = geoSphericalDistance(node1.loc, node2.loc);
41597           if (distance > threshold)
41598             return null;
41599         }
41600         return new validationIssue({
41601           type: type2,
41602           subtype: "vertices",
41603           severity: "warning",
41604           message: function(context2) {
41605             var entity2 = context2.hasEntity(this.entityIds[0]);
41606             return entity2 ? _t.append("issues.close_nodes.message", { way: utilDisplayLabel(entity2, context2.graph()) }) : "";
41607           },
41608           reference: showReference,
41609           entityIds: [way.id, node1.id, node2.id],
41610           loc: node1.loc,
41611           dynamicFixes: function() {
41612             return [
41613               new validationIssueFix({
41614                 icon: "iD-icon-plus",
41615                 title: _t.append("issues.fix.merge_points.title"),
41616                 onClick: function(context2) {
41617                   var entityIds = this.issue.entityIds;
41618                   var action = actionMergeNodes([entityIds[1], entityIds[2]]);
41619                   context2.perform(action, _t("issues.fix.merge_close_vertices.annotation"));
41620                 }
41621               }),
41622               new validationIssueFix({
41623                 icon: "iD-operation-disconnect",
41624                 title: _t.append("issues.fix.move_points_apart.title")
41625               })
41626             ];
41627           }
41628         });
41629         function showReference(selection2) {
41630           var referenceText = _t("issues.close_nodes.reference");
41631           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
41632         }
41633       }
41634     };
41635     validation.type = type2;
41636     return validation;
41637   }
41638
41639   // modules/validations/crossing_ways.js
41640   var import_lodash3 = __toESM(require_lodash());
41641   function validationCrossingWays(context) {
41642     var type2 = "crossing_ways";
41643     function getFeatureWithFeatureTypeTagsForWay(way, graph) {
41644       if (getFeatureType(way, graph) === null) {
41645         var parentRels = graph.parentRelations(way);
41646         for (var i2 = 0; i2 < parentRels.length; i2++) {
41647           var rel = parentRels[i2];
41648           if (getFeatureType(rel, graph) !== null) {
41649             return rel;
41650           }
41651         }
41652       }
41653       return way;
41654     }
41655     function hasTag(tags, key) {
41656       return tags[key] !== void 0 && tags[key] !== "no";
41657     }
41658     function taggedAsIndoor(tags) {
41659       return hasTag(tags, "indoor") || hasTag(tags, "level") || tags.highway === "corridor";
41660     }
41661     function allowsBridge(featureType) {
41662       return featureType === "highway" || featureType === "railway" || featureType === "waterway";
41663     }
41664     function allowsTunnel(featureType) {
41665       return featureType === "highway" || featureType === "railway" || featureType === "waterway";
41666     }
41667     var ignoredBuildings = {
41668       demolished: true,
41669       dismantled: true,
41670       proposed: true,
41671       razed: true
41672     };
41673     function getFeatureType(entity, graph) {
41674       var geometry = entity.geometry(graph);
41675       if (geometry !== "line" && geometry !== "area")
41676         return null;
41677       var tags = entity.tags;
41678       if (hasTag(tags, "building") && !ignoredBuildings[tags.building])
41679         return "building";
41680       if (hasTag(tags, "highway") && osmRoutableHighwayTagValues[tags.highway])
41681         return "highway";
41682       if (geometry !== "line")
41683         return null;
41684       if (hasTag(tags, "railway") && osmRailwayTrackTagValues[tags.railway])
41685         return "railway";
41686       if (hasTag(tags, "waterway") && osmFlowingWaterwayTagValues[tags.waterway])
41687         return "waterway";
41688       return null;
41689     }
41690     function isLegitCrossing(tags1, featureType1, tags2, featureType2) {
41691       var level1 = tags1.level || "0";
41692       var level2 = tags2.level || "0";
41693       if (taggedAsIndoor(tags1) && taggedAsIndoor(tags2) && level1 !== level2) {
41694         return true;
41695       }
41696       var layer1 = tags1.layer || "0";
41697       var layer2 = tags2.layer || "0";
41698       if (allowsBridge(featureType1) && allowsBridge(featureType2)) {
41699         if (hasTag(tags1, "bridge") && !hasTag(tags2, "bridge"))
41700           return true;
41701         if (!hasTag(tags1, "bridge") && hasTag(tags2, "bridge"))
41702           return true;
41703         if (hasTag(tags1, "bridge") && hasTag(tags2, "bridge") && layer1 !== layer2)
41704           return true;
41705       } else if (allowsBridge(featureType1) && hasTag(tags1, "bridge"))
41706         return true;
41707       else if (allowsBridge(featureType2) && hasTag(tags2, "bridge"))
41708         return true;
41709       if (allowsTunnel(featureType1) && allowsTunnel(featureType2)) {
41710         if (hasTag(tags1, "tunnel") && !hasTag(tags2, "tunnel"))
41711           return true;
41712         if (!hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel"))
41713           return true;
41714         if (hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel") && layer1 !== layer2)
41715           return true;
41716       } else if (allowsTunnel(featureType1) && hasTag(tags1, "tunnel"))
41717         return true;
41718       else if (allowsTunnel(featureType2) && hasTag(tags2, "tunnel"))
41719         return true;
41720       if (featureType1 === "waterway" && featureType2 === "highway" && tags2.man_made === "pier")
41721         return true;
41722       if (featureType2 === "waterway" && featureType1 === "highway" && tags1.man_made === "pier")
41723         return true;
41724       if (featureType1 === "building" || featureType2 === "building" || taggedAsIndoor(tags1) || taggedAsIndoor(tags2)) {
41725         if (layer1 !== layer2)
41726           return true;
41727       }
41728       return false;
41729     }
41730     var highwaysDisallowingFords = {
41731       motorway: true,
41732       motorway_link: true,
41733       trunk: true,
41734       trunk_link: true,
41735       primary: true,
41736       primary_link: true,
41737       secondary: true,
41738       secondary_link: true
41739     };
41740     function tagsForConnectionNodeIfAllowed(entity1, entity2, graph, lessLikelyTags) {
41741       var featureType1 = getFeatureType(entity1, graph);
41742       var featureType2 = getFeatureType(entity2, graph);
41743       var geometry1 = entity1.geometry(graph);
41744       var geometry2 = entity2.geometry(graph);
41745       var bothLines = geometry1 === "line" && geometry2 === "line";
41746       if (featureType1 === featureType2) {
41747         if (featureType1 === "highway") {
41748           var entity1IsPath = osmPathHighwayTagValues[entity1.tags.highway];
41749           var entity2IsPath = osmPathHighwayTagValues[entity2.tags.highway];
41750           if ((entity1IsPath || entity2IsPath) && entity1IsPath !== entity2IsPath) {
41751             var roadFeature = entity1IsPath ? entity2 : entity1;
41752             var pathFeature = entity1IsPath ? entity1 : entity2;
41753             if (roadFeature.tags.highway === "track") {
41754               return {};
41755             }
41756             if (!lessLikelyTags && roadFeature.tags.highway === "service" && pathFeature.tags.highway === "footway" && pathFeature.tags.footway === "sidewalk") {
41757               return {};
41758             }
41759             if (["marked", "unmarked", "traffic_signals", "uncontrolled"].indexOf(pathFeature.tags.crossing) !== -1) {
41760               return bothLines ? { highway: "crossing", crossing: pathFeature.tags.crossing } : {};
41761             }
41762             return bothLines ? { highway: "crossing" } : {};
41763           }
41764           return {};
41765         }
41766         if (featureType1 === "waterway")
41767           return {};
41768         if (featureType1 === "railway")
41769           return {};
41770       } else {
41771         var featureTypes = [featureType1, featureType2];
41772         if (featureTypes.indexOf("highway") !== -1) {
41773           if (featureTypes.indexOf("railway") !== -1) {
41774             if (!bothLines)
41775               return {};
41776             var isTram = entity1.tags.railway === "tram" || entity2.tags.railway === "tram";
41777             if (osmPathHighwayTagValues[entity1.tags.highway] || osmPathHighwayTagValues[entity2.tags.highway]) {
41778               if (isTram)
41779                 return { railway: "tram_crossing" };
41780               return { railway: "crossing" };
41781             } else {
41782               if (isTram)
41783                 return { railway: "tram_level_crossing" };
41784               return { railway: "level_crossing" };
41785             }
41786           }
41787           if (featureTypes.indexOf("waterway") !== -1) {
41788             if (hasTag(entity1.tags, "tunnel") && hasTag(entity2.tags, "tunnel"))
41789               return null;
41790             if (hasTag(entity1.tags, "bridge") && hasTag(entity2.tags, "bridge"))
41791               return null;
41792             if (highwaysDisallowingFords[entity1.tags.highway] || highwaysDisallowingFords[entity2.tags.highway]) {
41793               return null;
41794             }
41795             return bothLines ? { ford: "yes" } : {};
41796           }
41797         }
41798       }
41799       return null;
41800     }
41801     function findCrossingsByWay(way1, graph, tree) {
41802       var edgeCrossInfos = [];
41803       if (way1.type !== "way")
41804         return edgeCrossInfos;
41805       var taggedFeature1 = getFeatureWithFeatureTypeTagsForWay(way1, graph);
41806       var way1FeatureType = getFeatureType(taggedFeature1, graph);
41807       if (way1FeatureType === null)
41808         return edgeCrossInfos;
41809       var checkedSingleCrossingWays = {};
41810       var i2, j2;
41811       var extent;
41812       var n1, n2, nA, nB, nAId, nBId;
41813       var segment1, segment2;
41814       var oneOnly;
41815       var segmentInfos, segment2Info, way2, taggedFeature2, way2FeatureType;
41816       var way1Nodes = graph.childNodes(way1);
41817       var comparedWays = {};
41818       for (i2 = 0; i2 < way1Nodes.length - 1; i2++) {
41819         n1 = way1Nodes[i2];
41820         n2 = way1Nodes[i2 + 1];
41821         extent = geoExtent([
41822           [
41823             Math.min(n1.loc[0], n2.loc[0]),
41824             Math.min(n1.loc[1], n2.loc[1])
41825           ],
41826           [
41827             Math.max(n1.loc[0], n2.loc[0]),
41828             Math.max(n1.loc[1], n2.loc[1])
41829           ]
41830         ]);
41831         segmentInfos = tree.waySegments(extent, graph);
41832         for (j2 = 0; j2 < segmentInfos.length; j2++) {
41833           segment2Info = segmentInfos[j2];
41834           if (segment2Info.wayId === way1.id)
41835             continue;
41836           if (checkedSingleCrossingWays[segment2Info.wayId])
41837             continue;
41838           comparedWays[segment2Info.wayId] = true;
41839           way2 = graph.hasEntity(segment2Info.wayId);
41840           if (!way2)
41841             continue;
41842           taggedFeature2 = getFeatureWithFeatureTypeTagsForWay(way2, graph);
41843           way2FeatureType = getFeatureType(taggedFeature2, graph);
41844           if (way2FeatureType === null || isLegitCrossing(taggedFeature1.tags, way1FeatureType, taggedFeature2.tags, way2FeatureType)) {
41845             continue;
41846           }
41847           oneOnly = way1FeatureType === "building" || way2FeatureType === "building";
41848           nAId = segment2Info.nodes[0];
41849           nBId = segment2Info.nodes[1];
41850           if (nAId === n1.id || nAId === n2.id || nBId === n1.id || nBId === n2.id) {
41851             continue;
41852           }
41853           nA = graph.hasEntity(nAId);
41854           if (!nA)
41855             continue;
41856           nB = graph.hasEntity(nBId);
41857           if (!nB)
41858             continue;
41859           segment1 = [n1.loc, n2.loc];
41860           segment2 = [nA.loc, nB.loc];
41861           var point2 = geoLineIntersection(segment1, segment2);
41862           if (point2) {
41863             edgeCrossInfos.push({
41864               wayInfos: [
41865                 {
41866                   way: way1,
41867                   featureType: way1FeatureType,
41868                   edge: [n1.id, n2.id]
41869                 },
41870                 {
41871                   way: way2,
41872                   featureType: way2FeatureType,
41873                   edge: [nA.id, nB.id]
41874                 }
41875               ],
41876               crossPoint: point2
41877             });
41878             if (oneOnly) {
41879               checkedSingleCrossingWays[way2.id] = true;
41880               break;
41881             }
41882           }
41883         }
41884       }
41885       return edgeCrossInfos;
41886     }
41887     function waysToCheck(entity, graph) {
41888       var featureType = getFeatureType(entity, graph);
41889       if (!featureType)
41890         return [];
41891       if (entity.type === "way") {
41892         return [entity];
41893       } else if (entity.type === "relation") {
41894         return entity.members.reduce(function(array2, member) {
41895           if (member.type === "way" && // only look at geometry ways
41896           (!member.role || member.role === "outer" || member.role === "inner")) {
41897             var entity2 = graph.hasEntity(member.id);
41898             if (entity2 && array2.indexOf(entity2) === -1) {
41899               array2.push(entity2);
41900             }
41901           }
41902           return array2;
41903         }, []);
41904       }
41905       return [];
41906     }
41907     var validation = function checkCrossingWays(entity, graph) {
41908       var tree = context.history().tree();
41909       var ways = waysToCheck(entity, graph);
41910       var issues = [];
41911       var wayIndex, crossingIndex, crossings;
41912       for (wayIndex in ways) {
41913         crossings = findCrossingsByWay(ways[wayIndex], graph, tree);
41914         for (crossingIndex in crossings) {
41915           issues.push(createIssue(crossings[crossingIndex], graph));
41916         }
41917       }
41918       return issues;
41919     };
41920     function createIssue(crossing, graph) {
41921       crossing.wayInfos.sort(function(way1Info, way2Info) {
41922         var type1 = way1Info.featureType;
41923         var type22 = way2Info.featureType;
41924         if (type1 === type22) {
41925           return utilDisplayLabel(way1Info.way, graph) > utilDisplayLabel(way2Info.way, graph);
41926         } else if (type1 === "waterway") {
41927           return true;
41928         } else if (type22 === "waterway") {
41929           return false;
41930         }
41931         return type1 < type22;
41932       });
41933       var entities = crossing.wayInfos.map(function(wayInfo) {
41934         return getFeatureWithFeatureTypeTagsForWay(wayInfo.way, graph);
41935       });
41936       var edges = [crossing.wayInfos[0].edge, crossing.wayInfos[1].edge];
41937       var featureTypes = [crossing.wayInfos[0].featureType, crossing.wayInfos[1].featureType];
41938       var connectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph);
41939       var featureType1 = crossing.wayInfos[0].featureType;
41940       var featureType2 = crossing.wayInfos[1].featureType;
41941       var isCrossingIndoors = taggedAsIndoor(entities[0].tags) && taggedAsIndoor(entities[1].tags);
41942       var isCrossingTunnels = allowsTunnel(featureType1) && hasTag(entities[0].tags, "tunnel") && allowsTunnel(featureType2) && hasTag(entities[1].tags, "tunnel");
41943       var isCrossingBridges = allowsBridge(featureType1) && hasTag(entities[0].tags, "bridge") && allowsBridge(featureType2) && hasTag(entities[1].tags, "bridge");
41944       var subtype = [featureType1, featureType2].sort().join("-");
41945       var crossingTypeID = subtype;
41946       if (isCrossingIndoors) {
41947         crossingTypeID = "indoor-indoor";
41948       } else if (isCrossingTunnels) {
41949         crossingTypeID = "tunnel-tunnel";
41950       } else if (isCrossingBridges) {
41951         crossingTypeID = "bridge-bridge";
41952       }
41953       if (connectionTags && (isCrossingIndoors || isCrossingTunnels || isCrossingBridges)) {
41954         crossingTypeID += "_connectable";
41955       }
41956       var uniqueID = crossing.crossPoint[0].toFixed(4) + "," + crossing.crossPoint[1].toFixed(4);
41957       return new validationIssue({
41958         type: type2,
41959         subtype,
41960         severity: "warning",
41961         message: function(context2) {
41962           var graph2 = context2.graph();
41963           var entity1 = graph2.hasEntity(this.entityIds[0]), entity2 = graph2.hasEntity(this.entityIds[1]);
41964           return entity1 && entity2 ? _t.append("issues.crossing_ways.message", {
41965             feature: utilDisplayLabel(entity1, graph2),
41966             feature2: utilDisplayLabel(entity2, graph2)
41967           }) : "";
41968         },
41969         reference: showReference,
41970         entityIds: entities.map(function(entity) {
41971           return entity.id;
41972         }),
41973         data: {
41974           edges,
41975           featureTypes,
41976           connectionTags
41977         },
41978         hash: uniqueID,
41979         loc: crossing.crossPoint,
41980         dynamicFixes: function(context2) {
41981           var mode = context2.mode();
41982           if (!mode || mode.id !== "select" || mode.selectedIDs().length !== 1)
41983             return [];
41984           var selectedIndex = this.entityIds[0] === mode.selectedIDs()[0] ? 0 : 1;
41985           var selectedFeatureType = this.data.featureTypes[selectedIndex];
41986           var otherFeatureType = this.data.featureTypes[selectedIndex === 0 ? 1 : 0];
41987           var fixes = [];
41988           if (connectionTags) {
41989             fixes.push(makeConnectWaysFix(this.data.connectionTags));
41990             let lessLikelyConnectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph, true);
41991             if (lessLikelyConnectionTags && !(0, import_lodash3.isEqual)(connectionTags, lessLikelyConnectionTags)) {
41992               fixes.push(makeConnectWaysFix(lessLikelyConnectionTags));
41993             }
41994           }
41995           if (isCrossingIndoors) {
41996             fixes.push(new validationIssueFix({
41997               icon: "iD-icon-layers",
41998               title: _t.append("issues.fix.use_different_levels.title")
41999             }));
42000           } else if (isCrossingTunnels || isCrossingBridges || featureType1 === "building" || featureType2 === "building") {
42001             fixes.push(makeChangeLayerFix("higher"));
42002             fixes.push(makeChangeLayerFix("lower"));
42003           } else if (context2.graph().geometry(this.entityIds[0]) === "line" && context2.graph().geometry(this.entityIds[1]) === "line") {
42004             if (allowsBridge(selectedFeatureType) && selectedFeatureType !== "waterway") {
42005               fixes.push(makeAddBridgeOrTunnelFix("add_a_bridge", "temaki-bridge", "bridge"));
42006             }
42007             var skipTunnelFix = otherFeatureType === "waterway" && selectedFeatureType !== "waterway";
42008             if (allowsTunnel(selectedFeatureType) && !skipTunnelFix) {
42009               fixes.push(makeAddBridgeOrTunnelFix("add_a_tunnel", "temaki-tunnel", "tunnel"));
42010             }
42011           }
42012           fixes.push(new validationIssueFix({
42013             icon: "iD-operation-move",
42014             title: _t.append("issues.fix.reposition_features.title")
42015           }));
42016           return fixes;
42017         }
42018       });
42019       function showReference(selection2) {
42020         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.crossing_ways." + crossingTypeID + ".reference"));
42021       }
42022     }
42023     function makeAddBridgeOrTunnelFix(fixTitleID, iconName, bridgeOrTunnel) {
42024       return new validationIssueFix({
42025         icon: iconName,
42026         title: _t.append("issues.fix." + fixTitleID + ".title"),
42027         onClick: function(context2) {
42028           var mode = context2.mode();
42029           if (!mode || mode.id !== "select")
42030             return;
42031           var selectedIDs = mode.selectedIDs();
42032           if (selectedIDs.length !== 1)
42033             return;
42034           var selectedWayID = selectedIDs[0];
42035           if (!context2.hasEntity(selectedWayID))
42036             return;
42037           var resultWayIDs = [selectedWayID];
42038           var edge, crossedEdge, crossedWayID;
42039           if (this.issue.entityIds[0] === selectedWayID) {
42040             edge = this.issue.data.edges[0];
42041             crossedEdge = this.issue.data.edges[1];
42042             crossedWayID = this.issue.entityIds[1];
42043           } else {
42044             edge = this.issue.data.edges[1];
42045             crossedEdge = this.issue.data.edges[0];
42046             crossedWayID = this.issue.entityIds[0];
42047           }
42048           var crossingLoc = this.issue.loc;
42049           var projection2 = context2.projection;
42050           var action = function actionAddStructure(graph) {
42051             var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
42052             var crossedWay = graph.hasEntity(crossedWayID);
42053             var structLengthMeters = crossedWay && isFinite(crossedWay.tags.width) && Number(crossedWay.tags.width);
42054             if (!structLengthMeters) {
42055               structLengthMeters = crossedWay && crossedWay.impliedLineWidthMeters();
42056             }
42057             if (structLengthMeters) {
42058               if (getFeatureType(crossedWay, graph) === "railway") {
42059                 structLengthMeters *= 2;
42060               }
42061             } else {
42062               structLengthMeters = 8;
42063             }
42064             var a1 = geoAngle(edgeNodes[0], edgeNodes[1], projection2) + Math.PI;
42065             var a2 = geoAngle(graph.entity(crossedEdge[0]), graph.entity(crossedEdge[1]), projection2) + Math.PI;
42066             var crossingAngle = Math.max(a1, a2) - Math.min(a1, a2);
42067             if (crossingAngle > Math.PI)
42068               crossingAngle -= Math.PI;
42069             structLengthMeters = structLengthMeters / 2 / Math.sin(crossingAngle) * 2;
42070             structLengthMeters += 4;
42071             structLengthMeters = Math.min(Math.max(structLengthMeters, 4), 50);
42072             function geomToProj(geoPoint) {
42073               return [
42074                 geoLonToMeters(geoPoint[0], geoPoint[1]),
42075                 geoLatToMeters(geoPoint[1])
42076               ];
42077             }
42078             function projToGeom(projPoint) {
42079               var lat = geoMetersToLat(projPoint[1]);
42080               return [
42081                 geoMetersToLon(projPoint[0], lat),
42082                 lat
42083               ];
42084             }
42085             var projEdgeNode1 = geomToProj(edgeNodes[0].loc);
42086             var projEdgeNode2 = geomToProj(edgeNodes[1].loc);
42087             var projectedAngle = geoVecAngle(projEdgeNode1, projEdgeNode2);
42088             var projectedCrossingLoc = geomToProj(crossingLoc);
42089             var linearToSphericalMetersRatio = geoVecLength(projEdgeNode1, projEdgeNode2) / geoSphericalDistance(edgeNodes[0].loc, edgeNodes[1].loc);
42090             function locSphericalDistanceFromCrossingLoc(angle2, distanceMeters) {
42091               var lengthSphericalMeters = distanceMeters * linearToSphericalMetersRatio;
42092               return projToGeom([
42093                 projectedCrossingLoc[0] + Math.cos(angle2) * lengthSphericalMeters,
42094                 projectedCrossingLoc[1] + Math.sin(angle2) * lengthSphericalMeters
42095               ]);
42096             }
42097             var endpointLocGetter1 = function(lengthMeters) {
42098               return locSphericalDistanceFromCrossingLoc(projectedAngle, lengthMeters);
42099             };
42100             var endpointLocGetter2 = function(lengthMeters) {
42101               return locSphericalDistanceFromCrossingLoc(projectedAngle + Math.PI, lengthMeters);
42102             };
42103             var minEdgeLengthMeters = 0.55;
42104             function determineEndpoint(edge2, endNode, locGetter) {
42105               var newNode;
42106               var idealLengthMeters = structLengthMeters / 2;
42107               var crossingToEdgeEndDistance = geoSphericalDistance(crossingLoc, endNode.loc);
42108               if (crossingToEdgeEndDistance - idealLengthMeters > minEdgeLengthMeters) {
42109                 var idealNodeLoc = locGetter(idealLengthMeters);
42110                 newNode = osmNode();
42111                 graph = actionAddMidpoint({ loc: idealNodeLoc, edge: edge2 }, newNode)(graph);
42112               } else {
42113                 var edgeCount = 0;
42114                 endNode.parentIntersectionWays(graph).forEach(function(way) {
42115                   way.nodes.forEach(function(nodeID) {
42116                     if (nodeID === endNode.id) {
42117                       if (endNode.id === way.first() && endNode.id !== way.last() || endNode.id === way.last() && endNode.id !== way.first()) {
42118                         edgeCount += 1;
42119                       } else {
42120                         edgeCount += 2;
42121                       }
42122                     }
42123                   });
42124                 });
42125                 if (edgeCount >= 3) {
42126                   var insetLength = crossingToEdgeEndDistance - minEdgeLengthMeters;
42127                   if (insetLength > minEdgeLengthMeters) {
42128                     var insetNodeLoc = locGetter(insetLength);
42129                     newNode = osmNode();
42130                     graph = actionAddMidpoint({ loc: insetNodeLoc, edge: edge2 }, newNode)(graph);
42131                   }
42132                 }
42133               }
42134               if (!newNode)
42135                 newNode = endNode;
42136               var splitAction = actionSplit([newNode.id]).limitWays(resultWayIDs);
42137               graph = splitAction(graph);
42138               if (splitAction.getCreatedWayIDs().length) {
42139                 resultWayIDs.push(splitAction.getCreatedWayIDs()[0]);
42140               }
42141               return newNode;
42142             }
42143             var structEndNode1 = determineEndpoint(edge, edgeNodes[1], endpointLocGetter1);
42144             var structEndNode2 = determineEndpoint([edgeNodes[0].id, structEndNode1.id], edgeNodes[0], endpointLocGetter2);
42145             var structureWay = resultWayIDs.map(function(id2) {
42146               return graph.entity(id2);
42147             }).find(function(way) {
42148               return way.nodes.indexOf(structEndNode1.id) !== -1 && way.nodes.indexOf(structEndNode2.id) !== -1;
42149             });
42150             var tags = Object.assign({}, structureWay.tags);
42151             if (bridgeOrTunnel === "bridge") {
42152               tags.bridge = "yes";
42153               tags.layer = "1";
42154             } else {
42155               var tunnelValue = "yes";
42156               if (getFeatureType(structureWay, graph) === "waterway") {
42157                 tunnelValue = "culvert";
42158               }
42159               tags.tunnel = tunnelValue;
42160               tags.layer = "-1";
42161             }
42162             graph = actionChangeTags(structureWay.id, tags)(graph);
42163             return graph;
42164           };
42165           context2.perform(action, _t("issues.fix." + fixTitleID + ".annotation"));
42166           context2.enter(modeSelect(context2, resultWayIDs));
42167         }
42168       });
42169     }
42170     function makeConnectWaysFix(connectionTags) {
42171       var fixTitleID = "connect_features";
42172       var fixIcon = "iD-icon-crossing";
42173       if (connectionTags.highway === "crossing") {
42174         fixTitleID = "connect_using_crossing";
42175         fixIcon = "temaki-pedestrian";
42176       }
42177       if (connectionTags.ford) {
42178         fixTitleID = "connect_using_ford";
42179         fixIcon = "roentgen-ford";
42180       }
42181       const fix = new validationIssueFix({
42182         icon: fixIcon,
42183         title: _t.append("issues.fix." + fixTitleID + ".title"),
42184         onClick: function(context2) {
42185           var loc = this.issue.loc;
42186           var edges = this.issue.data.edges;
42187           context2.perform(
42188             function actionConnectCrossingWays(graph) {
42189               var node = osmNode({ loc, tags: connectionTags });
42190               graph = graph.replace(node);
42191               var nodesToMerge = [node.id];
42192               var mergeThresholdInMeters = 0.75;
42193               edges.forEach(function(edge) {
42194                 var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
42195                 var nearby = geoSphericalClosestNode(edgeNodes, loc);
42196                 if ((!nearby.node.hasInterestingTags() || nearby.node.isCrossing()) && nearby.distance < mergeThresholdInMeters) {
42197                   nodesToMerge.push(nearby.node.id);
42198                 } else {
42199                   graph = actionAddMidpoint({ loc, edge }, node)(graph);
42200                 }
42201               });
42202               if (nodesToMerge.length > 1) {
42203                 graph = actionMergeNodes(nodesToMerge, loc)(graph);
42204               }
42205               return graph;
42206             },
42207             _t("issues.fix.connect_crossing_features.annotation")
42208           );
42209         }
42210       });
42211       fix._connectionTags = connectionTags;
42212       return fix;
42213     }
42214     function makeChangeLayerFix(higherOrLower) {
42215       return new validationIssueFix({
42216         icon: "iD-icon-" + (higherOrLower === "higher" ? "up" : "down"),
42217         title: _t.append("issues.fix.tag_this_as_" + higherOrLower + ".title"),
42218         onClick: function(context2) {
42219           var mode = context2.mode();
42220           if (!mode || mode.id !== "select")
42221             return;
42222           var selectedIDs = mode.selectedIDs();
42223           if (selectedIDs.length !== 1)
42224             return;
42225           var selectedID = selectedIDs[0];
42226           if (!this.issue.entityIds.some(function(entityId) {
42227             return entityId === selectedID;
42228           }))
42229             return;
42230           var entity = context2.hasEntity(selectedID);
42231           if (!entity)
42232             return;
42233           var tags = Object.assign({}, entity.tags);
42234           var layer = tags.layer && Number(tags.layer);
42235           if (layer && !isNaN(layer)) {
42236             if (higherOrLower === "higher") {
42237               layer += 1;
42238             } else {
42239               layer -= 1;
42240             }
42241           } else {
42242             if (higherOrLower === "higher") {
42243               layer = 1;
42244             } else {
42245               layer = -1;
42246             }
42247           }
42248           tags.layer = layer.toString();
42249           context2.perform(
42250             actionChangeTags(entity.id, tags),
42251             _t("operations.change_tags.annotation")
42252           );
42253         }
42254       });
42255     }
42256     validation.type = type2;
42257     return validation;
42258   }
42259
42260   // modules/behavior/draw_way.js
42261   function behaviorDrawWay(context, wayID, mode, startGraph) {
42262     const keybinding = utilKeybinding("drawWay");
42263     var dispatch10 = dispatch_default("rejectedSelfIntersection");
42264     var behavior = behaviorDraw(context);
42265     var _nodeIndex;
42266     var _origWay;
42267     var _wayGeometry;
42268     var _headNodeID;
42269     var _annotation;
42270     var _pointerHasMoved = false;
42271     var _drawNode;
42272     var _didResolveTempEdit = false;
42273     function createDrawNode(loc) {
42274       _drawNode = osmNode({ loc });
42275       context.pauseChangeDispatch();
42276       context.replace(function actionAddDrawNode(graph) {
42277         var way = graph.entity(wayID);
42278         return graph.replace(_drawNode).replace(way.addNode(_drawNode.id, _nodeIndex));
42279       }, _annotation);
42280       context.resumeChangeDispatch();
42281       setActiveElements();
42282     }
42283     function removeDrawNode() {
42284       context.pauseChangeDispatch();
42285       context.replace(
42286         function actionDeleteDrawNode(graph) {
42287           var way = graph.entity(wayID);
42288           return graph.replace(way.removeNode(_drawNode.id)).remove(_drawNode);
42289         },
42290         _annotation
42291       );
42292       _drawNode = void 0;
42293       context.resumeChangeDispatch();
42294     }
42295     function keydown(d3_event) {
42296       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
42297         if (context.surface().classed("nope")) {
42298           context.surface().classed("nope-suppressed", true);
42299         }
42300         context.surface().classed("nope", false).classed("nope-disabled", true);
42301       }
42302     }
42303     function keyup(d3_event) {
42304       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
42305         if (context.surface().classed("nope-suppressed")) {
42306           context.surface().classed("nope", true);
42307         }
42308         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
42309       }
42310     }
42311     function allowsVertex(d) {
42312       return d.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d, context.graph());
42313     }
42314     function move(d3_event, datum2) {
42315       var loc = context.map().mouseCoordinates();
42316       if (!_drawNode)
42317         createDrawNode(loc);
42318       context.surface().classed("nope-disabled", d3_event.altKey);
42319       var targetLoc = datum2 && datum2.properties && datum2.properties.entity && allowsVertex(datum2.properties.entity) && datum2.properties.entity.loc;
42320       var targetNodes = datum2 && datum2.properties && datum2.properties.nodes;
42321       if (targetLoc) {
42322         loc = targetLoc;
42323       } else if (targetNodes) {
42324         var choice = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, _drawNode.id);
42325         if (choice) {
42326           loc = choice.loc;
42327         }
42328       }
42329       context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
42330       _drawNode = context.entity(_drawNode.id);
42331       checkGeometry(
42332         true
42333         /* includeDrawNode */
42334       );
42335     }
42336     function checkGeometry(includeDrawNode) {
42337       var nopeDisabled = context.surface().classed("nope-disabled");
42338       var isInvalid = isInvalidGeometry(includeDrawNode);
42339       if (nopeDisabled) {
42340         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
42341       } else {
42342         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
42343       }
42344     }
42345     function isInvalidGeometry(includeDrawNode) {
42346       var testNode = _drawNode;
42347       var parentWay = context.graph().entity(wayID);
42348       var nodes = context.graph().childNodes(parentWay).slice();
42349       if (includeDrawNode) {
42350         if (parentWay.isClosed()) {
42351           nodes.pop();
42352         }
42353       } else {
42354         if (parentWay.isClosed()) {
42355           if (nodes.length < 3)
42356             return false;
42357           if (_drawNode)
42358             nodes.splice(-2, 1);
42359           testNode = nodes[nodes.length - 2];
42360         } else {
42361           return false;
42362         }
42363       }
42364       return testNode && geoHasSelfIntersections(nodes, testNode.id);
42365     }
42366     function undone() {
42367       _didResolveTempEdit = true;
42368       context.pauseChangeDispatch();
42369       var nextMode;
42370       if (context.graph() === startGraph) {
42371         nextMode = modeSelect(context, [wayID]);
42372       } else {
42373         context.pop(1);
42374         nextMode = mode;
42375       }
42376       context.perform(actionNoop());
42377       context.pop(1);
42378       context.resumeChangeDispatch();
42379       context.enter(nextMode);
42380     }
42381     function setActiveElements() {
42382       if (!_drawNode)
42383         return;
42384       context.surface().selectAll("." + _drawNode.id).classed("active", true);
42385     }
42386     function resetToStartGraph() {
42387       while (context.graph() !== startGraph) {
42388         context.pop();
42389       }
42390     }
42391     var drawWay = function(surface) {
42392       _drawNode = void 0;
42393       _didResolveTempEdit = false;
42394       _origWay = context.entity(wayID);
42395       if (typeof _nodeIndex === "number") {
42396         _headNodeID = _origWay.nodes[_nodeIndex];
42397       } else if (_origWay.isClosed()) {
42398         _headNodeID = _origWay.nodes[_origWay.nodes.length - 2];
42399       } else {
42400         _headNodeID = _origWay.nodes[_origWay.nodes.length - 1];
42401       }
42402       _wayGeometry = _origWay.geometry(context.graph());
42403       _annotation = _t(
42404         (_origWay.nodes.length === (_origWay.isClosed() ? 2 : 1) ? "operations.start.annotation." : "operations.continue.annotation.") + _wayGeometry
42405       );
42406       _pointerHasMoved = false;
42407       context.pauseChangeDispatch();
42408       context.perform(actionNoop(), _annotation);
42409       context.resumeChangeDispatch();
42410       behavior.hover().initialNodeID(_headNodeID);
42411       behavior.on("move", function() {
42412         _pointerHasMoved = true;
42413         move.apply(this, arguments);
42414       }).on("down", function() {
42415         move.apply(this, arguments);
42416       }).on("downcancel", function() {
42417         if (_drawNode)
42418           removeDrawNode();
42419       }).on("click", drawWay.add).on("clickWay", drawWay.addWay).on("clickNode", drawWay.addNode).on("undo", context.undo).on("cancel", drawWay.cancel).on("finish", drawWay.finish);
42420       select_default2(window).on("keydown.drawWay", keydown).on("keyup.drawWay", keyup);
42421       context.map().dblclickZoomEnable(false).on("drawn.draw", setActiveElements);
42422       setActiveElements();
42423       surface.call(behavior);
42424       context.history().on("undone.draw", undone);
42425     };
42426     drawWay.off = function(surface) {
42427       if (!_didResolveTempEdit) {
42428         context.pauseChangeDispatch();
42429         resetToStartGraph();
42430         context.resumeChangeDispatch();
42431       }
42432       _drawNode = void 0;
42433       _nodeIndex = void 0;
42434       context.map().on("drawn.draw", null);
42435       surface.call(behavior.off).selectAll(".active").classed("active", false);
42436       surface.classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false);
42437       select_default2(window).on("keydown.drawWay", null).on("keyup.drawWay", null);
42438       context.history().on("undone.draw", null);
42439     };
42440     function attemptAdd(d, loc, doAdd) {
42441       if (_drawNode) {
42442         context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
42443         _drawNode = context.entity(_drawNode.id);
42444       } else {
42445         createDrawNode(loc);
42446       }
42447       checkGeometry(
42448         true
42449         /* includeDrawNode */
42450       );
42451       if (d && d.properties && d.properties.nope || context.surface().classed("nope")) {
42452         if (!_pointerHasMoved) {
42453           removeDrawNode();
42454         }
42455         dispatch10.call("rejectedSelfIntersection", this);
42456         return;
42457       }
42458       context.pauseChangeDispatch();
42459       doAdd();
42460       _didResolveTempEdit = true;
42461       context.resumeChangeDispatch();
42462       context.enter(mode);
42463     }
42464     drawWay.add = function(loc, d) {
42465       attemptAdd(d, loc, function() {
42466       });
42467     };
42468     drawWay.addWay = function(loc, edge, d) {
42469       attemptAdd(d, loc, function() {
42470         context.replace(
42471           actionAddMidpoint({ loc, edge }, _drawNode),
42472           _annotation
42473         );
42474       });
42475     };
42476     drawWay.addNode = function(node, d) {
42477       if (node.id === _headNodeID || // or the first node when drawing an area
42478       _origWay.isClosed() && node.id === _origWay.first()) {
42479         drawWay.finish();
42480         return;
42481       }
42482       attemptAdd(d, node.loc, function() {
42483         context.replace(
42484           function actionReplaceDrawNode(graph) {
42485             graph = graph.replace(graph.entity(wayID).removeNode(_drawNode.id)).remove(_drawNode);
42486             return graph.replace(graph.entity(wayID).addNode(node.id, _nodeIndex));
42487           },
42488           _annotation
42489         );
42490       });
42491     };
42492     function getFeatureType(ways) {
42493       if (ways.every((way) => way.isClosed()))
42494         return "area";
42495       if (ways.every((way) => !way.isClosed()))
42496         return "line";
42497       return "generic";
42498     }
42499     function followMode() {
42500       if (_didResolveTempEdit)
42501         return;
42502       try {
42503         const isDrawingArea = _origWay.nodes[0] === _origWay.nodes.slice(-1)[0];
42504         const [secondLastNodeId, lastNodeId] = _origWay.nodes.slice(isDrawingArea ? -3 : -2);
42505         const historyGraph = context.history().graph();
42506         if (!lastNodeId || !secondLastNodeId || !historyGraph.hasEntity(lastNodeId) || !historyGraph.hasEntity(secondLastNodeId)) {
42507           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.needs_more_initial_nodes"))();
42508           return;
42509         }
42510         const lastNodesParents = historyGraph.parentWays(historyGraph.entity(lastNodeId)).filter((w) => w.id !== wayID);
42511         const secondLastNodesParents = historyGraph.parentWays(historyGraph.entity(secondLastNodeId)).filter((w) => w.id !== wayID);
42512         const featureType = getFeatureType(lastNodesParents);
42513         if (lastNodesParents.length !== 1 || secondLastNodesParents.length === 0) {
42514           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(`operations.follow.error.intersection_of_multiple_ways.${featureType}`))();
42515           return;
42516         }
42517         if (!secondLastNodesParents.some((n2) => n2.id === lastNodesParents[0].id)) {
42518           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(`operations.follow.error.intersection_of_different_ways.${featureType}`))();
42519           return;
42520         }
42521         const way = lastNodesParents[0];
42522         const indexOfLast = way.nodes.indexOf(lastNodeId);
42523         const indexOfSecondLast = way.nodes.indexOf(secondLastNodeId);
42524         const isDescendingPastZero = indexOfLast === way.nodes.length - 2 && indexOfSecondLast === 0;
42525         let nextNodeIndex = indexOfLast + (indexOfLast > indexOfSecondLast && !isDescendingPastZero ? 1 : -1);
42526         if (nextNodeIndex === -1)
42527           nextNodeIndex = indexOfSecondLast === 1 ? way.nodes.length - 2 : 1;
42528         const nextNode = historyGraph.entity(way.nodes[nextNodeIndex]);
42529         drawWay.addNode(nextNode, {
42530           geometry: { type: "Point", coordinates: nextNode.loc },
42531           id: nextNode.id,
42532           properties: { target: true, entity: nextNode }
42533         });
42534       } catch (ex) {
42535         context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.unknown"))();
42536       }
42537     }
42538     keybinding.on(_t("operations.follow.key"), followMode);
42539     select_default2(document).call(keybinding);
42540     drawWay.finish = function() {
42541       checkGeometry(
42542         false
42543         /* includeDrawNode */
42544       );
42545       if (context.surface().classed("nope")) {
42546         dispatch10.call("rejectedSelfIntersection", this);
42547         return;
42548       }
42549       context.pauseChangeDispatch();
42550       context.pop(1);
42551       _didResolveTempEdit = true;
42552       context.resumeChangeDispatch();
42553       var way = context.hasEntity(wayID);
42554       if (!way || way.isDegenerate()) {
42555         drawWay.cancel();
42556         return;
42557       }
42558       window.setTimeout(function() {
42559         context.map().dblclickZoomEnable(true);
42560       }, 1e3);
42561       var isNewFeature = !mode.isContinuing;
42562       context.enter(modeSelect(context, [wayID]).newFeature(isNewFeature));
42563     };
42564     drawWay.cancel = function() {
42565       context.pauseChangeDispatch();
42566       resetToStartGraph();
42567       context.resumeChangeDispatch();
42568       window.setTimeout(function() {
42569         context.map().dblclickZoomEnable(true);
42570       }, 1e3);
42571       context.surface().classed("nope", false).classed("nope-disabled", false).classed("nope-suppressed", false);
42572       context.enter(modeBrowse(context));
42573     };
42574     drawWay.nodeIndex = function(val) {
42575       if (!arguments.length)
42576         return _nodeIndex;
42577       _nodeIndex = val;
42578       return drawWay;
42579     };
42580     drawWay.activeID = function() {
42581       if (!arguments.length)
42582         return _drawNode && _drawNode.id;
42583       return drawWay;
42584     };
42585     return utilRebind(drawWay, dispatch10, "on");
42586   }
42587
42588   // modules/modes/draw_line.js
42589   function modeDrawLine(context, wayID, startGraph, button, affix, continuing) {
42590     var mode = {
42591       button,
42592       id: "draw-line"
42593     };
42594     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawLine", function() {
42595       context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.lines"))();
42596     });
42597     mode.wayID = wayID;
42598     mode.isContinuing = continuing;
42599     mode.enter = function() {
42600       behavior.nodeIndex(affix === "prefix" ? 0 : void 0);
42601       context.install(behavior);
42602     };
42603     mode.exit = function() {
42604       context.uninstall(behavior);
42605     };
42606     mode.selectedIDs = function() {
42607       return [wayID];
42608     };
42609     mode.activeID = function() {
42610       return behavior && behavior.activeID() || [];
42611     };
42612     return mode;
42613   }
42614
42615   // modules/validations/disconnected_way.js
42616   function validationDisconnectedWay() {
42617     var type2 = "disconnected_way";
42618     function isTaggedAsHighway(entity) {
42619       return osmRoutableHighwayTagValues[entity.tags.highway];
42620     }
42621     var validation = function checkDisconnectedWay(entity, graph) {
42622       var routingIslandWays = routingIslandForEntity(entity);
42623       if (!routingIslandWays)
42624         return [];
42625       return [new validationIssue({
42626         type: type2,
42627         subtype: "highway",
42628         severity: "warning",
42629         message: function(context) {
42630           var entity2 = this.entityIds.length && context.hasEntity(this.entityIds[0]);
42631           var label = entity2 && utilDisplayLabel(entity2, context.graph());
42632           return _t.append("issues.disconnected_way.routable.message", { count: this.entityIds.length, highway: label });
42633         },
42634         reference: showReference,
42635         entityIds: Array.from(routingIslandWays).map(function(way) {
42636           return way.id;
42637         }),
42638         dynamicFixes: makeFixes
42639       })];
42640       function makeFixes(context) {
42641         var fixes = [];
42642         var singleEntity = this.entityIds.length === 1 && context.hasEntity(this.entityIds[0]);
42643         if (singleEntity) {
42644           if (singleEntity.type === "way" && !singleEntity.isClosed()) {
42645             var textDirection = _mainLocalizer.textDirection();
42646             var startFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.first(), "start");
42647             if (startFix)
42648               fixes.push(startFix);
42649             var endFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.last(), "end");
42650             if (endFix)
42651               fixes.push(endFix);
42652           }
42653           if (!fixes.length) {
42654             fixes.push(new validationIssueFix({
42655               title: _t.append("issues.fix.connect_feature.title")
42656             }));
42657           }
42658           fixes.push(new validationIssueFix({
42659             icon: "iD-operation-delete",
42660             title: _t.append("issues.fix.delete_feature.title"),
42661             entityIds: [singleEntity.id],
42662             onClick: function(context2) {
42663               var id2 = this.issue.entityIds[0];
42664               var operation = operationDelete(context2, [id2]);
42665               if (!operation.disabled()) {
42666                 operation();
42667               }
42668             }
42669           }));
42670         } else {
42671           fixes.push(new validationIssueFix({
42672             title: _t.append("issues.fix.connect_features.title")
42673           }));
42674         }
42675         return fixes;
42676       }
42677       function showReference(selection2) {
42678         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.disconnected_way.routable.reference"));
42679       }
42680       function routingIslandForEntity(entity2) {
42681         var routingIsland = /* @__PURE__ */ new Set();
42682         var waysToCheck = [];
42683         function queueParentWays(node) {
42684           graph.parentWays(node).forEach(function(parentWay) {
42685             if (!routingIsland.has(parentWay) && // only check each feature once
42686             isRoutableWay(parentWay, false)) {
42687               routingIsland.add(parentWay);
42688               waysToCheck.push(parentWay);
42689             }
42690           });
42691         }
42692         if (entity2.type === "way" && isRoutableWay(entity2, true)) {
42693           routingIsland.add(entity2);
42694           waysToCheck.push(entity2);
42695         } else if (entity2.type === "node" && isRoutableNode(entity2)) {
42696           routingIsland.add(entity2);
42697           queueParentWays(entity2);
42698         } else {
42699           return null;
42700         }
42701         while (waysToCheck.length) {
42702           var wayToCheck = waysToCheck.pop();
42703           var childNodes = graph.childNodes(wayToCheck);
42704           for (var i2 in childNodes) {
42705             var vertex = childNodes[i2];
42706             if (isConnectedVertex(vertex)) {
42707               return null;
42708             }
42709             if (isRoutableNode(vertex)) {
42710               routingIsland.add(vertex);
42711             }
42712             queueParentWays(vertex);
42713           }
42714         }
42715         return routingIsland;
42716       }
42717       function isConnectedVertex(vertex) {
42718         var osm = services.osm;
42719         if (osm && !osm.isDataLoaded(vertex.loc))
42720           return true;
42721         if (vertex.tags.entrance && vertex.tags.entrance !== "no")
42722           return true;
42723         if (vertex.tags.amenity === "parking_entrance")
42724           return true;
42725         return false;
42726       }
42727       function isRoutableNode(node) {
42728         if (node.tags.highway === "elevator")
42729           return true;
42730         return false;
42731       }
42732       function isRoutableWay(way, ignoreInnerWays) {
42733         if (isTaggedAsHighway(way) || way.tags.route === "ferry")
42734           return true;
42735         return graph.parentRelations(way).some(function(parentRelation) {
42736           if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry")
42737             return true;
42738           if (parentRelation.isMultipolygon() && isTaggedAsHighway(parentRelation) && (!ignoreInnerWays || parentRelation.memberById(way.id).role !== "inner"))
42739             return true;
42740           return false;
42741         });
42742       }
42743       function makeContinueDrawingFixIfAllowed(textDirection, vertexID, whichEnd) {
42744         var vertex = graph.hasEntity(vertexID);
42745         if (!vertex || vertex.tags.noexit === "yes")
42746           return null;
42747         var useLeftContinue = whichEnd === "start" && textDirection === "ltr" || whichEnd === "end" && textDirection === "rtl";
42748         return new validationIssueFix({
42749           icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
42750           title: _t.append("issues.fix.continue_from_" + whichEnd + ".title"),
42751           entityIds: [vertexID],
42752           onClick: function(context) {
42753             var wayId = this.issue.entityIds[0];
42754             var way = context.hasEntity(wayId);
42755             var vertexId = this.entityIds[0];
42756             var vertex2 = context.hasEntity(vertexId);
42757             if (!way || !vertex2)
42758               return;
42759             var map2 = context.map();
42760             if (!context.editable() || !map2.trimmedExtent().contains(vertex2.loc)) {
42761               map2.zoomToEase(vertex2);
42762             }
42763             context.enter(
42764               modeDrawLine(context, wayId, context.graph(), "line", way.affix(vertexId), true)
42765             );
42766           }
42767         });
42768       }
42769     };
42770     validation.type = type2;
42771     return validation;
42772   }
42773
42774   // modules/validations/invalid_format.js
42775   function validationFormatting() {
42776     var type2 = "invalid_format";
42777     var validation = function(entity) {
42778       var issues = [];
42779       function isValidEmail(email) {
42780         var valid_email = /^[^\(\)\\,":;<>@\[\]]+@[^\(\)\\,":;<>@\[\]\.]+(?:\.[a-z0-9-]+)*$/i;
42781         return !email || valid_email.test(email);
42782       }
42783       function showReferenceEmail(selection2) {
42784         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.invalid_format.email.reference"));
42785       }
42786       if (entity.tags.email) {
42787         var emails = entity.tags.email.split(";").map(function(s) {
42788           return s.trim();
42789         }).filter(function(x) {
42790           return !isValidEmail(x);
42791         });
42792         if (emails.length) {
42793           issues.push(new validationIssue({
42794             type: type2,
42795             subtype: "email",
42796             severity: "warning",
42797             message: function(context) {
42798               var entity2 = context.hasEntity(this.entityIds[0]);
42799               return entity2 ? _t.append(
42800                 "issues.invalid_format.email.message" + this.data,
42801                 { feature: utilDisplayLabel(entity2, context.graph()), email: emails.join(", ") }
42802               ) : "";
42803             },
42804             reference: showReferenceEmail,
42805             entityIds: [entity.id],
42806             hash: emails.join(),
42807             data: emails.length > 1 ? "_multi" : ""
42808           }));
42809         }
42810       }
42811       return issues;
42812     };
42813     validation.type = type2;
42814     return validation;
42815   }
42816
42817   // modules/validations/help_request.js
42818   function validationHelpRequest(context) {
42819     var type2 = "help_request";
42820     var validation = function checkFixmeTag(entity) {
42821       if (!entity.tags.fixme)
42822         return [];
42823       if (entity.version === void 0)
42824         return [];
42825       if (entity.v !== void 0) {
42826         var baseEntity = context.history().base().hasEntity(entity.id);
42827         if (!baseEntity || !baseEntity.tags.fixme)
42828           return [];
42829       }
42830       return [new validationIssue({
42831         type: type2,
42832         subtype: "fixme_tag",
42833         severity: "warning",
42834         message: function(context2) {
42835           var entity2 = context2.hasEntity(this.entityIds[0]);
42836           return entity2 ? _t.append("issues.fixme_tag.message", {
42837             feature: utilDisplayLabel(
42838               entity2,
42839               context2.graph(),
42840               true
42841               /* verbose */
42842             )
42843           }) : "";
42844         },
42845         dynamicFixes: function() {
42846           return [
42847             new validationIssueFix({
42848               title: _t.append("issues.fix.address_the_concern.title")
42849             })
42850           ];
42851         },
42852         reference: showReference,
42853         entityIds: [entity.id]
42854       })];
42855       function showReference(selection2) {
42856         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.fixme_tag.reference"));
42857       }
42858     };
42859     validation.type = type2;
42860     return validation;
42861   }
42862
42863   // modules/validations/impossible_oneway.js
42864   function validationImpossibleOneway() {
42865     var type2 = "impossible_oneway";
42866     var validation = function checkImpossibleOneway(entity, graph) {
42867       if (entity.type !== "way" || entity.geometry(graph) !== "line")
42868         return [];
42869       if (entity.isClosed())
42870         return [];
42871       if (!typeForWay(entity))
42872         return [];
42873       if (!isOneway(entity))
42874         return [];
42875       var firstIssues = issuesForNode(entity, entity.first());
42876       var lastIssues = issuesForNode(entity, entity.last());
42877       return firstIssues.concat(lastIssues);
42878       function typeForWay(way) {
42879         if (way.geometry(graph) !== "line")
42880           return null;
42881         if (osmRoutableHighwayTagValues[way.tags.highway])
42882           return "highway";
42883         if (osmFlowingWaterwayTagValues[way.tags.waterway])
42884           return "waterway";
42885         return null;
42886       }
42887       function isOneway(way) {
42888         if (way.tags.oneway === "yes")
42889           return true;
42890         if (way.tags.oneway)
42891           return false;
42892         for (var key in way.tags) {
42893           if (osmOneWayTags[key] && osmOneWayTags[key][way.tags[key]]) {
42894             return true;
42895           }
42896         }
42897         return false;
42898       }
42899       function nodeOccursMoreThanOnce(way, nodeID) {
42900         var occurrences = 0;
42901         for (var index in way.nodes) {
42902           if (way.nodes[index] === nodeID) {
42903             occurrences += 1;
42904             if (occurrences > 1)
42905               return true;
42906           }
42907         }
42908         return false;
42909       }
42910       function isConnectedViaOtherTypes(way, node) {
42911         var wayType = typeForWay(way);
42912         if (wayType === "highway") {
42913           if (node.tags.entrance && node.tags.entrance !== "no")
42914             return true;
42915           if (node.tags.amenity === "parking_entrance")
42916             return true;
42917         } else if (wayType === "waterway") {
42918           if (node.id === way.first()) {
42919             if (node.tags.natural === "spring")
42920               return true;
42921           } else {
42922             if (node.tags.manhole === "drain")
42923               return true;
42924           }
42925         }
42926         return graph.parentWays(node).some(function(parentWay) {
42927           if (parentWay.id === way.id)
42928             return false;
42929           if (wayType === "highway") {
42930             if (parentWay.geometry(graph) === "area" && osmRoutableHighwayTagValues[parentWay.tags.highway])
42931               return true;
42932             if (parentWay.tags.route === "ferry")
42933               return true;
42934             return graph.parentRelations(parentWay).some(function(parentRelation) {
42935               if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry")
42936                 return true;
42937               return parentRelation.isMultipolygon() && osmRoutableHighwayTagValues[parentRelation.tags.highway];
42938             });
42939           } else if (wayType === "waterway") {
42940             if (parentWay.tags.natural === "water" || parentWay.tags.natural === "coastline")
42941               return true;
42942           }
42943           return false;
42944         });
42945       }
42946       function issuesForNode(way, nodeID) {
42947         var isFirst = nodeID === way.first();
42948         var wayType = typeForWay(way);
42949         if (nodeOccursMoreThanOnce(way, nodeID))
42950           return [];
42951         var osm = services.osm;
42952         if (!osm)
42953           return [];
42954         var node = graph.hasEntity(nodeID);
42955         if (!node || !osm.isDataLoaded(node.loc))
42956           return [];
42957         if (isConnectedViaOtherTypes(way, node))
42958           return [];
42959         var attachedWaysOfSameType = graph.parentWays(node).filter(function(parentWay) {
42960           if (parentWay.id === way.id)
42961             return false;
42962           return typeForWay(parentWay) === wayType;
42963         });
42964         if (wayType === "waterway" && attachedWaysOfSameType.length === 0)
42965           return [];
42966         var attachedOneways = attachedWaysOfSameType.filter(function(attachedWay) {
42967           return isOneway(attachedWay);
42968         });
42969         if (attachedOneways.length < attachedWaysOfSameType.length)
42970           return [];
42971         if (attachedOneways.length) {
42972           var connectedEndpointsOkay = attachedOneways.some(function(attachedOneway) {
42973             if ((isFirst ? attachedOneway.first() : attachedOneway.last()) !== nodeID)
42974               return true;
42975             if (nodeOccursMoreThanOnce(attachedOneway, nodeID))
42976               return true;
42977             return false;
42978           });
42979           if (connectedEndpointsOkay)
42980             return [];
42981         }
42982         var placement = isFirst ? "start" : "end", messageID = wayType + ".", referenceID = wayType + ".";
42983         if (wayType === "waterway") {
42984           messageID += "connected." + placement;
42985           referenceID += "connected";
42986         } else {
42987           messageID += placement;
42988           referenceID += placement;
42989         }
42990         return [new validationIssue({
42991           type: type2,
42992           subtype: wayType,
42993           severity: "warning",
42994           message: function(context) {
42995             var entity2 = context.hasEntity(this.entityIds[0]);
42996             return entity2 ? _t.append("issues.impossible_oneway." + messageID + ".message", {
42997               feature: utilDisplayLabel(entity2, context.graph())
42998             }) : "";
42999           },
43000           reference: getReference(referenceID),
43001           entityIds: [way.id, node.id],
43002           dynamicFixes: function() {
43003             var fixes = [];
43004             if (attachedOneways.length) {
43005               fixes.push(new validationIssueFix({
43006                 icon: "iD-operation-reverse",
43007                 title: _t.append("issues.fix.reverse_feature.title"),
43008                 entityIds: [way.id],
43009                 onClick: function(context) {
43010                   var id2 = this.issue.entityIds[0];
43011                   context.perform(actionReverse(id2), _t("operations.reverse.annotation.line", { n: 1 }));
43012                 }
43013               }));
43014             }
43015             if (node.tags.noexit !== "yes") {
43016               var textDirection = _mainLocalizer.textDirection();
43017               var useLeftContinue = isFirst && textDirection === "ltr" || !isFirst && textDirection === "rtl";
43018               fixes.push(new validationIssueFix({
43019                 icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
43020                 title: _t.append("issues.fix.continue_from_" + (isFirst ? "start" : "end") + ".title"),
43021                 onClick: function(context) {
43022                   var entityID = this.issue.entityIds[0];
43023                   var vertexID = this.issue.entityIds[1];
43024                   var way2 = context.entity(entityID);
43025                   var vertex = context.entity(vertexID);
43026                   continueDrawing(way2, vertex, context);
43027                 }
43028               }));
43029             }
43030             return fixes;
43031           },
43032           loc: node.loc
43033         })];
43034         function getReference(referenceID2) {
43035           return function showReference(selection2) {
43036             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.impossible_oneway." + referenceID2 + ".reference"));
43037           };
43038         }
43039       }
43040     };
43041     function continueDrawing(way, vertex, context) {
43042       var map2 = context.map();
43043       if (!context.editable() || !map2.trimmedExtent().contains(vertex.loc)) {
43044         map2.zoomToEase(vertex);
43045       }
43046       context.enter(
43047         modeDrawLine(context, way.id, context.graph(), "line", way.affix(vertex.id), true)
43048       );
43049     }
43050     validation.type = type2;
43051     return validation;
43052   }
43053
43054   // modules/validations/incompatible_source.js
43055   function validationIncompatibleSource() {
43056     const type2 = "incompatible_source";
43057     const incompatibleRules = [
43058       {
43059         id: "amap",
43060         regex: /(^amap$|^amap\.com|autonavi|mapabc|高德)/i
43061       },
43062       {
43063         id: "baidu",
43064         regex: /(baidu|mapbar|百度)/i
43065       },
43066       {
43067         id: "google",
43068         regex: /google/i,
43069         exceptRegex: /((books|drive)\.google|google\s?(books|drive|plus))|(esri\/Google_Africa_Buildings)/i
43070       }
43071     ];
43072     const validation = function checkIncompatibleSource(entity) {
43073       const entitySources = entity.tags && entity.tags.source && entity.tags.source.split(";");
43074       if (!entitySources)
43075         return [];
43076       const entityID = entity.id;
43077       return entitySources.map((source) => {
43078         const matchRule = incompatibleRules.find((rule) => {
43079           if (!rule.regex.test(source))
43080             return false;
43081           if (rule.exceptRegex && rule.exceptRegex.test(source))
43082             return false;
43083           return true;
43084         });
43085         if (!matchRule)
43086           return null;
43087         return new validationIssue({
43088           type: type2,
43089           severity: "warning",
43090           message: (context) => {
43091             const entity2 = context.hasEntity(entityID);
43092             return entity2 ? _t.append("issues.incompatible_source.feature.message", {
43093               feature: utilDisplayLabel(
43094                 entity2,
43095                 context.graph(),
43096                 true
43097                 /* verbose */
43098               ),
43099               value: source
43100             }) : "";
43101           },
43102           reference: getReference(matchRule.id),
43103           entityIds: [entityID],
43104           hash: source,
43105           dynamicFixes: () => {
43106             return [
43107               new validationIssueFix({ title: _t.append("issues.fix.remove_proprietary_data.title") })
43108             ];
43109           }
43110         });
43111       }).filter(Boolean);
43112       function getReference(id2) {
43113         return function showReference(selection2) {
43114           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append(`issues.incompatible_source.reference.${id2}`));
43115         };
43116       }
43117     };
43118     validation.type = type2;
43119     return validation;
43120   }
43121
43122   // modules/validations/maprules.js
43123   function validationMaprules() {
43124     var type2 = "maprules";
43125     var validation = function checkMaprules(entity, graph) {
43126       if (!services.maprules)
43127         return [];
43128       var rules = services.maprules.validationRules();
43129       var issues = [];
43130       for (var i2 = 0; i2 < rules.length; i2++) {
43131         var rule = rules[i2];
43132         rule.findIssues(entity, graph, issues);
43133       }
43134       return issues;
43135     };
43136     validation.type = type2;
43137     return validation;
43138   }
43139
43140   // modules/validations/mismatched_geometry.js
43141   var import_fast_deep_equal4 = __toESM(require_fast_deep_equal());
43142   function validationMismatchedGeometry() {
43143     var type2 = "mismatched_geometry";
43144     function tagSuggestingLineIsArea(entity) {
43145       if (entity.type !== "way" || entity.isClosed())
43146         return null;
43147       var tagSuggestingArea = entity.tagSuggestingArea();
43148       if (!tagSuggestingArea) {
43149         return null;
43150       }
43151       var asLine = _mainPresetIndex.matchTags(tagSuggestingArea, "line");
43152       var asArea = _mainPresetIndex.matchTags(tagSuggestingArea, "area");
43153       if (asLine && asArea && asLine === asArea) {
43154         return null;
43155       }
43156       return tagSuggestingArea;
43157     }
43158     function makeConnectEndpointsFixOnClick(way, graph) {
43159       if (way.nodes.length < 3)
43160         return null;
43161       var nodes = graph.childNodes(way), testNodes;
43162       var firstToLastDistanceMeters = geoSphericalDistance(nodes[0].loc, nodes[nodes.length - 1].loc);
43163       if (firstToLastDistanceMeters < 0.75) {
43164         testNodes = nodes.slice();
43165         testNodes.pop();
43166         testNodes.push(testNodes[0]);
43167         if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
43168           return function(context) {
43169             var way2 = context.entity(this.issue.entityIds[0]);
43170             context.perform(
43171               actionMergeNodes([way2.nodes[0], way2.nodes[way2.nodes.length - 1]], nodes[0].loc),
43172               _t("issues.fix.connect_endpoints.annotation")
43173             );
43174           };
43175         }
43176       }
43177       testNodes = nodes.slice();
43178       testNodes.push(testNodes[0]);
43179       if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
43180         return function(context) {
43181           var wayId = this.issue.entityIds[0];
43182           var way2 = context.entity(wayId);
43183           var nodeId = way2.nodes[0];
43184           var index = way2.nodes.length;
43185           context.perform(
43186             actionAddVertex(wayId, nodeId, index),
43187             _t("issues.fix.connect_endpoints.annotation")
43188           );
43189         };
43190       }
43191     }
43192     function lineTaggedAsAreaIssue(entity) {
43193       var tagSuggestingArea = tagSuggestingLineIsArea(entity);
43194       if (!tagSuggestingArea)
43195         return null;
43196       var validAsLine = false;
43197       var presetAsLine = _mainPresetIndex.matchTags(entity.tags, "line");
43198       if (presetAsLine) {
43199         validAsLine = true;
43200         var key = Object.keys(tagSuggestingArea)[0];
43201         if (presetAsLine.tags[key] && presetAsLine.tags[key] === "*") {
43202           validAsLine = false;
43203         }
43204         if (Object.keys(presetAsLine.tags).length === 0) {
43205           validAsLine = false;
43206         }
43207       }
43208       return new validationIssue({
43209         type: type2,
43210         subtype: "area_as_line",
43211         severity: "warning",
43212         message: function(context) {
43213           var entity2 = context.hasEntity(this.entityIds[0]);
43214           return entity2 ? _t.append("issues.tag_suggests_area.message", {
43215             feature: utilDisplayLabel(
43216               entity2,
43217               "area",
43218               true
43219               /* verbose */
43220             ),
43221             tag: utilTagText({ tags: tagSuggestingArea })
43222           }) : "";
43223         },
43224         reference: showReference,
43225         entityIds: [entity.id],
43226         hash: JSON.stringify(tagSuggestingArea),
43227         dynamicFixes: function(context) {
43228           var fixes = [];
43229           var entity2 = context.entity(this.entityIds[0]);
43230           var connectEndsOnClick = makeConnectEndpointsFixOnClick(entity2, context.graph());
43231           if (!validAsLine) {
43232             fixes.push(new validationIssueFix({
43233               title: _t.append("issues.fix.connect_endpoints.title"),
43234               onClick: connectEndsOnClick
43235             }));
43236           }
43237           fixes.push(new validationIssueFix({
43238             icon: "iD-operation-delete",
43239             title: _t.append("issues.fix.remove_tag.title"),
43240             onClick: function(context2) {
43241               var entityId = this.issue.entityIds[0];
43242               var entity3 = context2.entity(entityId);
43243               var tags = Object.assign({}, entity3.tags);
43244               for (var key2 in tagSuggestingArea) {
43245                 delete tags[key2];
43246               }
43247               context2.perform(
43248                 actionChangeTags(entityId, tags),
43249                 _t("issues.fix.remove_tag.annotation")
43250               );
43251             }
43252           }));
43253           return fixes;
43254         }
43255       });
43256       function showReference(selection2) {
43257         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.tag_suggests_area.reference"));
43258       }
43259     }
43260     function vertexPointIssue(entity, graph) {
43261       if (entity.type !== "node")
43262         return null;
43263       if (Object.keys(entity.tags).length === 0)
43264         return null;
43265       if (entity.isOnAddressLine(graph))
43266         return null;
43267       var geometry = entity.geometry(graph);
43268       var allowedGeometries = osmNodeGeometriesForTags(entity.tags);
43269       if (geometry === "point" && !allowedGeometries.point && allowedGeometries.vertex) {
43270         return new validationIssue({
43271           type: type2,
43272           subtype: "vertex_as_point",
43273           severity: "warning",
43274           message: function(context) {
43275             var entity2 = context.hasEntity(this.entityIds[0]);
43276             return entity2 ? _t.append("issues.vertex_as_point.message", {
43277               feature: utilDisplayLabel(
43278                 entity2,
43279                 "vertex",
43280                 true
43281                 /* verbose */
43282               )
43283             }) : "";
43284           },
43285           reference: function showReference(selection2) {
43286             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.vertex_as_point.reference"));
43287           },
43288           entityIds: [entity.id]
43289         });
43290       } else if (geometry === "vertex" && !allowedGeometries.vertex && allowedGeometries.point) {
43291         return new validationIssue({
43292           type: type2,
43293           subtype: "point_as_vertex",
43294           severity: "warning",
43295           message: function(context) {
43296             var entity2 = context.hasEntity(this.entityIds[0]);
43297             return entity2 ? _t.append("issues.point_as_vertex.message", {
43298               feature: utilDisplayLabel(
43299                 entity2,
43300                 "point",
43301                 true
43302                 /* verbose */
43303               )
43304             }) : "";
43305           },
43306           reference: function showReference(selection2) {
43307             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.point_as_vertex.reference"));
43308           },
43309           entityIds: [entity.id],
43310           dynamicFixes: extractPointDynamicFixes
43311         });
43312       }
43313       return null;
43314     }
43315     function otherMismatchIssue(entity, graph) {
43316       if (!entity.hasInterestingTags())
43317         return null;
43318       if (entity.type !== "node" && entity.type !== "way")
43319         return null;
43320       if (entity.type === "node" && entity.isOnAddressLine(graph))
43321         return null;
43322       var sourceGeom = entity.geometry(graph);
43323       var targetGeoms = entity.type === "way" ? ["point", "vertex"] : ["line", "area"];
43324       if (sourceGeom === "area")
43325         targetGeoms.unshift("line");
43326       var asSource = _mainPresetIndex.match(entity, graph);
43327       var targetGeom = targetGeoms.find((nodeGeom) => {
43328         var asTarget = _mainPresetIndex.matchTags(entity.tags, nodeGeom);
43329         if (!asSource || !asTarget || asSource === asTarget || // sometimes there are two presets with the same tags for different geometries
43330         (0, import_fast_deep_equal4.default)(asSource.tags, asTarget.tags))
43331           return false;
43332         if (asTarget.isFallback())
43333           return false;
43334         var primaryKey = Object.keys(asTarget.tags)[0];
43335         if (primaryKey === "building")
43336           return false;
43337         if (asTarget.tags[primaryKey] === "*")
43338           return false;
43339         return asSource.isFallback() || asSource.tags[primaryKey] === "*";
43340       });
43341       if (!targetGeom)
43342         return null;
43343       var subtype = targetGeom + "_as_" + sourceGeom;
43344       if (targetGeom === "vertex")
43345         targetGeom = "point";
43346       if (sourceGeom === "vertex")
43347         sourceGeom = "point";
43348       var referenceId = targetGeom + "_as_" + sourceGeom;
43349       var dynamicFixes;
43350       if (targetGeom === "point") {
43351         dynamicFixes = extractPointDynamicFixes;
43352       } else if (sourceGeom === "area" && targetGeom === "line") {
43353         dynamicFixes = lineToAreaDynamicFixes;
43354       }
43355       return new validationIssue({
43356         type: type2,
43357         subtype,
43358         severity: "warning",
43359         message: function(context) {
43360           var entity2 = context.hasEntity(this.entityIds[0]);
43361           return entity2 ? _t.append("issues." + referenceId + ".message", {
43362             feature: utilDisplayLabel(
43363               entity2,
43364               targetGeom,
43365               true
43366               /* verbose */
43367             )
43368           }) : "";
43369         },
43370         reference: function showReference(selection2) {
43371           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.mismatched_geometry.reference"));
43372         },
43373         entityIds: [entity.id],
43374         dynamicFixes
43375       });
43376     }
43377     function lineToAreaDynamicFixes(context) {
43378       var convertOnClick;
43379       var entityId = this.entityIds[0];
43380       var entity = context.entity(entityId);
43381       var tags = Object.assign({}, entity.tags);
43382       delete tags.area;
43383       if (!osmTagSuggestingArea(tags)) {
43384         convertOnClick = function(context2) {
43385           var entityId2 = this.issue.entityIds[0];
43386           var entity2 = context2.entity(entityId2);
43387           var tags2 = Object.assign({}, entity2.tags);
43388           if (tags2.area) {
43389             delete tags2.area;
43390           }
43391           context2.perform(
43392             actionChangeTags(entityId2, tags2),
43393             _t("issues.fix.convert_to_line.annotation")
43394           );
43395         };
43396       }
43397       return [
43398         new validationIssueFix({
43399           icon: "iD-icon-line",
43400           title: _t.append("issues.fix.convert_to_line.title"),
43401           onClick: convertOnClick
43402         })
43403       ];
43404     }
43405     function extractPointDynamicFixes(context) {
43406       var entityId = this.entityIds[0];
43407       var extractOnClick = null;
43408       if (!context.hasHiddenConnections(entityId)) {
43409         extractOnClick = function(context2) {
43410           var entityId2 = this.issue.entityIds[0];
43411           var action = actionExtract(entityId2, context2.projection);
43412           context2.perform(
43413             action,
43414             _t("operations.extract.annotation", { n: 1 })
43415           );
43416           context2.enter(modeSelect(context2, [action.getExtractedNodeID()]));
43417         };
43418       }
43419       return [
43420         new validationIssueFix({
43421           icon: "iD-operation-extract",
43422           title: _t.append("issues.fix.extract_point.title"),
43423           onClick: extractOnClick
43424         })
43425       ];
43426     }
43427     function unclosedMultipolygonPartIssues(entity, graph) {
43428       if (entity.type !== "relation" || !entity.isMultipolygon() || entity.isDegenerate() || // cannot determine issues for incompletely-downloaded relations
43429       !entity.isComplete(graph))
43430         return [];
43431       var sequences = osmJoinWays(entity.members, graph);
43432       var issues = [];
43433       for (var i2 in sequences) {
43434         var sequence = sequences[i2];
43435         if (!sequence.nodes)
43436           continue;
43437         var firstNode = sequence.nodes[0];
43438         var lastNode = sequence.nodes[sequence.nodes.length - 1];
43439         if (firstNode === lastNode)
43440           continue;
43441         var issue = new validationIssue({
43442           type: type2,
43443           subtype: "unclosed_multipolygon_part",
43444           severity: "warning",
43445           message: function(context) {
43446             var entity2 = context.hasEntity(this.entityIds[0]);
43447             return entity2 ? _t.append("issues.unclosed_multipolygon_part.message", {
43448               feature: utilDisplayLabel(
43449                 entity2,
43450                 context.graph(),
43451                 true
43452                 /* verbose */
43453               )
43454             }) : "";
43455           },
43456           reference: showReference,
43457           loc: sequence.nodes[0].loc,
43458           entityIds: [entity.id],
43459           hash: sequence.map(function(way) {
43460             return way.id;
43461           }).join()
43462         });
43463         issues.push(issue);
43464       }
43465       return issues;
43466       function showReference(selection2) {
43467         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unclosed_multipolygon_part.reference"));
43468       }
43469     }
43470     var validation = function checkMismatchedGeometry(entity, graph) {
43471       var vertexPoint = vertexPointIssue(entity, graph);
43472       if (vertexPoint)
43473         return [vertexPoint];
43474       var lineAsArea = lineTaggedAsAreaIssue(entity);
43475       if (lineAsArea)
43476         return [lineAsArea];
43477       var mismatch = otherMismatchIssue(entity, graph);
43478       if (mismatch)
43479         return [mismatch];
43480       return unclosedMultipolygonPartIssues(entity, graph);
43481     };
43482     validation.type = type2;
43483     return validation;
43484   }
43485
43486   // modules/validations/missing_role.js
43487   function validationMissingRole() {
43488     var type2 = "missing_role";
43489     var validation = function checkMissingRole(entity, graph) {
43490       var issues = [];
43491       if (entity.type === "way") {
43492         graph.parentRelations(entity).forEach(function(relation) {
43493           if (!relation.isMultipolygon())
43494             return;
43495           var member = relation.memberById(entity.id);
43496           if (member && isMissingRole(member)) {
43497             issues.push(makeIssue(entity, relation, member));
43498           }
43499         });
43500       } else if (entity.type === "relation" && entity.isMultipolygon()) {
43501         entity.indexedMembers().forEach(function(member) {
43502           var way = graph.hasEntity(member.id);
43503           if (way && isMissingRole(member)) {
43504             issues.push(makeIssue(way, entity, member));
43505           }
43506         });
43507       }
43508       return issues;
43509     };
43510     function isMissingRole(member) {
43511       return !member.role || !member.role.trim().length;
43512     }
43513     function makeIssue(way, relation, member) {
43514       return new validationIssue({
43515         type: type2,
43516         severity: "warning",
43517         message: function(context) {
43518           var member2 = context.hasEntity(this.entityIds[1]), relation2 = context.hasEntity(this.entityIds[0]);
43519           return member2 && relation2 ? _t.append("issues.missing_role.message", {
43520             member: utilDisplayLabel(member2, context.graph()),
43521             relation: utilDisplayLabel(relation2, context.graph())
43522           }) : "";
43523         },
43524         reference: showReference,
43525         entityIds: [relation.id, way.id],
43526         data: {
43527           member
43528         },
43529         hash: member.index.toString(),
43530         dynamicFixes: function() {
43531           return [
43532             makeAddRoleFix("inner"),
43533             makeAddRoleFix("outer"),
43534             new validationIssueFix({
43535               icon: "iD-operation-delete",
43536               title: _t.append("issues.fix.remove_from_relation.title"),
43537               onClick: function(context) {
43538                 context.perform(
43539                   actionDeleteMember(this.issue.entityIds[0], this.issue.data.member.index),
43540                   _t("operations.delete_member.annotation", {
43541                     n: 1
43542                   })
43543                 );
43544               }
43545             })
43546           ];
43547         }
43548       });
43549       function showReference(selection2) {
43550         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.missing_role.multipolygon.reference"));
43551       }
43552     }
43553     function makeAddRoleFix(role) {
43554       return new validationIssueFix({
43555         title: _t.append("issues.fix.set_as_" + role + ".title"),
43556         onClick: function(context) {
43557           var oldMember = this.issue.data.member;
43558           var member = { id: this.issue.entityIds[1], type: oldMember.type, role };
43559           context.perform(
43560             actionChangeMember(this.issue.entityIds[0], member, oldMember.index),
43561             _t("operations.change_role.annotation", {
43562               n: 1
43563             })
43564           );
43565         }
43566       });
43567     }
43568     validation.type = type2;
43569     return validation;
43570   }
43571
43572   // modules/validations/missing_tag.js
43573   function validationMissingTag(context) {
43574     var type2 = "missing_tag";
43575     function hasDescriptiveTags(entity, graph) {
43576       var onlyAttributeKeys = ["description", "name", "note", "start_date"];
43577       var entityDescriptiveKeys = Object.keys(entity.tags).filter(function(k) {
43578         if (k === "area" || !osmIsInterestingTag(k))
43579           return false;
43580         return !onlyAttributeKeys.some(function(attributeKey) {
43581           return k === attributeKey || k.indexOf(attributeKey + ":") === 0;
43582         });
43583       });
43584       if (entity.type === "relation" && entityDescriptiveKeys.length === 1 && entity.tags.type === "multipolygon") {
43585         return osmOldMultipolygonOuterMemberOfRelation(entity, graph);
43586       }
43587       return entityDescriptiveKeys.length > 0;
43588     }
43589     function isUnknownRoad(entity) {
43590       return entity.type === "way" && entity.tags.highway === "road";
43591     }
43592     function isUntypedRelation(entity) {
43593       return entity.type === "relation" && !entity.tags.type;
43594     }
43595     var validation = function checkMissingTag(entity, graph) {
43596       var subtype;
43597       var osm = context.connection();
43598       var isUnloadedNode = entity.type === "node" && osm && !osm.isDataLoaded(entity.loc);
43599       if (!isUnloadedNode && // allow untagged nodes that are part of ways
43600       entity.geometry(graph) !== "vertex" && // allow untagged entities that are part of relations
43601       !entity.hasParentRelations(graph)) {
43602         if (Object.keys(entity.tags).length === 0) {
43603           subtype = "any";
43604         } else if (!hasDescriptiveTags(entity, graph)) {
43605           subtype = "descriptive";
43606         } else if (isUntypedRelation(entity)) {
43607           subtype = "relation_type";
43608         }
43609       }
43610       if (!subtype && isUnknownRoad(entity)) {
43611         subtype = "highway_classification";
43612       }
43613       if (!subtype)
43614         return [];
43615       var messageID = subtype === "highway_classification" ? "unknown_road" : "missing_tag." + subtype;
43616       var referenceID = subtype === "highway_classification" ? "unknown_road" : "missing_tag";
43617       var canDelete = entity.version === void 0 || entity.v !== void 0;
43618       var severity = canDelete && subtype !== "highway_classification" ? "error" : "warning";
43619       return [new validationIssue({
43620         type: type2,
43621         subtype,
43622         severity,
43623         message: function(context2) {
43624           var entity2 = context2.hasEntity(this.entityIds[0]);
43625           return entity2 ? _t.append("issues." + messageID + ".message", {
43626             feature: utilDisplayLabel(entity2, context2.graph())
43627           }) : "";
43628         },
43629         reference: showReference,
43630         entityIds: [entity.id],
43631         dynamicFixes: function(context2) {
43632           var fixes = [];
43633           var selectFixType = subtype === "highway_classification" ? "select_road_type" : "select_preset";
43634           fixes.push(new validationIssueFix({
43635             icon: "iD-icon-search",
43636             title: _t.append("issues.fix." + selectFixType + ".title"),
43637             onClick: function(context3) {
43638               context3.ui().sidebar.showPresetList();
43639             }
43640           }));
43641           var deleteOnClick;
43642           var id2 = this.entityIds[0];
43643           var operation = operationDelete(context2, [id2]);
43644           var disabledReasonID = operation.disabled();
43645           if (!disabledReasonID) {
43646             deleteOnClick = function(context3) {
43647               var id3 = this.issue.entityIds[0];
43648               var operation2 = operationDelete(context3, [id3]);
43649               if (!operation2.disabled()) {
43650                 operation2();
43651               }
43652             };
43653           }
43654           fixes.push(
43655             new validationIssueFix({
43656               icon: "iD-operation-delete",
43657               title: _t.append("issues.fix.delete_feature.title"),
43658               disabledReason: disabledReasonID ? _t("operations.delete." + disabledReasonID + ".single") : void 0,
43659               onClick: deleteOnClick
43660             })
43661           );
43662           return fixes;
43663         }
43664       })];
43665       function showReference(selection2) {
43666         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues." + referenceID + ".reference"));
43667       }
43668     };
43669     validation.type = type2;
43670     return validation;
43671   }
43672
43673   // modules/validations/outdated_tags.js
43674   function validationOutdatedTags() {
43675     const type2 = "outdated_tags";
43676     let _waitingForDeprecated = true;
43677     let _dataDeprecated;
43678     _mainFileFetcher.get("deprecated").then((d) => _dataDeprecated = d).catch(() => {
43679     }).finally(() => _waitingForDeprecated = false);
43680     function oldTagIssues(entity, graph) {
43681       if (!entity.hasInterestingTags())
43682         return [];
43683       let preset = _mainPresetIndex.match(entity, graph);
43684       if (!preset)
43685         return [];
43686       const oldTags = Object.assign({}, entity.tags);
43687       let subtype = "deprecated_tags";
43688       if (preset.replacement) {
43689         const newPreset = _mainPresetIndex.item(preset.replacement);
43690         graph = actionChangePreset(
43691           entity.id,
43692           preset,
43693           newPreset,
43694           true
43695           /* skip field defaults */
43696         )(graph);
43697         entity = graph.entity(entity.id);
43698         preset = newPreset;
43699       }
43700       if (_dataDeprecated) {
43701         const deprecatedTags = entity.deprecatedTags(_dataDeprecated);
43702         if (deprecatedTags.length) {
43703           deprecatedTags.forEach((tag) => {
43704             graph = actionUpgradeTags(entity.id, tag.old, tag.replace)(graph);
43705           });
43706           entity = graph.entity(entity.id);
43707         }
43708       }
43709       let newTags = Object.assign({}, entity.tags);
43710       if (preset.tags !== preset.addTags) {
43711         Object.keys(preset.addTags).forEach((k) => {
43712           if (!newTags[k]) {
43713             if (preset.addTags[k] === "*") {
43714               newTags[k] = "yes";
43715             } else {
43716               newTags[k] = preset.addTags[k];
43717             }
43718           }
43719         });
43720       }
43721       const nsi = services.nsi;
43722       let waitingForNsi = false;
43723       let nsiResult;
43724       if (nsi) {
43725         waitingForNsi = nsi.status() === "loading";
43726         if (!waitingForNsi) {
43727           const loc = entity.extent(graph).center();
43728           nsiResult = nsi.upgradeTags(newTags, loc);
43729           if (nsiResult) {
43730             newTags = nsiResult.newTags;
43731             subtype = "noncanonical_brand";
43732           }
43733         }
43734       }
43735       let issues = [];
43736       issues.provisional = _waitingForDeprecated || waitingForNsi;
43737       const tagDiff = utilTagDiff(oldTags, newTags);
43738       if (!tagDiff.length)
43739         return issues;
43740       const isOnlyAddingTags = tagDiff.every((d) => d.type === "+");
43741       let prefix = "";
43742       if (nsiResult) {
43743         prefix = "noncanonical_brand.";
43744       } else if (subtype === "deprecated_tags" && isOnlyAddingTags) {
43745         subtype = "incomplete_tags";
43746         prefix = "incomplete.";
43747       }
43748       let autoArgs = subtype !== "noncanonical_brand" ? [doUpgrade, _t("issues.fix.upgrade_tags.annotation")] : null;
43749       issues.push(new validationIssue({
43750         type: type2,
43751         subtype,
43752         severity: "warning",
43753         message: showMessage,
43754         reference: showReference,
43755         entityIds: [entity.id],
43756         hash: utilHashcode(JSON.stringify(tagDiff)),
43757         dynamicFixes: () => {
43758           let fixes = [
43759             new validationIssueFix({
43760               autoArgs,
43761               title: _t.append("issues.fix.upgrade_tags.title"),
43762               onClick: (context) => {
43763                 context.perform(doUpgrade, _t("issues.fix.upgrade_tags.annotation"));
43764               }
43765             })
43766           ];
43767           const item = nsiResult && nsiResult.matched;
43768           if (item) {
43769             fixes.push(
43770               new validationIssueFix({
43771                 title: _t.append("issues.fix.tag_as_not.title", { name: item.displayName }),
43772                 onClick: (context) => {
43773                   context.perform(addNotTag, _t("issues.fix.tag_as_not.annotation"));
43774                 }
43775               })
43776             );
43777           }
43778           return fixes;
43779         }
43780       }));
43781       return issues;
43782       function doUpgrade(graph2) {
43783         const currEntity = graph2.hasEntity(entity.id);
43784         if (!currEntity)
43785           return graph2;
43786         let newTags2 = Object.assign({}, currEntity.tags);
43787         tagDiff.forEach((diff) => {
43788           if (diff.type === "-") {
43789             delete newTags2[diff.key];
43790           } else if (diff.type === "+") {
43791             newTags2[diff.key] = diff.newVal;
43792           }
43793         });
43794         return actionChangeTags(currEntity.id, newTags2)(graph2);
43795       }
43796       function addNotTag(graph2) {
43797         const currEntity = graph2.hasEntity(entity.id);
43798         if (!currEntity)
43799           return graph2;
43800         const item = nsiResult && nsiResult.matched;
43801         if (!item)
43802           return graph2;
43803         let newTags2 = Object.assign({}, currEntity.tags);
43804         const wd = item.mainTag;
43805         const notwd = `not:${wd}`;
43806         const qid = item.tags[wd];
43807         newTags2[notwd] = qid;
43808         if (newTags2[wd] === qid) {
43809           const wp = item.mainTag.replace("wikidata", "wikipedia");
43810           delete newTags2[wd];
43811           delete newTags2[wp];
43812         }
43813         return actionChangeTags(currEntity.id, newTags2)(graph2);
43814       }
43815       function showMessage(context) {
43816         const currEntity = context.hasEntity(entity.id);
43817         if (!currEntity)
43818           return "";
43819         let messageID = `issues.outdated_tags.${prefix}message`;
43820         if (subtype === "noncanonical_brand" && isOnlyAddingTags) {
43821           messageID += "_incomplete";
43822         }
43823         return _t.append(messageID, {
43824           feature: utilDisplayLabel(
43825             currEntity,
43826             context.graph(),
43827             true
43828             /* verbose */
43829           )
43830         });
43831       }
43832       function showReference(selection2) {
43833         let enter = selection2.selectAll(".issue-reference").data([0]).enter();
43834         enter.append("div").attr("class", "issue-reference").call(_t.append(`issues.outdated_tags.${prefix}reference`));
43835         enter.append("strong").call(_t.append("issues.suggested"));
43836         enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", (d) => {
43837           let klass = d.type === "+" ? "add" : "remove";
43838           return `tagDiff-cell tagDiff-cell-${klass}`;
43839         }).html((d) => d.display);
43840       }
43841     }
43842     function oldMultipolygonIssues(entity, graph) {
43843       let multipolygon, outerWay;
43844       if (entity.type === "relation") {
43845         outerWay = osmOldMultipolygonOuterMemberOfRelation(entity, graph);
43846         multipolygon = entity;
43847       } else if (entity.type === "way") {
43848         multipolygon = osmIsOldMultipolygonOuterMember(entity, graph);
43849         outerWay = entity;
43850       } else {
43851         return [];
43852       }
43853       if (!multipolygon || !outerWay)
43854         return [];
43855       return [new validationIssue({
43856         type: type2,
43857         subtype: "old_multipolygon",
43858         severity: "warning",
43859         message: showMessage,
43860         reference: showReference,
43861         entityIds: [outerWay.id, multipolygon.id],
43862         dynamicFixes: () => {
43863           return [
43864             new validationIssueFix({
43865               autoArgs: [doUpgrade, _t("issues.fix.move_tags.annotation")],
43866               title: _t.append("issues.fix.move_tags.title"),
43867               onClick: (context) => {
43868                 context.perform(doUpgrade, _t("issues.fix.move_tags.annotation"));
43869               }
43870             })
43871           ];
43872         }
43873       })];
43874       function doUpgrade(graph2) {
43875         let currMultipolygon = graph2.hasEntity(multipolygon.id);
43876         let currOuterWay = graph2.hasEntity(outerWay.id);
43877         if (!currMultipolygon || !currOuterWay)
43878           return graph2;
43879         currMultipolygon = currMultipolygon.mergeTags(currOuterWay.tags);
43880         graph2 = graph2.replace(currMultipolygon);
43881         return actionChangeTags(currOuterWay.id, {})(graph2);
43882       }
43883       function showMessage(context) {
43884         let currMultipolygon = context.hasEntity(multipolygon.id);
43885         if (!currMultipolygon)
43886           return "";
43887         return _t.append(
43888           "issues.old_multipolygon.message",
43889           { multipolygon: utilDisplayLabel(
43890             currMultipolygon,
43891             context.graph(),
43892             true
43893             /* verbose */
43894           ) }
43895         );
43896       }
43897       function showReference(selection2) {
43898         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.old_multipolygon.reference"));
43899       }
43900     }
43901     let validation = function checkOutdatedTags(entity, graph) {
43902       let issues = oldMultipolygonIssues(entity, graph);
43903       if (!issues.length)
43904         issues = oldTagIssues(entity, graph);
43905       return issues;
43906     };
43907     validation.type = type2;
43908     return validation;
43909   }
43910
43911   // modules/validations/private_data.js
43912   function validationPrivateData() {
43913     var type2 = "private_data";
43914     var privateBuildingValues = {
43915       detached: true,
43916       farm: true,
43917       house: true,
43918       houseboat: true,
43919       residential: true,
43920       semidetached_house: true,
43921       static_caravan: true
43922     };
43923     var publicKeys = {
43924       amenity: true,
43925       craft: true,
43926       historic: true,
43927       leisure: true,
43928       office: true,
43929       shop: true,
43930       tourism: true
43931     };
43932     var personalTags = {
43933       "contact:email": true,
43934       "contact:fax": true,
43935       "contact:phone": true,
43936       email: true,
43937       fax: true,
43938       phone: true
43939     };
43940     var validation = function checkPrivateData(entity) {
43941       var tags = entity.tags;
43942       if (!tags.building || !privateBuildingValues[tags.building])
43943         return [];
43944       var keepTags = {};
43945       for (var k in tags) {
43946         if (publicKeys[k])
43947           return [];
43948         if (!personalTags[k]) {
43949           keepTags[k] = tags[k];
43950         }
43951       }
43952       var tagDiff = utilTagDiff(tags, keepTags);
43953       if (!tagDiff.length)
43954         return [];
43955       var fixID = tagDiff.length === 1 ? "remove_tag" : "remove_tags";
43956       return [new validationIssue({
43957         type: type2,
43958         severity: "warning",
43959         message: showMessage,
43960         reference: showReference,
43961         entityIds: [entity.id],
43962         dynamicFixes: function() {
43963           return [
43964             new validationIssueFix({
43965               icon: "iD-operation-delete",
43966               title: _t.append("issues.fix." + fixID + ".title"),
43967               onClick: function(context) {
43968                 context.perform(doUpgrade, _t("issues.fix.remove_tag.annotation"));
43969               }
43970             })
43971           ];
43972         }
43973       })];
43974       function doUpgrade(graph) {
43975         var currEntity = graph.hasEntity(entity.id);
43976         if (!currEntity)
43977           return graph;
43978         var newTags = Object.assign({}, currEntity.tags);
43979         tagDiff.forEach(function(diff) {
43980           if (diff.type === "-") {
43981             delete newTags[diff.key];
43982           } else if (diff.type === "+") {
43983             newTags[diff.key] = diff.newVal;
43984           }
43985         });
43986         return actionChangeTags(currEntity.id, newTags)(graph);
43987       }
43988       function showMessage(context) {
43989         var currEntity = context.hasEntity(this.entityIds[0]);
43990         if (!currEntity)
43991           return "";
43992         return _t.append(
43993           "issues.private_data.contact.message",
43994           { feature: utilDisplayLabel(currEntity, context.graph()) }
43995         );
43996       }
43997       function showReference(selection2) {
43998         var enter = selection2.selectAll(".issue-reference").data([0]).enter();
43999         enter.append("div").attr("class", "issue-reference").call(_t.append("issues.private_data.reference"));
44000         enter.append("strong").call(_t.append("issues.suggested"));
44001         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) {
44002           var klass = d.type === "+" ? "add" : "remove";
44003           return "tagDiff-cell tagDiff-cell-" + klass;
44004         }).html(function(d) {
44005           return d.display;
44006         });
44007       }
44008     };
44009     validation.type = type2;
44010     return validation;
44011   }
44012
44013   // modules/validations/suspicious_name.js
44014   function validationSuspiciousName() {
44015     const type2 = "suspicious_name";
44016     const keysToTestForGenericValues = [
44017       "aerialway",
44018       "aeroway",
44019       "amenity",
44020       "building",
44021       "craft",
44022       "highway",
44023       "leisure",
44024       "railway",
44025       "man_made",
44026       "office",
44027       "shop",
44028       "tourism",
44029       "waterway"
44030     ];
44031     let _waitingForNsi = false;
44032     function isGenericMatchInNsi(tags) {
44033       const nsi = services.nsi;
44034       if (nsi) {
44035         _waitingForNsi = nsi.status() === "loading";
44036         if (!_waitingForNsi) {
44037           return nsi.isGenericName(tags);
44038         }
44039       }
44040       return false;
44041     }
44042     function nameMatchesRawTag(lowercaseName, tags) {
44043       for (let i2 = 0; i2 < keysToTestForGenericValues.length; i2++) {
44044         let key = keysToTestForGenericValues[i2];
44045         let val = tags[key];
44046         if (val) {
44047           val = val.toLowerCase();
44048           if (key === lowercaseName || val === lowercaseName || key.replace(/\_/g, " ") === lowercaseName || val.replace(/\_/g, " ") === lowercaseName) {
44049             return true;
44050           }
44051         }
44052       }
44053       return false;
44054     }
44055     function isGenericName(name, tags) {
44056       name = name.toLowerCase();
44057       return nameMatchesRawTag(name, tags) || isGenericMatchInNsi(tags);
44058     }
44059     function makeGenericNameIssue(entityId, nameKey, genericName, langCode) {
44060       return new validationIssue({
44061         type: type2,
44062         subtype: "generic_name",
44063         severity: "warning",
44064         message: function(context) {
44065           let entity = context.hasEntity(this.entityIds[0]);
44066           if (!entity)
44067             return "";
44068           let preset = _mainPresetIndex.match(entity, context.graph());
44069           let langName = langCode && _mainLocalizer.languageName(langCode);
44070           return _t.append(
44071             "issues.generic_name.message" + (langName ? "_language" : ""),
44072             { feature: preset.name(), name: genericName, language: langName }
44073           );
44074         },
44075         reference: showReference,
44076         entityIds: [entityId],
44077         hash: `${nameKey}=${genericName}`,
44078         dynamicFixes: function() {
44079           return [
44080             new validationIssueFix({
44081               icon: "iD-operation-delete",
44082               title: _t.append("issues.fix.remove_the_name.title"),
44083               onClick: function(context) {
44084                 let entityId2 = this.issue.entityIds[0];
44085                 let entity = context.entity(entityId2);
44086                 let tags = Object.assign({}, entity.tags);
44087                 delete tags[nameKey];
44088                 context.perform(
44089                   actionChangeTags(entityId2, tags),
44090                   _t("issues.fix.remove_generic_name.annotation")
44091                 );
44092               }
44093             })
44094           ];
44095         }
44096       });
44097       function showReference(selection2) {
44098         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
44099       }
44100     }
44101     function makeIncorrectNameIssue(entityId, nameKey, incorrectName, langCode) {
44102       return new validationIssue({
44103         type: type2,
44104         subtype: "not_name",
44105         severity: "warning",
44106         message: function(context) {
44107           const entity = context.hasEntity(this.entityIds[0]);
44108           if (!entity)
44109             return "";
44110           const preset = _mainPresetIndex.match(entity, context.graph());
44111           const langName = langCode && _mainLocalizer.languageName(langCode);
44112           return _t.append(
44113             "issues.incorrect_name.message" + (langName ? "_language" : ""),
44114             { feature: preset.name(), name: incorrectName, language: langName }
44115           );
44116         },
44117         reference: showReference,
44118         entityIds: [entityId],
44119         hash: `${nameKey}=${incorrectName}`,
44120         dynamicFixes: function() {
44121           return [
44122             new validationIssueFix({
44123               icon: "iD-operation-delete",
44124               title: _t.append("issues.fix.remove_the_name.title"),
44125               onClick: function(context) {
44126                 const entityId2 = this.issue.entityIds[0];
44127                 const entity = context.entity(entityId2);
44128                 let tags = Object.assign({}, entity.tags);
44129                 delete tags[nameKey];
44130                 context.perform(
44131                   actionChangeTags(entityId2, tags),
44132                   _t("issues.fix.remove_mistaken_name.annotation")
44133                 );
44134               }
44135             })
44136           ];
44137         }
44138       });
44139       function showReference(selection2) {
44140         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
44141       }
44142     }
44143     let validation = function checkGenericName(entity) {
44144       const tags = entity.tags;
44145       const hasWikidata = !!tags.wikidata || !!tags["brand:wikidata"] || !!tags["operator:wikidata"];
44146       if (hasWikidata)
44147         return [];
44148       let issues = [];
44149       const notNames2 = (tags["not:name"] || "").split(";");
44150       for (let key in tags) {
44151         const m = key.match(/^name(?:(?::)([a-zA-Z_-]+))?$/);
44152         if (!m)
44153           continue;
44154         const langCode = m.length >= 2 ? m[1] : null;
44155         const value = tags[key];
44156         if (notNames2.length) {
44157           for (let i2 in notNames2) {
44158             const notName = notNames2[i2];
44159             if (notName && value === notName) {
44160               issues.push(makeIncorrectNameIssue(entity.id, key, value, langCode));
44161               continue;
44162             }
44163           }
44164         }
44165         if (isGenericName(value, tags)) {
44166           issues.provisional = _waitingForNsi;
44167           issues.push(makeGenericNameIssue(entity.id, key, value, langCode));
44168         }
44169       }
44170       return issues;
44171     };
44172     validation.type = type2;
44173     return validation;
44174   }
44175
44176   // modules/validations/unsquare_way.js
44177   function validationUnsquareWay(context) {
44178     var type2 = "unsquare_way";
44179     var DEFAULT_DEG_THRESHOLD = 5;
44180     var epsilon3 = 0.05;
44181     var nodeThreshold = 10;
44182     function isBuilding(entity, graph) {
44183       if (entity.type !== "way" || entity.geometry(graph) !== "area")
44184         return false;
44185       return entity.tags.building && entity.tags.building !== "no";
44186     }
44187     var validation = function checkUnsquareWay(entity, graph) {
44188       if (!isBuilding(entity, graph))
44189         return [];
44190       if (entity.tags.nonsquare === "yes")
44191         return [];
44192       var isClosed = entity.isClosed();
44193       if (!isClosed)
44194         return [];
44195       var nodes = graph.childNodes(entity).slice();
44196       if (nodes.length > nodeThreshold + 1)
44197         return [];
44198       var osm = services.osm;
44199       if (!osm || nodes.some(function(node) {
44200         return !osm.isDataLoaded(node.loc);
44201       }))
44202         return [];
44203       var hasConnectedSquarableWays = nodes.some(function(node) {
44204         return graph.parentWays(node).some(function(way) {
44205           if (way.id === entity.id)
44206             return false;
44207           if (isBuilding(way, graph))
44208             return true;
44209           return graph.parentRelations(way).some(function(parentRelation) {
44210             return parentRelation.isMultipolygon() && parentRelation.tags.building && parentRelation.tags.building !== "no";
44211           });
44212         });
44213       });
44214       if (hasConnectedSquarableWays)
44215         return [];
44216       var storedDegreeThreshold = corePreferences("validate-square-degrees");
44217       var degreeThreshold = isFinite(storedDegreeThreshold) ? Number(storedDegreeThreshold) : DEFAULT_DEG_THRESHOLD;
44218       var points = nodes.map(function(node) {
44219         return context.projection(node.loc);
44220       });
44221       if (!geoOrthoCanOrthogonalize(points, isClosed, epsilon3, degreeThreshold, true))
44222         return [];
44223       var autoArgs;
44224       if (!entity.tags.wikidata) {
44225         var autoAction = actionOrthogonalize(entity.id, context.projection, void 0, degreeThreshold);
44226         autoAction.transitionable = false;
44227         autoArgs = [autoAction, _t("operations.orthogonalize.annotation.feature", { n: 1 })];
44228       }
44229       return [new validationIssue({
44230         type: type2,
44231         subtype: "building",
44232         severity: "warning",
44233         message: function(context2) {
44234           var entity2 = context2.hasEntity(this.entityIds[0]);
44235           return entity2 ? _t.append("issues.unsquare_way.message", {
44236             feature: utilDisplayLabel(entity2, context2.graph())
44237           }) : "";
44238         },
44239         reference: showReference,
44240         entityIds: [entity.id],
44241         hash: degreeThreshold,
44242         dynamicFixes: function() {
44243           return [
44244             new validationIssueFix({
44245               icon: "iD-operation-orthogonalize",
44246               title: _t.append("issues.fix.square_feature.title"),
44247               autoArgs,
44248               onClick: function(context2, completionHandler) {
44249                 var entityId = this.issue.entityIds[0];
44250                 context2.perform(
44251                   actionOrthogonalize(entityId, context2.projection, void 0, degreeThreshold),
44252                   _t("operations.orthogonalize.annotation.feature", { n: 1 })
44253                 );
44254                 window.setTimeout(function() {
44255                   completionHandler();
44256                 }, 175);
44257               }
44258             })
44259             /*
44260             new validationIssueFix({
44261                 title: t.append('issues.fix.tag_as_unsquare.title'),
44262                 onClick: function(context) {
44263                     var entityId = this.issue.entityIds[0];
44264                     var entity = context.entity(entityId);
44265                     var tags = Object.assign({}, entity.tags);  // shallow copy
44266                     tags.nonsquare = 'yes';
44267                     context.perform(
44268                         actionChangeTags(entityId, tags),
44269                         t('issues.fix.tag_as_unsquare.annotation')
44270                     );
44271                 }
44272             })
44273             */
44274           ];
44275         }
44276       })];
44277       function showReference(selection2) {
44278         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unsquare_way.buildings.reference"));
44279       }
44280     };
44281     validation.type = type2;
44282     return validation;
44283   }
44284
44285   // modules/core/validator.js
44286   function coreValidator(context) {
44287     let dispatch10 = dispatch_default("validated", "focusedIssue");
44288     let validator = utilRebind({}, dispatch10, "on");
44289     let _rules = {};
44290     let _disabledRules = {};
44291     let _ignoredIssueIDs = /* @__PURE__ */ new Set();
44292     let _resolvedIssueIDs = /* @__PURE__ */ new Set();
44293     let _baseCache = validationCache("base");
44294     let _headCache = validationCache("head");
44295     let _completeDiff = {};
44296     let _headIsCurrent = false;
44297     let _deferredRIC = {};
44298     let _deferredST = /* @__PURE__ */ new Set();
44299     let _headPromise;
44300     const RETRY = 5e3;
44301     const _errorOverrides = parseHashParam(context.initialHashParams.validationError);
44302     const _warningOverrides = parseHashParam(context.initialHashParams.validationWarning);
44303     const _disableOverrides = parseHashParam(context.initialHashParams.validationDisable);
44304     function parseHashParam(param) {
44305       let result = [];
44306       let rules = (param || "").split(",");
44307       rules.forEach((rule) => {
44308         rule = rule.trim();
44309         const parts = rule.split("/", 2);
44310         const type2 = parts[0];
44311         const subtype = parts[1] || "*";
44312         if (!type2 || !subtype)
44313           return;
44314         result.push({ type: makeRegExp(type2), subtype: makeRegExp(subtype) });
44315       });
44316       return result;
44317       function makeRegExp(str2) {
44318         const escaped = str2.replace(/[-\/\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*");
44319         return new RegExp("^" + escaped + "$");
44320       }
44321     }
44322     validator.init = () => {
44323       Object.values(validations_exports).forEach((validation) => {
44324         if (typeof validation !== "function")
44325           return;
44326         const fn = validation(context);
44327         const key = fn.type;
44328         _rules[key] = fn;
44329       });
44330       let disabledRules = corePreferences("validate-disabledRules");
44331       if (disabledRules) {
44332         disabledRules.split(",").forEach((k) => _disabledRules[k] = true);
44333       }
44334     };
44335     function reset(resetIgnored) {
44336       _baseCache.queue = [];
44337       _headCache.queue = [];
44338       Object.keys(_deferredRIC).forEach((key) => {
44339         window.cancelIdleCallback(key);
44340         _deferredRIC[key]();
44341       });
44342       _deferredRIC = {};
44343       _deferredST.forEach(window.clearTimeout);
44344       _deferredST.clear();
44345       if (resetIgnored)
44346         _ignoredIssueIDs.clear();
44347       _resolvedIssueIDs.clear();
44348       _baseCache = validationCache("base");
44349       _headCache = validationCache("head");
44350       _completeDiff = {};
44351       _headIsCurrent = false;
44352     }
44353     validator.reset = () => {
44354       reset(true);
44355     };
44356     validator.resetIgnoredIssues = () => {
44357       _ignoredIssueIDs.clear();
44358       dispatch10.call("validated");
44359     };
44360     validator.revalidateUnsquare = () => {
44361       revalidateUnsquare(_headCache);
44362       revalidateUnsquare(_baseCache);
44363       dispatch10.call("validated");
44364     };
44365     function revalidateUnsquare(cache) {
44366       const checkUnsquareWay = _rules.unsquare_way;
44367       if (!cache.graph || typeof checkUnsquareWay !== "function")
44368         return;
44369       cache.uncacheIssuesOfType("unsquare_way");
44370       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");
44371       buildings.forEach((entity) => {
44372         const detected = checkUnsquareWay(entity, cache.graph);
44373         if (!detected.length)
44374           return;
44375         cache.cacheIssues(detected);
44376       });
44377     }
44378     validator.getIssues = (options2) => {
44379       const opts = Object.assign({ what: "all", where: "all", includeIgnored: false, includeDisabledRules: false }, options2);
44380       const view = context.map().extent();
44381       let seen = /* @__PURE__ */ new Set();
44382       let results = [];
44383       if (_headCache.graph && _headCache.graph !== _baseCache.graph) {
44384         Object.values(_headCache.issuesByIssueID).forEach((issue) => {
44385           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
44386           if (opts.what === "edited" && !userModified)
44387             return;
44388           if (!filter2(issue))
44389             return;
44390           seen.add(issue.id);
44391           results.push(issue);
44392         });
44393       }
44394       if (opts.what === "all") {
44395         Object.values(_baseCache.issuesByIssueID).forEach((issue) => {
44396           if (!filter2(issue))
44397             return;
44398           seen.add(issue.id);
44399           results.push(issue);
44400         });
44401       }
44402       return results;
44403       function filter2(issue) {
44404         if (!issue)
44405           return false;
44406         if (seen.has(issue.id))
44407           return false;
44408         if (_resolvedIssueIDs.has(issue.id))
44409           return false;
44410         if (opts.includeDisabledRules === "only" && !_disabledRules[issue.type])
44411           return false;
44412         if (!opts.includeDisabledRules && _disabledRules[issue.type])
44413           return false;
44414         if (opts.includeIgnored === "only" && !_ignoredIssueIDs.has(issue.id))
44415           return false;
44416         if (!opts.includeIgnored && _ignoredIssueIDs.has(issue.id))
44417           return false;
44418         if ((issue.entityIds || []).some((id2) => !context.hasEntity(id2)))
44419           return false;
44420         if (opts.where === "visible") {
44421           const extent = issue.extent(context.graph());
44422           if (!view.intersects(extent))
44423             return false;
44424         }
44425         return true;
44426       }
44427     };
44428     validator.getResolvedIssues = () => {
44429       return Array.from(_resolvedIssueIDs).map((issueID) => _baseCache.issuesByIssueID[issueID]).filter(Boolean);
44430     };
44431     validator.focusIssue = (issue) => {
44432       const graph = context.graph();
44433       let selectID;
44434       let focusCenter;
44435       const issueExtent = issue.extent(graph);
44436       if (issueExtent) {
44437         focusCenter = issueExtent.center();
44438       }
44439       if (issue.entityIds && issue.entityIds.length) {
44440         selectID = issue.entityIds[0];
44441         if (selectID && selectID.charAt(0) === "r") {
44442           const ids = utilEntityAndDeepMemberIDs([selectID], graph);
44443           let nodeID = ids.find((id2) => id2.charAt(0) === "n" && graph.hasEntity(id2));
44444           if (!nodeID) {
44445             const wayID = ids.find((id2) => id2.charAt(0) === "w" && graph.hasEntity(id2));
44446             if (wayID) {
44447               nodeID = graph.entity(wayID).first();
44448             }
44449           }
44450           if (nodeID) {
44451             focusCenter = graph.entity(nodeID).loc;
44452           }
44453         }
44454       }
44455       if (focusCenter) {
44456         const setZoom = Math.max(context.map().zoom(), 19);
44457         context.map().unobscuredCenterZoomEase(focusCenter, setZoom);
44458       }
44459       if (selectID) {
44460         window.setTimeout(() => {
44461           context.enter(modeSelect(context, [selectID]));
44462           dispatch10.call("focusedIssue", this, issue);
44463         }, 250);
44464       }
44465     };
44466     validator.getIssuesBySeverity = (options2) => {
44467       let groups = utilArrayGroupBy(validator.getIssues(options2), "severity");
44468       groups.error = groups.error || [];
44469       groups.warning = groups.warning || [];
44470       return groups;
44471     };
44472     validator.getSharedEntityIssues = (entityIDs, options2) => {
44473       const orderedIssueTypes = [
44474         // Show some issue types in a particular order:
44475         "missing_tag",
44476         "missing_role",
44477         // - missing data first
44478         "outdated_tags",
44479         "mismatched_geometry",
44480         // - identity issues
44481         "crossing_ways",
44482         "almost_junction",
44483         // - geometry issues where fixing them might solve connectivity issues
44484         "disconnected_way",
44485         "impossible_oneway"
44486         // - finally connectivity issues
44487       ];
44488       const allIssues = validator.getIssues(options2);
44489       const forEntityIDs = new Set(entityIDs);
44490       return allIssues.filter((issue) => (issue.entityIds || []).some((entityID) => forEntityIDs.has(entityID))).sort((issue1, issue2) => {
44491         if (issue1.type === issue2.type) {
44492           return issue1.id < issue2.id ? -1 : 1;
44493         }
44494         const index1 = orderedIssueTypes.indexOf(issue1.type);
44495         const index2 = orderedIssueTypes.indexOf(issue2.type);
44496         if (index1 !== -1 && index2 !== -1) {
44497           return index1 - index2;
44498         } else if (index1 === -1 && index2 === -1) {
44499           return issue1.type < issue2.type ? -1 : 1;
44500         } else {
44501           return index1 !== -1 ? -1 : 1;
44502         }
44503       });
44504     };
44505     validator.getEntityIssues = (entityID, options2) => {
44506       return validator.getSharedEntityIssues([entityID], options2);
44507     };
44508     validator.getRuleKeys = () => {
44509       return Object.keys(_rules);
44510     };
44511     validator.isRuleEnabled = (key) => {
44512       return !_disabledRules[key];
44513     };
44514     validator.toggleRule = (key) => {
44515       if (_disabledRules[key]) {
44516         delete _disabledRules[key];
44517       } else {
44518         _disabledRules[key] = true;
44519       }
44520       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
44521       validator.validate();
44522     };
44523     validator.disableRules = (keys2) => {
44524       _disabledRules = {};
44525       keys2.forEach((k) => _disabledRules[k] = true);
44526       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
44527       validator.validate();
44528     };
44529     validator.ignoreIssue = (issueID) => {
44530       _ignoredIssueIDs.add(issueID);
44531     };
44532     validator.validate = () => {
44533       const baseGraph = context.history().base();
44534       if (!_headCache.graph)
44535         _headCache.graph = baseGraph;
44536       if (!_baseCache.graph)
44537         _baseCache.graph = baseGraph;
44538       const prevGraph = _headCache.graph;
44539       const currGraph = context.graph();
44540       if (currGraph === prevGraph) {
44541         _headIsCurrent = true;
44542         dispatch10.call("validated");
44543         return Promise.resolve();
44544       }
44545       if (_headPromise) {
44546         _headIsCurrent = false;
44547         return _headPromise;
44548       }
44549       _headCache.graph = currGraph;
44550       _completeDiff = context.history().difference().complete();
44551       const incrementalDiff = coreDifference(prevGraph, currGraph);
44552       let entityIDs = Object.keys(incrementalDiff.complete());
44553       entityIDs = _headCache.withAllRelatedEntities(entityIDs);
44554       if (!entityIDs.size) {
44555         dispatch10.call("validated");
44556         return Promise.resolve();
44557       }
44558       _headPromise = validateEntitiesAsync(entityIDs, _headCache).then(() => updateResolvedIssues(entityIDs)).then(() => dispatch10.call("validated")).catch(() => {
44559       }).then(() => {
44560         _headPromise = null;
44561         if (!_headIsCurrent) {
44562           validator.validate();
44563         }
44564       });
44565       return _headPromise;
44566     };
44567     context.history().on("restore.validator", validator.validate).on("undone.validator", validator.validate).on("redone.validator", validator.validate).on("reset.validator", () => {
44568       reset(false);
44569       validator.validate();
44570     });
44571     context.on("exit.validator", validator.validate);
44572     context.history().on("merge.validator", (entities) => {
44573       if (!entities)
44574         return;
44575       const baseGraph = context.history().base();
44576       if (!_headCache.graph)
44577         _headCache.graph = baseGraph;
44578       if (!_baseCache.graph)
44579         _baseCache.graph = baseGraph;
44580       let entityIDs = entities.map((entity) => entity.id);
44581       entityIDs = _baseCache.withAllRelatedEntities(entityIDs);
44582       validateEntitiesAsync(entityIDs, _baseCache);
44583     });
44584     function validateEntity(entity, graph) {
44585       let result = { issues: [], provisional: false };
44586       Object.keys(_rules).forEach(runValidation);
44587       return result;
44588       function runValidation(key) {
44589         const fn = _rules[key];
44590         if (typeof fn !== "function") {
44591           console.error("no such validation rule = " + key);
44592           return;
44593         }
44594         let detected = fn(entity, graph);
44595         if (detected.provisional) {
44596           result.provisional = true;
44597         }
44598         detected = detected.filter(applySeverityOverrides);
44599         result.issues = result.issues.concat(detected);
44600         function applySeverityOverrides(issue) {
44601           const type2 = issue.type;
44602           const subtype = issue.subtype || "";
44603           let i2;
44604           for (i2 = 0; i2 < _errorOverrides.length; i2++) {
44605             if (_errorOverrides[i2].type.test(type2) && _errorOverrides[i2].subtype.test(subtype)) {
44606               issue.severity = "error";
44607               return true;
44608             }
44609           }
44610           for (i2 = 0; i2 < _warningOverrides.length; i2++) {
44611             if (_warningOverrides[i2].type.test(type2) && _warningOverrides[i2].subtype.test(subtype)) {
44612               issue.severity = "warning";
44613               return true;
44614             }
44615           }
44616           for (i2 = 0; i2 < _disableOverrides.length; i2++) {
44617             if (_disableOverrides[i2].type.test(type2) && _disableOverrides[i2].subtype.test(subtype)) {
44618               return false;
44619             }
44620           }
44621           return true;
44622         }
44623       }
44624     }
44625     function updateResolvedIssues(entityIDs) {
44626       entityIDs.forEach((entityID) => {
44627         const baseIssues = _baseCache.issuesByEntityID[entityID];
44628         if (!baseIssues)
44629           return;
44630         baseIssues.forEach((issueID) => {
44631           const issue = _baseCache.issuesByIssueID[issueID];
44632           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
44633           if (userModified && !_headCache.issuesByIssueID[issueID]) {
44634             _resolvedIssueIDs.add(issueID);
44635           } else {
44636             _resolvedIssueIDs.delete(issueID);
44637           }
44638         });
44639       });
44640     }
44641     function validateEntitiesAsync(entityIDs, cache) {
44642       const jobs = Array.from(entityIDs).map((entityID) => {
44643         if (cache.queuedEntityIDs.has(entityID))
44644           return null;
44645         cache.queuedEntityIDs.add(entityID);
44646         cache.uncacheEntityID(entityID);
44647         return () => {
44648           cache.queuedEntityIDs.delete(entityID);
44649           const graph = cache.graph;
44650           if (!graph)
44651             return;
44652           const entity = graph.hasEntity(entityID);
44653           if (!entity)
44654             return;
44655           const result = validateEntity(entity, graph);
44656           if (result.provisional) {
44657             cache.provisionalEntityIDs.add(entityID);
44658           }
44659           cache.cacheIssues(result.issues);
44660         };
44661       }).filter(Boolean);
44662       cache.queue = cache.queue.concat(utilArrayChunk(jobs, 100));
44663       if (cache.queuePromise)
44664         return cache.queuePromise;
44665       cache.queuePromise = processQueue(cache).then(() => revalidateProvisionalEntities(cache)).catch(() => {
44666       }).finally(() => cache.queuePromise = null);
44667       return cache.queuePromise;
44668     }
44669     function revalidateProvisionalEntities(cache) {
44670       if (!cache.provisionalEntityIDs.size)
44671         return;
44672       const handle = window.setTimeout(() => {
44673         _deferredST.delete(handle);
44674         if (!cache.provisionalEntityIDs.size)
44675           return;
44676         validateEntitiesAsync(Array.from(cache.provisionalEntityIDs), cache);
44677       }, RETRY);
44678       _deferredST.add(handle);
44679     }
44680     function processQueue(cache) {
44681       if (!cache.queue.length)
44682         return Promise.resolve();
44683       const chunk = cache.queue.pop();
44684       return new Promise((resolvePromise, rejectPromise) => {
44685         const handle = window.requestIdleCallback(() => {
44686           delete _deferredRIC[handle];
44687           chunk.forEach((job) => job());
44688           resolvePromise();
44689         });
44690         _deferredRIC[handle] = rejectPromise;
44691       }).then(() => {
44692         if (cache.queue.length % 25 === 0)
44693           dispatch10.call("validated");
44694       }).then(() => processQueue(cache));
44695     }
44696     return validator;
44697   }
44698   function validationCache(which) {
44699     let cache = {
44700       which,
44701       graph: null,
44702       queue: [],
44703       queuePromise: null,
44704       queuedEntityIDs: /* @__PURE__ */ new Set(),
44705       provisionalEntityIDs: /* @__PURE__ */ new Set(),
44706       issuesByIssueID: {},
44707       // issue.id -> issue
44708       issuesByEntityID: {}
44709       // entity.id -> Set(issue.id)
44710     };
44711     cache.cacheIssue = (issue) => {
44712       (issue.entityIds || []).forEach((entityID) => {
44713         if (!cache.issuesByEntityID[entityID]) {
44714           cache.issuesByEntityID[entityID] = /* @__PURE__ */ new Set();
44715         }
44716         cache.issuesByEntityID[entityID].add(issue.id);
44717       });
44718       cache.issuesByIssueID[issue.id] = issue;
44719     };
44720     cache.uncacheIssue = (issue) => {
44721       (issue.entityIds || []).forEach((entityID) => {
44722         if (cache.issuesByEntityID[entityID]) {
44723           cache.issuesByEntityID[entityID].delete(issue.id);
44724         }
44725       });
44726       delete cache.issuesByIssueID[issue.id];
44727     };
44728     cache.cacheIssues = (issues) => {
44729       issues.forEach(cache.cacheIssue);
44730     };
44731     cache.uncacheIssues = (issues) => {
44732       issues.forEach(cache.uncacheIssue);
44733     };
44734     cache.uncacheIssuesOfType = (type2) => {
44735       const issuesOfType = Object.values(cache.issuesByIssueID).filter((issue) => issue.type === type2);
44736       cache.uncacheIssues(issuesOfType);
44737     };
44738     cache.uncacheEntityID = (entityID) => {
44739       const entityIssueIDs = cache.issuesByEntityID[entityID];
44740       if (entityIssueIDs) {
44741         entityIssueIDs.forEach((issueID) => {
44742           const issue = cache.issuesByIssueID[issueID];
44743           if (issue) {
44744             cache.uncacheIssue(issue);
44745           } else {
44746             delete cache.issuesByIssueID[issueID];
44747           }
44748         });
44749       }
44750       delete cache.issuesByEntityID[entityID];
44751       cache.provisionalEntityIDs.delete(entityID);
44752     };
44753     cache.withAllRelatedEntities = (entityIDs) => {
44754       let result = /* @__PURE__ */ new Set();
44755       (entityIDs || []).forEach((entityID) => {
44756         result.add(entityID);
44757         const entityIssueIDs = cache.issuesByEntityID[entityID];
44758         if (entityIssueIDs) {
44759           entityIssueIDs.forEach((issueID) => {
44760             const issue = cache.issuesByIssueID[issueID];
44761             if (issue) {
44762               (issue.entityIds || []).forEach((relatedID) => result.add(relatedID));
44763             } else {
44764               delete cache.issuesByIssueID[issueID];
44765             }
44766           });
44767         }
44768       });
44769       return result;
44770     };
44771     return cache;
44772   }
44773
44774   // modules/core/uploader.js
44775   function coreUploader(context) {
44776     var dispatch10 = dispatch_default(
44777       // Start and end events are dispatched exactly once each per legitimate outside call to `save`
44778       "saveStarted",
44779       // dispatched as soon as a call to `save` has been deemed legitimate
44780       "saveEnded",
44781       // dispatched after the result event has been dispatched
44782       "willAttemptUpload",
44783       // dispatched before the actual upload call occurs, if it will
44784       "progressChanged",
44785       // Each save results in one of these outcomes:
44786       "resultNoChanges",
44787       // upload wasn't attempted since there were no edits
44788       "resultErrors",
44789       // upload failed due to errors
44790       "resultConflicts",
44791       // upload failed due to data conflicts
44792       "resultSuccess"
44793       // upload completed without errors
44794     );
44795     var _isSaving = false;
44796     var _conflicts = [];
44797     var _errors = [];
44798     var _origChanges;
44799     var _discardTags = {};
44800     _mainFileFetcher.get("discarded").then(function(d) {
44801       _discardTags = d;
44802     }).catch(function() {
44803     });
44804     var uploader = utilRebind({}, dispatch10, "on");
44805     uploader.isSaving = function() {
44806       return _isSaving;
44807     };
44808     uploader.save = function(changeset, tryAgain, checkConflicts) {
44809       if (_isSaving && !tryAgain) {
44810         return;
44811       }
44812       var osm = context.connection();
44813       if (!osm)
44814         return;
44815       if (!osm.authenticated()) {
44816         osm.authenticate(function(err) {
44817           if (!err) {
44818             uploader.save(changeset, tryAgain, checkConflicts);
44819           }
44820         });
44821         return;
44822       }
44823       if (!_isSaving) {
44824         _isSaving = true;
44825         dispatch10.call("saveStarted", this);
44826       }
44827       var history = context.history();
44828       _conflicts = [];
44829       _errors = [];
44830       _origChanges = history.changes(actionDiscardTags(history.difference(), _discardTags));
44831       if (!tryAgain) {
44832         history.perform(actionNoop());
44833       }
44834       if (!checkConflicts) {
44835         upload(changeset);
44836       } else {
44837         performFullConflictCheck(changeset);
44838       }
44839     };
44840     function performFullConflictCheck(changeset) {
44841       var osm = context.connection();
44842       if (!osm)
44843         return;
44844       var history = context.history();
44845       var localGraph = context.graph();
44846       var remoteGraph = coreGraph(history.base(), true);
44847       var summary = history.difference().summary();
44848       var _toCheck = [];
44849       for (var i2 = 0; i2 < summary.length; i2++) {
44850         var item = summary[i2];
44851         if (item.changeType === "modified") {
44852           _toCheck.push(item.entity.id);
44853         }
44854       }
44855       var _toLoad = withChildNodes(_toCheck, localGraph);
44856       var _loaded = {};
44857       var _toLoadCount = 0;
44858       var _toLoadTotal = _toLoad.length;
44859       if (_toCheck.length) {
44860         dispatch10.call("progressChanged", this, _toLoadCount, _toLoadTotal);
44861         _toLoad.forEach(function(id2) {
44862           _loaded[id2] = false;
44863         });
44864         osm.loadMultiple(_toLoad, loaded);
44865       } else {
44866         upload(changeset);
44867       }
44868       return;
44869       function withChildNodes(ids, graph) {
44870         var s = new Set(ids);
44871         ids.forEach(function(id2) {
44872           var entity = graph.entity(id2);
44873           if (entity.type !== "way")
44874             return;
44875           graph.childNodes(entity).forEach(function(child) {
44876             if (child.version !== void 0) {
44877               s.add(child.id);
44878             }
44879           });
44880         });
44881         return Array.from(s);
44882       }
44883       function loaded(err, result) {
44884         if (_errors.length)
44885           return;
44886         if (err) {
44887           _errors.push({
44888             msg: err.message || err.responseText,
44889             details: [_t("save.status_code", { code: err.status })]
44890           });
44891           didResultInErrors();
44892         } else {
44893           var loadMore = [];
44894           result.data.forEach(function(entity) {
44895             remoteGraph.replace(entity);
44896             _loaded[entity.id] = true;
44897             _toLoad = _toLoad.filter(function(val) {
44898               return val !== entity.id;
44899             });
44900             if (!entity.visible)
44901               return;
44902             var i3, id2;
44903             if (entity.type === "way") {
44904               for (i3 = 0; i3 < entity.nodes.length; i3++) {
44905                 id2 = entity.nodes[i3];
44906                 if (_loaded[id2] === void 0) {
44907                   _loaded[id2] = false;
44908                   loadMore.push(id2);
44909                 }
44910               }
44911             } else if (entity.type === "relation" && entity.isMultipolygon()) {
44912               for (i3 = 0; i3 < entity.members.length; i3++) {
44913                 id2 = entity.members[i3].id;
44914                 if (_loaded[id2] === void 0) {
44915                   _loaded[id2] = false;
44916                   loadMore.push(id2);
44917                 }
44918               }
44919             }
44920           });
44921           _toLoadCount += result.data.length;
44922           _toLoadTotal += loadMore.length;
44923           dispatch10.call("progressChanged", this, _toLoadCount, _toLoadTotal);
44924           if (loadMore.length) {
44925             _toLoad.push.apply(_toLoad, loadMore);
44926             osm.loadMultiple(loadMore, loaded);
44927           }
44928           if (!_toLoad.length) {
44929             detectConflicts();
44930             upload(changeset);
44931           }
44932         }
44933       }
44934       function detectConflicts() {
44935         function choice(id2, text2, action) {
44936           return {
44937             id: id2,
44938             text: text2,
44939             action: function() {
44940               history.replace(action);
44941             }
44942           };
44943         }
44944         function formatUser(d) {
44945           return '<a href="' + osm.userURL(d) + '" target="_blank">' + escape_default(d) + "</a>";
44946         }
44947         function entityName(entity) {
44948           return utilDisplayName(entity) || utilDisplayType(entity.id) + " " + entity.id;
44949         }
44950         function sameVersions(local, remote) {
44951           if (local.version !== remote.version)
44952             return false;
44953           if (local.type === "way") {
44954             var children2 = utilArrayUnion(local.nodes, remote.nodes);
44955             for (var i3 = 0; i3 < children2.length; i3++) {
44956               var a = localGraph.hasEntity(children2[i3]);
44957               var b = remoteGraph.hasEntity(children2[i3]);
44958               if (a && b && a.version !== b.version)
44959                 return false;
44960             }
44961           }
44962           return true;
44963         }
44964         _toCheck.forEach(function(id2) {
44965           var local = localGraph.entity(id2);
44966           var remote = remoteGraph.entity(id2);
44967           if (sameVersions(local, remote))
44968             return;
44969           var merge2 = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags, formatUser);
44970           history.replace(merge2);
44971           var mergeConflicts = merge2.conflicts();
44972           if (!mergeConflicts.length)
44973             return;
44974           var forceLocal = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_local");
44975           var forceRemote = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_remote");
44976           var keepMine = _t("save.conflict." + (remote.visible ? "keep_local" : "restore"));
44977           var keepTheirs = _t("save.conflict." + (remote.visible ? "keep_remote" : "delete"));
44978           _conflicts.push({
44979             id: id2,
44980             name: entityName(local),
44981             details: mergeConflicts,
44982             chosen: 1,
44983             choices: [
44984               choice(id2, keepMine, forceLocal),
44985               choice(id2, keepTheirs, forceRemote)
44986             ]
44987           });
44988         });
44989       }
44990     }
44991     function upload(changeset) {
44992       var osm = context.connection();
44993       if (!osm) {
44994         _errors.push({ msg: "No OSM Service" });
44995       }
44996       if (_conflicts.length) {
44997         didResultInConflicts(changeset);
44998       } else if (_errors.length) {
44999         didResultInErrors();
45000       } else {
45001         var history = context.history();
45002         var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
45003         if (changes.modified.length || changes.created.length || changes.deleted.length) {
45004           dispatch10.call("willAttemptUpload", this);
45005           osm.putChangeset(changeset, changes, uploadCallback);
45006         } else {
45007           didResultInNoChanges();
45008         }
45009       }
45010     }
45011     function uploadCallback(err, changeset) {
45012       if (err) {
45013         if (err.status === 409) {
45014           uploader.save(changeset, true, true);
45015         } else {
45016           _errors.push({
45017             msg: err.message || err.responseText,
45018             details: [_t("save.status_code", { code: err.status })]
45019           });
45020           didResultInErrors();
45021         }
45022       } else {
45023         didResultInSuccess(changeset);
45024       }
45025     }
45026     function didResultInNoChanges() {
45027       dispatch10.call("resultNoChanges", this);
45028       endSave();
45029       context.flush();
45030     }
45031     function didResultInErrors() {
45032       context.history().pop();
45033       dispatch10.call("resultErrors", this, _errors);
45034       endSave();
45035     }
45036     function didResultInConflicts(changeset) {
45037       _conflicts.sort(function(a, b) {
45038         return b.id.localeCompare(a.id);
45039       });
45040       dispatch10.call("resultConflicts", this, changeset, _conflicts, _origChanges);
45041       endSave();
45042     }
45043     function didResultInSuccess(changeset) {
45044       context.history().clearSaved();
45045       dispatch10.call("resultSuccess", this, changeset);
45046       window.setTimeout(function() {
45047         endSave();
45048         context.flush();
45049       }, 2500);
45050     }
45051     function endSave() {
45052       _isSaving = false;
45053       dispatch10.call("saveEnded", this);
45054     }
45055     uploader.cancelConflictResolution = function() {
45056       context.history().pop();
45057     };
45058     uploader.processResolvedConflicts = function(changeset) {
45059       var history = context.history();
45060       for (var i2 = 0; i2 < _conflicts.length; i2++) {
45061         if (_conflicts[i2].chosen === 1) {
45062           var entity = context.hasEntity(_conflicts[i2].id);
45063           if (entity && entity.type === "way") {
45064             var children2 = utilArrayUniq(entity.nodes);
45065             for (var j2 = 0; j2 < children2.length; j2++) {
45066               history.replace(actionRevert(children2[j2]));
45067             }
45068           }
45069           history.replace(actionRevert(_conflicts[i2].id));
45070         }
45071       }
45072       uploader.save(changeset, true, false);
45073     };
45074     uploader.reset = function() {
45075     };
45076     return uploader;
45077   }
45078
45079   // modules/renderer/background_source.js
45080   var import_lodash4 = __toESM(require_lodash());
45081
45082   // modules/util/IntervalTasksQueue.js
45083   var IntervalTasksQueue = class {
45084     /**
45085      * Interval in milliseconds inside which only 1 task can execute.
45086      * e.g. if interval is 200ms, and 5 async tasks are unqueued,
45087      * they will complete in ~1s if not cleared
45088      * @param {number} intervalInMs
45089      */
45090     constructor(intervalInMs) {
45091       this.intervalInMs = intervalInMs;
45092       this.pendingHandles = [];
45093       this.time = 0;
45094     }
45095     enqueue(task) {
45096       let taskTimeout = this.time;
45097       this.time += this.intervalInMs;
45098       this.pendingHandles.push(setTimeout(() => {
45099         this.time -= this.intervalInMs;
45100         task();
45101       }, taskTimeout));
45102     }
45103     clear() {
45104       this.pendingHandles.forEach((timeoutHandle) => {
45105         clearTimeout(timeoutHandle);
45106       });
45107       this.pendingHandles = [];
45108       this.time = 0;
45109     }
45110   };
45111
45112   // modules/renderer/background_source.js
45113   var isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
45114   window.matchMedia(`
45115         (-webkit-min-device-pixel-ratio: 2), /* Safari */
45116         (min-resolution: 2dppx),             /* standard */
45117         (min-resolution: 192dpi)             /* fallback */
45118     `).addListener(function() {
45119     isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
45120   });
45121   function localeDateString(s) {
45122     if (!s)
45123       return null;
45124     var options2 = { day: "numeric", month: "short", year: "numeric" };
45125     var d = new Date(s);
45126     if (isNaN(d.getTime()))
45127       return null;
45128     return d.toLocaleDateString(_mainLocalizer.localeCode(), options2);
45129   }
45130   function vintageRange(vintage) {
45131     var s;
45132     if (vintage.start || vintage.end) {
45133       s = vintage.start || "?";
45134       if (vintage.start !== vintage.end) {
45135         s += " - " + (vintage.end || "?");
45136       }
45137     }
45138     return s;
45139   }
45140   function rendererBackgroundSource(data) {
45141     var source = Object.assign({}, data);
45142     var _offset = [0, 0];
45143     var _name = source.name;
45144     var _description = source.description;
45145     var _best = !!source.best;
45146     var _template = source.encrypted ? utilAesDecrypt(source.template) : source.template;
45147     source.tileSize = data.tileSize || 256;
45148     source.zoomExtent = data.zoomExtent || [0, 22];
45149     source.overzoom = data.overzoom !== false;
45150     source.offset = function(val) {
45151       if (!arguments.length)
45152         return _offset;
45153       _offset = val;
45154       return source;
45155     };
45156     source.nudge = function(val, zoomlevel) {
45157       _offset[0] += val[0] / Math.pow(2, zoomlevel);
45158       _offset[1] += val[1] / Math.pow(2, zoomlevel);
45159       return source;
45160     };
45161     source.name = function() {
45162       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
45163       return _t("imagery." + id_safe + ".name", { default: (0, import_lodash4.escape)(_name) });
45164     };
45165     source.label = function() {
45166       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
45167       return _t.append("imagery." + id_safe + ".name", { default: (0, import_lodash4.escape)(_name) });
45168     };
45169     source.hasDescription = function() {
45170       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
45171       var descriptionText = _mainLocalizer.tInfo("imagery." + id_safe + ".description", { default: (0, import_lodash4.escape)(_description) }).text;
45172       return descriptionText !== "";
45173     };
45174     source.description = function() {
45175       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
45176       return _t.append("imagery." + id_safe + ".description", { default: (0, import_lodash4.escape)(_description) });
45177     };
45178     source.best = function() {
45179       return _best;
45180     };
45181     source.area = function() {
45182       if (!data.polygon)
45183         return Number.MAX_VALUE;
45184       var area = area_default({ type: "MultiPolygon", coordinates: [data.polygon] });
45185       return isNaN(area) ? 0 : area;
45186     };
45187     source.imageryUsed = function() {
45188       return _name || source.id;
45189     };
45190     source.template = function(val) {
45191       if (!arguments.length)
45192         return _template;
45193       if (source.id === "custom" || source.id === "Bing") {
45194         _template = val;
45195       }
45196       return source;
45197     };
45198     source.url = function(coord2) {
45199       var result = _template.replace(/#[\s\S]*/u, "");
45200       if (result === "")
45201         return result;
45202       if (!source.type || source.id === "custom") {
45203         if (/SERVICE=WMS|\{(proj|wkid|bbox)\}/.test(result)) {
45204           source.type = "wms";
45205           source.projection = "EPSG:3857";
45206         } else if (/\{(x|y)\}/.test(result)) {
45207           source.type = "tms";
45208         } else if (/\{u\}/.test(result)) {
45209           source.type = "bing";
45210         }
45211       }
45212       if (source.type === "wms") {
45213         var tileToProjectedCoords = function(x, y, z) {
45214           var zoomSize = Math.pow(2, z);
45215           var lon = x / zoomSize * Math.PI * 2 - Math.PI;
45216           var lat = Math.atan(Math.sinh(Math.PI * (1 - 2 * y / zoomSize)));
45217           switch (source.projection) {
45218             case "EPSG:4326":
45219               return {
45220                 x: lon * 180 / Math.PI,
45221                 y: lat * 180 / Math.PI
45222               };
45223             default:
45224               var mercCoords = mercatorRaw(lon, lat);
45225               return {
45226                 x: 2003750834e-2 / Math.PI * mercCoords[0],
45227                 y: 2003750834e-2 / Math.PI * mercCoords[1]
45228               };
45229           }
45230         };
45231         var tileSize = source.tileSize;
45232         var projection2 = source.projection;
45233         var minXmaxY = tileToProjectedCoords(coord2[0], coord2[1], coord2[2]);
45234         var maxXminY = tileToProjectedCoords(coord2[0] + 1, coord2[1] + 1, coord2[2]);
45235         result = result.replace(/\{(\w+)\}/g, function(token, key) {
45236           switch (key) {
45237             case "width":
45238             case "height":
45239               return tileSize;
45240             case "proj":
45241               return projection2;
45242             case "wkid":
45243               return projection2.replace(/^EPSG:/, "");
45244             case "bbox":
45245               if (projection2 === "EPSG:4326" && // The CRS parameter implies version 1.3 (prior versions use SRS)
45246               /VERSION=1.3|CRS={proj}/.test(source.template().toUpperCase())) {
45247                 return maxXminY.y + "," + minXmaxY.x + "," + minXmaxY.y + "," + maxXminY.x;
45248               } else {
45249                 return minXmaxY.x + "," + maxXminY.y + "," + maxXminY.x + "," + minXmaxY.y;
45250               }
45251             case "w":
45252               return minXmaxY.x;
45253             case "s":
45254               return maxXminY.y;
45255             case "n":
45256               return maxXminY.x;
45257             case "e":
45258               return minXmaxY.y;
45259             default:
45260               return token;
45261           }
45262         });
45263       } else if (source.type === "tms") {
45264         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" : "");
45265       } else if (source.type === "bing") {
45266         result = result.replace("{u}", function() {
45267           var u = "";
45268           for (var zoom = coord2[2]; zoom > 0; zoom--) {
45269             var b = 0;
45270             var mask = 1 << zoom - 1;
45271             if ((coord2[0] & mask) !== 0)
45272               b++;
45273             if ((coord2[1] & mask) !== 0)
45274               b += 2;
45275             u += b.toString();
45276           }
45277           return u;
45278         });
45279       }
45280       result = result.replace(/\{switch:([^}]+)\}/, function(s, r) {
45281         var subdomains = r.split(",");
45282         return subdomains[(coord2[0] + coord2[1]) % subdomains.length];
45283       });
45284       return result;
45285     };
45286     source.validZoom = function(z) {
45287       return source.zoomExtent[0] <= z && (source.overzoom || source.zoomExtent[1] > z);
45288     };
45289     source.isLocatorOverlay = function() {
45290       return source.id === "mapbox_locator_overlay";
45291     };
45292     source.isHidden = function() {
45293       return source.id === "DigitalGlobe-Premium-vintage" || source.id === "DigitalGlobe-Standard-vintage";
45294     };
45295     source.copyrightNotices = function() {
45296     };
45297     source.getMetadata = function(center, tileCoord, callback) {
45298       var vintage = {
45299         start: localeDateString(source.startDate),
45300         end: localeDateString(source.endDate)
45301       };
45302       vintage.range = vintageRange(vintage);
45303       var metadata = { vintage };
45304       callback(null, metadata);
45305     };
45306     return source;
45307   }
45308   rendererBackgroundSource.Bing = function(data, dispatch10) {
45309     data.template = "https://ecn.t{switch:0,1,2,3}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=1&pr=odbl&n=z";
45310     var bing = rendererBackgroundSource(data);
45311     var key = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
45312     const strictParam = "n";
45313     var url = "https://dev.virtualearth.net/REST/v1/Imagery/Metadata/AerialOSM?include=ImageryProviders&uriScheme=https&key=" + key;
45314     var cache = {};
45315     var inflight = {};
45316     var providers = [];
45317     var taskQueue = new IntervalTasksQueue(250);
45318     var metadataLastZoom = -1;
45319     json_default(url).then(function(json) {
45320       let imageryResource = json.resourceSets[0].resources[0];
45321       let template = imageryResource.imageUrl;
45322       let subDomains = imageryResource.imageUrlSubdomains;
45323       let subDomainNumbers = subDomains.map((subDomain) => {
45324         return subDomain.substring(1);
45325       }).join(",");
45326       template = template.replace("{subdomain}", `t{switch:${subDomainNumbers}}`).replace("{quadkey}", "{u}");
45327       if (!new URLSearchParams(template).has(strictParam)) {
45328         template += `&${strictParam}=z`;
45329       }
45330       bing.template(template);
45331       providers = imageryResource.imageryProviders.map(function(provider) {
45332         return {
45333           attribution: provider.attribution,
45334           areas: provider.coverageAreas.map(function(area) {
45335             return {
45336               zoom: [area.zoomMin, area.zoomMax],
45337               extent: geoExtent([area.bbox[1], area.bbox[0]], [area.bbox[3], area.bbox[2]])
45338             };
45339           })
45340         };
45341       });
45342       dispatch10.call("change");
45343     }).catch(function() {
45344     });
45345     bing.copyrightNotices = function(zoom, extent) {
45346       zoom = Math.min(zoom, 21);
45347       return providers.filter(function(provider) {
45348         return provider.areas.some(function(area) {
45349           return extent.intersects(area.extent) && area.zoom[0] <= zoom && area.zoom[1] >= zoom;
45350         });
45351       }).map(function(provider) {
45352         return provider.attribution;
45353       }).join(", ");
45354     };
45355     bing.getMetadata = function(center, tileCoord, callback) {
45356       var tileID = tileCoord.slice(0, 3).join("/");
45357       var zoom = Math.min(tileCoord[2], 21);
45358       var centerPoint = center[1] + "," + center[0];
45359       var url2 = "https://dev.virtualearth.net/REST/v1/Imagery/BasicMetadata/AerialOSM/" + centerPoint + "?zl=" + zoom + "&key=" + key;
45360       if (inflight[tileID])
45361         return;
45362       if (!cache[tileID]) {
45363         cache[tileID] = {};
45364       }
45365       if (cache[tileID] && cache[tileID].metadata) {
45366         return callback(null, cache[tileID].metadata);
45367       }
45368       inflight[tileID] = true;
45369       if (metadataLastZoom !== tileCoord[2]) {
45370         metadataLastZoom = tileCoord[2];
45371         taskQueue.clear();
45372       }
45373       taskQueue.enqueue(() => {
45374         json_default(url2).then(function(result) {
45375           delete inflight[tileID];
45376           if (!result) {
45377             throw new Error("Unknown Error");
45378           }
45379           var vintage = {
45380             start: localeDateString(result.resourceSets[0].resources[0].vintageStart),
45381             end: localeDateString(result.resourceSets[0].resources[0].vintageEnd)
45382           };
45383           vintage.range = vintageRange(vintage);
45384           var metadata = { vintage };
45385           cache[tileID].metadata = metadata;
45386           if (callback)
45387             callback(null, metadata);
45388         }).catch(function(err) {
45389           delete inflight[tileID];
45390           if (callback)
45391             callback(err.message);
45392         });
45393       });
45394     };
45395     bing.terms_url = "https://blog.openstreetmap.org/2010/11/30/microsoft-imagery-details";
45396     return bing;
45397   };
45398   rendererBackgroundSource.Esri = function(data) {
45399     if (data.template.match(/blankTile/) === null) {
45400       data.template = data.template + "?blankTile=false";
45401     }
45402     var esri = rendererBackgroundSource(data);
45403     var cache = {};
45404     var inflight = {};
45405     var _prevCenter;
45406     esri.fetchTilemap = function(center) {
45407       if (_prevCenter && geoSphericalDistance(center, _prevCenter) < 5e3)
45408         return;
45409       _prevCenter = center;
45410       var z = 20;
45411       var dummyUrl = esri.url([1, 2, 3]);
45412       var x = Math.floor((center[0] + 180) / 360 * Math.pow(2, z));
45413       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));
45414       var tilemapUrl = dummyUrl.replace(/tile\/[0-9]+\/[0-9]+\/[0-9]+\?blankTile=false/, "tilemap") + "/" + z + "/" + y + "/" + x + "/8/8";
45415       json_default(tilemapUrl).then(function(tilemap) {
45416         if (!tilemap) {
45417           throw new Error("Unknown Error");
45418         }
45419         var hasTiles = true;
45420         for (var i2 = 0; i2 < tilemap.data.length; i2++) {
45421           if (!tilemap.data[i2]) {
45422             hasTiles = false;
45423             break;
45424           }
45425         }
45426         esri.zoomExtent[1] = hasTiles ? 22 : 19;
45427       }).catch(function() {
45428       });
45429     };
45430     esri.getMetadata = function(center, tileCoord, callback) {
45431       if (esri.id !== "EsriWorldImagery") {
45432         return callback(null, {});
45433       }
45434       var tileID = tileCoord.slice(0, 3).join("/");
45435       var zoom = Math.min(tileCoord[2], esri.zoomExtent[1]);
45436       var centerPoint = center[0] + "," + center[1];
45437       var unknown = _t("info_panels.background.unknown");
45438       var vintage = {};
45439       var metadata = {};
45440       if (inflight[tileID])
45441         return;
45442       var url = "https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/4/query";
45443       url += "?returnGeometry=false&geometry=" + centerPoint + "&inSR=4326&geometryType=esriGeometryPoint&outFields=*&f=json";
45444       if (!cache[tileID]) {
45445         cache[tileID] = {};
45446       }
45447       if (cache[tileID] && cache[tileID].metadata) {
45448         return callback(null, cache[tileID].metadata);
45449       }
45450       inflight[tileID] = true;
45451       json_default(url).then(function(result) {
45452         delete inflight[tileID];
45453         result = result.features.map((f2) => f2.attributes).filter((a) => a.MinMapLevel <= zoom && a.MaxMapLevel >= zoom)[0];
45454         if (!result) {
45455           throw new Error("Unknown Error");
45456         } else if (result.features && result.features.length < 1) {
45457           throw new Error("No Results");
45458         } else if (result.error && result.error.message) {
45459           throw new Error(result.error.message);
45460         }
45461         var captureDate = localeDateString(result.SRC_DATE2);
45462         vintage = {
45463           start: captureDate,
45464           end: captureDate,
45465           range: captureDate
45466         };
45467         metadata = {
45468           vintage,
45469           source: clean2(result.NICE_NAME),
45470           description: clean2(result.NICE_DESC),
45471           resolution: clean2(+Number(result.SRC_RES).toFixed(4)),
45472           accuracy: clean2(+Number(result.SRC_ACC).toFixed(4))
45473         };
45474         if (isFinite(metadata.resolution)) {
45475           metadata.resolution += " m";
45476         }
45477         if (isFinite(metadata.accuracy)) {
45478           metadata.accuracy += " m";
45479         }
45480         cache[tileID].metadata = metadata;
45481         if (callback)
45482           callback(null, metadata);
45483       }).catch(function(err) {
45484         delete inflight[tileID];
45485         if (callback)
45486           callback(err.message);
45487       });
45488       function clean2(val) {
45489         return String(val).trim() || unknown;
45490       }
45491     };
45492     return esri;
45493   };
45494   rendererBackgroundSource.None = function() {
45495     var source = rendererBackgroundSource({ id: "none", template: "" });
45496     source.name = function() {
45497       return _t("background.none");
45498     };
45499     source.label = function() {
45500       return _t.append("background.none");
45501     };
45502     source.imageryUsed = function() {
45503       return null;
45504     };
45505     source.area = function() {
45506       return -1;
45507     };
45508     return source;
45509   };
45510   rendererBackgroundSource.Custom = function(template) {
45511     var source = rendererBackgroundSource({ id: "custom", template });
45512     source.name = function() {
45513       return _t("background.custom");
45514     };
45515     source.label = function() {
45516       return _t.append("background.custom");
45517     };
45518     source.imageryUsed = function() {
45519       var cleaned = source.template();
45520       if (cleaned.indexOf("?") !== -1) {
45521         var parts = cleaned.split("?", 2);
45522         var qs = utilStringQs(parts[1]);
45523         ["access_token", "connectId", "token"].forEach(function(param) {
45524           if (qs[param]) {
45525             qs[param] = "{apikey}";
45526           }
45527         });
45528         cleaned = parts[0] + "?" + utilQsString(qs, true);
45529       }
45530       cleaned = cleaned.replace(/token\/(\w+)/, "token/{apikey}").replace(/key=(\w+)/, "key={apikey}");
45531       return "Custom (" + cleaned + " )";
45532     };
45533     source.area = function() {
45534       return -2;
45535     };
45536     return source;
45537   };
45538
45539   // node_modules/@turf/helpers/dist/es/index.js
45540   var earthRadius = 63710088e-1;
45541   var factors = {
45542     centimeters: earthRadius * 100,
45543     centimetres: earthRadius * 100,
45544     degrees: earthRadius / 111325,
45545     feet: earthRadius * 3.28084,
45546     inches: earthRadius * 39.37,
45547     kilometers: earthRadius / 1e3,
45548     kilometres: earthRadius / 1e3,
45549     meters: earthRadius,
45550     metres: earthRadius,
45551     miles: earthRadius / 1609.344,
45552     millimeters: earthRadius * 1e3,
45553     millimetres: earthRadius * 1e3,
45554     nauticalmiles: earthRadius / 1852,
45555     radians: 1,
45556     yards: earthRadius * 1.0936
45557   };
45558   var unitsFactors = {
45559     centimeters: 100,
45560     centimetres: 100,
45561     degrees: 1 / 111325,
45562     feet: 3.28084,
45563     inches: 39.37,
45564     kilometers: 1 / 1e3,
45565     kilometres: 1 / 1e3,
45566     meters: 1,
45567     metres: 1,
45568     miles: 1 / 1609.344,
45569     millimeters: 1e3,
45570     millimetres: 1e3,
45571     nauticalmiles: 1 / 1852,
45572     radians: 1 / earthRadius,
45573     yards: 1.0936133
45574   };
45575   function feature2(geom, properties, options2) {
45576     if (options2 === void 0) {
45577       options2 = {};
45578     }
45579     var feat = { type: "Feature" };
45580     if (options2.id === 0 || options2.id) {
45581       feat.id = options2.id;
45582     }
45583     if (options2.bbox) {
45584       feat.bbox = options2.bbox;
45585     }
45586     feat.properties = properties || {};
45587     feat.geometry = geom;
45588     return feat;
45589   }
45590   function polygon(coordinates, properties, options2) {
45591     if (options2 === void 0) {
45592       options2 = {};
45593     }
45594     for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) {
45595       var ring = coordinates_1[_i];
45596       if (ring.length < 4) {
45597         throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
45598       }
45599       for (var j2 = 0; j2 < ring[ring.length - 1].length; j2++) {
45600         if (ring[ring.length - 1][j2] !== ring[0][j2]) {
45601           throw new Error("First and last Position are not equivalent.");
45602         }
45603       }
45604     }
45605     var geom = {
45606       type: "Polygon",
45607       coordinates
45608     };
45609     return feature2(geom, properties, options2);
45610   }
45611   function lineString(coordinates, properties, options2) {
45612     if (options2 === void 0) {
45613       options2 = {};
45614     }
45615     if (coordinates.length < 2) {
45616       throw new Error("coordinates must be an array of two or more positions");
45617     }
45618     var geom = {
45619       type: "LineString",
45620       coordinates
45621     };
45622     return feature2(geom, properties, options2);
45623   }
45624   function multiLineString(coordinates, properties, options2) {
45625     if (options2 === void 0) {
45626       options2 = {};
45627     }
45628     var geom = {
45629       type: "MultiLineString",
45630       coordinates
45631     };
45632     return feature2(geom, properties, options2);
45633   }
45634   function multiPolygon(coordinates, properties, options2) {
45635     if (options2 === void 0) {
45636       options2 = {};
45637     }
45638     var geom = {
45639       type: "MultiPolygon",
45640       coordinates
45641     };
45642     return feature2(geom, properties, options2);
45643   }
45644
45645   // node_modules/@turf/invariant/dist/es/index.js
45646   function getGeom(geojson) {
45647     if (geojson.type === "Feature") {
45648       return geojson.geometry;
45649     }
45650     return geojson;
45651   }
45652
45653   // node_modules/@turf/bbox-clip/dist/es/lib/lineclip.js
45654   function lineclip(points, bbox2, result) {
45655     var len = points.length, codeA = bitCode(points[0], bbox2), part = [], i2, codeB, lastCode;
45656     var a;
45657     var b;
45658     if (!result)
45659       result = [];
45660     for (i2 = 1; i2 < len; i2++) {
45661       a = points[i2 - 1];
45662       b = points[i2];
45663       codeB = lastCode = bitCode(b, bbox2);
45664       while (true) {
45665         if (!(codeA | codeB)) {
45666           part.push(a);
45667           if (codeB !== lastCode) {
45668             part.push(b);
45669             if (i2 < len - 1) {
45670               result.push(part);
45671               part = [];
45672             }
45673           } else if (i2 === len - 1) {
45674             part.push(b);
45675           }
45676           break;
45677         } else if (codeA & codeB) {
45678           break;
45679         } else if (codeA) {
45680           a = intersect(a, b, codeA, bbox2);
45681           codeA = bitCode(a, bbox2);
45682         } else {
45683           b = intersect(a, b, codeB, bbox2);
45684           codeB = bitCode(b, bbox2);
45685         }
45686       }
45687       codeA = lastCode;
45688     }
45689     if (part.length)
45690       result.push(part);
45691     return result;
45692   }
45693   function polygonclip(points, bbox2) {
45694     var result, edge, prev, prevInside, i2, p, inside;
45695     for (edge = 1; edge <= 8; edge *= 2) {
45696       result = [];
45697       prev = points[points.length - 1];
45698       prevInside = !(bitCode(prev, bbox2) & edge);
45699       for (i2 = 0; i2 < points.length; i2++) {
45700         p = points[i2];
45701         inside = !(bitCode(p, bbox2) & edge);
45702         if (inside !== prevInside)
45703           result.push(intersect(prev, p, edge, bbox2));
45704         if (inside)
45705           result.push(p);
45706         prev = p;
45707         prevInside = inside;
45708       }
45709       points = result;
45710       if (!points.length)
45711         break;
45712     }
45713     return result;
45714   }
45715   function intersect(a, b, edge, bbox2) {
45716     return edge & 8 ? [a[0] + (b[0] - a[0]) * (bbox2[3] - a[1]) / (b[1] - a[1]), bbox2[3]] : edge & 4 ? [a[0] + (b[0] - a[0]) * (bbox2[1] - a[1]) / (b[1] - a[1]), bbox2[1]] : edge & 2 ? [bbox2[2], a[1] + (b[1] - a[1]) * (bbox2[2] - a[0]) / (b[0] - a[0])] : edge & 1 ? [bbox2[0], a[1] + (b[1] - a[1]) * (bbox2[0] - a[0]) / (b[0] - a[0])] : null;
45717   }
45718   function bitCode(p, bbox2) {
45719     var code = 0;
45720     if (p[0] < bbox2[0])
45721       code |= 1;
45722     else if (p[0] > bbox2[2])
45723       code |= 2;
45724     if (p[1] < bbox2[1])
45725       code |= 4;
45726     else if (p[1] > bbox2[3])
45727       code |= 8;
45728     return code;
45729   }
45730
45731   // node_modules/@turf/bbox-clip/dist/es/index.js
45732   function bboxClip(feature3, bbox2) {
45733     var geom = getGeom(feature3);
45734     var type2 = geom.type;
45735     var properties = feature3.type === "Feature" ? feature3.properties : {};
45736     var coords = geom.coordinates;
45737     switch (type2) {
45738       case "LineString":
45739       case "MultiLineString": {
45740         var lines_1 = [];
45741         if (type2 === "LineString") {
45742           coords = [coords];
45743         }
45744         coords.forEach(function(line) {
45745           lineclip(line, bbox2, lines_1);
45746         });
45747         if (lines_1.length === 1) {
45748           return lineString(lines_1[0], properties);
45749         }
45750         return multiLineString(lines_1, properties);
45751       }
45752       case "Polygon":
45753         return polygon(clipPolygon(coords, bbox2), properties);
45754       case "MultiPolygon":
45755         return multiPolygon(coords.map(function(poly) {
45756           return clipPolygon(poly, bbox2);
45757         }), properties);
45758       default:
45759         throw new Error("geometry " + type2 + " not supported");
45760     }
45761   }
45762   function clipPolygon(rings, bbox2) {
45763     var outRings = [];
45764     for (var _i = 0, rings_1 = rings; _i < rings_1.length; _i++) {
45765       var ring = rings_1[_i];
45766       var clipped = polygonclip(ring, bbox2);
45767       if (clipped.length > 0) {
45768         if (clipped[0][0] !== clipped[clipped.length - 1][0] || clipped[0][1] !== clipped[clipped.length - 1][1]) {
45769           clipped.push(clipped[0]);
45770         }
45771         if (clipped.length >= 4) {
45772           outRings.push(clipped);
45773         }
45774       }
45775     }
45776     return outRings;
45777   }
45778
45779   // node_modules/@turf/meta/dist/es/index.js
45780   function coordEach(geojson, callback, excludeWrapCoord) {
45781     if (geojson === null)
45782       return;
45783     var j2, k, l, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type2 = geojson.type, isFeatureCollection = type2 === "FeatureCollection", isFeature = type2 === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
45784     for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
45785       geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
45786       isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
45787       stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
45788       for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
45789         var multiFeatureIndex = 0;
45790         var geometryIndex = 0;
45791         geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
45792         if (geometry === null)
45793           continue;
45794         coords = geometry.coordinates;
45795         var geomType = geometry.type;
45796         wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
45797         switch (geomType) {
45798           case null:
45799             break;
45800           case "Point":
45801             if (callback(
45802               coords,
45803               coordIndex,
45804               featureIndex,
45805               multiFeatureIndex,
45806               geometryIndex
45807             ) === false)
45808               return false;
45809             coordIndex++;
45810             multiFeatureIndex++;
45811             break;
45812           case "LineString":
45813           case "MultiPoint":
45814             for (j2 = 0; j2 < coords.length; j2++) {
45815               if (callback(
45816                 coords[j2],
45817                 coordIndex,
45818                 featureIndex,
45819                 multiFeatureIndex,
45820                 geometryIndex
45821               ) === false)
45822                 return false;
45823               coordIndex++;
45824               if (geomType === "MultiPoint")
45825                 multiFeatureIndex++;
45826             }
45827             if (geomType === "LineString")
45828               multiFeatureIndex++;
45829             break;
45830           case "Polygon":
45831           case "MultiLineString":
45832             for (j2 = 0; j2 < coords.length; j2++) {
45833               for (k = 0; k < coords[j2].length - wrapShrink; k++) {
45834                 if (callback(
45835                   coords[j2][k],
45836                   coordIndex,
45837                   featureIndex,
45838                   multiFeatureIndex,
45839                   geometryIndex
45840                 ) === false)
45841                   return false;
45842                 coordIndex++;
45843               }
45844               if (geomType === "MultiLineString")
45845                 multiFeatureIndex++;
45846               if (geomType === "Polygon")
45847                 geometryIndex++;
45848             }
45849             if (geomType === "Polygon")
45850               multiFeatureIndex++;
45851             break;
45852           case "MultiPolygon":
45853             for (j2 = 0; j2 < coords.length; j2++) {
45854               geometryIndex = 0;
45855               for (k = 0; k < coords[j2].length; k++) {
45856                 for (l = 0; l < coords[j2][k].length - wrapShrink; l++) {
45857                   if (callback(
45858                     coords[j2][k][l],
45859                     coordIndex,
45860                     featureIndex,
45861                     multiFeatureIndex,
45862                     geometryIndex
45863                   ) === false)
45864                     return false;
45865                   coordIndex++;
45866                 }
45867                 geometryIndex++;
45868               }
45869               multiFeatureIndex++;
45870             }
45871             break;
45872           case "GeometryCollection":
45873             for (j2 = 0; j2 < geometry.geometries.length; j2++)
45874               if (coordEach(geometry.geometries[j2], callback, excludeWrapCoord) === false)
45875                 return false;
45876             break;
45877           default:
45878             throw new Error("Unknown Geometry Type");
45879         }
45880       }
45881     }
45882   }
45883
45884   // node_modules/@turf/bbox/dist/es/index.js
45885   function bbox(geojson) {
45886     var result = [Infinity, Infinity, -Infinity, -Infinity];
45887     coordEach(geojson, function(coord2) {
45888       if (result[0] > coord2[0]) {
45889         result[0] = coord2[0];
45890       }
45891       if (result[1] > coord2[1]) {
45892         result[1] = coord2[1];
45893       }
45894       if (result[2] < coord2[0]) {
45895         result[2] = coord2[0];
45896       }
45897       if (result[3] < coord2[1]) {
45898         result[3] = coord2[1];
45899       }
45900     });
45901     return result;
45902   }
45903   bbox["default"] = bbox;
45904   var es_default = bbox;
45905
45906   // modules/renderer/background.js
45907   var import_which_polygon3 = __toESM(require_which_polygon());
45908
45909   // modules/renderer/tile_layer.js
45910   function rendererTileLayer(context) {
45911     var transformProp = utilPrefixCSSProperty("Transform");
45912     var tiler8 = utilTiler();
45913     var _tileSize = 256;
45914     var _projection;
45915     var _cache4 = {};
45916     var _tileOrigin;
45917     var _zoom;
45918     var _source;
45919     function tileSizeAtZoom(d, z) {
45920       var EPSILON = 2e-3;
45921       return _tileSize * Math.pow(2, z - d[2]) / _tileSize + EPSILON;
45922     }
45923     function atZoom(t, distance) {
45924       var power = Math.pow(2, distance);
45925       return [
45926         Math.floor(t[0] * power),
45927         Math.floor(t[1] * power),
45928         t[2] + distance
45929       ];
45930     }
45931     function lookUp(d) {
45932       for (var up = -1; up > -d[2]; up--) {
45933         var tile = atZoom(d, up);
45934         if (_cache4[_source.url(tile)] !== false) {
45935           return tile;
45936         }
45937       }
45938     }
45939     function uniqueBy(a, n2) {
45940       var o = [];
45941       var seen = {};
45942       for (var i2 = 0; i2 < a.length; i2++) {
45943         if (seen[a[i2][n2]] === void 0) {
45944           o.push(a[i2]);
45945           seen[a[i2][n2]] = true;
45946         }
45947       }
45948       return o;
45949     }
45950     function addSource(d) {
45951       d.push(_source.url(d));
45952       return d;
45953     }
45954     function background(selection2) {
45955       _zoom = geoScaleToZoom(_projection.scale(), _tileSize);
45956       var pixelOffset;
45957       if (_source) {
45958         pixelOffset = [
45959           _source.offset()[0] * Math.pow(2, _zoom),
45960           _source.offset()[1] * Math.pow(2, _zoom)
45961         ];
45962       } else {
45963         pixelOffset = [0, 0];
45964       }
45965       var translate = [
45966         _projection.translate()[0] + pixelOffset[0],
45967         _projection.translate()[1] + pixelOffset[1]
45968       ];
45969       tiler8.scale(_projection.scale() * 2 * Math.PI).translate(translate);
45970       _tileOrigin = [
45971         _projection.scale() * Math.PI - translate[0],
45972         _projection.scale() * Math.PI - translate[1]
45973       ];
45974       render(selection2);
45975     }
45976     function render(selection2) {
45977       if (!_source)
45978         return;
45979       var requests = [];
45980       var showDebug = context.getDebug("tile") && !_source.overlay;
45981       if (_source.validZoom(_zoom)) {
45982         tiler8.skipNullIsland(!!_source.overlay);
45983         tiler8().forEach(function(d) {
45984           addSource(d);
45985           if (d[3] === "")
45986             return;
45987           if (typeof d[3] !== "string")
45988             return;
45989           requests.push(d);
45990           if (_cache4[d[3]] === false && lookUp(d)) {
45991             requests.push(addSource(lookUp(d)));
45992           }
45993         });
45994         requests = uniqueBy(requests, 3).filter(function(r) {
45995           return _cache4[r[3]] !== false;
45996         });
45997       }
45998       function load(d3_event, d) {
45999         _cache4[d[3]] = true;
46000         select_default2(this).on("error", null).on("load", null).classed("tile-loaded", true);
46001         render(selection2);
46002       }
46003       function error(d3_event, d) {
46004         _cache4[d[3]] = false;
46005         select_default2(this).on("error", null).on("load", null).remove();
46006         render(selection2);
46007       }
46008       function imageTransform(d) {
46009         var ts = _tileSize * Math.pow(2, _zoom - d[2]);
46010         var scale = tileSizeAtZoom(d, _zoom);
46011         return "translate(" + (d[0] * ts - _tileOrigin[0]) + "px," + (d[1] * ts - _tileOrigin[1]) + "px) scale(" + scale + "," + scale + ")";
46012       }
46013       function tileCenter(d) {
46014         var ts = _tileSize * Math.pow(2, _zoom - d[2]);
46015         return [
46016           d[0] * ts - _tileOrigin[0] + ts / 2,
46017           d[1] * ts - _tileOrigin[1] + ts / 2
46018         ];
46019       }
46020       function debugTransform(d) {
46021         var coord2 = tileCenter(d);
46022         return "translate(" + coord2[0] + "px," + coord2[1] + "px)";
46023       }
46024       var dims = tiler8.size();
46025       var mapCenter = [dims[0] / 2, dims[1] / 2];
46026       var minDist = Math.max(dims[0], dims[1]);
46027       var nearCenter;
46028       requests.forEach(function(d) {
46029         var c = tileCenter(d);
46030         var dist = geoVecLength(c, mapCenter);
46031         if (dist < minDist) {
46032           minDist = dist;
46033           nearCenter = d;
46034         }
46035       });
46036       var image = selection2.selectAll("img").data(requests, function(d) {
46037         return d[3];
46038       });
46039       image.exit().style(transformProp, imageTransform).classed("tile-removing", true).classed("tile-center", false).each(function() {
46040         var tile = select_default2(this);
46041         window.setTimeout(function() {
46042           if (tile.classed("tile-removing")) {
46043             tile.remove();
46044           }
46045         }, 300);
46046       });
46047       image.enter().append("img").attr("class", "tile").attr("alt", "").attr("draggable", "false").style("width", _tileSize + "px").style("height", _tileSize + "px").attr("src", function(d) {
46048         return d[3];
46049       }).on("error", error).on("load", load).merge(image).style(transformProp, imageTransform).classed("tile-debug", showDebug).classed("tile-removing", false).classed("tile-center", function(d) {
46050         return d === nearCenter;
46051       });
46052       var debug2 = selection2.selectAll(".tile-label-debug").data(showDebug ? requests : [], function(d) {
46053         return d[3];
46054       });
46055       debug2.exit().remove();
46056       if (showDebug) {
46057         var debugEnter = debug2.enter().append("div").attr("class", "tile-label-debug");
46058         debugEnter.append("div").attr("class", "tile-label-debug-coord");
46059         debugEnter.append("div").attr("class", "tile-label-debug-vintage");
46060         debug2 = debug2.merge(debugEnter);
46061         debug2.style(transformProp, debugTransform);
46062         debug2.selectAll(".tile-label-debug-coord").text(function(d) {
46063           return d[2] + " / " + d[0] + " / " + d[1];
46064         });
46065         debug2.selectAll(".tile-label-debug-vintage").each(function(d) {
46066           var span = select_default2(this);
46067           var center = context.projection.invert(tileCenter(d));
46068           _source.getMetadata(center, d, function(err, result) {
46069             if (result && result.vintage && result.vintage.range) {
46070               span.text(result.vintage.range);
46071             } else {
46072               span.text("");
46073               span.call(_t.append("info_panels.background.vintage"));
46074               span.append("span").text(": ");
46075               span.call(_t.append("info_panels.background.unknown"));
46076             }
46077           });
46078         });
46079       }
46080     }
46081     background.projection = function(val) {
46082       if (!arguments.length)
46083         return _projection;
46084       _projection = val;
46085       return background;
46086     };
46087     background.dimensions = function(val) {
46088       if (!arguments.length)
46089         return tiler8.size();
46090       tiler8.size(val);
46091       return background;
46092     };
46093     background.source = function(val) {
46094       if (!arguments.length)
46095         return _source;
46096       _source = val;
46097       _tileSize = _source.tileSize;
46098       _cache4 = {};
46099       tiler8.tileSize(_source.tileSize).zoomExtent(_source.zoomExtent);
46100       return background;
46101     };
46102     return background;
46103   }
46104
46105   // modules/renderer/background.js
46106   var _imageryIndex = null;
46107   function rendererBackground(context) {
46108     const dispatch10 = dispatch_default("change");
46109     const baseLayer = rendererTileLayer(context).projection(context.projection);
46110     let _checkedBlocklists = [];
46111     let _isValid = true;
46112     let _overlayLayers = [];
46113     let _brightness = 1;
46114     let _contrast = 1;
46115     let _saturation = 1;
46116     let _sharpness = 1;
46117     function ensureImageryIndex() {
46118       return _mainFileFetcher.get("imagery").then((sources) => {
46119         if (_imageryIndex)
46120           return _imageryIndex;
46121         _imageryIndex = {
46122           imagery: sources,
46123           features: {}
46124         };
46125         const features = sources.map((source) => {
46126           if (!source.polygon)
46127             return null;
46128           const rings = source.polygon.map((ring) => [ring]);
46129           const feature3 = {
46130             type: "Feature",
46131             properties: { id: source.id },
46132             geometry: { type: "MultiPolygon", coordinates: rings }
46133           };
46134           _imageryIndex.features[source.id] = feature3;
46135           return feature3;
46136         }).filter(Boolean);
46137         _imageryIndex.query = (0, import_which_polygon3.default)({ type: "FeatureCollection", features });
46138         _imageryIndex.backgrounds = sources.map((source) => {
46139           if (source.type === "bing") {
46140             return rendererBackgroundSource.Bing(source, dispatch10);
46141           } else if (/^EsriWorldImagery/.test(source.id)) {
46142             return rendererBackgroundSource.Esri(source);
46143           } else {
46144             return rendererBackgroundSource(source);
46145           }
46146         });
46147         _imageryIndex.backgrounds.unshift(rendererBackgroundSource.None());
46148         let template = corePreferences("background-custom-template") || "";
46149         const custom = rendererBackgroundSource.Custom(template);
46150         _imageryIndex.backgrounds.unshift(custom);
46151         return _imageryIndex;
46152       });
46153     }
46154     function background(selection2) {
46155       const currSource = baseLayer.source();
46156       if (context.map().zoom() > 18) {
46157         if (currSource && /^EsriWorldImagery/.test(currSource.id)) {
46158           const center = context.map().center();
46159           currSource.fetchTilemap(center);
46160         }
46161       }
46162       const sources = background.sources(context.map().extent());
46163       const wasValid = _isValid;
46164       _isValid = !!sources.filter((d) => d === currSource).length;
46165       if (wasValid !== _isValid) {
46166         background.updateImagery();
46167       }
46168       let baseFilter = "";
46169       if (_brightness !== 1) {
46170         baseFilter += ` brightness(${_brightness})`;
46171       }
46172       if (_contrast !== 1) {
46173         baseFilter += ` contrast(${_contrast})`;
46174       }
46175       if (_saturation !== 1) {
46176         baseFilter += ` saturate(${_saturation})`;
46177       }
46178       if (_sharpness < 1) {
46179         const blur = number_default(0.5, 5)(1 - _sharpness);
46180         baseFilter += ` blur(${blur}px)`;
46181       }
46182       let base = selection2.selectAll(".layer-background").data([0]);
46183       base = base.enter().insert("div", ".layer-data").attr("class", "layer layer-background").merge(base);
46184       base.style("filter", baseFilter || null);
46185       let imagery = base.selectAll(".layer-imagery").data([0]);
46186       imagery.enter().append("div").attr("class", "layer layer-imagery").merge(imagery).call(baseLayer);
46187       let maskFilter = "";
46188       let mixBlendMode = "";
46189       if (_sharpness > 1) {
46190         mixBlendMode = "overlay";
46191         maskFilter = "saturate(0) blur(3px) invert(1)";
46192         let contrast = _sharpness - 1;
46193         maskFilter += ` contrast(${contrast})`;
46194         let brightness = number_default(1, 0.85)(_sharpness - 1);
46195         maskFilter += ` brightness(${brightness})`;
46196       }
46197       let mask = base.selectAll(".layer-unsharp-mask").data(_sharpness > 1 ? [0] : []);
46198       mask.exit().remove();
46199       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);
46200       let overlays = selection2.selectAll(".layer-overlay").data(_overlayLayers, (d) => d.source().name());
46201       overlays.exit().remove();
46202       overlays.enter().insert("div", ".layer-data").attr("class", "layer layer-overlay").merge(overlays).each((layer, i2, nodes) => select_default2(nodes[i2]).call(layer));
46203     }
46204     background.updateImagery = function() {
46205       let currSource = baseLayer.source();
46206       if (context.inIntro() || !currSource)
46207         return;
46208       let o = _overlayLayers.filter((d) => !d.source().isLocatorOverlay() && !d.source().isHidden()).map((d) => d.source().id).join(",");
46209       const meters = geoOffsetToMeters(currSource.offset());
46210       const EPSILON = 0.01;
46211       const x = +meters[0].toFixed(2);
46212       const y = +meters[1].toFixed(2);
46213       let hash = utilStringQs(window.location.hash);
46214       let id2 = currSource.id;
46215       if (id2 === "custom") {
46216         id2 = `custom:${currSource.template()}`;
46217       }
46218       if (id2) {
46219         hash.background = id2;
46220       } else {
46221         delete hash.background;
46222       }
46223       if (o) {
46224         hash.overlays = o;
46225       } else {
46226         delete hash.overlays;
46227       }
46228       if (Math.abs(x) > EPSILON || Math.abs(y) > EPSILON) {
46229         hash.offset = `${x},${y}`;
46230       } else {
46231         delete hash.offset;
46232       }
46233       if (!window.mocha) {
46234         window.location.replace("#" + utilQsString(hash, true));
46235       }
46236       let imageryUsed = [];
46237       let photoOverlaysUsed = [];
46238       const currUsed = currSource.imageryUsed();
46239       if (currUsed && _isValid) {
46240         imageryUsed.push(currUsed);
46241       }
46242       _overlayLayers.filter((d) => !d.source().isLocatorOverlay() && !d.source().isHidden()).forEach((d) => imageryUsed.push(d.source().imageryUsed()));
46243       const dataLayer = context.layers().layer("data");
46244       if (dataLayer && dataLayer.enabled() && dataLayer.hasData()) {
46245         imageryUsed.push(dataLayer.getSrc());
46246       }
46247       const photoOverlayLayers = {
46248         streetside: "Bing Streetside",
46249         mapillary: "Mapillary Images",
46250         "mapillary-map-features": "Mapillary Map Features",
46251         "mapillary-signs": "Mapillary Signs",
46252         kartaview: "KartaView Images"
46253       };
46254       for (let layerID in photoOverlayLayers) {
46255         const layer = context.layers().layer(layerID);
46256         if (layer && layer.enabled()) {
46257           photoOverlaysUsed.push(layerID);
46258           imageryUsed.push(photoOverlayLayers[layerID]);
46259         }
46260       }
46261       context.history().imageryUsed(imageryUsed);
46262       context.history().photoOverlaysUsed(photoOverlaysUsed);
46263     };
46264     background.sources = (extent, zoom, includeCurrent) => {
46265       if (!_imageryIndex)
46266         return [];
46267       let visible = {};
46268       (_imageryIndex.query.bbox(extent.rectangle(), true) || []).forEach((d) => visible[d.id] = true);
46269       const currSource = baseLayer.source();
46270       const osm = context.connection();
46271       const blocklists = osm && osm.imageryBlocklists() || [];
46272       const blocklistChanged = blocklists.length !== _checkedBlocklists.length || blocklists.some((regex, index) => String(regex) !== _checkedBlocklists[index]);
46273       if (blocklistChanged) {
46274         _imageryIndex.backgrounds.forEach((source) => {
46275           source.isBlocked = blocklists.some((regex) => regex.test(source.template()));
46276         });
46277         _checkedBlocklists = blocklists.map((regex) => String(regex));
46278       }
46279       return _imageryIndex.backgrounds.filter((source) => {
46280         if (includeCurrent && currSource === source)
46281           return true;
46282         if (source.isBlocked)
46283           return false;
46284         if (!source.polygon)
46285           return true;
46286         if (zoom && zoom < 6)
46287           return false;
46288         return visible[source.id];
46289       });
46290     };
46291     background.dimensions = (val) => {
46292       if (!val)
46293         return;
46294       baseLayer.dimensions(val);
46295       _overlayLayers.forEach((layer) => layer.dimensions(val));
46296     };
46297     background.baseLayerSource = function(d) {
46298       if (!arguments.length)
46299         return baseLayer.source();
46300       const osm = context.connection();
46301       if (!osm)
46302         return background;
46303       const blocklists = osm.imageryBlocklists();
46304       const template = d.template();
46305       let fail = false;
46306       let tested = 0;
46307       let regex;
46308       for (let i2 = 0; i2 < blocklists.length; i2++) {
46309         regex = blocklists[i2];
46310         fail = regex.test(template);
46311         tested++;
46312         if (fail)
46313           break;
46314       }
46315       if (!tested) {
46316         regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
46317         fail = regex.test(template);
46318       }
46319       baseLayer.source(!fail ? d : background.findSource("none"));
46320       dispatch10.call("change");
46321       background.updateImagery();
46322       return background;
46323     };
46324     background.findSource = (id2) => {
46325       if (!id2 || !_imageryIndex)
46326         return null;
46327       return _imageryIndex.backgrounds.find((d) => d.id && d.id === id2);
46328     };
46329     background.bing = () => {
46330       background.baseLayerSource(background.findSource("Bing"));
46331     };
46332     background.showsLayer = (d) => {
46333       const currSource = baseLayer.source();
46334       if (!d || !currSource)
46335         return false;
46336       return d.id === currSource.id || _overlayLayers.some((layer) => d.id === layer.source().id);
46337     };
46338     background.overlayLayerSources = () => {
46339       return _overlayLayers.map((layer) => layer.source());
46340     };
46341     background.toggleOverlayLayer = (d) => {
46342       let layer;
46343       for (let i2 = 0; i2 < _overlayLayers.length; i2++) {
46344         layer = _overlayLayers[i2];
46345         if (layer.source() === d) {
46346           _overlayLayers.splice(i2, 1);
46347           dispatch10.call("change");
46348           background.updateImagery();
46349           return;
46350         }
46351       }
46352       layer = rendererTileLayer(context).source(d).projection(context.projection).dimensions(
46353         baseLayer.dimensions()
46354       );
46355       _overlayLayers.push(layer);
46356       dispatch10.call("change");
46357       background.updateImagery();
46358     };
46359     background.nudge = (d, zoom) => {
46360       const currSource = baseLayer.source();
46361       if (currSource) {
46362         currSource.nudge(d, zoom);
46363         dispatch10.call("change");
46364         background.updateImagery();
46365       }
46366       return background;
46367     };
46368     background.offset = function(d) {
46369       const currSource = baseLayer.source();
46370       if (!arguments.length) {
46371         return currSource && currSource.offset() || [0, 0];
46372       }
46373       if (currSource) {
46374         currSource.offset(d);
46375         dispatch10.call("change");
46376         background.updateImagery();
46377       }
46378       return background;
46379     };
46380     background.brightness = function(d) {
46381       if (!arguments.length)
46382         return _brightness;
46383       _brightness = d;
46384       if (context.mode())
46385         dispatch10.call("change");
46386       return background;
46387     };
46388     background.contrast = function(d) {
46389       if (!arguments.length)
46390         return _contrast;
46391       _contrast = d;
46392       if (context.mode())
46393         dispatch10.call("change");
46394       return background;
46395     };
46396     background.saturation = function(d) {
46397       if (!arguments.length)
46398         return _saturation;
46399       _saturation = d;
46400       if (context.mode())
46401         dispatch10.call("change");
46402       return background;
46403     };
46404     background.sharpness = function(d) {
46405       if (!arguments.length)
46406         return _sharpness;
46407       _sharpness = d;
46408       if (context.mode())
46409         dispatch10.call("change");
46410       return background;
46411     };
46412     let _loadPromise;
46413     background.ensureLoaded = () => {
46414       if (_loadPromise)
46415         return _loadPromise;
46416       return _loadPromise = ensureImageryIndex();
46417     };
46418     background.init = () => {
46419       const loadPromise = background.ensureLoaded();
46420       const hash = utilStringQs(window.location.hash);
46421       const requestedBackground = hash.background || hash.layer;
46422       const lastUsedBackground = corePreferences("background-last-used");
46423       return loadPromise.then((imageryIndex) => {
46424         const extent = context.map().extent();
46425         const validBackgrounds = background.sources(extent).filter((d) => d.id !== "none" && d.id !== "custom");
46426         const first = validBackgrounds.length && validBackgrounds[0];
46427         const isLastUsedValid = !!validBackgrounds.find((d) => d.id && d.id === lastUsedBackground);
46428         let best;
46429         if (!requestedBackground && extent) {
46430           const viewArea = extent.area();
46431           best = validBackgrounds.find((s) => {
46432             if (!s.best() || s.overlay)
46433               return false;
46434             let bbox2 = es_default(bboxClip(
46435               { type: "MultiPolygon", coordinates: [s.polygon || [extent.polygon()]] },
46436               extent.rectangle()
46437             ));
46438             let area = geoExtent(bbox2.slice(0, 2), bbox2.slice(2, 4)).area();
46439             return area / viewArea > 0.5;
46440           });
46441         }
46442         if (requestedBackground && requestedBackground.indexOf("custom:") === 0) {
46443           const template = requestedBackground.replace(/^custom:/, "");
46444           const custom = background.findSource("custom");
46445           background.baseLayerSource(custom.template(template));
46446           corePreferences("background-custom-template", template);
46447         } else {
46448           background.baseLayerSource(
46449             background.findSource(requestedBackground) || best || isLastUsedValid && background.findSource(lastUsedBackground) || background.findSource("Bing") || first || background.findSource("none")
46450           );
46451         }
46452         const locator = imageryIndex.backgrounds.find((d) => d.overlay && d.default);
46453         if (locator) {
46454           background.toggleOverlayLayer(locator);
46455         }
46456         const overlays = (hash.overlays || "").split(",");
46457         overlays.forEach((overlay) => {
46458           overlay = background.findSource(overlay);
46459           if (overlay) {
46460             background.toggleOverlayLayer(overlay);
46461           }
46462         });
46463         if (hash.gpx) {
46464           const gpx2 = context.layers().layer("data");
46465           if (gpx2) {
46466             gpx2.url(hash.gpx, ".gpx");
46467           }
46468         }
46469         if (hash.offset) {
46470           const offset = hash.offset.replace(/;/g, ",").split(",").map((n2) => !isNaN(n2) && n2);
46471           if (offset.length === 2) {
46472             background.offset(geoMetersToOffset(offset));
46473           }
46474         }
46475       }).catch((err) => {
46476         console.error(err);
46477       });
46478     };
46479     return utilRebind(background, dispatch10, "on");
46480   }
46481
46482   // modules/renderer/features.js
46483   function rendererFeatures(context) {
46484     var dispatch10 = dispatch_default("change", "redraw");
46485     var features = utilRebind({}, dispatch10, "on");
46486     var _deferred2 = /* @__PURE__ */ new Set();
46487     var traffic_roads = {
46488       "motorway": true,
46489       "motorway_link": true,
46490       "trunk": true,
46491       "trunk_link": true,
46492       "primary": true,
46493       "primary_link": true,
46494       "secondary": true,
46495       "secondary_link": true,
46496       "tertiary": true,
46497       "tertiary_link": true,
46498       "residential": true,
46499       "unclassified": true,
46500       "living_street": true,
46501       "busway": true
46502     };
46503     var service_roads = {
46504       "service": true,
46505       "road": true,
46506       "track": true
46507     };
46508     var paths = {
46509       "path": true,
46510       "footway": true,
46511       "cycleway": true,
46512       "bridleway": true,
46513       "steps": true,
46514       "pedestrian": true
46515     };
46516     var _cullFactor = 1;
46517     var _cache4 = {};
46518     var _rules = {};
46519     var _stats = {};
46520     var _keys = [];
46521     var _hidden = [];
46522     var _forceVisible = {};
46523     function update() {
46524       if (!window.mocha) {
46525         var hash = utilStringQs(window.location.hash);
46526         var disabled = features.disabled();
46527         if (disabled.length) {
46528           hash.disable_features = disabled.join(",");
46529         } else {
46530           delete hash.disable_features;
46531         }
46532         window.location.replace("#" + utilQsString(hash, true));
46533         corePreferences("disabled-features", disabled.join(","));
46534       }
46535       _hidden = features.hidden();
46536       dispatch10.call("change");
46537       dispatch10.call("redraw");
46538     }
46539     function defineRule(k, filter2, max3) {
46540       var isEnabled = true;
46541       _keys.push(k);
46542       _rules[k] = {
46543         filter: filter2,
46544         enabled: isEnabled,
46545         // whether the user wants it enabled..
46546         count: 0,
46547         currentMax: max3 || Infinity,
46548         defaultMax: max3 || Infinity,
46549         enable: function() {
46550           this.enabled = true;
46551           this.currentMax = this.defaultMax;
46552         },
46553         disable: function() {
46554           this.enabled = false;
46555           this.currentMax = 0;
46556         },
46557         hidden: function() {
46558           return this.count === 0 && !this.enabled || this.count > this.currentMax * _cullFactor;
46559         },
46560         autoHidden: function() {
46561           return this.hidden() && this.currentMax > 0;
46562         }
46563       };
46564     }
46565     defineRule("points", function isPoint(tags, geometry) {
46566       return geometry === "point";
46567     }, 200);
46568     defineRule("traffic_roads", function isTrafficRoad(tags) {
46569       return traffic_roads[tags.highway];
46570     });
46571     defineRule("service_roads", function isServiceRoad(tags) {
46572       return service_roads[tags.highway];
46573     });
46574     defineRule("paths", function isPath(tags) {
46575       return paths[tags.highway];
46576     });
46577     defineRule("buildings", function isBuilding(tags) {
46578       return !!tags.building && tags.building !== "no" || tags.parking === "multi-storey" || tags.parking === "sheds" || tags.parking === "carports" || tags.parking === "garage_boxes";
46579     }, 250);
46580     defineRule("building_parts", function isBuildingPart(tags) {
46581       return tags["building:part"];
46582     });
46583     defineRule("indoor", function isIndoor(tags) {
46584       return tags.indoor;
46585     });
46586     defineRule("landuse", function isLanduse(tags, geometry) {
46587       return geometry === "area" && !_rules.buildings.filter(tags) && !_rules.building_parts.filter(tags) && !_rules.indoor.filter(tags) && !_rules.water.filter(tags) && !_rules.pistes.filter(tags);
46588     });
46589     defineRule("boundaries", function isBoundary(tags, geometry) {
46590       return (geometry === "line" && !!tags.boundary || geometry === "relation" && tags.type === "boundary") && !(traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway] || tags.waterway || tags.railway || tags.landuse || tags.natural || tags.building || tags.power);
46591     });
46592     defineRule("water", function isWater(tags) {
46593       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";
46594     });
46595     defineRule("rail", function isRail(tags) {
46596       return (!!tags.railway || tags.landuse === "railway") && !(traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]);
46597     });
46598     defineRule("pistes", function isPiste(tags) {
46599       return tags["piste:type"];
46600     });
46601     defineRule("aerialways", function isPiste(tags) {
46602       return tags.aerialway && tags.aerialway !== "yes" && tags.aerialway !== "station";
46603     });
46604     defineRule("power", function isPower(tags) {
46605       return !!tags.power;
46606     });
46607     defineRule("past_future", function isPastFuture(tags) {
46608       if (traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]) {
46609         return false;
46610       }
46611       var strings = Object.keys(tags);
46612       for (var i2 = 0; i2 < strings.length; i2++) {
46613         var s = strings[i2];
46614         if (osmLifecyclePrefixes[s] || osmLifecyclePrefixes[tags[s]])
46615           return true;
46616       }
46617       return false;
46618     });
46619     defineRule("others", function isOther(tags, geometry) {
46620       return geometry === "line" || geometry === "area";
46621     });
46622     features.features = function() {
46623       return _rules;
46624     };
46625     features.keys = function() {
46626       return _keys;
46627     };
46628     features.enabled = function(k) {
46629       if (!arguments.length) {
46630         return _keys.filter(function(k2) {
46631           return _rules[k2].enabled;
46632         });
46633       }
46634       return _rules[k] && _rules[k].enabled;
46635     };
46636     features.disabled = function(k) {
46637       if (!arguments.length) {
46638         return _keys.filter(function(k2) {
46639           return !_rules[k2].enabled;
46640         });
46641       }
46642       return _rules[k] && !_rules[k].enabled;
46643     };
46644     features.hidden = function(k) {
46645       if (!arguments.length) {
46646         return _keys.filter(function(k2) {
46647           return _rules[k2].hidden();
46648         });
46649       }
46650       return _rules[k] && _rules[k].hidden();
46651     };
46652     features.autoHidden = function(k) {
46653       if (!arguments.length) {
46654         return _keys.filter(function(k2) {
46655           return _rules[k2].autoHidden();
46656         });
46657       }
46658       return _rules[k] && _rules[k].autoHidden();
46659     };
46660     features.enable = function(k) {
46661       if (_rules[k] && !_rules[k].enabled) {
46662         _rules[k].enable();
46663         update();
46664       }
46665     };
46666     features.enableAll = function() {
46667       var didEnable = false;
46668       for (var k in _rules) {
46669         if (!_rules[k].enabled) {
46670           didEnable = true;
46671           _rules[k].enable();
46672         }
46673       }
46674       if (didEnable)
46675         update();
46676     };
46677     features.disable = function(k) {
46678       if (_rules[k] && _rules[k].enabled) {
46679         _rules[k].disable();
46680         update();
46681       }
46682     };
46683     features.disableAll = function() {
46684       var didDisable = false;
46685       for (var k in _rules) {
46686         if (_rules[k].enabled) {
46687           didDisable = true;
46688           _rules[k].disable();
46689         }
46690       }
46691       if (didDisable)
46692         update();
46693     };
46694     features.toggle = function(k) {
46695       if (_rules[k]) {
46696         (function(f2) {
46697           return f2.enabled ? f2.disable() : f2.enable();
46698         })(_rules[k]);
46699         update();
46700       }
46701     };
46702     features.resetStats = function() {
46703       for (var i2 = 0; i2 < _keys.length; i2++) {
46704         _rules[_keys[i2]].count = 0;
46705       }
46706       dispatch10.call("change");
46707     };
46708     features.gatherStats = function(d, resolver, dimensions) {
46709       var needsRedraw = false;
46710       var types = utilArrayGroupBy(d, "type");
46711       var entities = [].concat(types.relation || [], types.way || [], types.node || []);
46712       var currHidden, geometry, matches, i2, j2;
46713       for (i2 = 0; i2 < _keys.length; i2++) {
46714         _rules[_keys[i2]].count = 0;
46715       }
46716       _cullFactor = dimensions[0] * dimensions[1] / 1e6;
46717       for (i2 = 0; i2 < entities.length; i2++) {
46718         geometry = entities[i2].geometry(resolver);
46719         matches = Object.keys(features.getMatches(entities[i2], resolver, geometry));
46720         for (j2 = 0; j2 < matches.length; j2++) {
46721           _rules[matches[j2]].count++;
46722         }
46723       }
46724       currHidden = features.hidden();
46725       if (currHidden !== _hidden) {
46726         _hidden = currHidden;
46727         needsRedraw = true;
46728         dispatch10.call("change");
46729       }
46730       return needsRedraw;
46731     };
46732     features.stats = function() {
46733       for (var i2 = 0; i2 < _keys.length; i2++) {
46734         _stats[_keys[i2]] = _rules[_keys[i2]].count;
46735       }
46736       return _stats;
46737     };
46738     features.clear = function(d) {
46739       for (var i2 = 0; i2 < d.length; i2++) {
46740         features.clearEntity(d[i2]);
46741       }
46742     };
46743     features.clearEntity = function(entity) {
46744       delete _cache4[osmEntity.key(entity)];
46745     };
46746     features.reset = function() {
46747       Array.from(_deferred2).forEach(function(handle) {
46748         window.cancelIdleCallback(handle);
46749         _deferred2.delete(handle);
46750       });
46751       _cache4 = {};
46752     };
46753     function relationShouldBeChecked(relation) {
46754       return relation.tags.type === "boundary";
46755     }
46756     features.getMatches = function(entity, resolver, geometry) {
46757       if (geometry === "vertex" || geometry === "relation" && !relationShouldBeChecked(entity))
46758         return {};
46759       var ent = osmEntity.key(entity);
46760       if (!_cache4[ent]) {
46761         _cache4[ent] = {};
46762       }
46763       if (!_cache4[ent].matches) {
46764         var matches = {};
46765         var hasMatch = false;
46766         for (var i2 = 0; i2 < _keys.length; i2++) {
46767           if (_keys[i2] === "others") {
46768             if (hasMatch)
46769               continue;
46770             if (entity.type === "way") {
46771               var parents = features.getParents(entity, resolver, geometry);
46772               if (parents.length === 1 && parents[0].isMultipolygon() || // 2b. or belongs only to boundary relations
46773               parents.length > 0 && parents.every(function(parent) {
46774                 return parent.tags.type === "boundary";
46775               })) {
46776                 var pkey = osmEntity.key(parents[0]);
46777                 if (_cache4[pkey] && _cache4[pkey].matches) {
46778                   matches = Object.assign({}, _cache4[pkey].matches);
46779                   continue;
46780                 }
46781               }
46782             }
46783           }
46784           if (_rules[_keys[i2]].filter(entity.tags, geometry)) {
46785             matches[_keys[i2]] = hasMatch = true;
46786           }
46787         }
46788         _cache4[ent].matches = matches;
46789       }
46790       return _cache4[ent].matches;
46791     };
46792     features.getParents = function(entity, resolver, geometry) {
46793       if (geometry === "point")
46794         return [];
46795       var ent = osmEntity.key(entity);
46796       if (!_cache4[ent]) {
46797         _cache4[ent] = {};
46798       }
46799       if (!_cache4[ent].parents) {
46800         var parents = [];
46801         if (geometry === "vertex") {
46802           parents = resolver.parentWays(entity);
46803         } else {
46804           parents = resolver.parentRelations(entity);
46805         }
46806         _cache4[ent].parents = parents;
46807       }
46808       return _cache4[ent].parents;
46809     };
46810     features.isHiddenPreset = function(preset, geometry) {
46811       if (!_hidden.length)
46812         return false;
46813       if (!preset.tags)
46814         return false;
46815       var test = preset.setTags({}, geometry);
46816       for (var key in _rules) {
46817         if (_rules[key].filter(test, geometry)) {
46818           if (_hidden.indexOf(key) !== -1) {
46819             return key;
46820           }
46821           return false;
46822         }
46823       }
46824       return false;
46825     };
46826     features.isHiddenFeature = function(entity, resolver, geometry) {
46827       if (!_hidden.length)
46828         return false;
46829       if (!entity.version)
46830         return false;
46831       if (_forceVisible[entity.id])
46832         return false;
46833       var matches = Object.keys(features.getMatches(entity, resolver, geometry));
46834       return matches.length && matches.every(function(k) {
46835         return features.hidden(k);
46836       });
46837     };
46838     features.isHiddenChild = function(entity, resolver, geometry) {
46839       if (!_hidden.length)
46840         return false;
46841       if (!entity.version || geometry === "point")
46842         return false;
46843       if (_forceVisible[entity.id])
46844         return false;
46845       var parents = features.getParents(entity, resolver, geometry);
46846       if (!parents.length)
46847         return false;
46848       for (var i2 = 0; i2 < parents.length; i2++) {
46849         if (!features.isHidden(parents[i2], resolver, parents[i2].geometry(resolver))) {
46850           return false;
46851         }
46852       }
46853       return true;
46854     };
46855     features.hasHiddenConnections = function(entity, resolver) {
46856       if (!_hidden.length)
46857         return false;
46858       var childNodes, connections;
46859       if (entity.type === "midpoint") {
46860         childNodes = [resolver.entity(entity.edge[0]), resolver.entity(entity.edge[1])];
46861         connections = [];
46862       } else {
46863         childNodes = entity.nodes ? resolver.childNodes(entity) : [];
46864         connections = features.getParents(entity, resolver, entity.geometry(resolver));
46865       }
46866       connections = childNodes.reduce(function(result, e) {
46867         return resolver.isShared(e) ? utilArrayUnion(result, resolver.parentWays(e)) : result;
46868       }, connections);
46869       return connections.some(function(e) {
46870         return features.isHidden(e, resolver, e.geometry(resolver));
46871       });
46872     };
46873     features.isHidden = function(entity, resolver, geometry) {
46874       if (!_hidden.length)
46875         return false;
46876       if (!entity.version)
46877         return false;
46878       var fn = geometry === "vertex" ? features.isHiddenChild : features.isHiddenFeature;
46879       return fn(entity, resolver, geometry);
46880     };
46881     features.filter = function(d, resolver) {
46882       if (!_hidden.length)
46883         return d;
46884       var result = [];
46885       for (var i2 = 0; i2 < d.length; i2++) {
46886         var entity = d[i2];
46887         if (!features.isHidden(entity, resolver, entity.geometry(resolver))) {
46888           result.push(entity);
46889         }
46890       }
46891       return result;
46892     };
46893     features.forceVisible = function(entityIDs) {
46894       if (!arguments.length)
46895         return Object.keys(_forceVisible);
46896       _forceVisible = {};
46897       for (var i2 = 0; i2 < entityIDs.length; i2++) {
46898         _forceVisible[entityIDs[i2]] = true;
46899         var entity = context.hasEntity(entityIDs[i2]);
46900         if (entity && entity.type === "relation") {
46901           for (var j2 in entity.members) {
46902             _forceVisible[entity.members[j2].id] = true;
46903           }
46904         }
46905       }
46906       return features;
46907     };
46908     features.init = function() {
46909       var storage = corePreferences("disabled-features");
46910       if (storage) {
46911         var storageDisabled = storage.replace(/;/g, ",").split(",");
46912         storageDisabled.forEach(features.disable);
46913       }
46914       var hash = utilStringQs(window.location.hash);
46915       if (hash.disable_features) {
46916         var hashDisabled = hash.disable_features.replace(/;/g, ",").split(",");
46917         hashDisabled.forEach(features.disable);
46918       }
46919     };
46920     context.history().on("merge.features", function(newEntities) {
46921       if (!newEntities)
46922         return;
46923       var handle = window.requestIdleCallback(function() {
46924         var graph = context.graph();
46925         var types = utilArrayGroupBy(newEntities, "type");
46926         var entities = [].concat(types.relation || [], types.way || [], types.node || []);
46927         for (var i2 = 0; i2 < entities.length; i2++) {
46928           var geometry = entities[i2].geometry(graph);
46929           features.getMatches(entities[i2], graph, geometry);
46930         }
46931       });
46932       _deferred2.add(handle);
46933     });
46934     return features;
46935   }
46936
46937   // modules/svg/areas.js
46938   var import_fast_deep_equal5 = __toESM(require_fast_deep_equal());
46939
46940   // modules/svg/helpers.js
46941   function svgPassiveVertex(node, graph, activeID) {
46942     if (!activeID)
46943       return 1;
46944     if (activeID === node.id)
46945       return 0;
46946     var parents = graph.parentWays(node);
46947     var i2, j2, nodes, isClosed, ix1, ix2, ix3, ix4, max3;
46948     for (i2 = 0; i2 < parents.length; i2++) {
46949       nodes = parents[i2].nodes;
46950       isClosed = parents[i2].isClosed();
46951       for (j2 = 0; j2 < nodes.length; j2++) {
46952         if (nodes[j2] === node.id) {
46953           ix1 = j2 - 2;
46954           ix2 = j2 - 1;
46955           ix3 = j2 + 1;
46956           ix4 = j2 + 2;
46957           if (isClosed) {
46958             max3 = nodes.length - 1;
46959             if (ix1 < 0)
46960               ix1 = max3 + ix1;
46961             if (ix2 < 0)
46962               ix2 = max3 + ix2;
46963             if (ix3 > max3)
46964               ix3 = ix3 - max3;
46965             if (ix4 > max3)
46966               ix4 = ix4 - max3;
46967           }
46968           if (nodes[ix1] === activeID)
46969             return 0;
46970           else if (nodes[ix2] === activeID)
46971             return 2;
46972           else if (nodes[ix3] === activeID)
46973             return 2;
46974           else if (nodes[ix4] === activeID)
46975             return 0;
46976           else if (isClosed && nodes.indexOf(activeID) !== -1)
46977             return 0;
46978         }
46979       }
46980     }
46981     return 1;
46982   }
46983   function svgMarkerSegments(projection2, graph, dt, shouldReverse, bothDirections) {
46984     return function(entity) {
46985       var i2 = 0;
46986       var offset = dt;
46987       var segments = [];
46988       var clip = identity_default2().clipExtent(projection2.clipExtent()).stream;
46989       var coordinates = graph.childNodes(entity).map(function(n2) {
46990         return n2.loc;
46991       });
46992       var a, b;
46993       if (shouldReverse(entity)) {
46994         coordinates.reverse();
46995       }
46996       stream_default({
46997         type: "LineString",
46998         coordinates
46999       }, projection2.stream(clip({
47000         lineStart: function() {
47001         },
47002         lineEnd: function() {
47003           a = null;
47004         },
47005         point: function(x, y) {
47006           b = [x, y];
47007           if (a) {
47008             var span = geoVecLength(a, b) - offset;
47009             if (span >= 0) {
47010               var heading = geoVecAngle(a, b);
47011               var dx = dt * Math.cos(heading);
47012               var dy = dt * Math.sin(heading);
47013               var p = [
47014                 a[0] + offset * Math.cos(heading),
47015                 a[1] + offset * Math.sin(heading)
47016               ];
47017               var coord2 = [a, p];
47018               for (span -= dt; span >= 0; span -= dt) {
47019                 p = geoVecAdd(p, [dx, dy]);
47020                 coord2.push(p);
47021               }
47022               coord2.push(b);
47023               var segment = "";
47024               var j2;
47025               for (j2 = 0; j2 < coord2.length; j2++) {
47026                 segment += (j2 === 0 ? "M" : "L") + coord2[j2][0] + "," + coord2[j2][1];
47027               }
47028               segments.push({ id: entity.id, index: i2++, d: segment });
47029               if (bothDirections(entity)) {
47030                 segment = "";
47031                 for (j2 = coord2.length - 1; j2 >= 0; j2--) {
47032                   segment += (j2 === coord2.length - 1 ? "M" : "L") + coord2[j2][0] + "," + coord2[j2][1];
47033                 }
47034                 segments.push({ id: entity.id, index: i2++, d: segment });
47035               }
47036             }
47037             offset = -span;
47038           }
47039           a = b;
47040         }
47041       })));
47042       return segments;
47043     };
47044   }
47045   function svgPath(projection2, graph, isArea) {
47046     var cache = {};
47047     var padding = isArea ? 65 : 5;
47048     var viewport = projection2.clipExtent();
47049     var paddedExtent = [
47050       [viewport[0][0] - padding, viewport[0][1] - padding],
47051       [viewport[1][0] + padding, viewport[1][1] + padding]
47052     ];
47053     var clip = identity_default2().clipExtent(paddedExtent).stream;
47054     var project = projection2.stream;
47055     var path = path_default().projection({ stream: function(output) {
47056       return project(clip(output));
47057     } });
47058     var svgpath = function(entity) {
47059       if (entity.id in cache) {
47060         return cache[entity.id];
47061       } else {
47062         return cache[entity.id] = path(entity.asGeoJSON(graph));
47063       }
47064     };
47065     svgpath.geojson = function(d) {
47066       if (d.__featurehash__ !== void 0) {
47067         if (d.__featurehash__ in cache) {
47068           return cache[d.__featurehash__];
47069         } else {
47070           return cache[d.__featurehash__] = path(d);
47071         }
47072       } else {
47073         return path(d);
47074       }
47075     };
47076     return svgpath;
47077   }
47078   function svgPointTransform(projection2) {
47079     var svgpoint = function(entity) {
47080       var pt = projection2(entity.loc);
47081       return "translate(" + pt[0] + "," + pt[1] + ")";
47082     };
47083     svgpoint.geojson = function(d) {
47084       return svgpoint(d.properties.entity);
47085     };
47086     return svgpoint;
47087   }
47088   function svgRelationMemberTags(graph) {
47089     return function(entity) {
47090       var tags = entity.tags;
47091       var shouldCopyMultipolygonTags = !entity.hasInterestingTags();
47092       graph.parentRelations(entity).forEach(function(relation) {
47093         var type2 = relation.tags.type;
47094         if (type2 === "multipolygon" && shouldCopyMultipolygonTags || type2 === "boundary") {
47095           tags = Object.assign({}, relation.tags, tags);
47096         }
47097       });
47098       return tags;
47099     };
47100   }
47101   function svgSegmentWay(way, graph, activeID) {
47102     if (activeID === void 0) {
47103       return graph.transient(way, "waySegments", getWaySegments);
47104     } else {
47105       return getWaySegments();
47106     }
47107     function getWaySegments() {
47108       var isActiveWay = way.nodes.indexOf(activeID) !== -1;
47109       var features = { passive: [], active: [] };
47110       var start2 = {};
47111       var end = {};
47112       var node, type2;
47113       for (var i2 = 0; i2 < way.nodes.length; i2++) {
47114         node = graph.entity(way.nodes[i2]);
47115         type2 = svgPassiveVertex(node, graph, activeID);
47116         end = { node, type: type2 };
47117         if (start2.type !== void 0) {
47118           if (start2.node.id === activeID || end.node.id === activeID) {
47119           } else if (isActiveWay && (start2.type === 2 || end.type === 2)) {
47120             pushActive(start2, end, i2);
47121           } else if (start2.type === 0 && end.type === 0) {
47122             pushActive(start2, end, i2);
47123           } else {
47124             pushPassive(start2, end, i2);
47125           }
47126         }
47127         start2 = end;
47128       }
47129       return features;
47130       function pushActive(start3, end2, index) {
47131         features.active.push({
47132           type: "Feature",
47133           id: way.id + "-" + index + "-nope",
47134           properties: {
47135             nope: true,
47136             target: true,
47137             entity: way,
47138             nodes: [start3.node, end2.node],
47139             index
47140           },
47141           geometry: {
47142             type: "LineString",
47143             coordinates: [start3.node.loc, end2.node.loc]
47144           }
47145         });
47146       }
47147       function pushPassive(start3, end2, index) {
47148         features.passive.push({
47149           type: "Feature",
47150           id: way.id + "-" + index,
47151           properties: {
47152             target: true,
47153             entity: way,
47154             nodes: [start3.node, end2.node],
47155             index
47156           },
47157           geometry: {
47158             type: "LineString",
47159             coordinates: [start3.node.loc, end2.node.loc]
47160           }
47161         });
47162       }
47163     }
47164   }
47165
47166   // modules/svg/tag_classes.js
47167   function svgTagClasses() {
47168     var primaries = [
47169       "building",
47170       "highway",
47171       "railway",
47172       "waterway",
47173       "aeroway",
47174       "aerialway",
47175       "piste:type",
47176       "boundary",
47177       "power",
47178       "amenity",
47179       "natural",
47180       "landuse",
47181       "leisure",
47182       "military",
47183       "place",
47184       "man_made",
47185       "route",
47186       "attraction",
47187       "building:part",
47188       "indoor"
47189     ];
47190     var statuses = Object.keys(osmLifecyclePrefixes);
47191     var secondaries = [
47192       "oneway",
47193       "bridge",
47194       "tunnel",
47195       "embankment",
47196       "cutting",
47197       "barrier",
47198       "surface",
47199       "tracktype",
47200       "footway",
47201       "crossing",
47202       "service",
47203       "sport",
47204       "public_transport",
47205       "location",
47206       "parking",
47207       "golf",
47208       "type",
47209       "leisure",
47210       "man_made",
47211       "indoor",
47212       "construction",
47213       "proposed"
47214     ];
47215     var _tags = function(entity) {
47216       return entity.tags;
47217     };
47218     var tagClasses = function(selection2) {
47219       selection2.each(function tagClassesEach(entity) {
47220         var value = this.className;
47221         if (value.baseVal !== void 0) {
47222           value = value.baseVal;
47223         }
47224         var t = _tags(entity);
47225         var computed = tagClasses.getClassesString(t, value);
47226         if (computed !== value) {
47227           select_default2(this).attr("class", computed);
47228         }
47229       });
47230     };
47231     tagClasses.getClassesString = function(t, value) {
47232       var primary, status;
47233       var i2, j2, k, v;
47234       var overrideGeometry;
47235       if (/\bstroke\b/.test(value)) {
47236         if (!!t.barrier && t.barrier !== "no") {
47237           overrideGeometry = "line";
47238         }
47239       }
47240       var classes = value.trim().split(/\s+/).filter(function(klass) {
47241         return klass.length && !/^tag-/.test(klass);
47242       }).map(function(klass) {
47243         return klass === "line" || klass === "area" ? overrideGeometry || klass : klass;
47244       });
47245       for (i2 = 0; i2 < primaries.length; i2++) {
47246         k = primaries[i2];
47247         v = t[k];
47248         if (!v || v === "no")
47249           continue;
47250         if (k === "piste:type") {
47251           k = "piste";
47252         } else if (k === "building:part") {
47253           k = "building_part";
47254         }
47255         primary = k;
47256         if (statuses.indexOf(v) !== -1) {
47257           status = v;
47258           classes.push("tag-" + k);
47259         } else {
47260           classes.push("tag-" + k);
47261           classes.push("tag-" + k + "-" + v);
47262         }
47263         break;
47264       }
47265       if (!primary) {
47266         for (i2 = 0; i2 < statuses.length; i2++) {
47267           for (j2 = 0; j2 < primaries.length; j2++) {
47268             k = statuses[i2] + ":" + primaries[j2];
47269             v = t[k];
47270             if (!v || v === "no")
47271               continue;
47272             status = statuses[i2];
47273             break;
47274           }
47275         }
47276       }
47277       if (!status) {
47278         for (i2 = 0; i2 < statuses.length; i2++) {
47279           k = statuses[i2];
47280           v = t[k];
47281           if (!v || v === "no")
47282             continue;
47283           if (v === "yes") {
47284             status = k;
47285           } else if (primary && primary === v) {
47286             status = k;
47287           } else if (!primary && primaries.indexOf(v) !== -1) {
47288             status = k;
47289             primary = v;
47290             classes.push("tag-" + v);
47291           }
47292           if (status)
47293             break;
47294         }
47295       }
47296       if (status) {
47297         classes.push("tag-status");
47298         classes.push("tag-status-" + status);
47299       }
47300       for (i2 = 0; i2 < secondaries.length; i2++) {
47301         k = secondaries[i2];
47302         v = t[k];
47303         if (!v || v === "no" || k === primary)
47304           continue;
47305         classes.push("tag-" + k);
47306         classes.push("tag-" + k + "-" + v);
47307       }
47308       if (primary === "highway" && !osmPathHighwayTagValues[t.highway] || primary === "aeroway") {
47309         var surface = t.highway === "track" ? "unpaved" : "paved";
47310         for (k in t) {
47311           v = t[k];
47312           if (k in osmPavedTags) {
47313             surface = osmPavedTags[k][v] ? "paved" : "unpaved";
47314           }
47315           if (k in osmSemipavedTags && !!osmSemipavedTags[k][v]) {
47316             surface = "semipaved";
47317           }
47318         }
47319         classes.push("tag-" + surface);
47320       }
47321       var qid = t.wikidata || t["flag:wikidata"] || t["brand:wikidata"] || t["network:wikidata"] || t["operator:wikidata"];
47322       if (qid) {
47323         classes.push("tag-wikidata");
47324       }
47325       return classes.filter((klass) => /^[-_a-z0-9]+$/.test(klass)).join(" ").trim();
47326     };
47327     tagClasses.tags = function(val) {
47328       if (!arguments.length)
47329         return _tags;
47330       _tags = val;
47331       return tagClasses;
47332     };
47333     return tagClasses;
47334   }
47335
47336   // modules/svg/tag_pattern.js
47337   var patterns = {
47338     // tag - pattern name
47339     // -or-
47340     // tag - value - pattern name
47341     // -or-
47342     // tag - value - rules (optional tag-values, pattern name)
47343     // (matches earlier rules first, so fallback should be last entry)
47344     amenity: {
47345       grave_yard: "cemetery",
47346       fountain: "water_standing"
47347     },
47348     landuse: {
47349       cemetery: [
47350         { religion: "christian", pattern: "cemetery_christian" },
47351         { religion: "buddhist", pattern: "cemetery_buddhist" },
47352         { religion: "muslim", pattern: "cemetery_muslim" },
47353         { religion: "jewish", pattern: "cemetery_jewish" },
47354         { pattern: "cemetery" }
47355       ],
47356       construction: "construction",
47357       farmland: "farmland",
47358       farmyard: "farmyard",
47359       forest: [
47360         { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
47361         { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
47362         { leaf_type: "leafless", pattern: "forest_leafless" },
47363         { pattern: "forest" }
47364         // same as 'leaf_type:mixed'
47365       ],
47366       grave_yard: "cemetery",
47367       grass: "grass",
47368       landfill: "landfill",
47369       meadow: "meadow",
47370       military: "construction",
47371       orchard: "orchard",
47372       quarry: "quarry",
47373       vineyard: "vineyard"
47374     },
47375     leisure: {
47376       horse_riding: "farmyard"
47377     },
47378     natural: {
47379       beach: "beach",
47380       grassland: "grass",
47381       sand: "beach",
47382       scrub: "scrub",
47383       water: [
47384         { water: "pond", pattern: "pond" },
47385         { water: "reservoir", pattern: "water_standing" },
47386         { pattern: "waves" }
47387       ],
47388       wetland: [
47389         { wetland: "marsh", pattern: "wetland_marsh" },
47390         { wetland: "swamp", pattern: "wetland_swamp" },
47391         { wetland: "bog", pattern: "wetland_bog" },
47392         { wetland: "reedbed", pattern: "wetland_reedbed" },
47393         { pattern: "wetland" }
47394       ],
47395       wood: [
47396         { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
47397         { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
47398         { leaf_type: "leafless", pattern: "forest_leafless" },
47399         { pattern: "forest" }
47400         // same as 'leaf_type:mixed'
47401       ]
47402     },
47403     golf: {
47404       green: "golf_green",
47405       tee: "grass",
47406       fairway: "grass",
47407       rough: "scrub"
47408     },
47409     surface: {
47410       grass: "grass",
47411       sand: "beach"
47412     }
47413   };
47414   function svgTagPattern(tags) {
47415     if (tags.building && tags.building !== "no") {
47416       return null;
47417     }
47418     for (var tag in patterns) {
47419       var entityValue = tags[tag];
47420       if (!entityValue)
47421         continue;
47422       if (typeof patterns[tag] === "string") {
47423         return "pattern-" + patterns[tag];
47424       } else {
47425         var values = patterns[tag];
47426         for (var value in values) {
47427           if (entityValue !== value)
47428             continue;
47429           var rules = values[value];
47430           if (typeof rules === "string") {
47431             return "pattern-" + rules;
47432           }
47433           for (var ruleKey in rules) {
47434             var rule = rules[ruleKey];
47435             var pass = true;
47436             for (var criterion in rule) {
47437               if (criterion !== "pattern") {
47438                 var v = tags[criterion];
47439                 if (!v || v !== rule[criterion]) {
47440                   pass = false;
47441                   break;
47442                 }
47443               }
47444             }
47445             if (pass) {
47446               return "pattern-" + rule.pattern;
47447             }
47448           }
47449         }
47450       }
47451     }
47452     return null;
47453   }
47454
47455   // modules/svg/areas.js
47456   function svgAreas(projection2, context) {
47457     function getPatternStyle(tags) {
47458       var imageID = svgTagPattern(tags);
47459       if (imageID) {
47460         return 'url("#ideditor-' + imageID + '")';
47461       }
47462       return "";
47463     }
47464     function drawTargets(selection2, graph, entities, filter2) {
47465       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
47466       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
47467       var getPath = svgPath(projection2).geojson;
47468       var activeID = context.activeID();
47469       var base = context.history().base();
47470       var data = { targets: [], nopes: [] };
47471       entities.forEach(function(way) {
47472         var features = svgSegmentWay(way, graph, activeID);
47473         data.targets.push.apply(data.targets, features.passive);
47474         data.nopes.push.apply(data.nopes, features.active);
47475       });
47476       var targetData = data.targets.filter(getPath);
47477       var targets = selection2.selectAll(".area.target-allowed").filter(function(d) {
47478         return filter2(d.properties.entity);
47479       }).data(targetData, function key(d) {
47480         return d.id;
47481       });
47482       targets.exit().remove();
47483       var segmentWasEdited = function(d) {
47484         var wayID = d.properties.entity.id;
47485         if (!base.entities[wayID] || !(0, import_fast_deep_equal5.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
47486           return false;
47487         }
47488         return d.properties.nodes.some(function(n2) {
47489           return !base.entities[n2.id] || !(0, import_fast_deep_equal5.default)(graph.entities[n2.id].loc, base.entities[n2.id].loc);
47490         });
47491       };
47492       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d) {
47493         return "way area target target-allowed " + targetClass + d.id;
47494       }).classed("segment-edited", segmentWasEdited);
47495       var nopeData = data.nopes.filter(getPath);
47496       var nopes = selection2.selectAll(".area.target-nope").filter(function(d) {
47497         return filter2(d.properties.entity);
47498       }).data(nopeData, function key(d) {
47499         return d.id;
47500       });
47501       nopes.exit().remove();
47502       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d) {
47503         return "way area target target-nope " + nopeClass + d.id;
47504       }).classed("segment-edited", segmentWasEdited);
47505     }
47506     function drawAreas(selection2, graph, entities, filter2) {
47507       var path = svgPath(projection2, graph, true);
47508       var areas = {};
47509       var multipolygon;
47510       var base = context.history().base();
47511       for (var i2 = 0; i2 < entities.length; i2++) {
47512         var entity = entities[i2];
47513         if (entity.geometry(graph) !== "area")
47514           continue;
47515         multipolygon = osmIsOldMultipolygonOuterMember(entity, graph);
47516         if (multipolygon) {
47517           areas[multipolygon.id] = {
47518             entity: multipolygon.mergeTags(entity.tags),
47519             area: Math.abs(entity.area(graph))
47520           };
47521         } else if (!areas[entity.id]) {
47522           areas[entity.id] = {
47523             entity,
47524             area: Math.abs(entity.area(graph))
47525           };
47526         }
47527       }
47528       var fills = Object.values(areas).filter(function hasPath(a) {
47529         return path(a.entity);
47530       });
47531       fills.sort(function areaSort(a, b) {
47532         return b.area - a.area;
47533       });
47534       fills = fills.map(function(a) {
47535         return a.entity;
47536       });
47537       var strokes = fills.filter(function(area) {
47538         return area.type === "way";
47539       });
47540       var data = {
47541         clip: fills,
47542         shadow: strokes,
47543         stroke: strokes,
47544         fill: fills
47545       };
47546       var clipPaths = context.surface().selectAll("defs").selectAll(".clipPath-osm").filter(filter2).data(data.clip, osmEntity.key);
47547       clipPaths.exit().remove();
47548       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-osm").attr("id", function(entity2) {
47549         return "ideditor-" + entity2.id + "-clippath";
47550       });
47551       clipPathsEnter.append("path");
47552       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", path);
47553       var drawLayer = selection2.selectAll(".layer-osm.areas");
47554       var touchLayer = selection2.selectAll(".layer-touch.areas");
47555       var areagroup = drawLayer.selectAll("g.areagroup").data(["fill", "shadow", "stroke"]);
47556       areagroup = areagroup.enter().append("g").attr("class", function(d) {
47557         return "areagroup area-" + d;
47558       }).merge(areagroup);
47559       var paths = areagroup.selectAll("path").filter(filter2).data(function(layer) {
47560         return data[layer];
47561       }, osmEntity.key);
47562       paths.exit().remove();
47563       var fillpaths = selection2.selectAll(".area-fill path.area").nodes();
47564       var bisect = bisector(function(node) {
47565         return -node.__data__.area(graph);
47566       }).left;
47567       function sortedByArea(entity2) {
47568         if (this._parent.__data__ === "fill") {
47569           return fillpaths[bisect(fillpaths, -entity2.area(graph))];
47570         }
47571       }
47572       paths = paths.enter().insert("path", sortedByArea).merge(paths).each(function(entity2) {
47573         var layer = this.parentNode.__data__;
47574         this.setAttribute("class", entity2.type + " area " + layer + " " + entity2.id);
47575         if (layer === "fill") {
47576           this.setAttribute("clip-path", "url(#ideditor-" + entity2.id + "-clippath)");
47577           this.style.fill = this.style.stroke = getPatternStyle(entity2.tags);
47578         }
47579       }).classed("added", function(d) {
47580         return !base.entities[d.id];
47581       }).classed("geometry-edited", function(d) {
47582         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);
47583       }).classed("retagged", function(d) {
47584         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);
47585       }).call(svgTagClasses()).attr("d", path);
47586       touchLayer.call(drawTargets, graph, data.stroke, filter2);
47587     }
47588     return drawAreas;
47589   }
47590
47591   // modules/svg/data.js
47592   var import_fast_json_stable_stringify = __toESM(require_fast_json_stable_stringify());
47593
47594   // node_modules/@tmcw/togeojson/dist/togeojson.es.mjs
47595   function $(element, tagName) {
47596     return Array.from(element.getElementsByTagName(tagName));
47597   }
47598   function normalizeId(id2) {
47599     return id2[0] === "#" ? id2 : `#${id2}`;
47600   }
47601   function $ns(element, tagName, ns) {
47602     return Array.from(element.getElementsByTagNameNS(ns, tagName));
47603   }
47604   function nodeVal(node) {
47605     node?.normalize();
47606     return node && node.textContent || "";
47607   }
47608   function get1(node, tagName, callback) {
47609     const n2 = node.getElementsByTagName(tagName);
47610     const result = n2.length ? n2[0] : null;
47611     if (result && callback)
47612       callback(result);
47613     return result;
47614   }
47615   function get3(node, tagName, callback) {
47616     const properties = {};
47617     if (!node)
47618       return properties;
47619     const n2 = node.getElementsByTagName(tagName);
47620     const result = n2.length ? n2[0] : null;
47621     if (result && callback) {
47622       return callback(result, properties);
47623     }
47624     return properties;
47625   }
47626   function val1(node, tagName, callback) {
47627     const val = nodeVal(get1(node, tagName));
47628     if (val && callback)
47629       return callback(val) || {};
47630     return {};
47631   }
47632   function $num(node, tagName, callback) {
47633     const val = parseFloat(nodeVal(get1(node, tagName)));
47634     if (isNaN(val))
47635       return void 0;
47636     if (val && callback)
47637       return callback(val) || {};
47638     return {};
47639   }
47640   function num1(node, tagName, callback) {
47641     const val = parseFloat(nodeVal(get1(node, tagName)));
47642     if (isNaN(val))
47643       return void 0;
47644     if (callback)
47645       callback(val);
47646     return val;
47647   }
47648   function getMulti(node, propertyNames) {
47649     const properties = {};
47650     for (const property of propertyNames) {
47651       val1(node, property, (val) => {
47652         properties[property] = val;
47653       });
47654     }
47655     return properties;
47656   }
47657   function isElement(node) {
47658     return node?.nodeType === 1;
47659   }
47660   function getLineStyle(node) {
47661     return get3(node, "line", (lineStyle) => {
47662       const val = Object.assign({}, val1(lineStyle, "color", (color2) => {
47663         return { stroke: `#${color2}` };
47664       }), $num(lineStyle, "opacity", (opacity) => {
47665         return { "stroke-opacity": opacity };
47666       }), $num(lineStyle, "width", (width) => {
47667         return { "stroke-width": width * 96 / 25.4 };
47668       }));
47669       return val;
47670     });
47671   }
47672   function getExtensions(node) {
47673     let values = [];
47674     if (node === null)
47675       return values;
47676     for (const child of Array.from(node.childNodes)) {
47677       if (!isElement(child))
47678         continue;
47679       const name = abbreviateName(child.nodeName);
47680       if (name === "gpxtpx:TrackPointExtension") {
47681         values = values.concat(getExtensions(child));
47682       } else {
47683         const val = nodeVal(child);
47684         values.push([name, parseNumeric(val)]);
47685       }
47686     }
47687     return values;
47688   }
47689   function abbreviateName(name) {
47690     return ["heart", "gpxtpx:hr", "hr"].includes(name) ? "heart" : name;
47691   }
47692   function parseNumeric(val) {
47693     const num = parseFloat(val);
47694     return isNaN(num) ? val : num;
47695   }
47696   function coordPair$1(node) {
47697     const ll = [
47698       parseFloat(node.getAttribute("lon") || ""),
47699       parseFloat(node.getAttribute("lat") || "")
47700     ];
47701     if (isNaN(ll[0]) || isNaN(ll[1])) {
47702       return null;
47703     }
47704     num1(node, "ele", (val) => {
47705       ll.push(val);
47706     });
47707     const time = get1(node, "time");
47708     return {
47709       coordinates: ll,
47710       time: time ? nodeVal(time) : null,
47711       extendedValues: getExtensions(get1(node, "extensions"))
47712     };
47713   }
47714   function extractProperties(node) {
47715     const properties = getMulti(node, [
47716       "name",
47717       "cmt",
47718       "desc",
47719       "type",
47720       "time",
47721       "keywords"
47722     ]);
47723     const extensions = Array.from(node.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/GpxExtensions/v3", "*"));
47724     for (const child of extensions) {
47725       if (child.parentNode?.parentNode === node) {
47726         properties[child.tagName.replace(":", "_")] = nodeVal(child);
47727       }
47728     }
47729     const links = $(node, "link");
47730     if (links.length) {
47731       properties.links = links.map((link2) => Object.assign({ href: link2.getAttribute("href") }, getMulti(link2, ["text", "type"])));
47732     }
47733     return properties;
47734   }
47735   function getPoints$1(node, pointname) {
47736     const pts = $(node, pointname);
47737     const line = [];
47738     const times = [];
47739     const extendedValues = {};
47740     for (let i2 = 0; i2 < pts.length; i2++) {
47741       const c = coordPair$1(pts[i2]);
47742       if (!c) {
47743         continue;
47744       }
47745       line.push(c.coordinates);
47746       if (c.time)
47747         times.push(c.time);
47748       for (const [name, val] of c.extendedValues) {
47749         const plural = name === "heart" ? name : name.replace("gpxtpx:", "") + "s";
47750         if (!extendedValues[plural]) {
47751           extendedValues[plural] = Array(pts.length).fill(null);
47752         }
47753         extendedValues[plural][i2] = val;
47754       }
47755     }
47756     if (line.length < 2)
47757       return;
47758     return {
47759       line,
47760       times,
47761       extendedValues
47762     };
47763   }
47764   function getRoute(node) {
47765     const line = getPoints$1(node, "rtept");
47766     if (!line)
47767       return;
47768     return {
47769       type: "Feature",
47770       properties: Object.assign({ _gpxType: "rte" }, extractProperties(node), getLineStyle(get1(node, "extensions"))),
47771       geometry: {
47772         type: "LineString",
47773         coordinates: line.line
47774       }
47775     };
47776   }
47777   function getTrack(node) {
47778     const segments = $(node, "trkseg");
47779     const track = [];
47780     const times = [];
47781     const extractedLines = [];
47782     for (const segment of segments) {
47783       const line = getPoints$1(segment, "trkpt");
47784       if (line) {
47785         extractedLines.push(line);
47786         if (line.times && line.times.length)
47787           times.push(line.times);
47788       }
47789     }
47790     if (extractedLines.length === 0)
47791       return null;
47792     const multi = extractedLines.length > 1;
47793     const properties = Object.assign({ _gpxType: "trk" }, extractProperties(node), getLineStyle(get1(node, "extensions")), times.length ? {
47794       coordinateProperties: {
47795         times: multi ? times : times[0]
47796       }
47797     } : {});
47798     for (const line of extractedLines) {
47799       track.push(line.line);
47800       if (!properties.coordinateProperties) {
47801         properties.coordinateProperties = {};
47802       }
47803       const props = properties.coordinateProperties;
47804       const entries = Object.entries(line.extendedValues);
47805       for (let i2 = 0; i2 < entries.length; i2++) {
47806         const [name, val] = entries[i2];
47807         if (multi) {
47808           if (!props[name]) {
47809             props[name] = extractedLines.map((line2) => new Array(line2.line.length).fill(null));
47810           }
47811           props[name][i2] = val;
47812         } else {
47813           props[name] = val;
47814         }
47815       }
47816     }
47817     return {
47818       type: "Feature",
47819       properties,
47820       geometry: multi ? {
47821         type: "MultiLineString",
47822         coordinates: track
47823       } : {
47824         type: "LineString",
47825         coordinates: track[0]
47826       }
47827     };
47828   }
47829   function getPoint(node) {
47830     const properties = Object.assign(extractProperties(node), getMulti(node, ["sym"]));
47831     const pair2 = coordPair$1(node);
47832     if (!pair2)
47833       return null;
47834     return {
47835       type: "Feature",
47836       properties,
47837       geometry: {
47838         type: "Point",
47839         coordinates: pair2.coordinates
47840       }
47841     };
47842   }
47843   function* gpxGen(node) {
47844     for (const track of $(node, "trk")) {
47845       const feature3 = getTrack(track);
47846       if (feature3)
47847         yield feature3;
47848     }
47849     for (const route of $(node, "rte")) {
47850       const feature3 = getRoute(route);
47851       if (feature3)
47852         yield feature3;
47853     }
47854     for (const waypoint of $(node, "wpt")) {
47855       const point2 = getPoint(waypoint);
47856       if (point2)
47857         yield point2;
47858     }
47859   }
47860   function gpx(node) {
47861     return {
47862       type: "FeatureCollection",
47863       features: Array.from(gpxGen(node))
47864     };
47865   }
47866   function fixColor(v, prefix) {
47867     const properties = {};
47868     const colorProp = prefix == "stroke" || prefix === "fill" ? prefix : prefix + "-color";
47869     if (v[0] === "#") {
47870       v = v.substring(1);
47871     }
47872     if (v.length === 6 || v.length === 3) {
47873       properties[colorProp] = "#" + v;
47874     } else if (v.length === 8) {
47875       properties[prefix + "-opacity"] = parseInt(v.substring(0, 2), 16) / 255;
47876       properties[colorProp] = "#" + v.substring(6, 8) + v.substring(4, 6) + v.substring(2, 4);
47877     }
47878     return properties;
47879   }
47880   function numericProperty(node, source, target) {
47881     const properties = {};
47882     num1(node, source, (val) => {
47883       properties[target] = val;
47884     });
47885     return properties;
47886   }
47887   function getColor(node, output) {
47888     return get3(node, "color", (elem) => fixColor(nodeVal(elem), output));
47889   }
47890   function extractIconHref(node) {
47891     return get3(node, "Icon", (icon2, properties) => {
47892       val1(icon2, "href", (href) => {
47893         properties.icon = href;
47894       });
47895       return properties;
47896     });
47897   }
47898   function extractIcon(node) {
47899     return get3(node, "IconStyle", (iconStyle) => {
47900       return Object.assign(getColor(iconStyle, "icon"), numericProperty(iconStyle, "scale", "icon-scale"), numericProperty(iconStyle, "heading", "icon-heading"), get3(iconStyle, "hotSpot", (hotspot) => {
47901         const left = parseFloat(hotspot.getAttribute("x") || "");
47902         const top = parseFloat(hotspot.getAttribute("y") || "");
47903         const xunits = hotspot.getAttribute("xunits") || "";
47904         const yunits = hotspot.getAttribute("yunits") || "";
47905         if (!isNaN(left) && !isNaN(top))
47906           return {
47907             "icon-offset": [left, top],
47908             "icon-offset-units": [xunits, yunits]
47909           };
47910         return {};
47911       }), extractIconHref(iconStyle));
47912     });
47913   }
47914   function extractLabel(node) {
47915     return get3(node, "LabelStyle", (labelStyle) => {
47916       return Object.assign(getColor(labelStyle, "label"), numericProperty(labelStyle, "scale", "label-scale"));
47917     });
47918   }
47919   function extractLine(node) {
47920     return get3(node, "LineStyle", (lineStyle) => {
47921       return Object.assign(getColor(lineStyle, "stroke"), numericProperty(lineStyle, "width", "stroke-width"));
47922     });
47923   }
47924   function extractPoly(node) {
47925     return get3(node, "PolyStyle", (polyStyle, properties) => {
47926       return Object.assign(properties, get3(polyStyle, "color", (elem) => fixColor(nodeVal(elem), "fill")), val1(polyStyle, "fill", (fill) => {
47927         if (fill === "0")
47928           return { "fill-opacity": 0 };
47929       }), val1(polyStyle, "outline", (outline) => {
47930         if (outline === "0")
47931           return { "stroke-opacity": 0 };
47932       }));
47933     });
47934   }
47935   function extractStyle(node) {
47936     return Object.assign({}, extractPoly(node), extractLine(node), extractLabel(node), extractIcon(node));
47937   }
47938   var toNumber2 = (x) => Number(x);
47939   var typeConverters = {
47940     string: (x) => x,
47941     int: toNumber2,
47942     uint: toNumber2,
47943     short: toNumber2,
47944     ushort: toNumber2,
47945     float: toNumber2,
47946     double: toNumber2,
47947     bool: (x) => Boolean(x)
47948   };
47949   function extractExtendedData(node, schema) {
47950     return get3(node, "ExtendedData", (extendedData, properties) => {
47951       for (const data of $(extendedData, "Data")) {
47952         properties[data.getAttribute("name") || ""] = nodeVal(get1(data, "value"));
47953       }
47954       for (const simpleData of $(extendedData, "SimpleData")) {
47955         const name = simpleData.getAttribute("name") || "";
47956         const typeConverter = schema[name] || typeConverters.string;
47957         properties[name] = typeConverter(nodeVal(simpleData));
47958       }
47959       return properties;
47960     });
47961   }
47962   function getMaybeHTMLDescription(node) {
47963     const descriptionNode = get1(node, "description");
47964     for (const c of Array.from(descriptionNode?.childNodes || [])) {
47965       if (c.nodeType === 4) {
47966         return {
47967           description: {
47968             "@type": "html",
47969             value: nodeVal(c)
47970           }
47971         };
47972       }
47973     }
47974     return {};
47975   }
47976   function extractTimeSpan(node) {
47977     return get3(node, "TimeSpan", (timeSpan) => {
47978       return {
47979         timespan: {
47980           begin: nodeVal(get1(timeSpan, "begin")),
47981           end: nodeVal(get1(timeSpan, "end"))
47982         }
47983       };
47984     });
47985   }
47986   function extractTimeStamp(node) {
47987     return get3(node, "TimeStamp", (timeStamp) => {
47988       return { timestamp: nodeVal(get1(timeStamp, "when")) };
47989     });
47990   }
47991   function extractCascadedStyle(node, styleMap) {
47992     return val1(node, "styleUrl", (styleUrl) => {
47993       styleUrl = normalizeId(styleUrl);
47994       if (styleMap[styleUrl]) {
47995         return Object.assign({ styleUrl }, styleMap[styleUrl]);
47996       }
47997       return { styleUrl };
47998     });
47999   }
48000   var removeSpace = /\s*/g;
48001   var trimSpace = /^\s*|\s*$/g;
48002   var splitSpace = /\s+/;
48003   function coord1(value) {
48004     return value.replace(removeSpace, "").split(",").map(parseFloat).filter((num) => !isNaN(num)).slice(0, 3);
48005   }
48006   function coord(value) {
48007     return value.replace(trimSpace, "").split(splitSpace).map(coord1).filter((coord2) => {
48008       return coord2.length >= 2;
48009     });
48010   }
48011   function gxCoords(node) {
48012     let elems = $(node, "coord");
48013     if (elems.length === 0) {
48014       elems = $ns(node, "coord", "*");
48015     }
48016     const coordinates = elems.map((elem) => {
48017       return nodeVal(elem).split(" ").map(parseFloat);
48018     });
48019     if (coordinates.length === 0) {
48020       return null;
48021     }
48022     return {
48023       geometry: coordinates.length > 2 ? {
48024         type: "LineString",
48025         coordinates
48026       } : {
48027         type: "Point",
48028         coordinates: coordinates[0]
48029       },
48030       times: $(node, "when").map((elem) => nodeVal(elem))
48031     };
48032   }
48033   function fixRing(ring) {
48034     if (ring.length === 0)
48035       return ring;
48036     const first = ring[0];
48037     const last = ring[ring.length - 1];
48038     let equal = true;
48039     for (let i2 = 0; i2 < Math.max(first.length, last.length); i2++) {
48040       if (first[i2] !== last[i2]) {
48041         equal = false;
48042         break;
48043       }
48044     }
48045     if (!equal) {
48046       return ring.concat([ring[0]]);
48047     }
48048     return ring;
48049   }
48050   function getCoordinates(node) {
48051     return nodeVal(get1(node, "coordinates"));
48052   }
48053   function getGeometry(node) {
48054     let geometries = [];
48055     let coordTimes = [];
48056     for (let i2 = 0; i2 < node.childNodes.length; i2++) {
48057       const child = node.childNodes.item(i2);
48058       if (isElement(child)) {
48059         switch (child.tagName) {
48060           case "MultiGeometry":
48061           case "MultiTrack":
48062           case "gx:MultiTrack": {
48063             const childGeometries = getGeometry(child);
48064             geometries = geometries.concat(childGeometries.geometries);
48065             coordTimes = coordTimes.concat(childGeometries.coordTimes);
48066             break;
48067           }
48068           case "Point": {
48069             const coordinates = coord1(getCoordinates(child));
48070             if (coordinates.length >= 2) {
48071               geometries.push({
48072                 type: "Point",
48073                 coordinates
48074               });
48075             }
48076             break;
48077           }
48078           case "LinearRing":
48079           case "LineString": {
48080             const coordinates = coord(getCoordinates(child));
48081             if (coordinates.length >= 2) {
48082               geometries.push({
48083                 type: "LineString",
48084                 coordinates
48085               });
48086             }
48087             break;
48088           }
48089           case "Polygon": {
48090             const coords = [];
48091             for (const linearRing of $(child, "LinearRing")) {
48092               const ring = fixRing(coord(getCoordinates(linearRing)));
48093               if (ring.length >= 4) {
48094                 coords.push(ring);
48095               }
48096             }
48097             if (coords.length) {
48098               geometries.push({
48099                 type: "Polygon",
48100                 coordinates: coords
48101               });
48102             }
48103             break;
48104           }
48105           case "Track":
48106           case "gx:Track": {
48107             const gx = gxCoords(child);
48108             if (!gx)
48109               break;
48110             const { times, geometry } = gx;
48111             geometries.push(geometry);
48112             if (times.length)
48113               coordTimes.push(times);
48114             break;
48115           }
48116         }
48117       }
48118     }
48119     return {
48120       geometries,
48121       coordTimes
48122     };
48123   }
48124   function geometryListToGeometry(geometries) {
48125     return geometries.length === 0 ? null : geometries.length === 1 ? geometries[0] : {
48126       type: "GeometryCollection",
48127       geometries
48128     };
48129   }
48130   function getPlacemark(node, styleMap, schema) {
48131     const { coordTimes, geometries } = getGeometry(node);
48132     const feature3 = {
48133       type: "Feature",
48134       geometry: geometryListToGeometry(geometries),
48135       properties: Object.assign(getMulti(node, [
48136         "name",
48137         "address",
48138         "visibility",
48139         "open",
48140         "phoneNumber",
48141         "description"
48142       ]), getMaybeHTMLDescription(node), extractCascadedStyle(node, styleMap), extractStyle(node), extractExtendedData(node, schema), extractTimeSpan(node), extractTimeStamp(node), coordTimes.length ? {
48143         coordinateProperties: {
48144           times: coordTimes.length === 1 ? coordTimes[0] : coordTimes
48145         }
48146       } : {})
48147     };
48148     if (feature3.properties?.visibility !== void 0) {
48149       feature3.properties.visibility = feature3.properties.visibility !== "0";
48150     }
48151     const id2 = node.getAttribute("id");
48152     if (id2 !== null && id2 !== "")
48153       feature3.id = id2;
48154     return feature3;
48155   }
48156   function getGroundOverlayBox(node) {
48157     const latLonQuad = get1(node, "gx:LatLonQuad");
48158     if (latLonQuad) {
48159       const ring = fixRing(coord(getCoordinates(node)));
48160       return {
48161         type: "Polygon",
48162         coordinates: [ring]
48163       };
48164     }
48165     return getLatLonBox(node);
48166   }
48167   var DEGREES_TO_RADIANS = Math.PI / 180;
48168   function rotateBox(bbox2, coordinates, rotation) {
48169     const center = [(bbox2[0] + bbox2[2]) / 2, (bbox2[1] + bbox2[3]) / 2];
48170     return [
48171       coordinates[0].map((coordinate) => {
48172         const dy = coordinate[1] - center[1];
48173         const dx = coordinate[0] - center[0];
48174         const distance = Math.sqrt(Math.pow(dy, 2) + Math.pow(dx, 2));
48175         const angle2 = Math.atan2(dy, dx) - rotation * DEGREES_TO_RADIANS;
48176         return [
48177           center[0] + Math.cos(angle2) * distance,
48178           center[1] + Math.sin(angle2) * distance
48179         ];
48180       })
48181     ];
48182   }
48183   function getLatLonBox(node) {
48184     const latLonBox = get1(node, "LatLonBox");
48185     if (latLonBox) {
48186       const north = num1(latLonBox, "north");
48187       const west = num1(latLonBox, "west");
48188       const east = num1(latLonBox, "east");
48189       const south = num1(latLonBox, "south");
48190       const rotation = num1(latLonBox, "rotation");
48191       if (typeof north === "number" && typeof south === "number" && typeof west === "number" && typeof east === "number") {
48192         const bbox2 = [west, south, east, north];
48193         let coordinates = [
48194           [
48195             [west, north],
48196             [east, north],
48197             [east, south],
48198             [west, south],
48199             [west, north]
48200             // top left (again)
48201           ]
48202         ];
48203         if (typeof rotation === "number") {
48204           coordinates = rotateBox(bbox2, coordinates, rotation);
48205         }
48206         return {
48207           type: "Polygon",
48208           coordinates
48209         };
48210       }
48211     }
48212     return null;
48213   }
48214   function getGroundOverlay(node, styleMap, schema) {
48215     const geometry = getGroundOverlayBox(node);
48216     const feature3 = {
48217       type: "Feature",
48218       geometry,
48219       properties: Object.assign(
48220         /**
48221          * Related to
48222          * https://gist.github.com/tmcw/037a1cb6660d74a392e9da7446540f46
48223          */
48224         { "@geometry-type": "groundoverlay" },
48225         getMulti(node, [
48226           "name",
48227           "address",
48228           "visibility",
48229           "open",
48230           "phoneNumber",
48231           "description"
48232         ]),
48233         getMaybeHTMLDescription(node),
48234         extractCascadedStyle(node, styleMap),
48235         extractStyle(node),
48236         extractIconHref(node),
48237         extractExtendedData(node, schema),
48238         extractTimeSpan(node),
48239         extractTimeStamp(node)
48240       )
48241     };
48242     if (feature3.properties?.visibility !== void 0) {
48243       feature3.properties.visibility = feature3.properties.visibility !== "0";
48244     }
48245     const id2 = node.getAttribute("id");
48246     if (id2 !== null && id2 !== "")
48247       feature3.id = id2;
48248     return feature3;
48249   }
48250   function getStyleId(style) {
48251     let id2 = style.getAttribute("id");
48252     const parentNode = style.parentNode;
48253     if (!id2 && isElement(parentNode) && parentNode.localName === "CascadingStyle") {
48254       id2 = parentNode.getAttribute("kml:id") || parentNode.getAttribute("id");
48255     }
48256     return normalizeId(id2 || "");
48257   }
48258   function buildStyleMap(node) {
48259     const styleMap = {};
48260     for (const style of $(node, "Style")) {
48261       styleMap[getStyleId(style)] = extractStyle(style);
48262     }
48263     for (const map2 of $(node, "StyleMap")) {
48264       const id2 = normalizeId(map2.getAttribute("id") || "");
48265       val1(map2, "styleUrl", (styleUrl) => {
48266         styleUrl = normalizeId(styleUrl);
48267         if (styleMap[styleUrl]) {
48268           styleMap[id2] = styleMap[styleUrl];
48269         }
48270       });
48271     }
48272     return styleMap;
48273   }
48274   function buildSchema(node) {
48275     const schema = {};
48276     for (const field of $(node, "SimpleField")) {
48277       schema[field.getAttribute("name") || ""] = typeConverters[field.getAttribute("type") || ""] || typeConverters["string"];
48278     }
48279     return schema;
48280   }
48281   function* kmlGen(node) {
48282     const styleMap = buildStyleMap(node);
48283     const schema = buildSchema(node);
48284     for (const placemark of $(node, "Placemark")) {
48285       const feature3 = getPlacemark(placemark, styleMap, schema);
48286       if (feature3)
48287         yield feature3;
48288     }
48289     for (const groundOverlay of $(node, "GroundOverlay")) {
48290       const feature3 = getGroundOverlay(groundOverlay, styleMap, schema);
48291       if (feature3)
48292         yield feature3;
48293     }
48294   }
48295   function kml(node) {
48296     return {
48297       type: "FeatureCollection",
48298       features: Array.from(kmlGen(node))
48299     };
48300   }
48301
48302   // modules/svg/data.js
48303   var _initialized = false;
48304   var _enabled = false;
48305   var _geojson;
48306   function svgData(projection2, context, dispatch10) {
48307     var throttledRedraw = throttle_default(function() {
48308       dispatch10.call("change");
48309     }, 1e3);
48310     var _showLabels = true;
48311     var detected = utilDetect();
48312     var layer = select_default2(null);
48313     var _vtService;
48314     var _fileList;
48315     var _template;
48316     var _src;
48317     function init2() {
48318       if (_initialized)
48319         return;
48320       _geojson = {};
48321       _enabled = true;
48322       function over(d3_event) {
48323         d3_event.stopPropagation();
48324         d3_event.preventDefault();
48325         d3_event.dataTransfer.dropEffect = "copy";
48326       }
48327       context.container().attr("dropzone", "copy").on("drop.svgData", function(d3_event) {
48328         d3_event.stopPropagation();
48329         d3_event.preventDefault();
48330         if (!detected.filedrop)
48331           return;
48332         drawData.fileList(d3_event.dataTransfer.files);
48333       }).on("dragenter.svgData", over).on("dragexit.svgData", over).on("dragover.svgData", over);
48334       _initialized = true;
48335     }
48336     function getService() {
48337       if (services.vectorTile && !_vtService) {
48338         _vtService = services.vectorTile;
48339         _vtService.event.on("loadedData", throttledRedraw);
48340       } else if (!services.vectorTile && _vtService) {
48341         _vtService = null;
48342       }
48343       return _vtService;
48344     }
48345     function showLayer() {
48346       layerOn();
48347       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
48348         dispatch10.call("change");
48349       });
48350     }
48351     function hideLayer() {
48352       throttledRedraw.cancel();
48353       layer.transition().duration(250).style("opacity", 0).on("end", layerOff);
48354     }
48355     function layerOn() {
48356       layer.style("display", "block");
48357     }
48358     function layerOff() {
48359       layer.selectAll(".viewfield-group").remove();
48360       layer.style("display", "none");
48361     }
48362     function ensureIDs(gj) {
48363       if (!gj)
48364         return null;
48365       if (gj.type === "FeatureCollection") {
48366         for (var i2 = 0; i2 < gj.features.length; i2++) {
48367           ensureFeatureID(gj.features[i2]);
48368         }
48369       } else {
48370         ensureFeatureID(gj);
48371       }
48372       return gj;
48373     }
48374     function ensureFeatureID(feature3) {
48375       if (!feature3)
48376         return;
48377       feature3.__featurehash__ = utilHashcode((0, import_fast_json_stable_stringify.default)(feature3));
48378       return feature3;
48379     }
48380     function getFeatures(gj) {
48381       if (!gj)
48382         return [];
48383       if (gj.type === "FeatureCollection") {
48384         return gj.features;
48385       } else {
48386         return [gj];
48387       }
48388     }
48389     function featureKey(d) {
48390       return d.__featurehash__;
48391     }
48392     function isPolygon(d) {
48393       return d.geometry.type === "Polygon" || d.geometry.type === "MultiPolygon";
48394     }
48395     function clipPathID(d) {
48396       return "ideditor-data-" + d.__featurehash__ + "-clippath";
48397     }
48398     function featureClasses(d) {
48399       return [
48400         "data" + d.__featurehash__,
48401         d.geometry.type,
48402         isPolygon(d) ? "area" : "",
48403         d.__layerID__ || ""
48404       ].filter(Boolean).join(" ");
48405     }
48406     function drawData(selection2) {
48407       var vtService = getService();
48408       var getPath = svgPath(projection2).geojson;
48409       var getAreaPath = svgPath(projection2, null, true).geojson;
48410       var hasData = drawData.hasData();
48411       layer = selection2.selectAll(".layer-mapdata").data(_enabled && hasData ? [0] : []);
48412       layer.exit().remove();
48413       layer = layer.enter().append("g").attr("class", "layer-mapdata").merge(layer);
48414       var surface = context.surface();
48415       if (!surface || surface.empty())
48416         return;
48417       var geoData, polygonData;
48418       if (_template && vtService) {
48419         var sourceID = _template;
48420         vtService.loadTiles(sourceID, _template, projection2);
48421         geoData = vtService.data(sourceID, projection2);
48422       } else {
48423         geoData = getFeatures(_geojson);
48424       }
48425       geoData = geoData.filter(getPath);
48426       polygonData = geoData.filter(isPolygon);
48427       var clipPaths = surface.selectAll("defs").selectAll(".clipPath-data").data(polygonData, featureKey);
48428       clipPaths.exit().remove();
48429       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-data").attr("id", clipPathID);
48430       clipPathsEnter.append("path");
48431       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", getAreaPath);
48432       var datagroups = layer.selectAll("g.datagroup").data(["fill", "shadow", "stroke"]);
48433       datagroups = datagroups.enter().append("g").attr("class", function(d) {
48434         return "datagroup datagroup-" + d;
48435       }).merge(datagroups);
48436       var pathData = {
48437         fill: polygonData,
48438         shadow: geoData,
48439         stroke: geoData
48440       };
48441       var paths = datagroups.selectAll("path").data(function(layer2) {
48442         return pathData[layer2];
48443       }, featureKey);
48444       paths.exit().remove();
48445       paths = paths.enter().append("path").attr("class", function(d) {
48446         var datagroup = this.parentNode.__data__;
48447         return "pathdata " + datagroup + " " + featureClasses(d);
48448       }).attr("clip-path", function(d) {
48449         var datagroup = this.parentNode.__data__;
48450         return datagroup === "fill" ? "url(#" + clipPathID(d) + ")" : null;
48451       }).merge(paths).attr("d", function(d) {
48452         var datagroup = this.parentNode.__data__;
48453         return datagroup === "fill" ? getAreaPath(d) : getPath(d);
48454       });
48455       layer.call(drawLabels, "label-halo", geoData).call(drawLabels, "label", geoData);
48456       function drawLabels(selection3, textClass, data) {
48457         var labelPath = path_default(projection2);
48458         var labelData = data.filter(function(d) {
48459           return _showLabels && d.properties && (d.properties.desc || d.properties.name);
48460         });
48461         var labels = selection3.selectAll("text." + textClass).data(labelData, featureKey);
48462         labels.exit().remove();
48463         labels = labels.enter().append("text").attr("class", function(d) {
48464           return textClass + " " + featureClasses(d);
48465         }).merge(labels).text(function(d) {
48466           return d.properties.desc || d.properties.name;
48467         }).attr("x", function(d) {
48468           var centroid = labelPath.centroid(d);
48469           return centroid[0] + 11;
48470         }).attr("y", function(d) {
48471           var centroid = labelPath.centroid(d);
48472           return centroid[1];
48473         });
48474       }
48475     }
48476     function getExtension(fileName) {
48477       if (!fileName)
48478         return;
48479       var re2 = /\.(gpx|kml|(geo)?json)$/i;
48480       var match = fileName.toLowerCase().match(re2);
48481       return match && match.length && match[0];
48482     }
48483     function xmlToDom(textdata) {
48484       return new DOMParser().parseFromString(textdata, "text/xml");
48485     }
48486     function stringifyGeojsonProperties(feature3) {
48487       const properties = feature3.properties;
48488       for (const key in properties) {
48489         const property = properties[key];
48490         if (typeof property === "number" || typeof property === "boolean" || Array.isArray(property)) {
48491           properties[key] = property.toString();
48492         } else if (property === null) {
48493           properties[key] = "null";
48494         } else if (typeof property === "object") {
48495           properties[key] = JSON.stringify(property);
48496         }
48497       }
48498     }
48499     drawData.setFile = function(extension, data) {
48500       _template = null;
48501       _fileList = null;
48502       _geojson = null;
48503       _src = null;
48504       var gj;
48505       switch (extension) {
48506         case ".gpx":
48507           gj = gpx(xmlToDom(data));
48508           break;
48509         case ".kml":
48510           gj = kml(xmlToDom(data));
48511           break;
48512         case ".geojson":
48513         case ".json":
48514           gj = JSON.parse(data);
48515           if (gj.type === "FeatureCollection") {
48516             gj.features.forEach(stringifyGeojsonProperties);
48517           } else if (gj.type === "Feature") {
48518             stringifyGeojsonProperties(gj);
48519           }
48520           break;
48521       }
48522       gj = gj || {};
48523       if (Object.keys(gj).length) {
48524         _geojson = ensureIDs(gj);
48525         _src = extension + " data file";
48526         this.fitZoom();
48527       }
48528       dispatch10.call("change");
48529       return this;
48530     };
48531     drawData.showLabels = function(val) {
48532       if (!arguments.length)
48533         return _showLabels;
48534       _showLabels = val;
48535       return this;
48536     };
48537     drawData.enabled = function(val) {
48538       if (!arguments.length)
48539         return _enabled;
48540       _enabled = val;
48541       if (_enabled) {
48542         showLayer();
48543       } else {
48544         hideLayer();
48545       }
48546       dispatch10.call("change");
48547       return this;
48548     };
48549     drawData.hasData = function() {
48550       var gj = _geojson || {};
48551       return !!(_template || Object.keys(gj).length);
48552     };
48553     drawData.template = function(val, src) {
48554       if (!arguments.length)
48555         return _template;
48556       var osm = context.connection();
48557       if (osm) {
48558         var blocklists = osm.imageryBlocklists();
48559         var fail = false;
48560         var tested = 0;
48561         var regex;
48562         for (var i2 = 0; i2 < blocklists.length; i2++) {
48563           regex = blocklists[i2];
48564           fail = regex.test(val);
48565           tested++;
48566           if (fail)
48567             break;
48568         }
48569         if (!tested) {
48570           regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
48571           fail = regex.test(val);
48572         }
48573       }
48574       _template = val;
48575       _fileList = null;
48576       _geojson = null;
48577       _src = src || "vectortile:" + val.split(/[?#]/)[0];
48578       dispatch10.call("change");
48579       return this;
48580     };
48581     drawData.geojson = function(gj, src) {
48582       if (!arguments.length)
48583         return _geojson;
48584       _template = null;
48585       _fileList = null;
48586       _geojson = null;
48587       _src = null;
48588       gj = gj || {};
48589       if (Object.keys(gj).length) {
48590         _geojson = ensureIDs(gj);
48591         _src = src || "unknown.geojson";
48592       }
48593       dispatch10.call("change");
48594       return this;
48595     };
48596     drawData.fileList = function(fileList) {
48597       if (!arguments.length)
48598         return _fileList;
48599       _template = null;
48600       _fileList = fileList;
48601       _geojson = null;
48602       _src = null;
48603       if (!fileList || !fileList.length)
48604         return this;
48605       var f2 = fileList[0];
48606       var extension = getExtension(f2.name);
48607       var reader = new FileReader();
48608       reader.onload = function() {
48609         return function(e) {
48610           drawData.setFile(extension, e.target.result);
48611         };
48612       }(f2);
48613       reader.readAsText(f2);
48614       return this;
48615     };
48616     drawData.url = function(url, defaultExtension) {
48617       _template = null;
48618       _fileList = null;
48619       _geojson = null;
48620       _src = null;
48621       var testUrl = url.split(/[?#]/)[0];
48622       var extension = getExtension(testUrl) || defaultExtension;
48623       if (extension) {
48624         _template = null;
48625         text_default3(url).then(function(data) {
48626           drawData.setFile(extension, data);
48627         }).catch(function() {
48628         });
48629       } else {
48630         drawData.template(url);
48631       }
48632       return this;
48633     };
48634     drawData.getSrc = function() {
48635       return _src || "";
48636     };
48637     drawData.fitZoom = function() {
48638       var features = getFeatures(_geojson);
48639       if (!features.length)
48640         return;
48641       var map2 = context.map();
48642       var viewport = map2.trimmedExtent().polygon();
48643       var coords = features.reduce(function(coords2, feature3) {
48644         var geom = feature3.geometry;
48645         if (!geom)
48646           return coords2;
48647         var c = geom.coordinates;
48648         switch (geom.type) {
48649           case "Point":
48650             c = [c];
48651           case "MultiPoint":
48652           case "LineString":
48653             break;
48654           case "MultiPolygon":
48655             c = utilArrayFlatten(c);
48656           case "Polygon":
48657           case "MultiLineString":
48658             c = utilArrayFlatten(c);
48659             break;
48660         }
48661         return utilArrayUnion(coords2, c);
48662       }, []);
48663       if (!geoPolygonIntersectsPolygon(viewport, coords, true)) {
48664         var extent = geoExtent(bounds_default({ type: "LineString", coordinates: coords }));
48665         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
48666       }
48667       return this;
48668     };
48669     init2();
48670     return drawData;
48671   }
48672
48673   // modules/svg/debug.js
48674   function svgDebug(projection2, context) {
48675     function drawDebug(selection2) {
48676       const showTile = context.getDebug("tile");
48677       const showCollision = context.getDebug("collision");
48678       const showImagery = context.getDebug("imagery");
48679       const showTouchTargets = context.getDebug("target");
48680       const showDownloaded = context.getDebug("downloaded");
48681       let debugData = [];
48682       if (showTile) {
48683         debugData.push({ class: "red", label: "tile" });
48684       }
48685       if (showCollision) {
48686         debugData.push({ class: "yellow", label: "collision" });
48687       }
48688       if (showImagery) {
48689         debugData.push({ class: "orange", label: "imagery" });
48690       }
48691       if (showTouchTargets) {
48692         debugData.push({ class: "pink", label: "touchTargets" });
48693       }
48694       if (showDownloaded) {
48695         debugData.push({ class: "purple", label: "downloaded" });
48696       }
48697       let legend = context.container().select(".main-content").selectAll(".debug-legend").data(debugData.length ? [0] : []);
48698       legend.exit().remove();
48699       legend = legend.enter().append("div").attr("class", "fillD debug-legend").merge(legend);
48700       let legendItems = legend.selectAll(".debug-legend-item").data(debugData, (d) => d.label);
48701       legendItems.exit().remove();
48702       legendItems.enter().append("span").attr("class", (d) => `debug-legend-item ${d.class}`).text((d) => d.label);
48703       let layer = selection2.selectAll(".layer-debug").data(showImagery || showDownloaded ? [0] : []);
48704       layer.exit().remove();
48705       layer = layer.enter().append("g").attr("class", "layer-debug").merge(layer);
48706       const extent = context.map().extent();
48707       _mainFileFetcher.get("imagery").then((d) => {
48708         const hits = showImagery && d.query.bbox(extent.rectangle(), true) || [];
48709         const features = hits.map((d2) => d2.features[d2.id]);
48710         let imagery = layer.selectAll("path.debug-imagery").data(features);
48711         imagery.exit().remove();
48712         imagery.enter().append("path").attr("class", "debug-imagery debug orange");
48713       }).catch(() => {
48714       });
48715       const osm = context.connection();
48716       let dataDownloaded = [];
48717       if (osm && showDownloaded) {
48718         const rtree = osm.caches("get").tile.rtree;
48719         dataDownloaded = rtree.all().map((bbox2) => {
48720           return {
48721             type: "Feature",
48722             properties: { id: bbox2.id },
48723             geometry: {
48724               type: "Polygon",
48725               coordinates: [[
48726                 [bbox2.minX, bbox2.minY],
48727                 [bbox2.minX, bbox2.maxY],
48728                 [bbox2.maxX, bbox2.maxY],
48729                 [bbox2.maxX, bbox2.minY],
48730                 [bbox2.minX, bbox2.minY]
48731               ]]
48732             }
48733           };
48734         });
48735       }
48736       let downloaded = layer.selectAll("path.debug-downloaded").data(showDownloaded ? dataDownloaded : []);
48737       downloaded.exit().remove();
48738       downloaded.enter().append("path").attr("class", "debug-downloaded debug purple");
48739       layer.selectAll("path").attr("d", svgPath(projection2).geojson);
48740     }
48741     drawDebug.enabled = function() {
48742       if (!arguments.length) {
48743         return context.getDebug("tile") || context.getDebug("collision") || context.getDebug("imagery") || context.getDebug("target") || context.getDebug("downloaded");
48744       } else {
48745         return this;
48746       }
48747     };
48748     return drawDebug;
48749   }
48750
48751   // modules/svg/defs.js
48752   function svgDefs(context) {
48753     var _defsSelection = select_default2(null);
48754     var _spritesheetIds = [
48755       "iD-sprite",
48756       "maki-sprite",
48757       "temaki-sprite",
48758       "fa-sprite",
48759       "roentgen-sprite",
48760       "community-sprite"
48761     ];
48762     function drawDefs(selection2) {
48763       _defsSelection = selection2.append("defs");
48764       _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");
48765       function addSidedMarker(name, color2, offset) {
48766         _defsSelection.append("marker").attr("id", "ideditor-sided-marker-" + name).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-" + name + "-path").attr("d", "M 0,0 L 1,1 L 2,0 z").attr("stroke", "none").attr("fill", color2);
48767       }
48768       addSidedMarker("natural", "rgb(170, 170, 170)", 0);
48769       addSidedMarker("coastline", "#77dede", 1);
48770       addSidedMarker("waterway", "#77dede", 1);
48771       addSidedMarker("barrier", "#ddd", 1);
48772       addSidedMarker("man_made", "#fff", 0);
48773       _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");
48774       _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");
48775       var patterns2 = _defsSelection.selectAll("pattern").data([
48776         // pattern name, pattern image name
48777         ["beach", "dots"],
48778         ["construction", "construction"],
48779         ["cemetery", "cemetery"],
48780         ["cemetery_christian", "cemetery_christian"],
48781         ["cemetery_buddhist", "cemetery_buddhist"],
48782         ["cemetery_muslim", "cemetery_muslim"],
48783         ["cemetery_jewish", "cemetery_jewish"],
48784         ["farmland", "farmland"],
48785         ["farmyard", "farmyard"],
48786         ["forest", "forest"],
48787         ["forest_broadleaved", "forest_broadleaved"],
48788         ["forest_needleleaved", "forest_needleleaved"],
48789         ["forest_leafless", "forest_leafless"],
48790         ["golf_green", "grass"],
48791         ["grass", "grass"],
48792         ["landfill", "landfill"],
48793         ["meadow", "grass"],
48794         ["orchard", "orchard"],
48795         ["pond", "pond"],
48796         ["quarry", "quarry"],
48797         ["scrub", "bushes"],
48798         ["vineyard", "vineyard"],
48799         ["water_standing", "lines"],
48800         ["waves", "waves"],
48801         ["wetland", "wetland"],
48802         ["wetland_marsh", "wetland_marsh"],
48803         ["wetland_swamp", "wetland_swamp"],
48804         ["wetland_bog", "wetland_bog"],
48805         ["wetland_reedbed", "wetland_reedbed"]
48806       ]).enter().append("pattern").attr("id", function(d) {
48807         return "ideditor-pattern-" + d[0];
48808       }).attr("width", 32).attr("height", 32).attr("patternUnits", "userSpaceOnUse");
48809       patterns2.append("rect").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("class", function(d) {
48810         return "pattern-color-" + d[0];
48811       });
48812       patterns2.append("image").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("xlink:href", function(d) {
48813         return context.imagePath("pattern/" + d[1] + ".png");
48814       });
48815       _defsSelection.selectAll("clipPath").data([12, 18, 20, 32, 45]).enter().append("clipPath").attr("id", function(d) {
48816         return "ideditor-clip-square-" + d;
48817       }).append("rect").attr("x", 0).attr("y", 0).attr("width", function(d) {
48818         return d;
48819       }).attr("height", function(d) {
48820         return d;
48821       });
48822       addSprites(_spritesheetIds, true);
48823     }
48824     function addSprites(ids, overrideColors) {
48825       _spritesheetIds = utilArrayUniq(_spritesheetIds.concat(ids));
48826       var spritesheets = _defsSelection.selectAll(".spritesheet").data(_spritesheetIds);
48827       spritesheets.enter().append("g").attr("class", function(d) {
48828         return "spritesheet spritesheet-" + d;
48829       }).each(function(d) {
48830         var url = context.imagePath(d + ".svg");
48831         var node = select_default2(this).node();
48832         svg(url).then(function(svg2) {
48833           node.appendChild(
48834             select_default2(svg2.documentElement).attr("id", "ideditor-" + d).node()
48835           );
48836           if (overrideColors && d !== "iD-sprite") {
48837             select_default2(node).selectAll("path").attr("fill", "currentColor");
48838           }
48839         }).catch(function() {
48840         });
48841       });
48842       spritesheets.exit().remove();
48843     }
48844     drawDefs.addSprites = addSprites;
48845     return drawDefs;
48846   }
48847
48848   // modules/svg/keepRight.js
48849   var _layerEnabled = false;
48850   var _qaService;
48851   function svgKeepRight(projection2, context, dispatch10) {
48852     const throttledRedraw = throttle_default(() => dispatch10.call("change"), 1e3);
48853     const minZoom3 = 12;
48854     let touchLayer = select_default2(null);
48855     let drawLayer = select_default2(null);
48856     let layerVisible = false;
48857     function markerPath(selection2, klass) {
48858       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");
48859     }
48860     function getService() {
48861       if (services.keepRight && !_qaService) {
48862         _qaService = services.keepRight;
48863         _qaService.on("loaded", throttledRedraw);
48864       } else if (!services.keepRight && _qaService) {
48865         _qaService = null;
48866       }
48867       return _qaService;
48868     }
48869     function editOn() {
48870       if (!layerVisible) {
48871         layerVisible = true;
48872         drawLayer.style("display", "block");
48873       }
48874     }
48875     function editOff() {
48876       if (layerVisible) {
48877         layerVisible = false;
48878         drawLayer.style("display", "none");
48879         drawLayer.selectAll(".qaItem.keepRight").remove();
48880         touchLayer.selectAll(".qaItem.keepRight").remove();
48881       }
48882     }
48883     function layerOn() {
48884       editOn();
48885       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch10.call("change"));
48886     }
48887     function layerOff() {
48888       throttledRedraw.cancel();
48889       drawLayer.interrupt();
48890       touchLayer.selectAll(".qaItem.keepRight").remove();
48891       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
48892         editOff();
48893         dispatch10.call("change");
48894       });
48895     }
48896     function updateMarkers() {
48897       if (!layerVisible || !_layerEnabled)
48898         return;
48899       const service = getService();
48900       const selectedID = context.selectedErrorID();
48901       const data = service ? service.getItems(projection2) : [];
48902       const getTransform = svgPointTransform(projection2);
48903       const markers = drawLayer.selectAll(".qaItem.keepRight").data(data, (d) => d.id);
48904       markers.exit().remove();
48905       const markersEnter = markers.enter().append("g").attr("class", (d) => `qaItem ${d.service} itemId-${d.id} itemType-${d.parentIssueType}`);
48906       markersEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
48907       markersEnter.append("path").call(markerPath, "shadow");
48908       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");
48909       markers.merge(markersEnter).sort(sortY).classed("selected", (d) => d.id === selectedID).attr("transform", getTransform);
48910       if (touchLayer.empty())
48911         return;
48912       const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
48913       const targets = touchLayer.selectAll(".qaItem.keepRight").data(data, (d) => d.id);
48914       targets.exit().remove();
48915       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);
48916       function sortY(a, b) {
48917         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];
48918       }
48919     }
48920     function drawKeepRight(selection2) {
48921       const service = getService();
48922       const surface = context.surface();
48923       if (surface && !surface.empty()) {
48924         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
48925       }
48926       drawLayer = selection2.selectAll(".layer-keepRight").data(service ? [0] : []);
48927       drawLayer.exit().remove();
48928       drawLayer = drawLayer.enter().append("g").attr("class", "layer-keepRight").style("display", _layerEnabled ? "block" : "none").merge(drawLayer);
48929       if (_layerEnabled) {
48930         if (service && ~~context.map().zoom() >= minZoom3) {
48931           editOn();
48932           service.loadIssues(projection2);
48933           updateMarkers();
48934         } else {
48935           editOff();
48936         }
48937       }
48938     }
48939     drawKeepRight.enabled = function(val) {
48940       if (!arguments.length)
48941         return _layerEnabled;
48942       _layerEnabled = val;
48943       if (_layerEnabled) {
48944         layerOn();
48945       } else {
48946         layerOff();
48947         if (context.selectedErrorID()) {
48948           context.enter(modeBrowse(context));
48949         }
48950       }
48951       dispatch10.call("change");
48952       return this;
48953     };
48954     drawKeepRight.supported = () => !!getService();
48955     return drawKeepRight;
48956   }
48957
48958   // modules/svg/geolocate.js
48959   function svgGeolocate(projection2) {
48960     var layer = select_default2(null);
48961     var _position;
48962     function init2() {
48963       if (svgGeolocate.initialized)
48964         return;
48965       svgGeolocate.enabled = false;
48966       svgGeolocate.initialized = true;
48967     }
48968     function showLayer() {
48969       layer.style("display", "block");
48970     }
48971     function hideLayer() {
48972       layer.transition().duration(250).style("opacity", 0);
48973     }
48974     function layerOn() {
48975       layer.style("opacity", 0).transition().duration(250).style("opacity", 1);
48976     }
48977     function layerOff() {
48978       layer.style("display", "none");
48979     }
48980     function transform2(d) {
48981       return svgPointTransform(projection2)(d);
48982     }
48983     function accuracy(accuracy2, loc) {
48984       var degreesRadius = geoMetersToLat(accuracy2), tangentLoc = [loc[0], loc[1] + degreesRadius], projectedTangent = projection2(tangentLoc), projectedLoc = projection2([loc[0], loc[1]]);
48985       return Math.round(projectedLoc[1] - projectedTangent[1]).toString();
48986     }
48987     function update() {
48988       var geolocation = { loc: [_position.coords.longitude, _position.coords.latitude] };
48989       var groups = layer.selectAll(".geolocations").selectAll(".geolocation").data([geolocation]);
48990       groups.exit().remove();
48991       var pointsEnter = groups.enter().append("g").attr("class", "geolocation");
48992       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");
48993       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");
48994       groups.merge(pointsEnter).attr("transform", transform2);
48995       layer.select(".geolocate-radius").attr("r", accuracy(_position.coords.accuracy, geolocation.loc));
48996     }
48997     function drawLocation(selection2) {
48998       var enabled = svgGeolocate.enabled;
48999       layer = selection2.selectAll(".layer-geolocate").data([0]);
49000       layer.exit().remove();
49001       var layerEnter = layer.enter().append("g").attr("class", "layer-geolocate").style("display", enabled ? "block" : "none");
49002       layerEnter.append("g").attr("class", "geolocations");
49003       layer = layerEnter.merge(layer);
49004       if (enabled) {
49005         update();
49006       } else {
49007         layerOff();
49008       }
49009     }
49010     drawLocation.enabled = function(position, enabled) {
49011       if (!arguments.length)
49012         return svgGeolocate.enabled;
49013       _position = position;
49014       svgGeolocate.enabled = enabled;
49015       if (svgGeolocate.enabled) {
49016         showLayer();
49017         layerOn();
49018       } else {
49019         hideLayer();
49020       }
49021       return this;
49022     };
49023     init2();
49024     return drawLocation;
49025   }
49026
49027   // modules/svg/labels.js
49028   var import_rbush6 = __toESM(require_rbush_min());
49029   function svgLabels(projection2, context) {
49030     var path = path_default(projection2);
49031     var detected = utilDetect();
49032     var baselineHack = detected.ie || detected.browser.toLowerCase() === "edge" || detected.browser.toLowerCase() === "firefox" && detected.version >= 70;
49033     var _rdrawn = new import_rbush6.default();
49034     var _rskipped = new import_rbush6.default();
49035     var _textWidthCache = {};
49036     var _entitybboxes = {};
49037     var labelStack = [
49038       ["line", "aeroway", "*", 12],
49039       ["line", "highway", "motorway", 12],
49040       ["line", "highway", "trunk", 12],
49041       ["line", "highway", "primary", 12],
49042       ["line", "highway", "secondary", 12],
49043       ["line", "highway", "tertiary", 12],
49044       ["line", "highway", "*", 12],
49045       ["line", "railway", "*", 12],
49046       ["line", "waterway", "*", 12],
49047       ["area", "aeroway", "*", 12],
49048       ["area", "amenity", "*", 12],
49049       ["area", "building", "*", 12],
49050       ["area", "historic", "*", 12],
49051       ["area", "leisure", "*", 12],
49052       ["area", "man_made", "*", 12],
49053       ["area", "natural", "*", 12],
49054       ["area", "shop", "*", 12],
49055       ["area", "tourism", "*", 12],
49056       ["area", "camp_site", "*", 12],
49057       ["point", "aeroway", "*", 10],
49058       ["point", "amenity", "*", 10],
49059       ["point", "building", "*", 10],
49060       ["point", "historic", "*", 10],
49061       ["point", "leisure", "*", 10],
49062       ["point", "man_made", "*", 10],
49063       ["point", "natural", "*", 10],
49064       ["point", "shop", "*", 10],
49065       ["point", "tourism", "*", 10],
49066       ["point", "camp_site", "*", 10],
49067       ["line", "ref", "*", 12],
49068       ["area", "ref", "*", 12],
49069       ["point", "ref", "*", 10],
49070       ["line", "name", "*", 12],
49071       ["area", "name", "*", 12],
49072       ["point", "name", "*", 10]
49073     ];
49074     function shouldSkipIcon(preset) {
49075       var noIcons = ["building", "landuse", "natural"];
49076       return noIcons.some(function(s) {
49077         return preset.id.indexOf(s) >= 0;
49078       });
49079     }
49080     function get4(array2, prop) {
49081       return function(d, i2) {
49082         return array2[i2][prop];
49083       };
49084     }
49085     function textWidth(text2, size, elem) {
49086       var c = _textWidthCache[size];
49087       if (!c)
49088         c = _textWidthCache[size] = {};
49089       if (c[text2]) {
49090         return c[text2];
49091       } else if (elem) {
49092         c[text2] = elem.getComputedTextLength();
49093         return c[text2];
49094       } else {
49095         var str2 = encodeURIComponent(text2).match(/%[CDEFcdef]/g);
49096         if (str2 === null) {
49097           return size / 3 * 2 * text2.length;
49098         } else {
49099           return size / 3 * (2 * text2.length + str2.length);
49100         }
49101       }
49102     }
49103     function drawLinePaths(selection2, entities, filter2, classes, labels) {
49104       var paths = selection2.selectAll("path").filter(filter2).data(entities, osmEntity.key);
49105       paths.exit().remove();
49106       paths.enter().append("path").style("stroke-width", get4(labels, "font-size")).attr("id", function(d) {
49107         return "ideditor-labelpath-" + d.id;
49108       }).attr("class", classes).merge(paths).attr("d", get4(labels, "lineString"));
49109     }
49110     function drawLineLabels(selection2, entities, filter2, classes, labels) {
49111       var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
49112       texts.exit().remove();
49113       texts.enter().append("text").attr("class", function(d, i2) {
49114         return classes + " " + labels[i2].classes + " " + d.id;
49115       }).attr("dy", baselineHack ? "0.35em" : null).append("textPath").attr("class", "textpath");
49116       selection2.selectAll("text." + classes).selectAll(".textpath").filter(filter2).data(entities, osmEntity.key).attr("startOffset", "50%").attr("xlink:href", function(d) {
49117         return "#ideditor-labelpath-" + d.id;
49118       }).text(utilDisplayNameForPath);
49119     }
49120     function drawPointLabels(selection2, entities, filter2, classes, labels) {
49121       var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
49122       texts.exit().remove();
49123       texts.enter().append("text").attr("class", function(d, i2) {
49124         return classes + " " + labels[i2].classes + " " + d.id;
49125       }).merge(texts).attr("x", get4(labels, "x")).attr("y", get4(labels, "y")).style("text-anchor", get4(labels, "textAnchor")).text(utilDisplayName).each(function(d, i2) {
49126         textWidth(utilDisplayName(d), labels[i2].height, this);
49127       });
49128     }
49129     function drawAreaLabels(selection2, entities, filter2, classes, labels) {
49130       entities = entities.filter(hasText);
49131       labels = labels.filter(hasText);
49132       drawPointLabels(selection2, entities, filter2, classes, labels);
49133       function hasText(d, i2) {
49134         return labels[i2].hasOwnProperty("x") && labels[i2].hasOwnProperty("y");
49135       }
49136     }
49137     function drawAreaIcons(selection2, entities, filter2, classes, labels) {
49138       var icons = selection2.selectAll("use." + classes).filter(filter2).data(entities, osmEntity.key);
49139       icons.exit().remove();
49140       icons.enter().append("use").attr("class", "icon " + classes).attr("width", "17px").attr("height", "17px").merge(icons).attr("transform", get4(labels, "transform")).attr("xlink:href", function(d) {
49141         var preset = _mainPresetIndex.match(d, context.graph());
49142         var picon = preset && preset.icon;
49143         return picon ? "#" + picon : "";
49144       });
49145     }
49146     function drawCollisionBoxes(selection2, rtree, which) {
49147       var classes = "debug " + which + " " + (which === "debug-skipped" ? "orange" : "yellow");
49148       var gj = [];
49149       if (context.getDebug("collision")) {
49150         gj = rtree.all().map(function(d) {
49151           return { type: "Polygon", coordinates: [[
49152             [d.minX, d.minY],
49153             [d.maxX, d.minY],
49154             [d.maxX, d.maxY],
49155             [d.minX, d.maxY],
49156             [d.minX, d.minY]
49157           ]] };
49158         });
49159       }
49160       var boxes = selection2.selectAll("." + which).data(gj);
49161       boxes.exit().remove();
49162       boxes.enter().append("path").attr("class", classes).merge(boxes).attr("d", path_default());
49163     }
49164     function drawLabels(selection2, graph, entities, filter2, dimensions, fullRedraw) {
49165       var wireframe = context.surface().classed("fill-wireframe");
49166       var zoom = geoScaleToZoom(projection2.scale());
49167       var labelable = [];
49168       var renderNodeAs = {};
49169       var i2, j2, k, entity, geometry;
49170       for (i2 = 0; i2 < labelStack.length; i2++) {
49171         labelable.push([]);
49172       }
49173       if (fullRedraw) {
49174         _rdrawn.clear();
49175         _rskipped.clear();
49176         _entitybboxes = {};
49177       } else {
49178         for (i2 = 0; i2 < entities.length; i2++) {
49179           entity = entities[i2];
49180           var toRemove = [].concat(_entitybboxes[entity.id] || []).concat(_entitybboxes[entity.id + "I"] || []);
49181           for (j2 = 0; j2 < toRemove.length; j2++) {
49182             _rdrawn.remove(toRemove[j2]);
49183             _rskipped.remove(toRemove[j2]);
49184           }
49185         }
49186       }
49187       for (i2 = 0; i2 < entities.length; i2++) {
49188         entity = entities[i2];
49189         geometry = entity.geometry(graph);
49190         if (geometry === "point" || geometry === "vertex" && isInterestingVertex(entity)) {
49191           var hasDirections = entity.directions(graph, projection2).length;
49192           var markerPadding;
49193           if (!wireframe && geometry === "point" && !(zoom >= 18 && hasDirections)) {
49194             renderNodeAs[entity.id] = "point";
49195             markerPadding = 20;
49196           } else {
49197             renderNodeAs[entity.id] = "vertex";
49198             markerPadding = 0;
49199           }
49200           var coord2 = projection2(entity.loc);
49201           var nodePadding = 10;
49202           var bbox2 = {
49203             minX: coord2[0] - nodePadding,
49204             minY: coord2[1] - nodePadding - markerPadding,
49205             maxX: coord2[0] + nodePadding,
49206             maxY: coord2[1] + nodePadding
49207           };
49208           doInsert(bbox2, entity.id + "P");
49209         }
49210         if (geometry === "vertex") {
49211           geometry = "point";
49212         }
49213         var preset = geometry === "area" && _mainPresetIndex.match(entity, graph);
49214         var icon2 = preset && !shouldSkipIcon(preset) && preset.icon;
49215         if (!icon2 && !utilDisplayName(entity))
49216           continue;
49217         for (k = 0; k < labelStack.length; k++) {
49218           var matchGeom = labelStack[k][0];
49219           var matchKey = labelStack[k][1];
49220           var matchVal = labelStack[k][2];
49221           var hasVal = entity.tags[matchKey];
49222           if (geometry === matchGeom && hasVal && (matchVal === "*" || matchVal === hasVal)) {
49223             labelable[k].push(entity);
49224             break;
49225           }
49226         }
49227       }
49228       var positions = {
49229         point: [],
49230         line: [],
49231         area: []
49232       };
49233       var labelled = {
49234         point: [],
49235         line: [],
49236         area: []
49237       };
49238       for (k = 0; k < labelable.length; k++) {
49239         var fontSize = labelStack[k][3];
49240         for (i2 = 0; i2 < labelable[k].length; i2++) {
49241           entity = labelable[k][i2];
49242           geometry = entity.geometry(graph);
49243           var getName = geometry === "line" ? utilDisplayNameForPath : utilDisplayName;
49244           var name = getName(entity);
49245           var width = name && textWidth(name, fontSize);
49246           var p = null;
49247           if (geometry === "point" || geometry === "vertex") {
49248             if (wireframe)
49249               continue;
49250             var renderAs = renderNodeAs[entity.id];
49251             if (renderAs === "vertex" && zoom < 17)
49252               continue;
49253             p = getPointLabel(entity, width, fontSize, renderAs);
49254           } else if (geometry === "line") {
49255             p = getLineLabel(entity, width, fontSize);
49256           } else if (geometry === "area") {
49257             p = getAreaLabel(entity, width, fontSize);
49258           }
49259           if (p) {
49260             if (geometry === "vertex") {
49261               geometry = "point";
49262             }
49263             p.classes = geometry + " tag-" + labelStack[k][1];
49264             positions[geometry].push(p);
49265             labelled[geometry].push(entity);
49266           }
49267         }
49268       }
49269       function isInterestingVertex(entity2) {
49270         var selectedIDs = context.selectedIDs();
49271         return entity2.hasInterestingTags() || entity2.isEndpoint(graph) || entity2.isConnected(graph) || selectedIDs.indexOf(entity2.id) !== -1 || graph.parentWays(entity2).some(function(parent) {
49272           return selectedIDs.indexOf(parent.id) !== -1;
49273         });
49274       }
49275       function getPointLabel(entity2, width2, height, geometry2) {
49276         var y = geometry2 === "point" ? -12 : 0;
49277         var pointOffsets = {
49278           ltr: [15, y, "start"],
49279           rtl: [-15, y, "end"]
49280         };
49281         var textDirection = _mainLocalizer.textDirection();
49282         var coord3 = projection2(entity2.loc);
49283         var textPadding = 2;
49284         var offset = pointOffsets[textDirection];
49285         var p2 = {
49286           height,
49287           width: width2,
49288           x: coord3[0] + offset[0],
49289           y: coord3[1] + offset[1],
49290           textAnchor: offset[2]
49291         };
49292         var bbox3;
49293         if (textDirection === "rtl") {
49294           bbox3 = {
49295             minX: p2.x - width2 - textPadding,
49296             minY: p2.y - height / 2 - textPadding,
49297             maxX: p2.x + textPadding,
49298             maxY: p2.y + height / 2 + textPadding
49299           };
49300         } else {
49301           bbox3 = {
49302             minX: p2.x - textPadding,
49303             minY: p2.y - height / 2 - textPadding,
49304             maxX: p2.x + width2 + textPadding,
49305             maxY: p2.y + height / 2 + textPadding
49306           };
49307         }
49308         if (tryInsert([bbox3], entity2.id, true)) {
49309           return p2;
49310         }
49311       }
49312       function getLineLabel(entity2, width2, height) {
49313         var viewport = geoExtent(context.projection.clipExtent()).polygon();
49314         var points = graph.childNodes(entity2).map(function(node) {
49315           return projection2(node.loc);
49316         });
49317         var length = geoPathLength(points);
49318         if (length < width2 + 20)
49319           return;
49320         var lineOffsets = [
49321           50,
49322           45,
49323           55,
49324           40,
49325           60,
49326           35,
49327           65,
49328           30,
49329           70,
49330           25,
49331           75,
49332           20,
49333           80,
49334           15,
49335           95,
49336           10,
49337           90,
49338           5,
49339           95
49340         ];
49341         var padding = 3;
49342         for (var i3 = 0; i3 < lineOffsets.length; i3++) {
49343           var offset = lineOffsets[i3];
49344           var middle = offset / 100 * length;
49345           var start2 = middle - width2 / 2;
49346           if (start2 < 0 || start2 + width2 > length)
49347             continue;
49348           var sub = subpath(points, start2, start2 + width2);
49349           if (!sub || !geoPolygonIntersectsPolygon(viewport, sub, true)) {
49350             continue;
49351           }
49352           var isReverse = reverse(sub);
49353           if (isReverse) {
49354             sub = sub.reverse();
49355           }
49356           var bboxes = [];
49357           var boxsize = (height + 2) / 2;
49358           for (var j3 = 0; j3 < sub.length - 1; j3++) {
49359             var a = sub[j3];
49360             var b = sub[j3 + 1];
49361             var num = Math.max(1, Math.floor(geoVecLength(a, b) / boxsize / 2));
49362             for (var box = 0; box < num; box++) {
49363               var p2 = geoVecInterp(a, b, box / num);
49364               var x05 = p2[0] - boxsize - padding;
49365               var y05 = p2[1] - boxsize - padding;
49366               var x12 = p2[0] + boxsize + padding;
49367               var y12 = p2[1] + boxsize + padding;
49368               bboxes.push({
49369                 minX: Math.min(x05, x12),
49370                 minY: Math.min(y05, y12),
49371                 maxX: Math.max(x05, x12),
49372                 maxY: Math.max(y05, y12)
49373               });
49374             }
49375           }
49376           if (tryInsert(bboxes, entity2.id, false)) {
49377             return {
49378               "font-size": height + 2,
49379               lineString: lineString2(sub),
49380               startOffset: offset + "%"
49381             };
49382           }
49383         }
49384         function reverse(p3) {
49385           var angle2 = Math.atan2(p3[1][1] - p3[0][1], p3[1][0] - p3[0][0]);
49386           return !(p3[0][0] < p3[p3.length - 1][0] && angle2 < Math.PI / 2 && angle2 > -Math.PI / 2);
49387         }
49388         function lineString2(points2) {
49389           return "M" + points2.join("L");
49390         }
49391         function subpath(points2, from, to) {
49392           var sofar = 0;
49393           var start3, end, i0, i1;
49394           for (var i4 = 0; i4 < points2.length - 1; i4++) {
49395             var a2 = points2[i4];
49396             var b2 = points2[i4 + 1];
49397             var current = geoVecLength(a2, b2);
49398             var portion;
49399             if (!start3 && sofar + current >= from) {
49400               portion = (from - sofar) / current;
49401               start3 = [
49402                 a2[0] + portion * (b2[0] - a2[0]),
49403                 a2[1] + portion * (b2[1] - a2[1])
49404               ];
49405               i0 = i4 + 1;
49406             }
49407             if (!end && sofar + current >= to) {
49408               portion = (to - sofar) / current;
49409               end = [
49410                 a2[0] + portion * (b2[0] - a2[0]),
49411                 a2[1] + portion * (b2[1] - a2[1])
49412               ];
49413               i1 = i4 + 1;
49414             }
49415             sofar += current;
49416           }
49417           var result = points2.slice(i0, i1);
49418           result.unshift(start3);
49419           result.push(end);
49420           return result;
49421         }
49422       }
49423       function getAreaLabel(entity2, width2, height) {
49424         var centroid = path.centroid(entity2.asGeoJSON(graph));
49425         var extent = entity2.extent(graph);
49426         var areaWidth = projection2(extent[1])[0] - projection2(extent[0])[0];
49427         if (isNaN(centroid[0]) || areaWidth < 20)
49428           return;
49429         var preset2 = _mainPresetIndex.match(entity2, context.graph());
49430         var picon = preset2 && preset2.icon;
49431         var iconSize = 17;
49432         var padding = 2;
49433         var p2 = {};
49434         if (picon) {
49435           if (addIcon()) {
49436             addLabel(iconSize + padding);
49437             return p2;
49438           }
49439         } else {
49440           if (addLabel(0)) {
49441             return p2;
49442           }
49443         }
49444         function addIcon() {
49445           var iconX = centroid[0] - iconSize / 2;
49446           var iconY = centroid[1] - iconSize / 2;
49447           var bbox3 = {
49448             minX: iconX,
49449             minY: iconY,
49450             maxX: iconX + iconSize,
49451             maxY: iconY + iconSize
49452           };
49453           if (tryInsert([bbox3], entity2.id + "I", true)) {
49454             p2.transform = "translate(" + iconX + "," + iconY + ")";
49455             return true;
49456           }
49457           return false;
49458         }
49459         function addLabel(yOffset) {
49460           if (width2 && areaWidth >= width2 + 20) {
49461             var labelX = centroid[0];
49462             var labelY = centroid[1] + yOffset;
49463             var bbox3 = {
49464               minX: labelX - width2 / 2 - padding,
49465               minY: labelY - height / 2 - padding,
49466               maxX: labelX + width2 / 2 + padding,
49467               maxY: labelY + height / 2 + padding
49468             };
49469             if (tryInsert([bbox3], entity2.id, true)) {
49470               p2.x = labelX;
49471               p2.y = labelY;
49472               p2.textAnchor = "middle";
49473               p2.height = height;
49474               return true;
49475             }
49476           }
49477           return false;
49478         }
49479       }
49480       function doInsert(bbox3, id2) {
49481         bbox3.id = id2;
49482         var oldbox = _entitybboxes[id2];
49483         if (oldbox) {
49484           _rdrawn.remove(oldbox);
49485         }
49486         _entitybboxes[id2] = bbox3;
49487         _rdrawn.insert(bbox3);
49488       }
49489       function tryInsert(bboxes, id2, saveSkipped) {
49490         var skipped = false;
49491         for (var i3 = 0; i3 < bboxes.length; i3++) {
49492           var bbox3 = bboxes[i3];
49493           bbox3.id = id2;
49494           if (bbox3.minX < 0 || bbox3.minY < 0 || bbox3.maxX > dimensions[0] || bbox3.maxY > dimensions[1]) {
49495             skipped = true;
49496             break;
49497           }
49498           if (_rdrawn.collides(bbox3)) {
49499             skipped = true;
49500             break;
49501           }
49502         }
49503         _entitybboxes[id2] = bboxes;
49504         if (skipped) {
49505           if (saveSkipped) {
49506             _rskipped.load(bboxes);
49507           }
49508         } else {
49509           _rdrawn.load(bboxes);
49510         }
49511         return !skipped;
49512       }
49513       var layer = selection2.selectAll(".layer-osm.labels");
49514       layer.selectAll(".labels-group").data(["halo", "label", "debug"]).enter().append("g").attr("class", function(d) {
49515         return "labels-group " + d;
49516       });
49517       var halo = layer.selectAll(".labels-group.halo");
49518       var label = layer.selectAll(".labels-group.label");
49519       var debug2 = layer.selectAll(".labels-group.debug");
49520       drawPointLabels(label, labelled.point, filter2, "pointlabel", positions.point);
49521       drawPointLabels(halo, labelled.point, filter2, "pointlabel-halo", positions.point);
49522       drawLinePaths(layer, labelled.line, filter2, "", positions.line);
49523       drawLineLabels(label, labelled.line, filter2, "linelabel", positions.line);
49524       drawLineLabels(halo, labelled.line, filter2, "linelabel-halo", positions.line);
49525       drawAreaLabels(label, labelled.area, filter2, "arealabel", positions.area);
49526       drawAreaLabels(halo, labelled.area, filter2, "arealabel-halo", positions.area);
49527       drawAreaIcons(label, labelled.area, filter2, "areaicon", positions.area);
49528       drawAreaIcons(halo, labelled.area, filter2, "areaicon-halo", positions.area);
49529       drawCollisionBoxes(debug2, _rskipped, "debug-skipped");
49530       drawCollisionBoxes(debug2, _rdrawn, "debug-drawn");
49531       layer.call(filterLabels);
49532     }
49533     function filterLabels(selection2) {
49534       var drawLayer = selection2.selectAll(".layer-osm.labels");
49535       var layers = drawLayer.selectAll(".labels-group.halo, .labels-group.label");
49536       layers.selectAll(".nolabel").classed("nolabel", false);
49537       var mouse = context.map().mouse();
49538       var graph = context.graph();
49539       var selectedIDs = context.selectedIDs();
49540       var ids = [];
49541       var pad2, bbox2;
49542       if (mouse) {
49543         pad2 = 20;
49544         bbox2 = { minX: mouse[0] - pad2, minY: mouse[1] - pad2, maxX: mouse[0] + pad2, maxY: mouse[1] + pad2 };
49545         var nearMouse = _rdrawn.search(bbox2).map(function(entity2) {
49546           return entity2.id;
49547         });
49548         ids.push.apply(ids, nearMouse);
49549       }
49550       for (var i2 = 0; i2 < selectedIDs.length; i2++) {
49551         var entity = graph.hasEntity(selectedIDs[i2]);
49552         if (entity && entity.type === "node") {
49553           ids.push(selectedIDs[i2]);
49554         }
49555       }
49556       layers.selectAll(utilEntitySelector(ids)).classed("nolabel", true);
49557       var debug2 = selection2.selectAll(".labels-group.debug");
49558       var gj = [];
49559       if (context.getDebug("collision")) {
49560         gj = bbox2 ? [{
49561           type: "Polygon",
49562           coordinates: [[
49563             [bbox2.minX, bbox2.minY],
49564             [bbox2.maxX, bbox2.minY],
49565             [bbox2.maxX, bbox2.maxY],
49566             [bbox2.minX, bbox2.maxY],
49567             [bbox2.minX, bbox2.minY]
49568           ]]
49569         }] : [];
49570       }
49571       var box = debug2.selectAll(".debug-mouse").data(gj);
49572       box.exit().remove();
49573       box.enter().append("path").attr("class", "debug debug-mouse yellow").merge(box).attr("d", path_default());
49574     }
49575     var throttleFilterLabels = throttle_default(filterLabels, 100);
49576     drawLabels.observe = function(selection2) {
49577       var listener = function() {
49578         throttleFilterLabels(selection2);
49579       };
49580       selection2.on("mousemove.hidelabels", listener);
49581       context.on("enter.hidelabels", listener);
49582     };
49583     drawLabels.off = function(selection2) {
49584       throttleFilterLabels.cancel();
49585       selection2.on("mousemove.hidelabels", null);
49586       context.on("enter.hidelabels", null);
49587     };
49588     return drawLabels;
49589   }
49590
49591   // modules/svg/improveOSM.js
49592   var _layerEnabled2 = false;
49593   var _qaService2;
49594   function svgImproveOSM(projection2, context, dispatch10) {
49595     const throttledRedraw = throttle_default(() => dispatch10.call("change"), 1e3);
49596     const minZoom3 = 12;
49597     let touchLayer = select_default2(null);
49598     let drawLayer = select_default2(null);
49599     let layerVisible = false;
49600     function markerPath(selection2, klass) {
49601       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");
49602     }
49603     function getService() {
49604       if (services.improveOSM && !_qaService2) {
49605         _qaService2 = services.improveOSM;
49606         _qaService2.on("loaded", throttledRedraw);
49607       } else if (!services.improveOSM && _qaService2) {
49608         _qaService2 = null;
49609       }
49610       return _qaService2;
49611     }
49612     function editOn() {
49613       if (!layerVisible) {
49614         layerVisible = true;
49615         drawLayer.style("display", "block");
49616       }
49617     }
49618     function editOff() {
49619       if (layerVisible) {
49620         layerVisible = false;
49621         drawLayer.style("display", "none");
49622         drawLayer.selectAll(".qaItem.improveOSM").remove();
49623         touchLayer.selectAll(".qaItem.improveOSM").remove();
49624       }
49625     }
49626     function layerOn() {
49627       editOn();
49628       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch10.call("change"));
49629     }
49630     function layerOff() {
49631       throttledRedraw.cancel();
49632       drawLayer.interrupt();
49633       touchLayer.selectAll(".qaItem.improveOSM").remove();
49634       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
49635         editOff();
49636         dispatch10.call("change");
49637       });
49638     }
49639     function updateMarkers() {
49640       if (!layerVisible || !_layerEnabled2)
49641         return;
49642       const service = getService();
49643       const selectedID = context.selectedErrorID();
49644       const data = service ? service.getItems(projection2) : [];
49645       const getTransform = svgPointTransform(projection2);
49646       const markers = drawLayer.selectAll(".qaItem.improveOSM").data(data, (d) => d.id);
49647       markers.exit().remove();
49648       const markersEnter = markers.enter().append("g").attr("class", (d) => `qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`);
49649       markersEnter.append("polygon").call(markerPath, "shadow");
49650       markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
49651       markersEnter.append("polygon").attr("fill", "currentColor").call(markerPath, "qaItem-fill");
49652       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 : "");
49653       markers.merge(markersEnter).sort(sortY).classed("selected", (d) => d.id === selectedID).attr("transform", getTransform);
49654       if (touchLayer.empty())
49655         return;
49656       const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
49657       const targets = touchLayer.selectAll(".qaItem.improveOSM").data(data, (d) => d.id);
49658       targets.exit().remove();
49659       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);
49660       function sortY(a, b) {
49661         return a.id === selectedID ? 1 : b.id === selectedID ? -1 : b.loc[1] - a.loc[1];
49662       }
49663     }
49664     function drawImproveOSM(selection2) {
49665       const service = getService();
49666       const surface = context.surface();
49667       if (surface && !surface.empty()) {
49668         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
49669       }
49670       drawLayer = selection2.selectAll(".layer-improveOSM").data(service ? [0] : []);
49671       drawLayer.exit().remove();
49672       drawLayer = drawLayer.enter().append("g").attr("class", "layer-improveOSM").style("display", _layerEnabled2 ? "block" : "none").merge(drawLayer);
49673       if (_layerEnabled2) {
49674         if (service && ~~context.map().zoom() >= minZoom3) {
49675           editOn();
49676           service.loadIssues(projection2);
49677           updateMarkers();
49678         } else {
49679           editOff();
49680         }
49681       }
49682     }
49683     drawImproveOSM.enabled = function(val) {
49684       if (!arguments.length)
49685         return _layerEnabled2;
49686       _layerEnabled2 = val;
49687       if (_layerEnabled2) {
49688         layerOn();
49689       } else {
49690         layerOff();
49691         if (context.selectedErrorID()) {
49692           context.enter(modeBrowse(context));
49693         }
49694       }
49695       dispatch10.call("change");
49696       return this;
49697     };
49698     drawImproveOSM.supported = () => !!getService();
49699     return drawImproveOSM;
49700   }
49701
49702   // modules/svg/osmose.js
49703   var _layerEnabled3 = false;
49704   var _qaService3;
49705   function svgOsmose(projection2, context, dispatch10) {
49706     const throttledRedraw = throttle_default(() => dispatch10.call("change"), 1e3);
49707     const minZoom3 = 12;
49708     let touchLayer = select_default2(null);
49709     let drawLayer = select_default2(null);
49710     let layerVisible = false;
49711     function markerPath(selection2, klass) {
49712       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");
49713     }
49714     function getService() {
49715       if (services.osmose && !_qaService3) {
49716         _qaService3 = services.osmose;
49717         _qaService3.on("loaded", throttledRedraw);
49718       } else if (!services.osmose && _qaService3) {
49719         _qaService3 = null;
49720       }
49721       return _qaService3;
49722     }
49723     function editOn() {
49724       if (!layerVisible) {
49725         layerVisible = true;
49726         drawLayer.style("display", "block");
49727       }
49728     }
49729     function editOff() {
49730       if (layerVisible) {
49731         layerVisible = false;
49732         drawLayer.style("display", "none");
49733         drawLayer.selectAll(".qaItem.osmose").remove();
49734         touchLayer.selectAll(".qaItem.osmose").remove();
49735       }
49736     }
49737     function layerOn() {
49738       editOn();
49739       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch10.call("change"));
49740     }
49741     function layerOff() {
49742       throttledRedraw.cancel();
49743       drawLayer.interrupt();
49744       touchLayer.selectAll(".qaItem.osmose").remove();
49745       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
49746         editOff();
49747         dispatch10.call("change");
49748       });
49749     }
49750     function updateMarkers() {
49751       if (!layerVisible || !_layerEnabled3)
49752         return;
49753       const service = getService();
49754       const selectedID = context.selectedErrorID();
49755       const data = service ? service.getItems(projection2) : [];
49756       const getTransform = svgPointTransform(projection2);
49757       const markers = drawLayer.selectAll(".qaItem.osmose").data(data, (d) => d.id);
49758       markers.exit().remove();
49759       const markersEnter = markers.enter().append("g").attr("class", (d) => `qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`);
49760       markersEnter.append("polygon").call(markerPath, "shadow");
49761       markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
49762       markersEnter.append("polygon").attr("fill", (d) => service.getColor(d.item)).call(markerPath, "qaItem-fill");
49763       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 : "");
49764       markers.merge(markersEnter).sort(sortY).classed("selected", (d) => d.id === selectedID).attr("transform", getTransform);
49765       if (touchLayer.empty())
49766         return;
49767       const fillClass = context.getDebug("target") ? "pink" : "nocolor";
49768       const targets = touchLayer.selectAll(".qaItem.osmose").data(data, (d) => d.id);
49769       targets.exit().remove();
49770       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);
49771       function sortY(a, b) {
49772         return a.id === selectedID ? 1 : b.id === selectedID ? -1 : b.loc[1] - a.loc[1];
49773       }
49774     }
49775     function drawOsmose(selection2) {
49776       const service = getService();
49777       const surface = context.surface();
49778       if (surface && !surface.empty()) {
49779         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
49780       }
49781       drawLayer = selection2.selectAll(".layer-osmose").data(service ? [0] : []);
49782       drawLayer.exit().remove();
49783       drawLayer = drawLayer.enter().append("g").attr("class", "layer-osmose").style("display", _layerEnabled3 ? "block" : "none").merge(drawLayer);
49784       if (_layerEnabled3) {
49785         if (service && ~~context.map().zoom() >= minZoom3) {
49786           editOn();
49787           service.loadIssues(projection2);
49788           updateMarkers();
49789         } else {
49790           editOff();
49791         }
49792       }
49793     }
49794     drawOsmose.enabled = function(val) {
49795       if (!arguments.length)
49796         return _layerEnabled3;
49797       _layerEnabled3 = val;
49798       if (_layerEnabled3) {
49799         getService().loadStrings().then(layerOn).catch((err) => {
49800           console.log(err);
49801         });
49802       } else {
49803         layerOff();
49804         if (context.selectedErrorID()) {
49805           context.enter(modeBrowse(context));
49806         }
49807       }
49808       dispatch10.call("change");
49809       return this;
49810     };
49811     drawOsmose.supported = () => !!getService();
49812     return drawOsmose;
49813   }
49814
49815   // modules/svg/streetside.js
49816   function svgStreetside(projection2, context, dispatch10) {
49817     var throttledRedraw = throttle_default(function() {
49818       dispatch10.call("change");
49819     }, 1e3);
49820     var minZoom3 = 14;
49821     var minMarkerZoom = 16;
49822     var minViewfieldZoom = 18;
49823     var layer = select_default2(null);
49824     var _viewerYaw = 0;
49825     var _selectedSequence = null;
49826     var _streetside;
49827     function init2() {
49828       if (svgStreetside.initialized)
49829         return;
49830       svgStreetside.enabled = false;
49831       svgStreetside.initialized = true;
49832     }
49833     function getService() {
49834       if (services.streetside && !_streetside) {
49835         _streetside = services.streetside;
49836         _streetside.event.on("viewerChanged.svgStreetside", viewerChanged).on("loadedImages.svgStreetside", throttledRedraw);
49837       } else if (!services.streetside && _streetside) {
49838         _streetside = null;
49839       }
49840       return _streetside;
49841     }
49842     function showLayer() {
49843       var service = getService();
49844       if (!service)
49845         return;
49846       editOn();
49847       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
49848         dispatch10.call("change");
49849       });
49850     }
49851     function hideLayer() {
49852       throttledRedraw.cancel();
49853       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
49854     }
49855     function editOn() {
49856       layer.style("display", "block");
49857     }
49858     function editOff() {
49859       layer.selectAll(".viewfield-group").remove();
49860       layer.style("display", "none");
49861     }
49862     function click(d3_event, d) {
49863       var service = getService();
49864       if (!service)
49865         return;
49866       if (d.sequenceKey !== _selectedSequence) {
49867         _viewerYaw = 0;
49868       }
49869       _selectedSequence = d.sequenceKey;
49870       service.ensureViewerLoaded(context).then(function() {
49871         service.selectImage(context, d.key).yaw(_viewerYaw).showViewer(context);
49872       });
49873       context.map().centerEase(d.loc);
49874     }
49875     function mouseover(d3_event, d) {
49876       var service = getService();
49877       if (service)
49878         service.setStyles(context, d);
49879     }
49880     function mouseout() {
49881       var service = getService();
49882       if (service)
49883         service.setStyles(context, null);
49884     }
49885     function transform2(d) {
49886       var t = svgPointTransform(projection2)(d);
49887       var rot = d.ca + _viewerYaw;
49888       if (rot) {
49889         t += " rotate(" + Math.floor(rot) + ",0,0)";
49890       }
49891       return t;
49892     }
49893     function viewerChanged() {
49894       var service = getService();
49895       if (!service)
49896         return;
49897       var viewer = service.viewer();
49898       if (!viewer)
49899         return;
49900       _viewerYaw = viewer.getYaw();
49901       if (context.map().isTransformed())
49902         return;
49903       layer.selectAll(".viewfield-group.currentView").attr("transform", transform2);
49904     }
49905     function filterBubbles(bubbles) {
49906       var fromDate = context.photos().fromDate();
49907       var toDate = context.photos().toDate();
49908       var usernames = context.photos().usernames();
49909       if (fromDate) {
49910         var fromTimestamp = new Date(fromDate).getTime();
49911         bubbles = bubbles.filter(function(bubble) {
49912           return new Date(bubble.captured_at).getTime() >= fromTimestamp;
49913         });
49914       }
49915       if (toDate) {
49916         var toTimestamp = new Date(toDate).getTime();
49917         bubbles = bubbles.filter(function(bubble) {
49918           return new Date(bubble.captured_at).getTime() <= toTimestamp;
49919         });
49920       }
49921       if (usernames) {
49922         bubbles = bubbles.filter(function(bubble) {
49923           return usernames.indexOf(bubble.captured_by) !== -1;
49924         });
49925       }
49926       return bubbles;
49927     }
49928     function filterSequences(sequences) {
49929       var fromDate = context.photos().fromDate();
49930       var toDate = context.photos().toDate();
49931       var usernames = context.photos().usernames();
49932       if (fromDate) {
49933         var fromTimestamp = new Date(fromDate).getTime();
49934         sequences = sequences.filter(function(sequences2) {
49935           return new Date(sequences2.properties.captured_at).getTime() >= fromTimestamp;
49936         });
49937       }
49938       if (toDate) {
49939         var toTimestamp = new Date(toDate).getTime();
49940         sequences = sequences.filter(function(sequences2) {
49941           return new Date(sequences2.properties.captured_at).getTime() <= toTimestamp;
49942         });
49943       }
49944       if (usernames) {
49945         sequences = sequences.filter(function(sequences2) {
49946           return usernames.indexOf(sequences2.properties.captured_by) !== -1;
49947         });
49948       }
49949       return sequences;
49950     }
49951     function update() {
49952       var viewer = context.container().select(".photoviewer");
49953       var selected = viewer.empty() ? void 0 : viewer.datum();
49954       var z = ~~context.map().zoom();
49955       var showMarkers = z >= minMarkerZoom;
49956       var showViewfields = z >= minViewfieldZoom;
49957       var service = getService();
49958       var sequences = [];
49959       var bubbles = [];
49960       if (context.photos().showsPanoramic()) {
49961         sequences = service ? service.sequences(projection2) : [];
49962         bubbles = service && showMarkers ? service.bubbles(projection2) : [];
49963         sequences = filterSequences(sequences);
49964         bubbles = filterBubbles(bubbles);
49965       }
49966       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d) {
49967         return d.properties.key;
49968       });
49969       traces.exit().remove();
49970       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
49971       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(bubbles, function(d) {
49972         return d.key + (d.sequenceKey ? "v1" : "v0");
49973       });
49974       groups.exit().remove();
49975       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
49976       groupsEnter.append("g").attr("class", "viewfield-scale");
49977       var markers = groups.merge(groupsEnter).sort(function(a, b) {
49978         return a === selected ? 1 : b === selected ? -1 : b.loc[1] - a.loc[1];
49979       }).attr("transform", transform2).select(".viewfield-scale");
49980       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
49981       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
49982       viewfields.exit().remove();
49983       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
49984       function viewfieldPath() {
49985         var d = this.parentNode.__data__;
49986         if (d.pano) {
49987           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
49988         } else {
49989           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
49990         }
49991       }
49992     }
49993     function drawImages(selection2) {
49994       var enabled = svgStreetside.enabled;
49995       var service = getService();
49996       layer = selection2.selectAll(".layer-streetside-images").data(service ? [0] : []);
49997       layer.exit().remove();
49998       var layerEnter = layer.enter().append("g").attr("class", "layer-streetside-images").style("display", enabled ? "block" : "none");
49999       layerEnter.append("g").attr("class", "sequences");
50000       layerEnter.append("g").attr("class", "markers");
50001       layer = layerEnter.merge(layer);
50002       if (enabled) {
50003         if (service && ~~context.map().zoom() >= minZoom3) {
50004           editOn();
50005           update();
50006           service.loadBubbles(projection2);
50007         } else {
50008           editOff();
50009         }
50010       }
50011     }
50012     drawImages.enabled = function(_) {
50013       if (!arguments.length)
50014         return svgStreetside.enabled;
50015       svgStreetside.enabled = _;
50016       if (svgStreetside.enabled) {
50017         showLayer();
50018         context.photos().on("change.streetside", update);
50019       } else {
50020         hideLayer();
50021         context.photos().on("change.streetside", null);
50022       }
50023       dispatch10.call("change");
50024       return this;
50025     };
50026     drawImages.supported = function() {
50027       return !!getService();
50028     };
50029     init2();
50030     return drawImages;
50031   }
50032
50033   // modules/svg/mapillary_images.js
50034   function svgMapillaryImages(projection2, context, dispatch10) {
50035     const throttledRedraw = throttle_default(function() {
50036       dispatch10.call("change");
50037     }, 1e3);
50038     const minZoom3 = 12;
50039     const minMarkerZoom = 16;
50040     const minViewfieldZoom = 18;
50041     let layer = select_default2(null);
50042     let _mapillary;
50043     function init2() {
50044       if (svgMapillaryImages.initialized)
50045         return;
50046       svgMapillaryImages.enabled = false;
50047       svgMapillaryImages.initialized = true;
50048     }
50049     function getService() {
50050       if (services.mapillary && !_mapillary) {
50051         _mapillary = services.mapillary;
50052         _mapillary.event.on("loadedImages", throttledRedraw);
50053       } else if (!services.mapillary && _mapillary) {
50054         _mapillary = null;
50055       }
50056       return _mapillary;
50057     }
50058     function showLayer() {
50059       const service = getService();
50060       if (!service)
50061         return;
50062       editOn();
50063       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
50064         dispatch10.call("change");
50065       });
50066     }
50067     function hideLayer() {
50068       throttledRedraw.cancel();
50069       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
50070     }
50071     function editOn() {
50072       layer.style("display", "block");
50073     }
50074     function editOff() {
50075       layer.selectAll(".viewfield-group").remove();
50076       layer.style("display", "none");
50077     }
50078     function click(d3_event, image) {
50079       const service = getService();
50080       if (!service)
50081         return;
50082       service.ensureViewerLoaded(context).then(function() {
50083         service.selectImage(context, image.id).showViewer(context);
50084       });
50085       context.map().centerEase(image.loc);
50086     }
50087     function mouseover(d3_event, image) {
50088       const service = getService();
50089       if (service)
50090         service.setStyles(context, image);
50091     }
50092     function mouseout() {
50093       const service = getService();
50094       if (service)
50095         service.setStyles(context, null);
50096     }
50097     function transform2(d) {
50098       let t = svgPointTransform(projection2)(d);
50099       if (d.ca) {
50100         t += " rotate(" + Math.floor(d.ca) + ",0,0)";
50101       }
50102       return t;
50103     }
50104     function filterImages(images) {
50105       const showsPano = context.photos().showsPanoramic();
50106       const showsFlat = context.photos().showsFlat();
50107       const fromDate = context.photos().fromDate();
50108       const toDate = context.photos().toDate();
50109       if (!showsPano || !showsFlat) {
50110         images = images.filter(function(image) {
50111           if (image.is_pano)
50112             return showsPano;
50113           return showsFlat;
50114         });
50115       }
50116       if (fromDate) {
50117         images = images.filter(function(image) {
50118           return new Date(image.captured_at).getTime() >= new Date(fromDate).getTime();
50119         });
50120       }
50121       if (toDate) {
50122         images = images.filter(function(image) {
50123           return new Date(image.captured_at).getTime() <= new Date(toDate).getTime();
50124         });
50125       }
50126       return images;
50127     }
50128     function filterSequences(sequences) {
50129       const showsPano = context.photos().showsPanoramic();
50130       const showsFlat = context.photos().showsFlat();
50131       const fromDate = context.photos().fromDate();
50132       const toDate = context.photos().toDate();
50133       if (!showsPano || !showsFlat) {
50134         sequences = sequences.filter(function(sequence) {
50135           if (sequence.properties.hasOwnProperty("is_pano")) {
50136             if (sequence.properties.is_pano)
50137               return showsPano;
50138             return showsFlat;
50139           }
50140           return false;
50141         });
50142       }
50143       if (fromDate) {
50144         sequences = sequences.filter(function(sequence) {
50145           return new Date(sequence.properties.captured_at).getTime() >= new Date(fromDate).getTime().toString();
50146         });
50147       }
50148       if (toDate) {
50149         sequences = sequences.filter(function(sequence) {
50150           return new Date(sequence.properties.captured_at).getTime() <= new Date(toDate).getTime().toString();
50151         });
50152       }
50153       return sequences;
50154     }
50155     function update() {
50156       const z = ~~context.map().zoom();
50157       const showMarkers = z >= minMarkerZoom;
50158       const showViewfields = z >= minViewfieldZoom;
50159       const service = getService();
50160       let sequences = service ? service.sequences(projection2) : [];
50161       let images = service && showMarkers ? service.images(projection2) : [];
50162       images = filterImages(images);
50163       sequences = filterSequences(sequences, service);
50164       service.filterViewer(context);
50165       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d) {
50166         return d.properties.id;
50167       });
50168       traces.exit().remove();
50169       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
50170       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d) {
50171         return d.id;
50172       });
50173       groups.exit().remove();
50174       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
50175       groupsEnter.append("g").attr("class", "viewfield-scale");
50176       const markers = groups.merge(groupsEnter).sort(function(a, b) {
50177         return b.loc[1] - a.loc[1];
50178       }).attr("transform", transform2).select(".viewfield-scale");
50179       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
50180       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
50181       viewfields.exit().remove();
50182       viewfields.enter().insert("path", "circle").attr("class", "viewfield").classed("pano", function() {
50183         return this.parentNode.__data__.is_pano;
50184       }).attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
50185       function viewfieldPath() {
50186         if (this.parentNode.__data__.is_pano) {
50187           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
50188         } else {
50189           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
50190         }
50191       }
50192     }
50193     function drawImages(selection2) {
50194       const enabled = svgMapillaryImages.enabled;
50195       const service = getService();
50196       layer = selection2.selectAll(".layer-mapillary").data(service ? [0] : []);
50197       layer.exit().remove();
50198       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary").style("display", enabled ? "block" : "none");
50199       layerEnter.append("g").attr("class", "sequences");
50200       layerEnter.append("g").attr("class", "markers");
50201       layer = layerEnter.merge(layer);
50202       if (enabled) {
50203         if (service && ~~context.map().zoom() >= minZoom3) {
50204           editOn();
50205           update();
50206           service.loadImages(projection2);
50207         } else {
50208           editOff();
50209         }
50210       }
50211     }
50212     drawImages.enabled = function(_) {
50213       if (!arguments.length)
50214         return svgMapillaryImages.enabled;
50215       svgMapillaryImages.enabled = _;
50216       if (svgMapillaryImages.enabled) {
50217         showLayer();
50218         context.photos().on("change.mapillary_images", update);
50219       } else {
50220         hideLayer();
50221         context.photos().on("change.mapillary_images", null);
50222       }
50223       dispatch10.call("change");
50224       return this;
50225     };
50226     drawImages.supported = function() {
50227       return !!getService();
50228     };
50229     init2();
50230     return drawImages;
50231   }
50232
50233   // modules/svg/mapillary_position.js
50234   function svgMapillaryPosition(projection2, context) {
50235     const throttledRedraw = throttle_default(function() {
50236       update();
50237     }, 1e3);
50238     const minZoom3 = 12;
50239     const minViewfieldZoom = 18;
50240     let layer = select_default2(null);
50241     let _mapillary;
50242     let viewerCompassAngle;
50243     function init2() {
50244       if (svgMapillaryPosition.initialized)
50245         return;
50246       svgMapillaryPosition.initialized = true;
50247     }
50248     function getService() {
50249       if (services.mapillary && !_mapillary) {
50250         _mapillary = services.mapillary;
50251         _mapillary.event.on("imageChanged", throttledRedraw);
50252         _mapillary.event.on("bearingChanged", function(e) {
50253           viewerCompassAngle = e.bearing;
50254           if (context.map().isTransformed())
50255             return;
50256           layer.selectAll(".viewfield-group.currentView").filter(function(d) {
50257             return d.is_pano;
50258           }).attr("transform", transform2);
50259         });
50260       } else if (!services.mapillary && _mapillary) {
50261         _mapillary = null;
50262       }
50263       return _mapillary;
50264     }
50265     function editOn() {
50266       layer.style("display", "block");
50267     }
50268     function editOff() {
50269       layer.selectAll(".viewfield-group").remove();
50270       layer.style("display", "none");
50271     }
50272     function transform2(d) {
50273       let t = svgPointTransform(projection2)(d);
50274       if (d.is_pano && viewerCompassAngle !== null && isFinite(viewerCompassAngle)) {
50275         t += " rotate(" + Math.floor(viewerCompassAngle) + ",0,0)";
50276       } else if (d.ca) {
50277         t += " rotate(" + Math.floor(d.ca) + ",0,0)";
50278       }
50279       return t;
50280     }
50281     function update() {
50282       const z = ~~context.map().zoom();
50283       const showViewfields = z >= minViewfieldZoom;
50284       const service = getService();
50285       const image = service && service.getActiveImage();
50286       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(image ? [image] : [], function(d) {
50287         return d.id;
50288       });
50289       groups.exit().remove();
50290       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group currentView highlighted");
50291       groupsEnter.append("g").attr("class", "viewfield-scale");
50292       const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
50293       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
50294       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
50295       viewfields.exit().remove();
50296       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");
50297     }
50298     function drawImages(selection2) {
50299       const service = getService();
50300       layer = selection2.selectAll(".layer-mapillary-position").data(service ? [0] : []);
50301       layer.exit().remove();
50302       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary-position");
50303       layerEnter.append("g").attr("class", "markers");
50304       layer = layerEnter.merge(layer);
50305       if (service && ~~context.map().zoom() >= minZoom3) {
50306         editOn();
50307         update();
50308       } else {
50309         editOff();
50310       }
50311     }
50312     drawImages.enabled = function() {
50313       update();
50314       return this;
50315     };
50316     drawImages.supported = function() {
50317       return !!getService();
50318     };
50319     init2();
50320     return drawImages;
50321   }
50322
50323   // modules/svg/mapillary_signs.js
50324   function svgMapillarySigns(projection2, context, dispatch10) {
50325     const throttledRedraw = throttle_default(function() {
50326       dispatch10.call("change");
50327     }, 1e3);
50328     const minZoom3 = 12;
50329     let layer = select_default2(null);
50330     let _mapillary;
50331     function init2() {
50332       if (svgMapillarySigns.initialized)
50333         return;
50334       svgMapillarySigns.enabled = false;
50335       svgMapillarySigns.initialized = true;
50336     }
50337     function getService() {
50338       if (services.mapillary && !_mapillary) {
50339         _mapillary = services.mapillary;
50340         _mapillary.event.on("loadedSigns", throttledRedraw);
50341       } else if (!services.mapillary && _mapillary) {
50342         _mapillary = null;
50343       }
50344       return _mapillary;
50345     }
50346     function showLayer() {
50347       const service = getService();
50348       if (!service)
50349         return;
50350       service.loadSignResources(context);
50351       editOn();
50352     }
50353     function hideLayer() {
50354       throttledRedraw.cancel();
50355       editOff();
50356     }
50357     function editOn() {
50358       layer.style("display", "block");
50359     }
50360     function editOff() {
50361       layer.selectAll(".icon-sign").remove();
50362       layer.style("display", "none");
50363     }
50364     function click(d3_event, d) {
50365       const service = getService();
50366       if (!service)
50367         return;
50368       context.map().centerEase(d.loc);
50369       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
50370       service.getDetections(d.id).then((detections) => {
50371         if (detections.length) {
50372           const imageId = detections[0].image.id;
50373           if (imageId === selectedImageId) {
50374             service.highlightDetection(detections[0]).selectImage(context, imageId);
50375           } else {
50376             service.ensureViewerLoaded(context).then(function() {
50377               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
50378             });
50379           }
50380         }
50381       });
50382     }
50383     function filterData(detectedFeatures) {
50384       var fromDate = context.photos().fromDate();
50385       var toDate = context.photos().toDate();
50386       if (fromDate) {
50387         var fromTimestamp = new Date(fromDate).getTime();
50388         detectedFeatures = detectedFeatures.filter(function(feature3) {
50389           return new Date(feature3.last_seen_at).getTime() >= fromTimestamp;
50390         });
50391       }
50392       if (toDate) {
50393         var toTimestamp = new Date(toDate).getTime();
50394         detectedFeatures = detectedFeatures.filter(function(feature3) {
50395           return new Date(feature3.first_seen_at).getTime() <= toTimestamp;
50396         });
50397       }
50398       return detectedFeatures;
50399     }
50400     function update() {
50401       const service = getService();
50402       let data = service ? service.signs(projection2) : [];
50403       data = filterData(data);
50404       const transform2 = svgPointTransform(projection2);
50405       const signs = layer.selectAll(".icon-sign").data(data, function(d) {
50406         return d.id;
50407       });
50408       signs.exit().remove();
50409       const enter = signs.enter().append("g").attr("class", "icon-sign icon-detected").on("click", click);
50410       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d) {
50411         return "#" + d.value;
50412       });
50413       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
50414       signs.merge(enter).attr("transform", transform2);
50415     }
50416     function drawSigns(selection2) {
50417       const enabled = svgMapillarySigns.enabled;
50418       const service = getService();
50419       layer = selection2.selectAll(".layer-mapillary-signs").data(service ? [0] : []);
50420       layer.exit().remove();
50421       layer = layer.enter().append("g").attr("class", "layer-mapillary-signs layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
50422       if (enabled) {
50423         if (service && ~~context.map().zoom() >= minZoom3) {
50424           editOn();
50425           update();
50426           service.loadSigns(projection2);
50427           service.showSignDetections(true);
50428         } else {
50429           editOff();
50430         }
50431       } else if (service) {
50432         service.showSignDetections(false);
50433       }
50434     }
50435     drawSigns.enabled = function(_) {
50436       if (!arguments.length)
50437         return svgMapillarySigns.enabled;
50438       svgMapillarySigns.enabled = _;
50439       if (svgMapillarySigns.enabled) {
50440         showLayer();
50441         context.photos().on("change.mapillary_signs", update);
50442       } else {
50443         hideLayer();
50444         context.photos().on("change.mapillary_signs", null);
50445       }
50446       dispatch10.call("change");
50447       return this;
50448     };
50449     drawSigns.supported = function() {
50450       return !!getService();
50451     };
50452     init2();
50453     return drawSigns;
50454   }
50455
50456   // modules/svg/mapillary_map_features.js
50457   function svgMapillaryMapFeatures(projection2, context, dispatch10) {
50458     const throttledRedraw = throttle_default(function() {
50459       dispatch10.call("change");
50460     }, 1e3);
50461     const minZoom3 = 12;
50462     let layer = select_default2(null);
50463     let _mapillary;
50464     function init2() {
50465       if (svgMapillaryMapFeatures.initialized)
50466         return;
50467       svgMapillaryMapFeatures.enabled = false;
50468       svgMapillaryMapFeatures.initialized = true;
50469     }
50470     function getService() {
50471       if (services.mapillary && !_mapillary) {
50472         _mapillary = services.mapillary;
50473         _mapillary.event.on("loadedMapFeatures", throttledRedraw);
50474       } else if (!services.mapillary && _mapillary) {
50475         _mapillary = null;
50476       }
50477       return _mapillary;
50478     }
50479     function showLayer() {
50480       const service = getService();
50481       if (!service)
50482         return;
50483       service.loadObjectResources(context);
50484       editOn();
50485     }
50486     function hideLayer() {
50487       throttledRedraw.cancel();
50488       editOff();
50489     }
50490     function editOn() {
50491       layer.style("display", "block");
50492     }
50493     function editOff() {
50494       layer.selectAll(".icon-map-feature").remove();
50495       layer.style("display", "none");
50496     }
50497     function click(d3_event, d) {
50498       const service = getService();
50499       if (!service)
50500         return;
50501       context.map().centerEase(d.loc);
50502       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
50503       service.getDetections(d.id).then((detections) => {
50504         if (detections.length) {
50505           const imageId = detections[0].image.id;
50506           if (imageId === selectedImageId) {
50507             service.highlightDetection(detections[0]).selectImage(context, imageId);
50508           } else {
50509             service.ensureViewerLoaded(context).then(function() {
50510               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
50511             });
50512           }
50513         }
50514       });
50515     }
50516     function filterData(detectedFeatures) {
50517       const fromDate = context.photos().fromDate();
50518       const toDate = context.photos().toDate();
50519       if (fromDate) {
50520         detectedFeatures = detectedFeatures.filter(function(feature3) {
50521           return new Date(feature3.last_seen_at).getTime() >= new Date(fromDate).getTime();
50522         });
50523       }
50524       if (toDate) {
50525         detectedFeatures = detectedFeatures.filter(function(feature3) {
50526           return new Date(feature3.first_seen_at).getTime() <= new Date(toDate).getTime();
50527         });
50528       }
50529       return detectedFeatures;
50530     }
50531     function update() {
50532       const service = getService();
50533       let data = service ? service.mapFeatures(projection2) : [];
50534       data = filterData(data);
50535       const transform2 = svgPointTransform(projection2);
50536       const mapFeatures = layer.selectAll(".icon-map-feature").data(data, function(d) {
50537         return d.id;
50538       });
50539       mapFeatures.exit().remove();
50540       const enter = mapFeatures.enter().append("g").attr("class", "icon-map-feature icon-detected").on("click", click);
50541       enter.append("title").text(function(d) {
50542         var id2 = d.value.replace(/--/g, ".").replace(/-/g, "_");
50543         return _t("mapillary_map_features." + id2);
50544       });
50545       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d) {
50546         if (d.value === "object--billboard") {
50547           return "#object--sign--advertisement";
50548         }
50549         return "#" + d.value;
50550       });
50551       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
50552       mapFeatures.merge(enter).attr("transform", transform2);
50553     }
50554     function drawMapFeatures(selection2) {
50555       const enabled = svgMapillaryMapFeatures.enabled;
50556       const service = getService();
50557       layer = selection2.selectAll(".layer-mapillary-map-features").data(service ? [0] : []);
50558       layer.exit().remove();
50559       layer = layer.enter().append("g").attr("class", "layer-mapillary-map-features layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
50560       if (enabled) {
50561         if (service && ~~context.map().zoom() >= minZoom3) {
50562           editOn();
50563           update();
50564           service.loadMapFeatures(projection2);
50565           service.showFeatureDetections(true);
50566         } else {
50567           editOff();
50568         }
50569       } else if (service) {
50570         service.showFeatureDetections(false);
50571       }
50572     }
50573     drawMapFeatures.enabled = function(_) {
50574       if (!arguments.length)
50575         return svgMapillaryMapFeatures.enabled;
50576       svgMapillaryMapFeatures.enabled = _;
50577       if (svgMapillaryMapFeatures.enabled) {
50578         showLayer();
50579         context.photos().on("change.mapillary_map_features", update);
50580       } else {
50581         hideLayer();
50582         context.photos().on("change.mapillary_map_features", null);
50583       }
50584       dispatch10.call("change");
50585       return this;
50586     };
50587     drawMapFeatures.supported = function() {
50588       return !!getService();
50589     };
50590     init2();
50591     return drawMapFeatures;
50592   }
50593
50594   // modules/svg/kartaview_images.js
50595   function svgKartaviewImages(projection2, context, dispatch10) {
50596     var throttledRedraw = throttle_default(function() {
50597       dispatch10.call("change");
50598     }, 1e3);
50599     var minZoom3 = 12;
50600     var minMarkerZoom = 16;
50601     var minViewfieldZoom = 18;
50602     var layer = select_default2(null);
50603     var _kartaview;
50604     function init2() {
50605       if (svgKartaviewImages.initialized)
50606         return;
50607       svgKartaviewImages.enabled = false;
50608       svgKartaviewImages.initialized = true;
50609     }
50610     function getService() {
50611       if (services.kartaview && !_kartaview) {
50612         _kartaview = services.kartaview;
50613         _kartaview.event.on("loadedImages", throttledRedraw);
50614       } else if (!services.kartaview && _kartaview) {
50615         _kartaview = null;
50616       }
50617       return _kartaview;
50618     }
50619     function showLayer() {
50620       var service = getService();
50621       if (!service)
50622         return;
50623       editOn();
50624       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
50625         dispatch10.call("change");
50626       });
50627     }
50628     function hideLayer() {
50629       throttledRedraw.cancel();
50630       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
50631     }
50632     function editOn() {
50633       layer.style("display", "block");
50634     }
50635     function editOff() {
50636       layer.selectAll(".viewfield-group").remove();
50637       layer.style("display", "none");
50638     }
50639     function click(d3_event, d) {
50640       var service = getService();
50641       if (!service)
50642         return;
50643       service.ensureViewerLoaded(context).then(function() {
50644         service.selectImage(context, d.key).showViewer(context);
50645       });
50646       context.map().centerEase(d.loc);
50647     }
50648     function mouseover(d3_event, d) {
50649       var service = getService();
50650       if (service)
50651         service.setStyles(context, d);
50652     }
50653     function mouseout() {
50654       var service = getService();
50655       if (service)
50656         service.setStyles(context, null);
50657     }
50658     function transform2(d) {
50659       var t = svgPointTransform(projection2)(d);
50660       if (d.ca) {
50661         t += " rotate(" + Math.floor(d.ca) + ",0,0)";
50662       }
50663       return t;
50664     }
50665     function filterImages(images) {
50666       var fromDate = context.photos().fromDate();
50667       var toDate = context.photos().toDate();
50668       var usernames = context.photos().usernames();
50669       if (fromDate) {
50670         var fromTimestamp = new Date(fromDate).getTime();
50671         images = images.filter(function(item) {
50672           return new Date(item.captured_at).getTime() >= fromTimestamp;
50673         });
50674       }
50675       if (toDate) {
50676         var toTimestamp = new Date(toDate).getTime();
50677         images = images.filter(function(item) {
50678           return new Date(item.captured_at).getTime() <= toTimestamp;
50679         });
50680       }
50681       if (usernames) {
50682         images = images.filter(function(item) {
50683           return usernames.indexOf(item.captured_by) !== -1;
50684         });
50685       }
50686       return images;
50687     }
50688     function filterSequences(sequences) {
50689       var fromDate = context.photos().fromDate();
50690       var toDate = context.photos().toDate();
50691       var usernames = context.photos().usernames();
50692       if (fromDate) {
50693         var fromTimestamp = new Date(fromDate).getTime();
50694         sequences = sequences.filter(function(image) {
50695           return new Date(image.properties.captured_at).getTime() >= fromTimestamp;
50696         });
50697       }
50698       if (toDate) {
50699         var toTimestamp = new Date(toDate).getTime();
50700         sequences = sequences.filter(function(image) {
50701           return new Date(image.properties.captured_at).getTime() <= toTimestamp;
50702         });
50703       }
50704       if (usernames) {
50705         sequences = sequences.filter(function(image) {
50706           return usernames.indexOf(image.properties.captured_by) !== -1;
50707         });
50708       }
50709       return sequences;
50710     }
50711     function update() {
50712       var viewer = context.container().select(".photoviewer");
50713       var selected = viewer.empty() ? void 0 : viewer.datum();
50714       var z = ~~context.map().zoom();
50715       var showMarkers = z >= minMarkerZoom;
50716       var showViewfields = z >= minViewfieldZoom;
50717       var service = getService();
50718       var sequences = [];
50719       var images = [];
50720       if (context.photos().showsFlat()) {
50721         sequences = service ? service.sequences(projection2) : [];
50722         images = service && showMarkers ? service.images(projection2) : [];
50723         sequences = filterSequences(sequences);
50724         images = filterImages(images);
50725       }
50726       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d) {
50727         return d.properties.key;
50728       });
50729       traces.exit().remove();
50730       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
50731       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d) {
50732         return d.key;
50733       });
50734       groups.exit().remove();
50735       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
50736       groupsEnter.append("g").attr("class", "viewfield-scale");
50737       var markers = groups.merge(groupsEnter).sort(function(a, b) {
50738         return a === selected ? 1 : b === selected ? -1 : b.loc[1] - a.loc[1];
50739       }).attr("transform", transform2).select(".viewfield-scale");
50740       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
50741       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
50742       viewfields.exit().remove();
50743       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");
50744     }
50745     function drawImages(selection2) {
50746       var enabled = svgKartaviewImages.enabled, service = getService();
50747       layer = selection2.selectAll(".layer-kartaview").data(service ? [0] : []);
50748       layer.exit().remove();
50749       var layerEnter = layer.enter().append("g").attr("class", "layer-kartaview").style("display", enabled ? "block" : "none");
50750       layerEnter.append("g").attr("class", "sequences");
50751       layerEnter.append("g").attr("class", "markers");
50752       layer = layerEnter.merge(layer);
50753       if (enabled) {
50754         if (service && ~~context.map().zoom() >= minZoom3) {
50755           editOn();
50756           update();
50757           service.loadImages(projection2);
50758         } else {
50759           editOff();
50760         }
50761       }
50762     }
50763     drawImages.enabled = function(_) {
50764       if (!arguments.length)
50765         return svgKartaviewImages.enabled;
50766       svgKartaviewImages.enabled = _;
50767       if (svgKartaviewImages.enabled) {
50768         showLayer();
50769         context.photos().on("change.kartaview_images", update);
50770       } else {
50771         hideLayer();
50772         context.photos().on("change.kartaview_images", null);
50773       }
50774       dispatch10.call("change");
50775       return this;
50776     };
50777     drawImages.supported = function() {
50778       return !!getService();
50779     };
50780     init2();
50781     return drawImages;
50782   }
50783
50784   // modules/svg/osm.js
50785   function svgOsm(projection2, context, dispatch10) {
50786     var enabled = true;
50787     function drawOsm(selection2) {
50788       selection2.selectAll(".layer-osm").data(["covered", "areas", "lines", "points", "labels"]).enter().append("g").attr("class", function(d) {
50789         return "layer-osm " + d;
50790       });
50791       selection2.selectAll(".layer-osm.points").selectAll(".points-group").data(["points", "midpoints", "vertices", "turns"]).enter().append("g").attr("class", function(d) {
50792         return "points-group " + d;
50793       });
50794     }
50795     function showLayer() {
50796       var layer = context.surface().selectAll(".data-layer.osm");
50797       layer.interrupt();
50798       layer.classed("disabled", false).style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
50799         dispatch10.call("change");
50800       });
50801     }
50802     function hideLayer() {
50803       var layer = context.surface().selectAll(".data-layer.osm");
50804       layer.interrupt();
50805       layer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
50806         layer.classed("disabled", true);
50807         dispatch10.call("change");
50808       });
50809     }
50810     drawOsm.enabled = function(val) {
50811       if (!arguments.length)
50812         return enabled;
50813       enabled = val;
50814       if (enabled) {
50815         showLayer();
50816       } else {
50817         hideLayer();
50818       }
50819       dispatch10.call("change");
50820       return this;
50821     };
50822     return drawOsm;
50823   }
50824
50825   // modules/svg/notes.js
50826   var _notesEnabled = false;
50827   var _osmService;
50828   function svgNotes(projection2, context, dispatch10) {
50829     if (!dispatch10) {
50830       dispatch10 = dispatch_default("change");
50831     }
50832     var throttledRedraw = throttle_default(function() {
50833       dispatch10.call("change");
50834     }, 1e3);
50835     var minZoom3 = 12;
50836     var touchLayer = select_default2(null);
50837     var drawLayer = select_default2(null);
50838     var _notesVisible = false;
50839     function markerPath(selection2, klass) {
50840       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");
50841     }
50842     function getService() {
50843       if (services.osm && !_osmService) {
50844         _osmService = services.osm;
50845         _osmService.on("loadedNotes", throttledRedraw);
50846       } else if (!services.osm && _osmService) {
50847         _osmService = null;
50848       }
50849       return _osmService;
50850     }
50851     function editOn() {
50852       if (!_notesVisible) {
50853         _notesVisible = true;
50854         drawLayer.style("display", "block");
50855       }
50856     }
50857     function editOff() {
50858       if (_notesVisible) {
50859         _notesVisible = false;
50860         drawLayer.style("display", "none");
50861         drawLayer.selectAll(".note").remove();
50862         touchLayer.selectAll(".note").remove();
50863       }
50864     }
50865     function layerOn() {
50866       editOn();
50867       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
50868         dispatch10.call("change");
50869       });
50870     }
50871     function layerOff() {
50872       throttledRedraw.cancel();
50873       drawLayer.interrupt();
50874       touchLayer.selectAll(".note").remove();
50875       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
50876         editOff();
50877         dispatch10.call("change");
50878       });
50879     }
50880     function updateMarkers() {
50881       if (!_notesVisible || !_notesEnabled)
50882         return;
50883       var service = getService();
50884       var selectedID = context.selectedNoteID();
50885       var data = service ? service.notes(projection2) : [];
50886       var getTransform = svgPointTransform(projection2);
50887       var notes = drawLayer.selectAll(".note").data(data, function(d) {
50888         return d.status + d.id;
50889       });
50890       notes.exit().remove();
50891       var notesEnter = notes.enter().append("g").attr("class", function(d) {
50892         return "note note-" + d.id + " " + d.status;
50893       }).classed("new", function(d) {
50894         return d.id < 0;
50895       });
50896       notesEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
50897       notesEnter.append("path").call(markerPath, "shadow");
50898       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");
50899       notesEnter.selectAll(".icon-annotation").data(function(d) {
50900         return [d];
50901       }).enter().append("use").attr("class", "icon-annotation").attr("width", "10px").attr("height", "10px").attr("x", "-3px").attr("y", "-19px").attr("xlink:href", function(d) {
50902         if (d.id < 0)
50903           return "#iD-icon-plus";
50904         if (d.status === "open")
50905           return "#iD-icon-close";
50906         return "#iD-icon-apply";
50907       });
50908       notes.merge(notesEnter).sort(sortY).classed("selected", function(d) {
50909         var mode = context.mode();
50910         var isMoving = mode && mode.id === "drag-note";
50911         return !isMoving && d.id === selectedID;
50912       }).attr("transform", getTransform);
50913       if (touchLayer.empty())
50914         return;
50915       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
50916       var targets = touchLayer.selectAll(".note").data(data, function(d) {
50917         return d.id;
50918       });
50919       targets.exit().remove();
50920       targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", function(d) {
50921         var newClass = d.id < 0 ? "new" : "";
50922         return "note target note-" + d.id + " " + fillClass + newClass;
50923       }).attr("transform", getTransform);
50924       function sortY(a, b) {
50925         if (a.id === selectedID)
50926           return 1;
50927         if (b.id === selectedID)
50928           return -1;
50929         return b.loc[1] - a.loc[1];
50930       }
50931     }
50932     function drawNotes(selection2) {
50933       var service = getService();
50934       var surface = context.surface();
50935       if (surface && !surface.empty()) {
50936         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
50937       }
50938       drawLayer = selection2.selectAll(".layer-notes").data(service ? [0] : []);
50939       drawLayer.exit().remove();
50940       drawLayer = drawLayer.enter().append("g").attr("class", "layer-notes").style("display", _notesEnabled ? "block" : "none").merge(drawLayer);
50941       if (_notesEnabled) {
50942         if (service && ~~context.map().zoom() >= minZoom3) {
50943           editOn();
50944           service.loadNotes(projection2);
50945           updateMarkers();
50946         } else {
50947           editOff();
50948         }
50949       }
50950     }
50951     drawNotes.enabled = function(val) {
50952       if (!arguments.length)
50953         return _notesEnabled;
50954       _notesEnabled = val;
50955       if (_notesEnabled) {
50956         layerOn();
50957       } else {
50958         layerOff();
50959         if (context.selectedNoteID()) {
50960           context.enter(modeBrowse(context));
50961         }
50962       }
50963       dispatch10.call("change");
50964       return this;
50965     };
50966     return drawNotes;
50967   }
50968
50969   // modules/svg/touch.js
50970   function svgTouch() {
50971     function drawTouch(selection2) {
50972       selection2.selectAll(".layer-touch").data(["areas", "lines", "points", "turns", "markers"]).enter().append("g").attr("class", function(d) {
50973         return "layer-touch " + d;
50974       });
50975     }
50976     return drawTouch;
50977   }
50978
50979   // modules/util/dimensions.js
50980   function refresh(selection2, node) {
50981     var cr = node.getBoundingClientRect();
50982     var prop = [cr.width, cr.height];
50983     selection2.property("__dimensions__", prop);
50984     return prop;
50985   }
50986   function utilGetDimensions(selection2, force) {
50987     if (!selection2 || selection2.empty()) {
50988       return [0, 0];
50989     }
50990     var node = selection2.node(), cached = selection2.property("__dimensions__");
50991     return !cached || force ? refresh(selection2, node) : cached;
50992   }
50993   function utilSetDimensions(selection2, dimensions) {
50994     if (!selection2 || selection2.empty()) {
50995       return selection2;
50996     }
50997     var node = selection2.node();
50998     if (dimensions === null) {
50999       refresh(selection2, node);
51000       return selection2;
51001     }
51002     return selection2.property("__dimensions__", [dimensions[0], dimensions[1]]).attr("width", dimensions[0]).attr("height", dimensions[1]);
51003   }
51004
51005   // modules/svg/layers.js
51006   function svgLayers(projection2, context) {
51007     var dispatch10 = dispatch_default("change");
51008     var svg2 = select_default2(null);
51009     var _layers = [
51010       { id: "osm", layer: svgOsm(projection2, context, dispatch10) },
51011       { id: "notes", layer: svgNotes(projection2, context, dispatch10) },
51012       { id: "data", layer: svgData(projection2, context, dispatch10) },
51013       { id: "keepRight", layer: svgKeepRight(projection2, context, dispatch10) },
51014       { id: "improveOSM", layer: svgImproveOSM(projection2, context, dispatch10) },
51015       { id: "osmose", layer: svgOsmose(projection2, context, dispatch10) },
51016       { id: "streetside", layer: svgStreetside(projection2, context, dispatch10) },
51017       { id: "mapillary", layer: svgMapillaryImages(projection2, context, dispatch10) },
51018       { id: "mapillary-position", layer: svgMapillaryPosition(projection2, context, dispatch10) },
51019       { id: "mapillary-map-features", layer: svgMapillaryMapFeatures(projection2, context, dispatch10) },
51020       { id: "mapillary-signs", layer: svgMapillarySigns(projection2, context, dispatch10) },
51021       { id: "kartaview", layer: svgKartaviewImages(projection2, context, dispatch10) },
51022       { id: "debug", layer: svgDebug(projection2, context, dispatch10) },
51023       { id: "geolocate", layer: svgGeolocate(projection2, context, dispatch10) },
51024       { id: "touch", layer: svgTouch(projection2, context, dispatch10) }
51025     ];
51026     function drawLayers(selection2) {
51027       svg2 = selection2.selectAll(".surface").data([0]);
51028       svg2 = svg2.enter().append("svg").attr("class", "surface").merge(svg2);
51029       var defs = svg2.selectAll(".surface-defs").data([0]);
51030       defs.enter().append("defs").attr("class", "surface-defs");
51031       var groups = svg2.selectAll(".data-layer").data(_layers);
51032       groups.exit().remove();
51033       groups.enter().append("g").attr("class", function(d) {
51034         return "data-layer " + d.id;
51035       }).merge(groups).each(function(d) {
51036         select_default2(this).call(d.layer);
51037       });
51038     }
51039     drawLayers.all = function() {
51040       return _layers;
51041     };
51042     drawLayers.layer = function(id2) {
51043       var obj = _layers.find(function(o) {
51044         return o.id === id2;
51045       });
51046       return obj && obj.layer;
51047     };
51048     drawLayers.only = function(what) {
51049       var arr = [].concat(what);
51050       var all = _layers.map(function(layer) {
51051         return layer.id;
51052       });
51053       return drawLayers.remove(utilArrayDifference(all, arr));
51054     };
51055     drawLayers.remove = function(what) {
51056       var arr = [].concat(what);
51057       arr.forEach(function(id2) {
51058         _layers = _layers.filter(function(o) {
51059           return o.id !== id2;
51060         });
51061       });
51062       dispatch10.call("change");
51063       return this;
51064     };
51065     drawLayers.add = function(what) {
51066       var arr = [].concat(what);
51067       arr.forEach(function(obj) {
51068         if ("id" in obj && "layer" in obj) {
51069           _layers.push(obj);
51070         }
51071       });
51072       dispatch10.call("change");
51073       return this;
51074     };
51075     drawLayers.dimensions = function(val) {
51076       if (!arguments.length)
51077         return utilGetDimensions(svg2);
51078       utilSetDimensions(svg2, val);
51079       return this;
51080     };
51081     return utilRebind(drawLayers, dispatch10, "on");
51082   }
51083
51084   // modules/svg/lines.js
51085   var import_fast_deep_equal6 = __toESM(require_fast_deep_equal());
51086   function svgLines(projection2, context) {
51087     var detected = utilDetect();
51088     var highway_stack = {
51089       motorway: 0,
51090       motorway_link: 1,
51091       trunk: 2,
51092       trunk_link: 3,
51093       primary: 4,
51094       primary_link: 5,
51095       secondary: 6,
51096       tertiary: 7,
51097       unclassified: 8,
51098       residential: 9,
51099       service: 10,
51100       footway: 11
51101     };
51102     function drawTargets(selection2, graph, entities, filter2) {
51103       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
51104       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
51105       var getPath = svgPath(projection2).geojson;
51106       var activeID = context.activeID();
51107       var base = context.history().base();
51108       var data = { targets: [], nopes: [] };
51109       entities.forEach(function(way) {
51110         var features = svgSegmentWay(way, graph, activeID);
51111         data.targets.push.apply(data.targets, features.passive);
51112         data.nopes.push.apply(data.nopes, features.active);
51113       });
51114       var targetData = data.targets.filter(getPath);
51115       var targets = selection2.selectAll(".line.target-allowed").filter(function(d) {
51116         return filter2(d.properties.entity);
51117       }).data(targetData, function key(d) {
51118         return d.id;
51119       });
51120       targets.exit().remove();
51121       var segmentWasEdited = function(d) {
51122         var wayID = d.properties.entity.id;
51123         if (!base.entities[wayID] || !(0, import_fast_deep_equal6.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
51124           return false;
51125         }
51126         return d.properties.nodes.some(function(n2) {
51127           return !base.entities[n2.id] || !(0, import_fast_deep_equal6.default)(graph.entities[n2.id].loc, base.entities[n2.id].loc);
51128         });
51129       };
51130       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d) {
51131         return "way line target target-allowed " + targetClass + d.id;
51132       }).classed("segment-edited", segmentWasEdited);
51133       var nopeData = data.nopes.filter(getPath);
51134       var nopes = selection2.selectAll(".line.target-nope").filter(function(d) {
51135         return filter2(d.properties.entity);
51136       }).data(nopeData, function key(d) {
51137         return d.id;
51138       });
51139       nopes.exit().remove();
51140       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d) {
51141         return "way line target target-nope " + nopeClass + d.id;
51142       }).classed("segment-edited", segmentWasEdited);
51143     }
51144     function drawLines(selection2, graph, entities, filter2) {
51145       var base = context.history().base();
51146       function waystack(a, b) {
51147         var selected = context.selectedIDs();
51148         var scoreA = selected.indexOf(a.id) !== -1 ? 20 : 0;
51149         var scoreB = selected.indexOf(b.id) !== -1 ? 20 : 0;
51150         if (a.tags.highway) {
51151           scoreA -= highway_stack[a.tags.highway];
51152         }
51153         if (b.tags.highway) {
51154           scoreB -= highway_stack[b.tags.highway];
51155         }
51156         return scoreA - scoreB;
51157       }
51158       function drawLineGroup(selection3, klass, isSelected) {
51159         var mode = context.mode();
51160         var isDrawing = mode && /^draw/.test(mode.id);
51161         var selectedClass = !isDrawing && isSelected ? "selected " : "";
51162         var lines = selection3.selectAll("path").filter(filter2).data(getPathData(isSelected), osmEntity.key);
51163         lines.exit().remove();
51164         lines.enter().append("path").attr("class", function(d) {
51165           var prefix = "way line";
51166           if (!d.hasInterestingTags()) {
51167             var parentRelations = graph.parentRelations(d);
51168             var parentMultipolygons = parentRelations.filter(function(relation) {
51169               return relation.isMultipolygon();
51170             });
51171             if (parentMultipolygons.length > 0 && // and only multipolygon relations
51172             parentRelations.length === parentMultipolygons.length) {
51173               prefix = "relation area";
51174             }
51175           }
51176           var oldMPClass = oldMultiPolygonOuters[d.id] ? "old-multipolygon " : "";
51177           return prefix + " " + klass + " " + selectedClass + oldMPClass + d.id;
51178         }).classed("added", function(d) {
51179           return !base.entities[d.id];
51180         }).classed("geometry-edited", function(d) {
51181           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);
51182         }).classed("retagged", function(d) {
51183           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);
51184         }).call(svgTagClasses()).merge(lines).sort(waystack).attr("d", getPath).call(svgTagClasses().tags(svgRelationMemberTags(graph)));
51185         return selection3;
51186       }
51187       function getPathData(isSelected) {
51188         return function() {
51189           var layer = this.parentNode.__data__;
51190           var data = pathdata[layer] || [];
51191           return data.filter(function(d) {
51192             if (isSelected) {
51193               return context.selectedIDs().indexOf(d.id) !== -1;
51194             } else {
51195               return context.selectedIDs().indexOf(d.id) === -1;
51196             }
51197           });
51198         };
51199       }
51200       function addMarkers(layergroup, pathclass, groupclass, groupdata, marker) {
51201         var markergroup = layergroup.selectAll("g." + groupclass).data([pathclass]);
51202         markergroup = markergroup.enter().append("g").attr("class", groupclass).merge(markergroup);
51203         var markers = markergroup.selectAll("path").filter(filter2).data(
51204           function data() {
51205             return groupdata[this.parentNode.__data__] || [];
51206           },
51207           function key(d) {
51208             return [d.id, d.index];
51209           }
51210         );
51211         markers.exit().remove();
51212         markers = markers.enter().append("path").attr("class", pathclass).merge(markers).attr("marker-mid", marker).attr("d", function(d) {
51213           return d.d;
51214         });
51215         if (detected.ie) {
51216           markers.each(function() {
51217             this.parentNode.insertBefore(this, this);
51218           });
51219         }
51220       }
51221       var getPath = svgPath(projection2, graph);
51222       var ways = [];
51223       var onewaydata = {};
51224       var sideddata = {};
51225       var oldMultiPolygonOuters = {};
51226       for (var i2 = 0; i2 < entities.length; i2++) {
51227         var entity = entities[i2];
51228         var outer = osmOldMultipolygonOuterMember(entity, graph);
51229         if (outer) {
51230           ways.push(entity.mergeTags(outer.tags));
51231           oldMultiPolygonOuters[outer.id] = true;
51232         } else if (entity.geometry(graph) === "line" || entity.geometry(graph) === "area" && entity.sidednessIdentifier && entity.sidednessIdentifier() === "coastline") {
51233           ways.push(entity);
51234         }
51235       }
51236       ways = ways.filter(getPath);
51237       var pathdata = utilArrayGroupBy(ways, function(way) {
51238         return way.layer();
51239       });
51240       Object.keys(pathdata).forEach(function(k) {
51241         var v = pathdata[k];
51242         var onewayArr = v.filter(function(d) {
51243           return d.isOneWay();
51244         });
51245         var onewaySegments = svgMarkerSegments(
51246           projection2,
51247           graph,
51248           35,
51249           function shouldReverse(entity2) {
51250             return entity2.tags.oneway === "-1";
51251           },
51252           function bothDirections(entity2) {
51253             return entity2.tags.oneway === "reversible" || entity2.tags.oneway === "alternating";
51254           }
51255         );
51256         onewaydata[k] = utilArrayFlatten(onewayArr.map(onewaySegments));
51257         var sidedArr = v.filter(function(d) {
51258           return d.isSided();
51259         });
51260         var sidedSegments = svgMarkerSegments(
51261           projection2,
51262           graph,
51263           30,
51264           function shouldReverse() {
51265             return false;
51266           },
51267           function bothDirections() {
51268             return false;
51269           }
51270         );
51271         sideddata[k] = utilArrayFlatten(sidedArr.map(sidedSegments));
51272       });
51273       var covered = selection2.selectAll(".layer-osm.covered");
51274       var uncovered = selection2.selectAll(".layer-osm.lines");
51275       var touchLayer = selection2.selectAll(".layer-touch.lines");
51276       [covered, uncovered].forEach(function(selection3) {
51277         var range3 = selection3 === covered ? range(-10, 0) : range(0, 11);
51278         var layergroup = selection3.selectAll("g.layergroup").data(range3);
51279         layergroup = layergroup.enter().append("g").attr("class", function(d) {
51280           return "layergroup layer" + String(d);
51281         }).merge(layergroup);
51282         layergroup.selectAll("g.linegroup").data(["shadow", "casing", "stroke", "shadow-highlighted", "casing-highlighted", "stroke-highlighted"]).enter().append("g").attr("class", function(d) {
51283           return "linegroup line-" + d;
51284         });
51285         layergroup.selectAll("g.line-shadow").call(drawLineGroup, "shadow", false);
51286         layergroup.selectAll("g.line-casing").call(drawLineGroup, "casing", false);
51287         layergroup.selectAll("g.line-stroke").call(drawLineGroup, "stroke", false);
51288         layergroup.selectAll("g.line-shadow-highlighted").call(drawLineGroup, "shadow", true);
51289         layergroup.selectAll("g.line-casing-highlighted").call(drawLineGroup, "casing", true);
51290         layergroup.selectAll("g.line-stroke-highlighted").call(drawLineGroup, "stroke", true);
51291         addMarkers(layergroup, "oneway", "onewaygroup", onewaydata, "url(#ideditor-oneway-marker)");
51292         addMarkers(
51293           layergroup,
51294           "sided",
51295           "sidedgroup",
51296           sideddata,
51297           function marker(d) {
51298             var category = graph.entity(d.id).sidednessIdentifier();
51299             return "url(#ideditor-sided-marker-" + category + ")";
51300           }
51301         );
51302       });
51303       touchLayer.call(drawTargets, graph, ways, filter2);
51304     }
51305     return drawLines;
51306   }
51307
51308   // modules/svg/midpoints.js
51309   function svgMidpoints(projection2, context) {
51310     var targetRadius = 8;
51311     function drawTargets(selection2, graph, entities, filter2) {
51312       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
51313       var getTransform = svgPointTransform(projection2).geojson;
51314       var data = entities.map(function(midpoint) {
51315         return {
51316           type: "Feature",
51317           id: midpoint.id,
51318           properties: {
51319             target: true,
51320             entity: midpoint
51321           },
51322           geometry: {
51323             type: "Point",
51324             coordinates: midpoint.loc
51325           }
51326         };
51327       });
51328       var targets = selection2.selectAll(".midpoint.target").filter(function(d) {
51329         return filter2(d.properties.entity);
51330       }).data(data, function key(d) {
51331         return d.id;
51332       });
51333       targets.exit().remove();
51334       targets.enter().append("circle").attr("r", targetRadius).merge(targets).attr("class", function(d) {
51335         return "node midpoint target " + fillClass + d.id;
51336       }).attr("transform", getTransform);
51337     }
51338     function drawMidpoints(selection2, graph, entities, filter2, extent) {
51339       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.midpoints");
51340       var touchLayer = selection2.selectAll(".layer-touch.points");
51341       var mode = context.mode();
51342       if (mode && mode.id !== "select" || !context.map().withinEditableZoom()) {
51343         drawLayer.selectAll(".midpoint").remove();
51344         touchLayer.selectAll(".midpoint.target").remove();
51345         return;
51346       }
51347       var poly = extent.polygon();
51348       var midpoints = {};
51349       for (var i2 = 0; i2 < entities.length; i2++) {
51350         var entity = entities[i2];
51351         if (entity.type !== "way")
51352           continue;
51353         if (!filter2(entity))
51354           continue;
51355         if (context.selectedIDs().indexOf(entity.id) < 0)
51356           continue;
51357         var nodes = graph.childNodes(entity);
51358         for (var j2 = 0; j2 < nodes.length - 1; j2++) {
51359           var a = nodes[j2];
51360           var b = nodes[j2 + 1];
51361           var id2 = [a.id, b.id].sort().join("-");
51362           if (midpoints[id2]) {
51363             midpoints[id2].parents.push(entity);
51364           } else if (geoVecLength(projection2(a.loc), projection2(b.loc)) > 40) {
51365             var point2 = geoVecInterp(a.loc, b.loc, 0.5);
51366             var loc = null;
51367             if (extent.intersects(point2)) {
51368               loc = point2;
51369             } else {
51370               for (var k = 0; k < 4; k++) {
51371                 point2 = geoLineIntersection([a.loc, b.loc], [poly[k], poly[k + 1]]);
51372                 if (point2 && geoVecLength(projection2(a.loc), projection2(point2)) > 20 && geoVecLength(projection2(b.loc), projection2(point2)) > 20) {
51373                   loc = point2;
51374                   break;
51375                 }
51376               }
51377             }
51378             if (loc) {
51379               midpoints[id2] = {
51380                 type: "midpoint",
51381                 id: id2,
51382                 loc,
51383                 edge: [a.id, b.id],
51384                 parents: [entity]
51385               };
51386             }
51387           }
51388         }
51389       }
51390       function midpointFilter(d) {
51391         if (midpoints[d.id])
51392           return true;
51393         for (var i3 = 0; i3 < d.parents.length; i3++) {
51394           if (filter2(d.parents[i3])) {
51395             return true;
51396           }
51397         }
51398         return false;
51399       }
51400       var groups = drawLayer.selectAll(".midpoint").filter(midpointFilter).data(Object.values(midpoints), function(d) {
51401         return d.id;
51402       });
51403       groups.exit().remove();
51404       var enter = groups.enter().insert("g", ":first-child").attr("class", "midpoint");
51405       enter.append("polygon").attr("points", "-6,8 10,0 -6,-8").attr("class", "shadow");
51406       enter.append("polygon").attr("points", "-3,4 5,0 -3,-4").attr("class", "fill");
51407       groups = groups.merge(enter).attr("transform", function(d) {
51408         var translate = svgPointTransform(projection2);
51409         var a2 = graph.entity(d.edge[0]);
51410         var b2 = graph.entity(d.edge[1]);
51411         var angle2 = geoAngle(a2, b2, projection2) * (180 / Math.PI);
51412         return translate(d) + " rotate(" + angle2 + ")";
51413       }).call(svgTagClasses().tags(
51414         function(d) {
51415           return d.parents[0].tags;
51416         }
51417       ));
51418       groups.select("polygon.shadow");
51419       groups.select("polygon.fill");
51420       touchLayer.call(drawTargets, graph, Object.values(midpoints), midpointFilter);
51421     }
51422     return drawMidpoints;
51423   }
51424
51425   // modules/svg/points.js
51426   var import_fast_deep_equal7 = __toESM(require_fast_deep_equal());
51427   function svgPoints(projection2, context) {
51428     function markerPath(selection2, klass) {
51429       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");
51430     }
51431     function sortY(a, b) {
51432       return b.loc[1] - a.loc[1];
51433     }
51434     function fastEntityKey(d) {
51435       var mode = context.mode();
51436       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
51437       return isMoving ? d.id : osmEntity.key(d);
51438     }
51439     function drawTargets(selection2, graph, entities, filter2) {
51440       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
51441       var getTransform = svgPointTransform(projection2).geojson;
51442       var activeID = context.activeID();
51443       var data = [];
51444       entities.forEach(function(node) {
51445         if (activeID === node.id)
51446           return;
51447         data.push({
51448           type: "Feature",
51449           id: node.id,
51450           properties: {
51451             target: true,
51452             entity: node
51453           },
51454           geometry: node.asGeoJSON()
51455         });
51456       });
51457       var targets = selection2.selectAll(".point.target").filter(function(d) {
51458         return filter2(d.properties.entity);
51459       }).data(data, function key(d) {
51460         return d.id;
51461       });
51462       targets.exit().remove();
51463       targets.enter().append("rect").attr("x", -10).attr("y", -26).attr("width", 20).attr("height", 30).merge(targets).attr("class", function(d) {
51464         return "node point target " + fillClass + d.id;
51465       }).attr("transform", getTransform);
51466     }
51467     function drawPoints(selection2, graph, entities, filter2) {
51468       var wireframe = context.surface().classed("fill-wireframe");
51469       var zoom = geoScaleToZoom(projection2.scale());
51470       var base = context.history().base();
51471       function renderAsPoint(entity) {
51472         return entity.geometry(graph) === "point" && !(zoom >= 18 && entity.directions(graph, projection2).length);
51473       }
51474       var points = wireframe ? [] : entities.filter(renderAsPoint);
51475       points.sort(sortY);
51476       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.points");
51477       var touchLayer = selection2.selectAll(".layer-touch.points");
51478       var groups = drawLayer.selectAll("g.point").filter(filter2).data(points, fastEntityKey);
51479       groups.exit().remove();
51480       var enter = groups.enter().append("g").attr("class", function(d) {
51481         return "node point " + d.id;
51482       }).order();
51483       enter.append("path").call(markerPath, "shadow");
51484       enter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
51485       enter.append("path").call(markerPath, "stroke");
51486       enter.append("use").attr("transform", "translate(-5.5, -20)").attr("class", "icon").attr("width", "12px").attr("height", "12px");
51487       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("added", function(d) {
51488         return !base.entities[d.id];
51489       }).classed("moved", function(d) {
51490         return base.entities[d.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d.id].loc, base.entities[d.id].loc);
51491       }).classed("retagged", function(d) {
51492         return base.entities[d.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d.id].tags, base.entities[d.id].tags);
51493       }).call(svgTagClasses());
51494       groups.select(".shadow");
51495       groups.select(".stroke");
51496       groups.select(".icon").attr("xlink:href", function(entity) {
51497         var preset = _mainPresetIndex.match(entity, graph);
51498         var picon = preset && preset.icon;
51499         return picon ? "#" + picon : "";
51500       });
51501       touchLayer.call(drawTargets, graph, points, filter2);
51502     }
51503     return drawPoints;
51504   }
51505
51506   // modules/svg/turns.js
51507   function svgTurns(projection2, context) {
51508     function icon2(turn) {
51509       var u = turn.u ? "-u" : "";
51510       if (turn.no)
51511         return "#iD-turn-no" + u;
51512       if (turn.only)
51513         return "#iD-turn-only" + u;
51514       return "#iD-turn-yes" + u;
51515     }
51516     function drawTurns(selection2, graph, turns) {
51517       function turnTransform(d) {
51518         var pxRadius = 50;
51519         var toWay = graph.entity(d.to.way);
51520         var toPoints = graph.childNodes(toWay).map(function(n2) {
51521           return n2.loc;
51522         }).map(projection2);
51523         var toLength = geoPathLength(toPoints);
51524         var mid = toLength / 2;
51525         var toNode = graph.entity(d.to.node);
51526         var toVertex = graph.entity(d.to.vertex);
51527         var a = geoAngle(toVertex, toNode, projection2);
51528         var o = projection2(toVertex.loc);
51529         var r = d.u ? 0 : !toWay.__via ? pxRadius : Math.min(mid, pxRadius);
51530         return "translate(" + (r * Math.cos(a) + o[0]) + "," + (r * Math.sin(a) + o[1]) + ") rotate(" + a * 180 / Math.PI + ")";
51531       }
51532       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.turns");
51533       var touchLayer = selection2.selectAll(".layer-touch.turns");
51534       var groups = drawLayer.selectAll("g.turn").data(turns, function(d) {
51535         return d.key;
51536       });
51537       groups.exit().remove();
51538       var groupsEnter = groups.enter().append("g").attr("class", function(d) {
51539         return "turn " + d.key;
51540       });
51541       var turnsEnter = groupsEnter.filter(function(d) {
51542         return !d.u;
51543       });
51544       turnsEnter.append("rect").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
51545       turnsEnter.append("use").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
51546       var uEnter = groupsEnter.filter(function(d) {
51547         return d.u;
51548       });
51549       uEnter.append("circle").attr("r", "16");
51550       uEnter.append("use").attr("transform", "translate(-16, -16)").attr("width", "32").attr("height", "32");
51551       groups = groups.merge(groupsEnter).attr("opacity", function(d) {
51552         return d.direct === false ? "0.7" : null;
51553       }).attr("transform", turnTransform);
51554       groups.select("use").attr("xlink:href", icon2);
51555       groups.select("rect");
51556       groups.select("circle");
51557       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
51558       groups = touchLayer.selectAll("g.turn").data(turns, function(d) {
51559         return d.key;
51560       });
51561       groups.exit().remove();
51562       groupsEnter = groups.enter().append("g").attr("class", function(d) {
51563         return "turn " + d.key;
51564       });
51565       turnsEnter = groupsEnter.filter(function(d) {
51566         return !d.u;
51567       });
51568       turnsEnter.append("rect").attr("class", "target " + fillClass).attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
51569       uEnter = groupsEnter.filter(function(d) {
51570         return d.u;
51571       });
51572       uEnter.append("circle").attr("class", "target " + fillClass).attr("r", "16");
51573       groups = groups.merge(groupsEnter).attr("transform", turnTransform);
51574       groups.select("rect");
51575       groups.select("circle");
51576       return this;
51577     }
51578     return drawTurns;
51579   }
51580
51581   // modules/svg/vertices.js
51582   var import_fast_deep_equal8 = __toESM(require_fast_deep_equal());
51583   function svgVertices(projection2, context) {
51584     var radiuses = {
51585       //       z16-, z17,   z18+,  w/icon
51586       shadow: [6, 7.5, 7.5, 12],
51587       stroke: [2.5, 3.5, 3.5, 8],
51588       fill: [1, 1.5, 1.5, 1.5]
51589     };
51590     var _currHoverTarget;
51591     var _currPersistent = {};
51592     var _currHover = {};
51593     var _prevHover = {};
51594     var _currSelected = {};
51595     var _prevSelected = {};
51596     var _radii = {};
51597     function sortY(a, b) {
51598       return b.loc[1] - a.loc[1];
51599     }
51600     function fastEntityKey(d) {
51601       var mode = context.mode();
51602       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
51603       return isMoving ? d.id : osmEntity.key(d);
51604     }
51605     function draw(selection2, graph, vertices, sets2, filter2) {
51606       sets2 = sets2 || { selected: {}, important: {}, hovered: {} };
51607       var icons = {};
51608       var directions = {};
51609       var wireframe = context.surface().classed("fill-wireframe");
51610       var zoom = geoScaleToZoom(projection2.scale());
51611       var z = zoom < 17 ? 0 : zoom < 18 ? 1 : 2;
51612       var activeID = context.activeID();
51613       var base = context.history().base();
51614       function getIcon(d) {
51615         var entity = graph.entity(d.id);
51616         if (entity.id in icons)
51617           return icons[entity.id];
51618         icons[entity.id] = entity.hasInterestingTags() && _mainPresetIndex.match(entity, graph).icon;
51619         return icons[entity.id];
51620       }
51621       function getDirections(entity) {
51622         if (entity.id in directions)
51623           return directions[entity.id];
51624         var angles = entity.directions(graph, projection2);
51625         directions[entity.id] = angles.length ? angles : false;
51626         return angles;
51627       }
51628       function updateAttributes(selection3) {
51629         ["shadow", "stroke", "fill"].forEach(function(klass) {
51630           var rads = radiuses[klass];
51631           selection3.selectAll("." + klass).each(function(entity) {
51632             var i2 = z && getIcon(entity);
51633             var r = rads[i2 ? 3 : z];
51634             if (entity.id !== activeID && entity.isEndpoint(graph) && !entity.isConnected(graph)) {
51635               r += 1.5;
51636             }
51637             if (klass === "shadow") {
51638               _radii[entity.id] = r;
51639             }
51640             select_default2(this).attr("r", r).attr("visibility", i2 && klass === "fill" ? "hidden" : null);
51641           });
51642         });
51643       }
51644       vertices.sort(sortY);
51645       var groups = selection2.selectAll("g.vertex").filter(filter2).data(vertices, fastEntityKey);
51646       groups.exit().remove();
51647       var enter = groups.enter().append("g").attr("class", function(d) {
51648         return "node vertex " + d.id;
51649       }).order();
51650       enter.append("circle").attr("class", "shadow");
51651       enter.append("circle").attr("class", "stroke");
51652       enter.filter(function(d) {
51653         return d.hasInterestingTags();
51654       }).append("circle").attr("class", "fill");
51655       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("sibling", function(d) {
51656         return d.id in sets2.selected;
51657       }).classed("shared", function(d) {
51658         return graph.isShared(d);
51659       }).classed("endpoint", function(d) {
51660         return d.isEndpoint(graph);
51661       }).classed("added", function(d) {
51662         return !base.entities[d.id];
51663       }).classed("moved", function(d) {
51664         return base.entities[d.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d.id].loc, base.entities[d.id].loc);
51665       }).classed("retagged", function(d) {
51666         return base.entities[d.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d.id].tags, base.entities[d.id].tags);
51667       }).call(updateAttributes);
51668       var iconUse = groups.selectAll(".icon").data(function data(d) {
51669         return zoom >= 17 && getIcon(d) ? [d] : [];
51670       }, fastEntityKey);
51671       iconUse.exit().remove();
51672       iconUse.enter().append("use").attr("class", "icon").attr("width", "12px").attr("height", "12px").attr("transform", "translate(-6, -6)").attr("xlink:href", function(d) {
51673         var picon = getIcon(d);
51674         return picon ? "#" + picon : "";
51675       });
51676       var dgroups = groups.selectAll(".viewfieldgroup").data(function data(d) {
51677         return zoom >= 18 && getDirections(d) ? [d] : [];
51678       }, fastEntityKey);
51679       dgroups.exit().remove();
51680       dgroups = dgroups.enter().insert("g", ".shadow").attr("class", "viewfieldgroup").merge(dgroups);
51681       var viewfields = dgroups.selectAll(".viewfield").data(getDirections, function key(d) {
51682         return osmEntity.key(d);
51683       });
51684       viewfields.exit().remove();
51685       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) {
51686         return "rotate(" + d + ")";
51687       });
51688     }
51689     function drawTargets(selection2, graph, entities, filter2) {
51690       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
51691       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
51692       var getTransform = svgPointTransform(projection2).geojson;
51693       var activeID = context.activeID();
51694       var data = { targets: [], nopes: [] };
51695       entities.forEach(function(node) {
51696         if (activeID === node.id)
51697           return;
51698         var vertexType = svgPassiveVertex(node, graph, activeID);
51699         if (vertexType !== 0) {
51700           data.targets.push({
51701             type: "Feature",
51702             id: node.id,
51703             properties: {
51704               target: true,
51705               entity: node
51706             },
51707             geometry: node.asGeoJSON()
51708           });
51709         } else {
51710           data.nopes.push({
51711             type: "Feature",
51712             id: node.id + "-nope",
51713             properties: {
51714               nope: true,
51715               target: true,
51716               entity: node
51717             },
51718             geometry: node.asGeoJSON()
51719           });
51720         }
51721       });
51722       var targets = selection2.selectAll(".vertex.target-allowed").filter(function(d) {
51723         return filter2(d.properties.entity);
51724       }).data(data.targets, function key(d) {
51725         return d.id;
51726       });
51727       targets.exit().remove();
51728       targets.enter().append("circle").attr("r", function(d) {
51729         return _radii[d.id] || radiuses.shadow[3];
51730       }).merge(targets).attr("class", function(d) {
51731         return "node vertex target target-allowed " + targetClass + d.id;
51732       }).attr("transform", getTransform);
51733       var nopes = selection2.selectAll(".vertex.target-nope").filter(function(d) {
51734         return filter2(d.properties.entity);
51735       }).data(data.nopes, function key(d) {
51736         return d.id;
51737       });
51738       nopes.exit().remove();
51739       nopes.enter().append("circle").attr("r", function(d) {
51740         return _radii[d.properties.entity.id] || radiuses.shadow[3];
51741       }).merge(nopes).attr("class", function(d) {
51742         return "node vertex target target-nope " + nopeClass + d.id;
51743       }).attr("transform", getTransform);
51744     }
51745     function renderAsVertex(entity, graph, wireframe, zoom) {
51746       var geometry = entity.geometry(graph);
51747       return geometry === "vertex" || geometry === "point" && (wireframe || zoom >= 18 && entity.directions(graph, projection2).length);
51748     }
51749     function isEditedNode(node, base, head) {
51750       var baseNode = base.entities[node.id];
51751       var headNode = head.entities[node.id];
51752       return !headNode || !baseNode || !(0, import_fast_deep_equal8.default)(headNode.tags, baseNode.tags) || !(0, import_fast_deep_equal8.default)(headNode.loc, baseNode.loc);
51753     }
51754     function getSiblingAndChildVertices(ids, graph, wireframe, zoom) {
51755       var results = {};
51756       var seenIds = {};
51757       function addChildVertices(entity) {
51758         if (seenIds[entity.id])
51759           return;
51760         seenIds[entity.id] = true;
51761         var geometry = entity.geometry(graph);
51762         if (!context.features().isHiddenFeature(entity, graph, geometry)) {
51763           var i2;
51764           if (entity.type === "way") {
51765             for (i2 = 0; i2 < entity.nodes.length; i2++) {
51766               var child = graph.hasEntity(entity.nodes[i2]);
51767               if (child) {
51768                 addChildVertices(child);
51769               }
51770             }
51771           } else if (entity.type === "relation") {
51772             for (i2 = 0; i2 < entity.members.length; i2++) {
51773               var member = graph.hasEntity(entity.members[i2].id);
51774               if (member) {
51775                 addChildVertices(member);
51776               }
51777             }
51778           } else if (renderAsVertex(entity, graph, wireframe, zoom)) {
51779             results[entity.id] = entity;
51780           }
51781         }
51782       }
51783       ids.forEach(function(id2) {
51784         var entity = graph.hasEntity(id2);
51785         if (!entity)
51786           return;
51787         if (entity.type === "node") {
51788           if (renderAsVertex(entity, graph, wireframe, zoom)) {
51789             results[entity.id] = entity;
51790             graph.parentWays(entity).forEach(function(entity2) {
51791               addChildVertices(entity2);
51792             });
51793           }
51794         } else {
51795           addChildVertices(entity);
51796         }
51797       });
51798       return results;
51799     }
51800     function drawVertices(selection2, graph, entities, filter2, extent, fullRedraw) {
51801       var wireframe = context.surface().classed("fill-wireframe");
51802       var visualDiff = context.surface().classed("highlight-edited");
51803       var zoom = geoScaleToZoom(projection2.scale());
51804       var mode = context.mode();
51805       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
51806       var base = context.history().base();
51807       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.vertices");
51808       var touchLayer = selection2.selectAll(".layer-touch.points");
51809       if (fullRedraw) {
51810         _currPersistent = {};
51811         _radii = {};
51812       }
51813       for (var i2 = 0; i2 < entities.length; i2++) {
51814         var entity = entities[i2];
51815         var geometry = entity.geometry(graph);
51816         var keep = false;
51817         if (geometry === "point" && renderAsVertex(entity, graph, wireframe, zoom)) {
51818           _currPersistent[entity.id] = entity;
51819           keep = true;
51820         } else if (geometry === "vertex" && (entity.hasInterestingTags() || entity.isEndpoint(graph) || entity.isConnected(graph) || visualDiff && isEditedNode(entity, base, graph))) {
51821           _currPersistent[entity.id] = entity;
51822           keep = true;
51823         }
51824         if (!keep && !fullRedraw) {
51825           delete _currPersistent[entity.id];
51826         }
51827       }
51828       var sets2 = {
51829         persistent: _currPersistent,
51830         // persistent = important vertices (render always)
51831         selected: _currSelected,
51832         // selected + siblings of selected (render always)
51833         hovered: _currHover
51834         // hovered + siblings of hovered (render only in draw modes)
51835       };
51836       var all = Object.assign({}, isMoving ? _currHover : {}, _currSelected, _currPersistent);
51837       var filterRendered = function(d) {
51838         return d.id in _currPersistent || d.id in _currSelected || d.id in _currHover || filter2(d);
51839       };
51840       drawLayer.call(draw, graph, currentVisible(all), sets2, filterRendered);
51841       var filterTouch = function(d) {
51842         return isMoving ? true : filterRendered(d);
51843       };
51844       touchLayer.call(drawTargets, graph, currentVisible(all), filterTouch);
51845       function currentVisible(which) {
51846         return Object.keys(which).map(graph.hasEntity, graph).filter(function(entity2) {
51847           return entity2 && entity2.intersects(extent, graph);
51848         });
51849       }
51850     }
51851     drawVertices.drawSelected = function(selection2, graph, extent) {
51852       var wireframe = context.surface().classed("fill-wireframe");
51853       var zoom = geoScaleToZoom(projection2.scale());
51854       _prevSelected = _currSelected || {};
51855       if (context.map().isInWideSelection()) {
51856         _currSelected = {};
51857         context.selectedIDs().forEach(function(id2) {
51858           var entity = graph.hasEntity(id2);
51859           if (!entity)
51860             return;
51861           if (entity.type === "node") {
51862             if (renderAsVertex(entity, graph, wireframe, zoom)) {
51863               _currSelected[entity.id] = entity;
51864             }
51865           }
51866         });
51867       } else {
51868         _currSelected = getSiblingAndChildVertices(context.selectedIDs(), graph, wireframe, zoom);
51869       }
51870       var filter2 = function(d) {
51871         return d.id in _prevSelected;
51872       };
51873       drawVertices(selection2, graph, Object.values(_prevSelected), filter2, extent, false);
51874     };
51875     drawVertices.drawHover = function(selection2, graph, target, extent) {
51876       if (target === _currHoverTarget)
51877         return;
51878       var wireframe = context.surface().classed("fill-wireframe");
51879       var zoom = geoScaleToZoom(projection2.scale());
51880       _prevHover = _currHover || {};
51881       _currHoverTarget = target;
51882       var entity = target && target.properties && target.properties.entity;
51883       if (entity) {
51884         _currHover = getSiblingAndChildVertices([entity.id], graph, wireframe, zoom);
51885       } else {
51886         _currHover = {};
51887       }
51888       var filter2 = function(d) {
51889         return d.id in _prevHover;
51890       };
51891       drawVertices(selection2, graph, Object.values(_prevHover), filter2, extent, false);
51892     };
51893     return drawVertices;
51894   }
51895
51896   // modules/util/bind_once.js
51897   function utilBindOnce(target, type2, listener, capture) {
51898     var typeOnce = type2 + ".once";
51899     function one2() {
51900       target.on(typeOnce, null);
51901       listener.apply(this, arguments);
51902     }
51903     target.on(typeOnce, one2, capture);
51904     return this;
51905   }
51906
51907   // modules/util/zoom_pan.js
51908   function defaultFilter3(d3_event) {
51909     return !d3_event.ctrlKey && !d3_event.button;
51910   }
51911   function defaultExtent2() {
51912     var e = this;
51913     if (e instanceof SVGElement) {
51914       e = e.ownerSVGElement || e;
51915       if (e.hasAttribute("viewBox")) {
51916         e = e.viewBox.baseVal;
51917         return [[e.x, e.y], [e.x + e.width, e.y + e.height]];
51918       }
51919       return [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]];
51920     }
51921     return [[0, 0], [e.clientWidth, e.clientHeight]];
51922   }
51923   function defaultWheelDelta2(d3_event) {
51924     return -d3_event.deltaY * (d3_event.deltaMode === 1 ? 0.05 : d3_event.deltaMode ? 1 : 2e-3);
51925   }
51926   function defaultConstrain2(transform2, extent, translateExtent) {
51927     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];
51928     return transform2.translate(
51929       dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
51930       dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
51931     );
51932   }
51933   function utilZoomPan() {
51934     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;
51935     function zoom(selection2) {
51936       selection2.on("pointerdown.zoom", pointerdown).on("wheel.zoom", wheeled).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
51937       select_default2(window).on("pointermove.zoompan", pointermove).on("pointerup.zoompan pointercancel.zoompan", pointerup);
51938     }
51939     zoom.transform = function(collection, transform2, point2) {
51940       var selection2 = collection.selection ? collection.selection() : collection;
51941       if (collection !== selection2) {
51942         schedule(collection, transform2, point2);
51943       } else {
51944         selection2.interrupt().each(function() {
51945           gesture(this, arguments).start(null).zoom(null, null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end(null);
51946         });
51947       }
51948     };
51949     zoom.scaleBy = function(selection2, k, p) {
51950       zoom.scaleTo(selection2, function() {
51951         var k0 = _transform.k, k1 = typeof k === "function" ? k.apply(this, arguments) : k;
51952         return k0 * k1;
51953       }, p);
51954     };
51955     zoom.scaleTo = function(selection2, k, p) {
51956       zoom.transform(selection2, function() {
51957         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;
51958         return constrain(translate(scale(t0, k1), p02, p1), e, translateExtent);
51959       }, p);
51960     };
51961     zoom.translateBy = function(selection2, x, y) {
51962       zoom.transform(selection2, function() {
51963         return constrain(_transform.translate(
51964           typeof x === "function" ? x.apply(this, arguments) : x,
51965           typeof y === "function" ? y.apply(this, arguments) : y
51966         ), extent.apply(this, arguments), translateExtent);
51967       });
51968     };
51969     zoom.translateTo = function(selection2, x, y, p) {
51970       zoom.transform(selection2, function() {
51971         var e = extent.apply(this, arguments), t = _transform, p02 = !p ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p;
51972         return constrain(identity2.translate(p02[0], p02[1]).scale(t.k).translate(
51973           typeof x === "function" ? -x.apply(this, arguments) : -x,
51974           typeof y === "function" ? -y.apply(this, arguments) : -y
51975         ), e, translateExtent);
51976       }, p);
51977     };
51978     function scale(transform2, k) {
51979       k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));
51980       return k === transform2.k ? transform2 : new Transform(k, transform2.x, transform2.y);
51981     }
51982     function translate(transform2, p02, p1) {
51983       var x = p02[0] - p1[0] * transform2.k, y = p02[1] - p1[1] * transform2.k;
51984       return x === transform2.x && y === transform2.y ? transform2 : new Transform(transform2.k, x, y);
51985     }
51986     function centroid(extent2) {
51987       return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
51988     }
51989     function schedule(transition2, transform2, point2) {
51990       transition2.on("start.zoom", function() {
51991         gesture(this, arguments).start(null);
51992       }).on("interrupt.zoom end.zoom", function() {
51993         gesture(this, arguments).end(null);
51994       }).tween("zoom", function() {
51995         var that = this, args = arguments, g = gesture(that, args), e = extent.apply(that, args), p = !point2 ? centroid(e) : typeof point2 === "function" ? point2.apply(that, args) : point2, 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));
51996         return function(t) {
51997           if (t === 1) {
51998             t = b;
51999           } else {
52000             var l = i2(t);
52001             var k = w / l[2];
52002             t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k);
52003           }
52004           g.zoom(null, null, t);
52005         };
52006       });
52007     }
52008     function gesture(that, args, clean2) {
52009       return !clean2 && _activeGesture || new Gesture(that, args);
52010     }
52011     function Gesture(that, args) {
52012       this.that = that;
52013       this.args = args;
52014       this.active = 0;
52015       this.extent = extent.apply(that, args);
52016     }
52017     Gesture.prototype = {
52018       start: function(d3_event) {
52019         if (++this.active === 1) {
52020           _activeGesture = this;
52021           dispatch10.call("start", this, d3_event);
52022         }
52023         return this;
52024       },
52025       zoom: function(d3_event, key, transform2) {
52026         if (this.mouse && key !== "mouse")
52027           this.mouse[1] = transform2.invert(this.mouse[0]);
52028         if (this.pointer0 && key !== "touch")
52029           this.pointer0[1] = transform2.invert(this.pointer0[0]);
52030         if (this.pointer1 && key !== "touch")
52031           this.pointer1[1] = transform2.invert(this.pointer1[0]);
52032         _transform = transform2;
52033         dispatch10.call("zoom", this, d3_event, key, transform2);
52034         return this;
52035       },
52036       end: function(d3_event) {
52037         if (--this.active === 0) {
52038           _activeGesture = null;
52039           dispatch10.call("end", this, d3_event);
52040         }
52041         return this;
52042       }
52043     };
52044     function wheeled(d3_event) {
52045       if (!filter2.apply(this, arguments))
52046         return;
52047       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);
52048       if (g.wheel) {
52049         if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {
52050           g.mouse[1] = t.invert(g.mouse[0] = p);
52051         }
52052         clearTimeout(g.wheel);
52053       } else {
52054         g.mouse = [p, t.invert(p)];
52055         interrupt_default(this);
52056         g.start(d3_event);
52057       }
52058       d3_event.preventDefault();
52059       d3_event.stopImmediatePropagation();
52060       g.wheel = setTimeout(wheelidled, _wheelDelay);
52061       g.zoom(d3_event, "mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
52062       function wheelidled() {
52063         g.wheel = null;
52064         g.end(d3_event);
52065       }
52066     }
52067     var _downPointerIDs = /* @__PURE__ */ new Set();
52068     var _pointerLocGetter;
52069     function pointerdown(d3_event) {
52070       _downPointerIDs.add(d3_event.pointerId);
52071       if (!filter2.apply(this, arguments))
52072         return;
52073       var g = gesture(this, arguments, _downPointerIDs.size === 1);
52074       var started;
52075       d3_event.stopImmediatePropagation();
52076       _pointerLocGetter = utilFastMouse(this);
52077       var loc = _pointerLocGetter(d3_event);
52078       var p = [loc, _transform.invert(loc), d3_event.pointerId];
52079       if (!g.pointer0) {
52080         g.pointer0 = p;
52081         started = true;
52082       } else if (!g.pointer1 && g.pointer0[2] !== p[2]) {
52083         g.pointer1 = p;
52084       }
52085       if (started) {
52086         interrupt_default(this);
52087         g.start(d3_event);
52088       }
52089     }
52090     function pointermove(d3_event) {
52091       if (!_downPointerIDs.has(d3_event.pointerId))
52092         return;
52093       if (!_activeGesture || !_pointerLocGetter)
52094         return;
52095       var g = gesture(this, arguments);
52096       var isPointer0 = g.pointer0 && g.pointer0[2] === d3_event.pointerId;
52097       var isPointer1 = !isPointer0 && g.pointer1 && g.pointer1[2] === d3_event.pointerId;
52098       if ((isPointer0 || isPointer1) && "buttons" in d3_event && !d3_event.buttons) {
52099         if (g.pointer0)
52100           _downPointerIDs.delete(g.pointer0[2]);
52101         if (g.pointer1)
52102           _downPointerIDs.delete(g.pointer1[2]);
52103         g.end(d3_event);
52104         return;
52105       }
52106       d3_event.preventDefault();
52107       d3_event.stopImmediatePropagation();
52108       var loc = _pointerLocGetter(d3_event);
52109       var t, p, l;
52110       if (isPointer0)
52111         g.pointer0[0] = loc;
52112       else if (isPointer1)
52113         g.pointer1[0] = loc;
52114       t = _transform;
52115       if (g.pointer1) {
52116         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;
52117         t = scale(t, Math.sqrt(dp / dl));
52118         p = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
52119         l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
52120       } else if (g.pointer0) {
52121         p = g.pointer0[0];
52122         l = g.pointer0[1];
52123       } else {
52124         return;
52125       }
52126       g.zoom(d3_event, "touch", constrain(translate(t, p, l), g.extent, translateExtent));
52127     }
52128     function pointerup(d3_event) {
52129       if (!_downPointerIDs.has(d3_event.pointerId))
52130         return;
52131       _downPointerIDs.delete(d3_event.pointerId);
52132       if (!_activeGesture)
52133         return;
52134       var g = gesture(this, arguments);
52135       d3_event.stopImmediatePropagation();
52136       if (g.pointer0 && g.pointer0[2] === d3_event.pointerId)
52137         delete g.pointer0;
52138       else if (g.pointer1 && g.pointer1[2] === d3_event.pointerId)
52139         delete g.pointer1;
52140       if (g.pointer1 && !g.pointer0) {
52141         g.pointer0 = g.pointer1;
52142         delete g.pointer1;
52143       }
52144       if (g.pointer0) {
52145         g.pointer0[1] = _transform.invert(g.pointer0[0]);
52146       } else {
52147         g.end(d3_event);
52148       }
52149     }
52150     zoom.wheelDelta = function(_) {
52151       return arguments.length ? (wheelDelta = utilFunctor(+_), zoom) : wheelDelta;
52152     };
52153     zoom.filter = function(_) {
52154       return arguments.length ? (filter2 = utilFunctor(!!_), zoom) : filter2;
52155     };
52156     zoom.extent = function(_) {
52157       return arguments.length ? (extent = utilFunctor([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
52158     };
52159     zoom.scaleExtent = function(_) {
52160       return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];
52161     };
52162     zoom.translateExtent = function(_) {
52163       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]]];
52164     };
52165     zoom.constrain = function(_) {
52166       return arguments.length ? (constrain = _, zoom) : constrain;
52167     };
52168     zoom.interpolate = function(_) {
52169       return arguments.length ? (interpolate = _, zoom) : interpolate;
52170     };
52171     zoom._transform = function(_) {
52172       return arguments.length ? (_transform = _, zoom) : _transform;
52173     };
52174     return utilRebind(zoom, dispatch10, "on");
52175   }
52176
52177   // modules/util/double_up.js
52178   function utilDoubleUp() {
52179     var dispatch10 = dispatch_default("doubleUp");
52180     var _maxTimespan = 500;
52181     var _maxDistance = 20;
52182     var _pointer;
52183     function pointerIsValidFor(loc) {
52184       return (/* @__PURE__ */ new Date()).getTime() - _pointer.startTime <= _maxTimespan && // all pointer events must occur within a small distance of the first pointerdown
52185       geoVecLength(_pointer.startLoc, loc) <= _maxDistance;
52186     }
52187     function pointerdown(d3_event) {
52188       if (d3_event.ctrlKey || d3_event.button === 2)
52189         return;
52190       var loc = [d3_event.clientX, d3_event.clientY];
52191       if (_pointer && !pointerIsValidFor(loc)) {
52192         _pointer = void 0;
52193       }
52194       if (!_pointer) {
52195         _pointer = {
52196           startLoc: loc,
52197           startTime: (/* @__PURE__ */ new Date()).getTime(),
52198           upCount: 0,
52199           pointerId: d3_event.pointerId
52200         };
52201       } else {
52202         _pointer.pointerId = d3_event.pointerId;
52203       }
52204     }
52205     function pointerup(d3_event) {
52206       if (d3_event.ctrlKey || d3_event.button === 2)
52207         return;
52208       if (!_pointer || _pointer.pointerId !== d3_event.pointerId)
52209         return;
52210       _pointer.upCount += 1;
52211       if (_pointer.upCount === 2) {
52212         var loc = [d3_event.clientX, d3_event.clientY];
52213         if (pointerIsValidFor(loc)) {
52214           var locInThis = utilFastMouse(this)(d3_event);
52215           dispatch10.call("doubleUp", this, d3_event, locInThis);
52216         }
52217         _pointer = void 0;
52218       }
52219     }
52220     function doubleUp(selection2) {
52221       if ("PointerEvent" in window) {
52222         selection2.on("pointerdown.doubleUp", pointerdown).on("pointerup.doubleUp", pointerup);
52223       } else {
52224         selection2.on("dblclick.doubleUp", function(d3_event) {
52225           dispatch10.call("doubleUp", this, d3_event, utilFastMouse(this)(d3_event));
52226         });
52227       }
52228     }
52229     doubleUp.off = function(selection2) {
52230       selection2.on("pointerdown.doubleUp", null).on("pointerup.doubleUp", null).on("dblclick.doubleUp", null);
52231     };
52232     return utilRebind(doubleUp, dispatch10, "on");
52233   }
52234
52235   // modules/renderer/map.js
52236   var TILESIZE = 256;
52237   var minZoom2 = 2;
52238   var maxZoom = 24;
52239   var kMin = geoZoomToScale(minZoom2, TILESIZE);
52240   var kMax = geoZoomToScale(maxZoom, TILESIZE);
52241   function clamp(num, min3, max3) {
52242     return Math.max(min3, Math.min(num, max3));
52243   }
52244   function rendererMap(context) {
52245     var dispatch10 = dispatch_default(
52246       "move",
52247       "drawn",
52248       "crossEditableZoom",
52249       "hitMinZoom",
52250       "changeHighlighting",
52251       "changeAreaFill"
52252     );
52253     var projection2 = context.projection;
52254     var curtainProjection = context.curtainProjection;
52255     var drawLayers;
52256     var drawPoints;
52257     var drawVertices;
52258     var drawLines;
52259     var drawAreas;
52260     var drawMidpoints;
52261     var drawLabels;
52262     var _selection = select_default2(null);
52263     var supersurface = select_default2(null);
52264     var wrapper = select_default2(null);
52265     var surface = select_default2(null);
52266     var _dimensions = [1, 1];
52267     var _dblClickZoomEnabled = true;
52268     var _redrawEnabled = true;
52269     var _gestureTransformStart;
52270     var _transformStart = projection2.transform();
52271     var _transformLast;
52272     var _isTransformed = false;
52273     var _minzoom = 0;
52274     var _getMouseCoords;
52275     var _lastPointerEvent;
52276     var _lastWithinEditableZoom;
52277     var _pointerDown = false;
52278     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
52279     var _zoomerPannerFunction = "PointerEvent" in window ? utilZoomPan : zoom_default2;
52280     var _zoomerPanner = _zoomerPannerFunction().scaleExtent([kMin, kMax]).interpolate(value_default).filter(zoomEventFilter).on("zoom.map", zoomPan).on("start.map", function(d3_event) {
52281       _pointerDown = d3_event && (d3_event.type === "pointerdown" || d3_event.sourceEvent && d3_event.sourceEvent.type === "pointerdown");
52282     }).on("end.map", function() {
52283       _pointerDown = false;
52284     });
52285     var _doubleUpHandler = utilDoubleUp();
52286     var scheduleRedraw = throttle_default(redraw, 750);
52287     function cancelPendingRedraw() {
52288       scheduleRedraw.cancel();
52289     }
52290     function map2(selection2) {
52291       _selection = selection2;
52292       context.on("change.map", immediateRedraw);
52293       var osm = context.connection();
52294       if (osm) {
52295         osm.on("change.map", immediateRedraw);
52296       }
52297       function didUndoOrRedo(targetTransform) {
52298         var mode = context.mode().id;
52299         if (mode !== "browse" && mode !== "select")
52300           return;
52301         if (targetTransform) {
52302           map2.transformEase(targetTransform);
52303         }
52304       }
52305       context.history().on("merge.map", function() {
52306         scheduleRedraw();
52307       }).on("change.map", immediateRedraw).on("undone.map", function(stack, fromStack) {
52308         didUndoOrRedo(fromStack.transform);
52309       }).on("redone.map", function(stack) {
52310         didUndoOrRedo(stack.transform);
52311       });
52312       context.background().on("change.map", immediateRedraw);
52313       context.features().on("redraw.map", immediateRedraw);
52314       drawLayers.on("change.map", function() {
52315         context.background().updateImagery();
52316         immediateRedraw();
52317       });
52318       selection2.on("wheel.map mousewheel.map", function(d3_event) {
52319         d3_event.preventDefault();
52320       }).call(_zoomerPanner).call(_zoomerPanner.transform, projection2.transform()).on("dblclick.zoom", null);
52321       map2.supersurface = supersurface = selection2.append("div").attr("class", "supersurface").call(utilSetTransform, 0, 0);
52322       wrapper = supersurface.append("div").attr("class", "layer layer-data");
52323       map2.surface = surface = wrapper.call(drawLayers).selectAll(".surface");
52324       surface.call(drawLabels.observe).call(_doubleUpHandler).on(_pointerPrefix + "down.zoom", function(d3_event) {
52325         _lastPointerEvent = d3_event;
52326         if (d3_event.button === 2) {
52327           d3_event.stopPropagation();
52328         }
52329       }, true).on(_pointerPrefix + "up.zoom", function(d3_event) {
52330         _lastPointerEvent = d3_event;
52331         if (resetTransform()) {
52332           immediateRedraw();
52333         }
52334       }).on(_pointerPrefix + "move.map", function(d3_event) {
52335         _lastPointerEvent = d3_event;
52336       }).on(_pointerPrefix + "over.vertices", function(d3_event) {
52337         if (map2.editableDataEnabled() && !_isTransformed) {
52338           var hover = d3_event.target.__data__;
52339           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
52340           dispatch10.call("drawn", this, { full: false });
52341         }
52342       }).on(_pointerPrefix + "out.vertices", function(d3_event) {
52343         if (map2.editableDataEnabled() && !_isTransformed) {
52344           var hover = d3_event.relatedTarget && d3_event.relatedTarget.__data__;
52345           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
52346           dispatch10.call("drawn", this, { full: false });
52347         }
52348       });
52349       var detected = utilDetect();
52350       if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
52351       // but we only need to do this on desktop Safari anyway. – #7694
52352       !detected.isMobileWebKit) {
52353         surface.on("gesturestart.surface", function(d3_event) {
52354           d3_event.preventDefault();
52355           _gestureTransformStart = projection2.transform();
52356         }).on("gesturechange.surface", gestureChange);
52357       }
52358       updateAreaFill();
52359       _doubleUpHandler.on("doubleUp.map", function(d3_event, p02) {
52360         if (!_dblClickZoomEnabled)
52361           return;
52362         if (typeof d3_event.target.__data__ === "object" && // or area fills
52363         !select_default2(d3_event.target).classed("fill"))
52364           return;
52365         var zoomOut2 = d3_event.shiftKey;
52366         var t = projection2.transform();
52367         var p1 = t.invert(p02);
52368         t = t.scale(zoomOut2 ? 0.5 : 2);
52369         t.x = p02[0] - p1[0] * t.k;
52370         t.y = p02[1] - p1[1] * t.k;
52371         map2.transformEase(t);
52372       });
52373       context.on("enter.map", function() {
52374         if (!map2.editableDataEnabled(
52375           true
52376           /* skip zoom check */
52377         ))
52378           return;
52379         if (_isTransformed)
52380           return;
52381         var graph = context.graph();
52382         var selectedAndParents = {};
52383         context.selectedIDs().forEach(function(id2) {
52384           var entity = graph.hasEntity(id2);
52385           if (entity) {
52386             selectedAndParents[entity.id] = entity;
52387             if (entity.type === "node") {
52388               graph.parentWays(entity).forEach(function(parent) {
52389                 selectedAndParents[parent.id] = parent;
52390               });
52391             }
52392           }
52393         });
52394         var data = Object.values(selectedAndParents);
52395         var filter2 = function(d) {
52396           return d.id in selectedAndParents;
52397         };
52398         data = context.features().filter(data, graph);
52399         surface.call(drawVertices.drawSelected, graph, map2.extent()).call(drawLines, graph, data, filter2).call(drawAreas, graph, data, filter2).call(drawMidpoints, graph, data, filter2, map2.trimmedExtent());
52400         dispatch10.call("drawn", this, { full: false });
52401         scheduleRedraw();
52402       });
52403       map2.dimensions(utilGetDimensions(selection2));
52404     }
52405     function zoomEventFilter(d3_event) {
52406       if (d3_event.type === "mousedown") {
52407         var hasOrphan = false;
52408         var listeners = window.__on;
52409         for (var i2 = 0; i2 < listeners.length; i2++) {
52410           var listener = listeners[i2];
52411           if (listener.name === "zoom" && listener.type === "mouseup") {
52412             hasOrphan = true;
52413             break;
52414           }
52415         }
52416         if (hasOrphan) {
52417           var event = window.CustomEvent;
52418           if (event) {
52419             event = new event("mouseup");
52420           } else {
52421             event = window.document.createEvent("Event");
52422             event.initEvent("mouseup", false, false);
52423           }
52424           event.view = window;
52425           window.dispatchEvent(event);
52426         }
52427       }
52428       return d3_event.button !== 2;
52429     }
52430     function pxCenter() {
52431       return [_dimensions[0] / 2, _dimensions[1] / 2];
52432     }
52433     function drawEditable(difference, extent) {
52434       var mode = context.mode();
52435       var graph = context.graph();
52436       var features = context.features();
52437       var all = context.history().intersects(map2.extent());
52438       var fullRedraw = false;
52439       var data;
52440       var set3;
52441       var filter2;
52442       var applyFeatureLayerFilters = true;
52443       if (map2.isInWideSelection()) {
52444         data = [];
52445         utilEntityAndDeepMemberIDs(mode.selectedIDs(), context.graph()).forEach(function(id2) {
52446           var entity = context.hasEntity(id2);
52447           if (entity)
52448             data.push(entity);
52449         });
52450         fullRedraw = true;
52451         filter2 = utilFunctor(true);
52452         applyFeatureLayerFilters = false;
52453       } else if (difference) {
52454         var complete = difference.complete(map2.extent());
52455         data = Object.values(complete).filter(Boolean);
52456         set3 = new Set(Object.keys(complete));
52457         filter2 = function(d) {
52458           return set3.has(d.id);
52459         };
52460         features.clear(data);
52461       } else {
52462         if (features.gatherStats(all, graph, _dimensions)) {
52463           extent = void 0;
52464         }
52465         if (extent) {
52466           data = context.history().intersects(map2.extent().intersection(extent));
52467           set3 = new Set(data.map(function(entity) {
52468             return entity.id;
52469           }));
52470           filter2 = function(d) {
52471             return set3.has(d.id);
52472           };
52473         } else {
52474           data = all;
52475           fullRedraw = true;
52476           filter2 = utilFunctor(true);
52477         }
52478       }
52479       if (applyFeatureLayerFilters) {
52480         data = features.filter(data, graph);
52481       } else {
52482         context.features().resetStats();
52483       }
52484       if (mode && mode.id === "select") {
52485         surface.call(drawVertices.drawSelected, graph, map2.extent());
52486       }
52487       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);
52488       dispatch10.call("drawn", this, { full: true });
52489     }
52490     map2.init = function() {
52491       drawLayers = svgLayers(projection2, context);
52492       drawPoints = svgPoints(projection2, context);
52493       drawVertices = svgVertices(projection2, context);
52494       drawLines = svgLines(projection2, context);
52495       drawAreas = svgAreas(projection2, context);
52496       drawMidpoints = svgMidpoints(projection2, context);
52497       drawLabels = svgLabels(projection2, context);
52498     };
52499     function editOff() {
52500       context.features().resetStats();
52501       surface.selectAll(".layer-osm *").remove();
52502       surface.selectAll(".layer-touch:not(.markers) *").remove();
52503       var allowed = {
52504         "browse": true,
52505         "save": true,
52506         "select-note": true,
52507         "select-data": true,
52508         "select-error": true
52509       };
52510       var mode = context.mode();
52511       if (mode && !allowed[mode.id]) {
52512         context.enter(modeBrowse(context));
52513       }
52514       dispatch10.call("drawn", this, { full: true });
52515     }
52516     function gestureChange(d3_event) {
52517       var e = d3_event;
52518       e.preventDefault();
52519       var props = {
52520         deltaMode: 0,
52521         // dummy values to ignore in zoomPan
52522         deltaY: 1,
52523         // dummy values to ignore in zoomPan
52524         clientX: e.clientX,
52525         clientY: e.clientY,
52526         screenX: e.screenX,
52527         screenY: e.screenY,
52528         x: e.x,
52529         y: e.y
52530       };
52531       var e22 = new WheelEvent("wheel", props);
52532       e22._scale = e.scale;
52533       e22._rotation = e.rotation;
52534       _selection.node().dispatchEvent(e22);
52535     }
52536     function zoomPan(event, key, transform2) {
52537       var source = event && event.sourceEvent || event;
52538       var eventTransform = transform2 || event && event.transform;
52539       var x = eventTransform.x;
52540       var y = eventTransform.y;
52541       var k = eventTransform.k;
52542       if (source && source.type === "wheel") {
52543         if (_pointerDown)
52544           return;
52545         var detected = utilDetect();
52546         var dX = source.deltaX;
52547         var dY = source.deltaY;
52548         var x2 = x;
52549         var y2 = y;
52550         var k2 = k;
52551         var t0, p02, p1;
52552         if (source.deltaMode === 1) {
52553           var lines = Math.abs(source.deltaY);
52554           var sign2 = source.deltaY > 0 ? 1 : -1;
52555           dY = sign2 * clamp(
52556             Math.exp((lines - 1) * 0.75) * 4.000244140625,
52557             4.000244140625,
52558             // min
52559             350.000244140625
52560             // max
52561           );
52562           if (detected.os !== "mac") {
52563             dY *= 5;
52564           }
52565           t0 = _isTransformed ? _transformLast : _transformStart;
52566           p02 = _getMouseCoords(source);
52567           p1 = t0.invert(p02);
52568           k2 = t0.k * Math.pow(2, -dY / 500);
52569           k2 = clamp(k2, kMin, kMax);
52570           x2 = p02[0] - p1[0] * k2;
52571           y2 = p02[1] - p1[1] * k2;
52572         } else if (source._scale) {
52573           t0 = _gestureTransformStart;
52574           p02 = _getMouseCoords(source);
52575           p1 = t0.invert(p02);
52576           k2 = t0.k * source._scale;
52577           k2 = clamp(k2, kMin, kMax);
52578           x2 = p02[0] - p1[0] * k2;
52579           y2 = p02[1] - p1[1] * k2;
52580         } else if (source.ctrlKey && !isInteger(dY)) {
52581           dY *= 6;
52582           t0 = _isTransformed ? _transformLast : _transformStart;
52583           p02 = _getMouseCoords(source);
52584           p1 = t0.invert(p02);
52585           k2 = t0.k * Math.pow(2, -dY / 500);
52586           k2 = clamp(k2, kMin, kMax);
52587           x2 = p02[0] - p1[0] * k2;
52588           y2 = p02[1] - p1[1] * k2;
52589         } else if ((source.altKey || source.shiftKey) && isInteger(dY)) {
52590           t0 = _isTransformed ? _transformLast : _transformStart;
52591           p02 = _getMouseCoords(source);
52592           p1 = t0.invert(p02);
52593           k2 = t0.k * Math.pow(2, -dY / 500);
52594           k2 = clamp(k2, kMin, kMax);
52595           x2 = p02[0] - p1[0] * k2;
52596           y2 = p02[1] - p1[1] * k2;
52597         } else if (detected.os === "mac" && detected.browser !== "Firefox" && !source.ctrlKey && isInteger(dX) && isInteger(dY)) {
52598           p1 = projection2.translate();
52599           x2 = p1[0] - dX;
52600           y2 = p1[1] - dY;
52601           k2 = projection2.scale();
52602           k2 = clamp(k2, kMin, kMax);
52603         }
52604         if (x2 !== x || y2 !== y || k2 !== k) {
52605           x = x2;
52606           y = y2;
52607           k = k2;
52608           eventTransform = identity2.translate(x2, y2).scale(k2);
52609           if (_zoomerPanner._transform) {
52610             _zoomerPanner._transform(eventTransform);
52611           } else {
52612             _selection.node().__zoom = eventTransform;
52613           }
52614         }
52615       }
52616       if (_transformStart.x === x && _transformStart.y === y && _transformStart.k === k) {
52617         return;
52618       }
52619       if (geoScaleToZoom(k, TILESIZE) < _minzoom) {
52620         surface.interrupt();
52621         dispatch10.call("hitMinZoom", this, map2);
52622         setCenterZoom(map2.center(), context.minEditableZoom(), 0, true);
52623         scheduleRedraw();
52624         dispatch10.call("move", this, map2);
52625         return;
52626       }
52627       projection2.transform(eventTransform);
52628       var withinEditableZoom = map2.withinEditableZoom();
52629       if (_lastWithinEditableZoom !== withinEditableZoom) {
52630         if (_lastWithinEditableZoom !== void 0) {
52631           dispatch10.call("crossEditableZoom", this, withinEditableZoom);
52632         }
52633         _lastWithinEditableZoom = withinEditableZoom;
52634       }
52635       var scale = k / _transformStart.k;
52636       var tX = (x / scale - _transformStart.x) * scale;
52637       var tY = (y / scale - _transformStart.y) * scale;
52638       if (context.inIntro()) {
52639         curtainProjection.transform({
52640           x: x - tX,
52641           y: y - tY,
52642           k
52643         });
52644       }
52645       if (source) {
52646         _lastPointerEvent = event;
52647       }
52648       _isTransformed = true;
52649       _transformLast = eventTransform;
52650       utilSetTransform(supersurface, tX, tY, scale);
52651       scheduleRedraw();
52652       dispatch10.call("move", this, map2);
52653       function isInteger(val) {
52654         return typeof val === "number" && isFinite(val) && Math.floor(val) === val;
52655       }
52656     }
52657     function resetTransform() {
52658       if (!_isTransformed)
52659         return false;
52660       utilSetTransform(supersurface, 0, 0);
52661       _isTransformed = false;
52662       if (context.inIntro()) {
52663         curtainProjection.transform(projection2.transform());
52664       }
52665       return true;
52666     }
52667     function redraw(difference, extent) {
52668       if (surface.empty() || !_redrawEnabled)
52669         return;
52670       if (resetTransform()) {
52671         difference = extent = void 0;
52672       }
52673       var zoom = map2.zoom();
52674       var z = String(~~zoom);
52675       if (surface.attr("data-zoom") !== z) {
52676         surface.attr("data-zoom", z);
52677       }
52678       var lat = map2.center()[1];
52679       var lowzoom = linear3().domain([-60, 0, 60]).range([17, 18.5, 17]).clamp(true);
52680       surface.classed("low-zoom", zoom <= lowzoom(lat));
52681       if (!difference) {
52682         supersurface.call(context.background());
52683         wrapper.call(drawLayers);
52684       }
52685       if (map2.editableDataEnabled() || map2.isInWideSelection()) {
52686         context.loadTiles(projection2);
52687         drawEditable(difference, extent);
52688       } else {
52689         editOff();
52690       }
52691       _transformStart = projection2.transform();
52692       return map2;
52693     }
52694     var immediateRedraw = function(difference, extent) {
52695       if (!difference && !extent)
52696         cancelPendingRedraw();
52697       redraw(difference, extent);
52698     };
52699     map2.lastPointerEvent = function() {
52700       return _lastPointerEvent;
52701     };
52702     map2.mouse = function(d3_event) {
52703       var event = d3_event || _lastPointerEvent;
52704       if (event) {
52705         var s;
52706         while (s = event.sourceEvent) {
52707           event = s;
52708         }
52709         return _getMouseCoords(event);
52710       }
52711       return null;
52712     };
52713     map2.mouseCoordinates = function() {
52714       var coord2 = map2.mouse() || pxCenter();
52715       return projection2.invert(coord2);
52716     };
52717     map2.dblclickZoomEnable = function(val) {
52718       if (!arguments.length)
52719         return _dblClickZoomEnabled;
52720       _dblClickZoomEnabled = val;
52721       return map2;
52722     };
52723     map2.redrawEnable = function(val) {
52724       if (!arguments.length)
52725         return _redrawEnabled;
52726       _redrawEnabled = val;
52727       return map2;
52728     };
52729     map2.isTransformed = function() {
52730       return _isTransformed;
52731     };
52732     function setTransform(t2, duration, force) {
52733       var t = projection2.transform();
52734       if (!force && t2.k === t.k && t2.x === t.x && t2.y === t.y)
52735         return false;
52736       if (duration) {
52737         _selection.transition().duration(duration).on("start", function() {
52738           map2.startEase();
52739         }).call(_zoomerPanner.transform, identity2.translate(t2.x, t2.y).scale(t2.k));
52740       } else {
52741         projection2.transform(t2);
52742         _transformStart = t2;
52743         _selection.call(_zoomerPanner.transform, _transformStart);
52744       }
52745       return true;
52746     }
52747     function setCenterZoom(loc2, z2, duration, force) {
52748       var c = map2.center();
52749       var z = map2.zoom();
52750       if (loc2[0] === c[0] && loc2[1] === c[1] && z2 === z && !force)
52751         return false;
52752       var proj = geoRawMercator().transform(projection2.transform());
52753       var k2 = clamp(geoZoomToScale(z2, TILESIZE), kMin, kMax);
52754       proj.scale(k2);
52755       var t = proj.translate();
52756       var point2 = proj(loc2);
52757       var center = pxCenter();
52758       t[0] += center[0] - point2[0];
52759       t[1] += center[1] - point2[1];
52760       return setTransform(identity2.translate(t[0], t[1]).scale(k2), duration, force);
52761     }
52762     map2.pan = function(delta, duration) {
52763       var t = projection2.translate();
52764       var k = projection2.scale();
52765       t[0] += delta[0];
52766       t[1] += delta[1];
52767       if (duration) {
52768         _selection.transition().duration(duration).on("start", function() {
52769           map2.startEase();
52770         }).call(_zoomerPanner.transform, identity2.translate(t[0], t[1]).scale(k));
52771       } else {
52772         projection2.translate(t);
52773         _transformStart = projection2.transform();
52774         _selection.call(_zoomerPanner.transform, _transformStart);
52775         dispatch10.call("move", this, map2);
52776         immediateRedraw();
52777       }
52778       return map2;
52779     };
52780     map2.dimensions = function(val) {
52781       if (!arguments.length)
52782         return _dimensions;
52783       _dimensions = val;
52784       drawLayers.dimensions(_dimensions);
52785       context.background().dimensions(_dimensions);
52786       projection2.clipExtent([[0, 0], _dimensions]);
52787       _getMouseCoords = utilFastMouse(supersurface.node());
52788       scheduleRedraw();
52789       return map2;
52790     };
52791     function zoomIn(delta) {
52792       setCenterZoom(map2.center(), ~~map2.zoom() + delta, 250, true);
52793     }
52794     function zoomOut(delta) {
52795       setCenterZoom(map2.center(), ~~map2.zoom() - delta, 250, true);
52796     }
52797     map2.zoomIn = function() {
52798       zoomIn(1);
52799     };
52800     map2.zoomInFurther = function() {
52801       zoomIn(4);
52802     };
52803     map2.canZoomIn = function() {
52804       return map2.zoom() < maxZoom;
52805     };
52806     map2.zoomOut = function() {
52807       zoomOut(1);
52808     };
52809     map2.zoomOutFurther = function() {
52810       zoomOut(4);
52811     };
52812     map2.canZoomOut = function() {
52813       return map2.zoom() > minZoom2;
52814     };
52815     map2.center = function(loc2) {
52816       if (!arguments.length) {
52817         return projection2.invert(pxCenter());
52818       }
52819       if (setCenterZoom(loc2, map2.zoom())) {
52820         dispatch10.call("move", this, map2);
52821       }
52822       scheduleRedraw();
52823       return map2;
52824     };
52825     map2.unobscuredCenterZoomEase = function(loc, zoom) {
52826       var offset = map2.unobscuredOffsetPx();
52827       var proj = geoRawMercator().transform(projection2.transform());
52828       proj.scale(geoZoomToScale(zoom, TILESIZE));
52829       var locPx = proj(loc);
52830       var offsetLocPx = [locPx[0] + offset[0], locPx[1] + offset[1]];
52831       var offsetLoc = proj.invert(offsetLocPx);
52832       map2.centerZoomEase(offsetLoc, zoom);
52833     };
52834     map2.unobscuredOffsetPx = function() {
52835       var openPane = context.container().select(".map-panes .map-pane.shown");
52836       if (!openPane.empty()) {
52837         return [openPane.node().offsetWidth / 2, 0];
52838       }
52839       return [0, 0];
52840     };
52841     map2.zoom = function(z2) {
52842       if (!arguments.length) {
52843         return Math.max(geoScaleToZoom(projection2.scale(), TILESIZE), 0);
52844       }
52845       if (z2 < _minzoom) {
52846         surface.interrupt();
52847         dispatch10.call("hitMinZoom", this, map2);
52848         z2 = context.minEditableZoom();
52849       }
52850       if (setCenterZoom(map2.center(), z2)) {
52851         dispatch10.call("move", this, map2);
52852       }
52853       scheduleRedraw();
52854       return map2;
52855     };
52856     map2.centerZoom = function(loc2, z2) {
52857       if (setCenterZoom(loc2, z2)) {
52858         dispatch10.call("move", this, map2);
52859       }
52860       scheduleRedraw();
52861       return map2;
52862     };
52863     map2.zoomTo = function(entity) {
52864       var extent = entity.extent(context.graph());
52865       if (!isFinite(extent.area()))
52866         return map2;
52867       var z2 = clamp(map2.trimmedExtentZoom(extent), 0, 20);
52868       return map2.centerZoom(extent.center(), z2);
52869     };
52870     map2.centerEase = function(loc2, duration) {
52871       duration = duration || 250;
52872       setCenterZoom(loc2, map2.zoom(), duration);
52873       return map2;
52874     };
52875     map2.zoomEase = function(z2, duration) {
52876       duration = duration || 250;
52877       setCenterZoom(map2.center(), z2, duration, false);
52878       return map2;
52879     };
52880     map2.centerZoomEase = function(loc2, z2, duration) {
52881       duration = duration || 250;
52882       setCenterZoom(loc2, z2, duration, false);
52883       return map2;
52884     };
52885     map2.transformEase = function(t2, duration) {
52886       duration = duration || 250;
52887       setTransform(
52888         t2,
52889         duration,
52890         false
52891         /* don't force */
52892       );
52893       return map2;
52894     };
52895     map2.zoomToEase = function(obj, duration) {
52896       var extent;
52897       if (Array.isArray(obj)) {
52898         obj.forEach(function(entity) {
52899           var entityExtent = entity.extent(context.graph());
52900           if (!extent) {
52901             extent = entityExtent;
52902           } else {
52903             extent = extent.extend(entityExtent);
52904           }
52905         });
52906       } else {
52907         extent = obj.extent(context.graph());
52908       }
52909       if (!isFinite(extent.area()))
52910         return map2;
52911       var z2 = clamp(map2.trimmedExtentZoom(extent), 0, 20);
52912       return map2.centerZoomEase(extent.center(), z2, duration);
52913     };
52914     map2.startEase = function() {
52915       utilBindOnce(surface, _pointerPrefix + "down.ease", function() {
52916         map2.cancelEase();
52917       });
52918       return map2;
52919     };
52920     map2.cancelEase = function() {
52921       _selection.interrupt();
52922       return map2;
52923     };
52924     map2.extent = function(val) {
52925       if (!arguments.length) {
52926         return new geoExtent(
52927           projection2.invert([0, _dimensions[1]]),
52928           projection2.invert([_dimensions[0], 0])
52929         );
52930       } else {
52931         var extent = geoExtent(val);
52932         map2.centerZoom(extent.center(), map2.extentZoom(extent));
52933       }
52934     };
52935     map2.trimmedExtent = function(val) {
52936       if (!arguments.length) {
52937         var headerY = 71;
52938         var footerY = 30;
52939         var pad2 = 10;
52940         return new geoExtent(
52941           projection2.invert([pad2, _dimensions[1] - footerY - pad2]),
52942           projection2.invert([_dimensions[0] - pad2, headerY + pad2])
52943         );
52944       } else {
52945         var extent = geoExtent(val);
52946         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
52947       }
52948     };
52949     function calcExtentZoom(extent, dim) {
52950       var tl = projection2([extent[0][0], extent[1][1]]);
52951       var br = projection2([extent[1][0], extent[0][1]]);
52952       var hFactor = (br[0] - tl[0]) / dim[0];
52953       var vFactor = (br[1] - tl[1]) / dim[1];
52954       var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
52955       var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
52956       var newZoom = map2.zoom() - Math.max(hZoomDiff, vZoomDiff);
52957       return newZoom;
52958     }
52959     map2.extentZoom = function(val) {
52960       return calcExtentZoom(geoExtent(val), _dimensions);
52961     };
52962     map2.trimmedExtentZoom = function(val) {
52963       var trimY = 120;
52964       var trimX = 40;
52965       var trimmed = [_dimensions[0] - trimX, _dimensions[1] - trimY];
52966       return calcExtentZoom(geoExtent(val), trimmed);
52967     };
52968     map2.withinEditableZoom = function() {
52969       return map2.zoom() >= context.minEditableZoom();
52970     };
52971     map2.isInWideSelection = function() {
52972       return !map2.withinEditableZoom() && context.selectedIDs().length;
52973     };
52974     map2.editableDataEnabled = function(skipZoomCheck) {
52975       var layer = context.layers().layer("osm");
52976       if (!layer || !layer.enabled())
52977         return false;
52978       return skipZoomCheck || map2.withinEditableZoom();
52979     };
52980     map2.notesEditable = function() {
52981       var layer = context.layers().layer("notes");
52982       if (!layer || !layer.enabled())
52983         return false;
52984       return map2.withinEditableZoom();
52985     };
52986     map2.minzoom = function(val) {
52987       if (!arguments.length)
52988         return _minzoom;
52989       _minzoom = val;
52990       return map2;
52991     };
52992     map2.toggleHighlightEdited = function() {
52993       surface.classed("highlight-edited", !surface.classed("highlight-edited"));
52994       map2.pan([0, 0]);
52995       dispatch10.call("changeHighlighting", this);
52996     };
52997     map2.areaFillOptions = ["wireframe", "partial", "full"];
52998     map2.activeAreaFill = function(val) {
52999       if (!arguments.length)
53000         return corePreferences("area-fill") || "partial";
53001       corePreferences("area-fill", val);
53002       if (val !== "wireframe") {
53003         corePreferences("area-fill-toggle", val);
53004       }
53005       updateAreaFill();
53006       map2.pan([0, 0]);
53007       dispatch10.call("changeAreaFill", this);
53008       return map2;
53009     };
53010     map2.toggleWireframe = function() {
53011       var activeFill = map2.activeAreaFill();
53012       if (activeFill === "wireframe") {
53013         activeFill = corePreferences("area-fill-toggle") || "partial";
53014       } else {
53015         activeFill = "wireframe";
53016       }
53017       map2.activeAreaFill(activeFill);
53018     };
53019     function updateAreaFill() {
53020       var activeFill = map2.activeAreaFill();
53021       map2.areaFillOptions.forEach(function(opt) {
53022         surface.classed("fill-" + opt, Boolean(opt === activeFill));
53023       });
53024     }
53025     map2.layers = () => drawLayers;
53026     map2.doubleUpHandler = function() {
53027       return _doubleUpHandler;
53028     };
53029     return utilRebind(map2, dispatch10, "on");
53030   }
53031
53032   // modules/renderer/photos.js
53033   function rendererPhotos(context) {
53034     var dispatch10 = dispatch_default("change");
53035     var _layerIDs = ["streetside", "mapillary", "mapillary-map-features", "mapillary-signs", "kartaview"];
53036     var _allPhotoTypes = ["flat", "panoramic"];
53037     var _shownPhotoTypes = _allPhotoTypes.slice();
53038     var _dateFilters = ["fromDate", "toDate"];
53039     var _fromDate;
53040     var _toDate;
53041     var _usernames;
53042     function photos() {
53043     }
53044     function updateStorage() {
53045       if (window.mocha)
53046         return;
53047       var hash = utilStringQs(window.location.hash);
53048       var enabled = context.layers().all().filter(function(d) {
53049         return _layerIDs.indexOf(d.id) !== -1 && d.layer && d.layer.supported() && d.layer.enabled();
53050       }).map(function(d) {
53051         return d.id;
53052       });
53053       if (enabled.length) {
53054         hash.photo_overlay = enabled.join(",");
53055       } else {
53056         delete hash.photo_overlay;
53057       }
53058       window.location.replace("#" + utilQsString(hash, true));
53059     }
53060     photos.overlayLayerIDs = function() {
53061       return _layerIDs;
53062     };
53063     photos.allPhotoTypes = function() {
53064       return _allPhotoTypes;
53065     };
53066     photos.dateFilters = function() {
53067       return _dateFilters;
53068     };
53069     photos.dateFilterValue = function(val) {
53070       return val === _dateFilters[0] ? _fromDate : _toDate;
53071     };
53072     photos.setDateFilter = function(type2, val, updateUrl) {
53073       var date = val && new Date(val);
53074       if (date && !isNaN(date)) {
53075         val = date.toISOString().slice(0, 10);
53076       } else {
53077         val = null;
53078       }
53079       if (type2 === _dateFilters[0]) {
53080         _fromDate = val;
53081         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
53082           _toDate = _fromDate;
53083         }
53084       }
53085       if (type2 === _dateFilters[1]) {
53086         _toDate = val;
53087         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
53088           _fromDate = _toDate;
53089         }
53090       }
53091       dispatch10.call("change", this);
53092       if (updateUrl) {
53093         var rangeString;
53094         if (_fromDate || _toDate) {
53095           rangeString = (_fromDate || "") + "_" + (_toDate || "");
53096         }
53097         setUrlFilterValue("photo_dates", rangeString);
53098       }
53099     };
53100     photos.setUsernameFilter = function(val, updateUrl) {
53101       if (val && typeof val === "string")
53102         val = val.replace(/;/g, ",").split(",");
53103       if (val) {
53104         val = val.map((d) => d.trim()).filter(Boolean);
53105         if (!val.length) {
53106           val = null;
53107         }
53108       }
53109       _usernames = val;
53110       dispatch10.call("change", this);
53111       if (updateUrl) {
53112         var hashString;
53113         if (_usernames) {
53114           hashString = _usernames.join(",");
53115         }
53116         setUrlFilterValue("photo_username", hashString);
53117       }
53118     };
53119     function setUrlFilterValue(property, val) {
53120       if (!window.mocha) {
53121         var hash = utilStringQs(window.location.hash);
53122         if (val) {
53123           if (hash[property] === val)
53124             return;
53125           hash[property] = val;
53126         } else {
53127           if (!(property in hash))
53128             return;
53129           delete hash[property];
53130         }
53131         window.location.replace("#" + utilQsString(hash, true));
53132       }
53133     }
53134     function showsLayer(id2) {
53135       var layer = context.layers().layer(id2);
53136       return layer && layer.supported() && layer.enabled();
53137     }
53138     photos.shouldFilterByDate = function() {
53139       return showsLayer("mapillary") || showsLayer("kartaview") || showsLayer("streetside");
53140     };
53141     photos.shouldFilterByPhotoType = function() {
53142       return showsLayer("mapillary") || showsLayer("streetside") && showsLayer("kartaview");
53143     };
53144     photos.shouldFilterByUsername = function() {
53145       return !showsLayer("mapillary") && showsLayer("kartaview") && !showsLayer("streetside");
53146     };
53147     photos.showsPhotoType = function(val) {
53148       if (!photos.shouldFilterByPhotoType())
53149         return true;
53150       return _shownPhotoTypes.indexOf(val) !== -1;
53151     };
53152     photos.showsFlat = function() {
53153       return photos.showsPhotoType("flat");
53154     };
53155     photos.showsPanoramic = function() {
53156       return photos.showsPhotoType("panoramic");
53157     };
53158     photos.fromDate = function() {
53159       return _fromDate;
53160     };
53161     photos.toDate = function() {
53162       return _toDate;
53163     };
53164     photos.togglePhotoType = function(val) {
53165       var index = _shownPhotoTypes.indexOf(val);
53166       if (index !== -1) {
53167         _shownPhotoTypes.splice(index, 1);
53168       } else {
53169         _shownPhotoTypes.push(val);
53170       }
53171       dispatch10.call("change", this);
53172       return photos;
53173     };
53174     photos.usernames = function() {
53175       return _usernames;
53176     };
53177     photos.init = function() {
53178       var hash = utilStringQs(window.location.hash);
53179       if (hash.photo_dates) {
53180         var parts = /^(.*)[–_](.*)$/g.exec(hash.photo_dates.trim());
53181         this.setDateFilter("fromDate", parts && parts.length >= 2 && parts[1], false);
53182         this.setDateFilter("toDate", parts && parts.length >= 3 && parts[2], false);
53183       }
53184       if (hash.photo_username) {
53185         this.setUsernameFilter(hash.photo_username, false);
53186       }
53187       if (hash.photo_overlay) {
53188         var hashOverlayIDs = hash.photo_overlay.replace(/;/g, ",").split(",");
53189         hashOverlayIDs.forEach(function(id2) {
53190           if (id2 === "openstreetcam")
53191             id2 = "kartaview";
53192           var layer2 = _layerIDs.indexOf(id2) !== -1 && context.layers().layer(id2);
53193           if (layer2 && !layer2.enabled())
53194             layer2.enabled(true);
53195         });
53196       }
53197       if (hash.photo) {
53198         var photoIds = hash.photo.replace(/;/g, ",").split(",");
53199         var photoId = photoIds.length && photoIds[0].trim();
53200         var results = /(.*)\/(.*)/g.exec(photoId);
53201         if (results && results.length >= 3) {
53202           var serviceId = results[1];
53203           if (serviceId === "openstreetcam")
53204             serviceId = "kartaview";
53205           var photoKey = results[2];
53206           var service = services[serviceId];
53207           if (service && service.ensureViewerLoaded) {
53208             var layer = _layerIDs.indexOf(serviceId) !== -1 && context.layers().layer(serviceId);
53209             if (layer && !layer.enabled())
53210               layer.enabled(true);
53211             var baselineTime = Date.now();
53212             service.on("loadedImages.rendererPhotos", function() {
53213               if (Date.now() - baselineTime > 45e3) {
53214                 service.on("loadedImages.rendererPhotos", null);
53215                 return;
53216               }
53217               if (!service.cachedImage(photoKey))
53218                 return;
53219               service.on("loadedImages.rendererPhotos", null);
53220               service.ensureViewerLoaded(context).then(function() {
53221                 service.selectImage(context, photoKey).showViewer(context);
53222               });
53223             });
53224           }
53225         }
53226       }
53227       context.layers().on("change.rendererPhotos", updateStorage);
53228     };
53229     return utilRebind(photos, dispatch10, "on");
53230   }
53231
53232   // modules/ui/account.js
53233   function uiAccount(context) {
53234     const osm = context.connection();
53235     function updateUserDetails(selection2) {
53236       if (!osm)
53237         return;
53238       if (!osm.authenticated()) {
53239         render(selection2, null);
53240       } else {
53241         osm.userDetails((err, user) => render(selection2, user));
53242       }
53243     }
53244     function render(selection2, user) {
53245       let userInfo = selection2.select(".userInfo");
53246       let loginLogout = selection2.select(".loginLogout");
53247       if (user) {
53248         userInfo.html("").classed("hide", false);
53249         let userLink = userInfo.append("a").attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
53250         if (user.image_url) {
53251           userLink.append("img").attr("class", "icon pre-text user-icon").attr("src", user.image_url);
53252         } else {
53253           userLink.call(svgIcon("#iD-icon-avatar", "pre-text light"));
53254         }
53255         userLink.append("span").attr("class", "label").html(user.display_name);
53256         loginLogout.classed("hide", false).select("a").text(_t("logout")).on("click", (e) => {
53257           e.preventDefault();
53258           osm.logout();
53259           tryLogout();
53260         });
53261       } else {
53262         userInfo.html("").classed("hide", true);
53263         loginLogout.classed("hide", false).select("a").text(_t("login")).on("click", (e) => {
53264           e.preventDefault();
53265           osm.authenticate();
53266         });
53267       }
53268     }
53269     function tryLogout() {
53270       if (!osm)
53271         return;
53272       const url = osm.getUrlRoot() + "/logout?referer=%2Flogin";
53273       const w = 600;
53274       const h = 550;
53275       const settings = [
53276         ["width", w],
53277         ["height", h],
53278         ["left", window.screen.width / 2 - w / 2],
53279         ["top", window.screen.height / 2 - h / 2]
53280       ].map((x) => x.join("=")).join(",");
53281       window.open(url, "_blank", settings);
53282     }
53283     return function(selection2) {
53284       if (!osm)
53285         return;
53286       selection2.append("li").attr("class", "userInfo").classed("hide", true);
53287       selection2.append("li").attr("class", "loginLogout").classed("hide", true).append("a").attr("href", "#");
53288       osm.on("change.account", () => updateUserDetails(selection2));
53289       updateUserDetails(selection2);
53290     };
53291   }
53292
53293   // modules/ui/attribution.js
53294   function uiAttribution(context) {
53295     let _selection = select_default2(null);
53296     function render(selection2, data, klass) {
53297       let div = selection2.selectAll(`.${klass}`).data([0]);
53298       div = div.enter().append("div").attr("class", klass).merge(div);
53299       let attributions = div.selectAll(".attribution").data(data, (d) => d.id);
53300       attributions.exit().remove();
53301       attributions = attributions.enter().append("span").attr("class", "attribution").each((d, i2, nodes) => {
53302         let attribution = select_default2(nodes[i2]);
53303         if (d.terms_html) {
53304           attribution.html(d.terms_html);
53305           return;
53306         }
53307         if (d.terms_url) {
53308           attribution = attribution.append("a").attr("href", d.terms_url).attr("target", "_blank");
53309         }
53310         const sourceID = d.id.replace(/\./g, "<TX_DOT>");
53311         const terms_text = _t(
53312           `imagery.${sourceID}.attribution.text`,
53313           { default: d.terms_text || d.id || d.name() }
53314         );
53315         if (d.icon && !d.overlay) {
53316           attribution.append("img").attr("class", "source-image").attr("src", d.icon);
53317         }
53318         attribution.append("span").attr("class", "attribution-text").text(terms_text);
53319       }).merge(attributions);
53320       let copyright = attributions.selectAll(".copyright-notice").data((d) => {
53321         let notice = d.copyrightNotices(context.map().zoom(), context.map().extent());
53322         return notice ? [notice] : [];
53323       });
53324       copyright.exit().remove();
53325       copyright = copyright.enter().append("span").attr("class", "copyright-notice").merge(copyright);
53326       copyright.text(String);
53327     }
53328     function update() {
53329       let baselayer = context.background().baseLayerSource();
53330       _selection.call(render, baselayer ? [baselayer] : [], "base-layer-attribution");
53331       const z = context.map().zoom();
53332       let overlays = context.background().overlayLayerSources() || [];
53333       _selection.call(render, overlays.filter((s) => s.validZoom(z)), "overlay-layer-attribution");
53334     }
53335     return function(selection2) {
53336       _selection = selection2;
53337       context.background().on("change.attribution", update);
53338       context.map().on("move.attribution", throttle_default(update, 400, { leading: false }));
53339       update();
53340     };
53341   }
53342
53343   // modules/ui/contributors.js
53344   function uiContributors(context) {
53345     var osm = context.connection(), debouncedUpdate = debounce_default(function() {
53346       update();
53347     }, 1e3), limit = 4, hidden = false, wrap2 = select_default2(null);
53348     function update() {
53349       if (!osm)
53350         return;
53351       var users = {}, entities = context.history().intersects(context.map().extent());
53352       entities.forEach(function(entity) {
53353         if (entity && entity.user)
53354           users[entity.user] = true;
53355       });
53356       var u = Object.keys(users), subset = u.slice(0, u.length > limit ? limit - 1 : limit);
53357       wrap2.html("").call(svgIcon("#iD-icon-nearby", "pre-text light"));
53358       var userList = select_default2(document.createElement("span"));
53359       userList.selectAll().data(subset).enter().append("a").attr("class", "user-link").attr("href", function(d) {
53360         return osm.userURL(d);
53361       }).attr("target", "_blank").text(String);
53362       if (u.length > limit) {
53363         var count = select_default2(document.createElement("span"));
53364         var othersNum = u.length - limit + 1;
53365         count.append("a").attr("target", "_blank").attr("href", function() {
53366           return osm.changesetsURL(context.map().center(), context.map().zoom());
53367         }).text(othersNum);
53368         wrap2.append("span").html(_t.html("contributors.truncated_list", { n: othersNum, users: { html: userList.html() }, count: { html: count.html() } }));
53369       } else {
53370         wrap2.append("span").html(_t.html("contributors.list", { users: { html: userList.html() } }));
53371       }
53372       if (!u.length) {
53373         hidden = true;
53374         wrap2.transition().style("opacity", 0);
53375       } else if (hidden) {
53376         wrap2.transition().style("opacity", 1);
53377       }
53378     }
53379     return function(selection2) {
53380       if (!osm)
53381         return;
53382       wrap2 = selection2;
53383       update();
53384       osm.on("loaded.contributors", debouncedUpdate);
53385       context.map().on("move.contributors", debouncedUpdate);
53386     };
53387   }
53388
53389   // modules/ui/popover.js
53390   var _popoverID = 0;
53391   function uiPopover(klass) {
53392     var _id = _popoverID++;
53393     var _anchorSelection = select_default2(null);
53394     var popover = function(selection2) {
53395       _anchorSelection = selection2;
53396       selection2.each(setup);
53397     };
53398     var _animation = utilFunctor(false);
53399     var _placement = utilFunctor("top");
53400     var _alignment = utilFunctor("center");
53401     var _scrollContainer = utilFunctor(select_default2(null));
53402     var _content;
53403     var _displayType = utilFunctor("");
53404     var _hasArrow = utilFunctor(true);
53405     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
53406     popover.displayType = function(val) {
53407       if (arguments.length) {
53408         _displayType = utilFunctor(val);
53409         return popover;
53410       } else {
53411         return _displayType;
53412       }
53413     };
53414     popover.hasArrow = function(val) {
53415       if (arguments.length) {
53416         _hasArrow = utilFunctor(val);
53417         return popover;
53418       } else {
53419         return _hasArrow;
53420       }
53421     };
53422     popover.placement = function(val) {
53423       if (arguments.length) {
53424         _placement = utilFunctor(val);
53425         return popover;
53426       } else {
53427         return _placement;
53428       }
53429     };
53430     popover.alignment = function(val) {
53431       if (arguments.length) {
53432         _alignment = utilFunctor(val);
53433         return popover;
53434       } else {
53435         return _alignment;
53436       }
53437     };
53438     popover.scrollContainer = function(val) {
53439       if (arguments.length) {
53440         _scrollContainer = utilFunctor(val);
53441         return popover;
53442       } else {
53443         return _scrollContainer;
53444       }
53445     };
53446     popover.content = function(val) {
53447       if (arguments.length) {
53448         _content = val;
53449         return popover;
53450       } else {
53451         return _content;
53452       }
53453     };
53454     popover.isShown = function() {
53455       var popoverSelection = _anchorSelection.select(".popover-" + _id);
53456       return !popoverSelection.empty() && popoverSelection.classed("in");
53457     };
53458     popover.show = function() {
53459       _anchorSelection.each(show);
53460     };
53461     popover.updateContent = function() {
53462       _anchorSelection.each(updateContent);
53463     };
53464     popover.hide = function() {
53465       _anchorSelection.each(hide);
53466     };
53467     popover.toggle = function() {
53468       _anchorSelection.each(toggle);
53469     };
53470     popover.destroy = function(selection2, selector) {
53471       selector = selector || ".popover-" + _id;
53472       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() {
53473         return this.getAttribute("data-original-title") || this.getAttribute("title");
53474       }).attr("data-original-title", null).selectAll(selector).remove();
53475     };
53476     popover.destroyAny = function(selection2) {
53477       selection2.call(popover.destroy, ".popover");
53478     };
53479     function setup() {
53480       var anchor = select_default2(this);
53481       var animate = _animation.apply(this, arguments);
53482       var popoverSelection = anchor.selectAll(".popover-" + _id).data([0]);
53483       var enter = popoverSelection.enter().append("div").attr("class", "popover popover-" + _id + " " + (klass ? klass : "")).classed("arrowed", _hasArrow.apply(this, arguments));
53484       enter.append("div").attr("class", "popover-arrow");
53485       enter.append("div").attr("class", "popover-inner");
53486       popoverSelection = enter.merge(popoverSelection);
53487       if (animate) {
53488         popoverSelection.classed("fade", true);
53489       }
53490       var display = _displayType.apply(this, arguments);
53491       if (display === "hover") {
53492         var _lastNonMouseEnterTime;
53493         anchor.on(_pointerPrefix + "enter.popover", function(d3_event) {
53494           if (d3_event.pointerType) {
53495             if (d3_event.pointerType !== "mouse") {
53496               _lastNonMouseEnterTime = d3_event.timeStamp;
53497               return;
53498             } else if (_lastNonMouseEnterTime && d3_event.timeStamp - _lastNonMouseEnterTime < 1500) {
53499               return;
53500             }
53501           }
53502           if (d3_event.buttons !== 0)
53503             return;
53504           show.apply(this, arguments);
53505         }).on(_pointerPrefix + "leave.popover", function() {
53506           hide.apply(this, arguments);
53507         }).on("focus.popover", function() {
53508           show.apply(this, arguments);
53509         }).on("blur.popover", function() {
53510           hide.apply(this, arguments);
53511         });
53512       } else if (display === "clickFocus") {
53513         anchor.on(_pointerPrefix + "down.popover", function(d3_event) {
53514           d3_event.preventDefault();
53515           d3_event.stopPropagation();
53516         }).on(_pointerPrefix + "up.popover", function(d3_event) {
53517           d3_event.preventDefault();
53518           d3_event.stopPropagation();
53519         }).on("click.popover", toggle);
53520         popoverSelection.attr("tabindex", 0).on("blur.popover", function() {
53521           anchor.each(function() {
53522             hide.apply(this, arguments);
53523           });
53524         });
53525       }
53526     }
53527     function show() {
53528       var anchor = select_default2(this);
53529       var popoverSelection = anchor.selectAll(".popover-" + _id);
53530       if (popoverSelection.empty()) {
53531         anchor.call(popover.destroy);
53532         anchor.each(setup);
53533         popoverSelection = anchor.selectAll(".popover-" + _id);
53534       }
53535       popoverSelection.classed("in", true);
53536       var displayType = _displayType.apply(this, arguments);
53537       if (displayType === "clickFocus") {
53538         anchor.classed("active", true);
53539         popoverSelection.node().focus();
53540       }
53541       anchor.each(updateContent);
53542     }
53543     function updateContent() {
53544       var anchor = select_default2(this);
53545       if (_content) {
53546         anchor.selectAll(".popover-" + _id + " > .popover-inner").call(_content.apply(this, arguments));
53547       }
53548       updatePosition.apply(this, arguments);
53549       updatePosition.apply(this, arguments);
53550       updatePosition.apply(this, arguments);
53551     }
53552     function updatePosition() {
53553       var anchor = select_default2(this);
53554       var popoverSelection = anchor.selectAll(".popover-" + _id);
53555       var scrollContainer = _scrollContainer && _scrollContainer.apply(this, arguments);
53556       var scrollNode = scrollContainer && !scrollContainer.empty() && scrollContainer.node();
53557       var scrollLeft = scrollNode ? scrollNode.scrollLeft : 0;
53558       var scrollTop = scrollNode ? scrollNode.scrollTop : 0;
53559       var placement = _placement.apply(this, arguments);
53560       popoverSelection.classed("left", false).classed("right", false).classed("top", false).classed("bottom", false).classed(placement, true);
53561       var alignment = _alignment.apply(this, arguments);
53562       var alignFactor = 0.5;
53563       if (alignment === "leading") {
53564         alignFactor = 0;
53565       } else if (alignment === "trailing") {
53566         alignFactor = 1;
53567       }
53568       var anchorFrame = getFrame(anchor.node());
53569       var popoverFrame = getFrame(popoverSelection.node());
53570       var position;
53571       switch (placement) {
53572         case "top":
53573           position = {
53574             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
53575             y: anchorFrame.y - popoverFrame.h
53576           };
53577           break;
53578         case "bottom":
53579           position = {
53580             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
53581             y: anchorFrame.y + anchorFrame.h
53582           };
53583           break;
53584         case "left":
53585           position = {
53586             x: anchorFrame.x - popoverFrame.w,
53587             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
53588           };
53589           break;
53590         case "right":
53591           position = {
53592             x: anchorFrame.x + anchorFrame.w,
53593             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
53594           };
53595           break;
53596       }
53597       if (position) {
53598         if (scrollNode && (placement === "top" || placement === "bottom")) {
53599           var initialPosX = position.x;
53600           if (position.x + popoverFrame.w > scrollNode.offsetWidth - 10) {
53601             position.x = scrollNode.offsetWidth - 10 - popoverFrame.w;
53602           } else if (position.x < 10) {
53603             position.x = 10;
53604           }
53605           var arrow = anchor.selectAll(".popover-" + _id + " > .popover-arrow");
53606           var arrowPosX = Math.min(Math.max(popoverFrame.w / 2 - (position.x - initialPosX), 10), popoverFrame.w - 10);
53607           arrow.style("left", ~~arrowPosX + "px");
53608         }
53609         popoverSelection.style("left", ~~position.x + "px").style("top", ~~position.y + "px");
53610       } else {
53611         popoverSelection.style("left", null).style("top", null);
53612       }
53613       function getFrame(node) {
53614         var positionStyle = select_default2(node).style("position");
53615         if (positionStyle === "absolute" || positionStyle === "static") {
53616           return {
53617             x: node.offsetLeft - scrollLeft,
53618             y: node.offsetTop - scrollTop,
53619             w: node.offsetWidth,
53620             h: node.offsetHeight
53621           };
53622         } else {
53623           return {
53624             x: 0,
53625             y: 0,
53626             w: node.offsetWidth,
53627             h: node.offsetHeight
53628           };
53629         }
53630       }
53631     }
53632     function hide() {
53633       var anchor = select_default2(this);
53634       if (_displayType.apply(this, arguments) === "clickFocus") {
53635         anchor.classed("active", false);
53636       }
53637       anchor.selectAll(".popover-" + _id).classed("in", false);
53638     }
53639     function toggle() {
53640       if (select_default2(this).select(".popover-" + _id).classed("in")) {
53641         hide.apply(this, arguments);
53642       } else {
53643         show.apply(this, arguments);
53644       }
53645     }
53646     return popover;
53647   }
53648
53649   // modules/ui/tooltip.js
53650   function uiTooltip(klass) {
53651     var tooltip = uiPopover((klass || "") + " tooltip").displayType("hover");
53652     var _title = function() {
53653       var title = this.getAttribute("data-original-title");
53654       if (title) {
53655         return title;
53656       } else {
53657         title = this.getAttribute("title");
53658         this.removeAttribute("title");
53659         this.setAttribute("data-original-title", title);
53660       }
53661       return title;
53662     };
53663     var _heading = utilFunctor(null);
53664     var _keys = utilFunctor(null);
53665     tooltip.title = function(val) {
53666       if (!arguments.length)
53667         return _title;
53668       _title = utilFunctor(val);
53669       return tooltip;
53670     };
53671     tooltip.heading = function(val) {
53672       if (!arguments.length)
53673         return _heading;
53674       _heading = utilFunctor(val);
53675       return tooltip;
53676     };
53677     tooltip.keys = function(val) {
53678       if (!arguments.length)
53679         return _keys;
53680       _keys = utilFunctor(val);
53681       return tooltip;
53682     };
53683     tooltip.content(function() {
53684       var heading = _heading.apply(this, arguments);
53685       var text2 = _title.apply(this, arguments);
53686       var keys2 = _keys.apply(this, arguments);
53687       var headingCallback = typeof heading === "function" ? heading : (s) => s.text(heading);
53688       var textCallback = typeof text2 === "function" ? text2 : (s) => s.text(text2);
53689       return function(selection2) {
53690         var headingSelect = selection2.selectAll(".tooltip-heading").data(heading ? [heading] : []);
53691         headingSelect.exit().remove();
53692         headingSelect.enter().append("div").attr("class", "tooltip-heading").merge(headingSelect).text("").call(headingCallback);
53693         var textSelect = selection2.selectAll(".tooltip-text").data(text2 ? [text2] : []);
53694         textSelect.exit().remove();
53695         textSelect.enter().append("div").attr("class", "tooltip-text").merge(textSelect).text("").call(textCallback);
53696         var keyhintWrap = selection2.selectAll(".keyhint-wrap").data(keys2 && keys2.length ? [0] : []);
53697         keyhintWrap.exit().remove();
53698         var keyhintWrapEnter = keyhintWrap.enter().append("div").attr("class", "keyhint-wrap");
53699         keyhintWrapEnter.append("span").call(_t.append("tooltip_keyhint"));
53700         keyhintWrap = keyhintWrapEnter.merge(keyhintWrap);
53701         keyhintWrap.selectAll("kbd.shortcut").data(keys2 && keys2.length ? keys2 : []).enter().append("kbd").attr("class", "shortcut").text(function(d) {
53702           return d;
53703         });
53704       };
53705     });
53706     return tooltip;
53707   }
53708
53709   // modules/ui/edit_menu.js
53710   function uiEditMenu(context) {
53711     var dispatch10 = dispatch_default("toggled");
53712     var _menu = select_default2(null);
53713     var _operations = [];
53714     var _anchorLoc = [0, 0];
53715     var _anchorLocLonLat = [0, 0];
53716     var _triggerType = "";
53717     var _vpTopMargin = 85;
53718     var _vpBottomMargin = 45;
53719     var _vpSideMargin = 35;
53720     var _menuTop = false;
53721     var _menuHeight;
53722     var _menuWidth;
53723     var _verticalPadding = 4;
53724     var _tooltipWidth = 210;
53725     var _menuSideMargin = 10;
53726     var _tooltips = [];
53727     var editMenu = function(selection2) {
53728       var isTouchMenu = _triggerType.includes("touch") || _triggerType.includes("pen");
53729       var ops = _operations.filter(function(op) {
53730         return !isTouchMenu || !op.mouseOnly;
53731       });
53732       if (!ops.length)
53733         return;
53734       _tooltips = [];
53735       _menuTop = isTouchMenu;
53736       var showLabels = isTouchMenu;
53737       var buttonHeight = showLabels ? 32 : 34;
53738       if (showLabels) {
53739         _menuWidth = 52 + Math.min(120, 6 * Math.max.apply(Math, ops.map(function(op) {
53740           return op.title.length;
53741         })));
53742       } else {
53743         _menuWidth = 44;
53744       }
53745       _menuHeight = _verticalPadding * 2 + ops.length * buttonHeight;
53746       _menu = selection2.append("div").attr("class", "edit-menu").classed("touch-menu", isTouchMenu).style("padding", _verticalPadding + "px 0");
53747       var buttons = _menu.selectAll(".edit-menu-item").data(ops);
53748       var buttonsEnter = buttons.enter().append("button").attr("class", function(d) {
53749         return "edit-menu-item edit-menu-item-" + d.id;
53750       }).style("height", buttonHeight + "px").on("click", click).on("pointerup", pointerup).on("pointerdown mousedown", function pointerdown(d3_event) {
53751         d3_event.stopPropagation();
53752       }).on("mouseenter.highlight", function(d3_event, d) {
53753         if (!d.relatedEntityIds || select_default2(this).classed("disabled"))
53754           return;
53755         utilHighlightEntities(d.relatedEntityIds(), true, context);
53756       }).on("mouseleave.highlight", function(d3_event, d) {
53757         if (!d.relatedEntityIds)
53758           return;
53759         utilHighlightEntities(d.relatedEntityIds(), false, context);
53760       });
53761       buttonsEnter.each(function(d) {
53762         var tooltip = uiTooltip().heading(() => d.title).title(d.tooltip).keys([d.keys[0]]);
53763         _tooltips.push(tooltip);
53764         select_default2(this).call(tooltip).append("div").attr("class", "icon-wrap").call(svgIcon(d.icon && d.icon() || "#iD-operation-" + d.id, "operation"));
53765       });
53766       if (showLabels) {
53767         buttonsEnter.append("span").attr("class", "label").each(function(d) {
53768           select_default2(this).call(d.title);
53769         });
53770       }
53771       buttonsEnter.merge(buttons).classed("disabled", function(d) {
53772         return d.disabled();
53773       });
53774       updatePosition();
53775       var initialScale = context.projection.scale();
53776       context.map().on("move.edit-menu", function() {
53777         if (initialScale !== context.projection.scale()) {
53778           editMenu.close();
53779         }
53780       }).on("drawn.edit-menu", function(info) {
53781         if (info.full)
53782           updatePosition();
53783       });
53784       var lastPointerUpType;
53785       function pointerup(d3_event) {
53786         lastPointerUpType = d3_event.pointerType;
53787       }
53788       function click(d3_event, operation) {
53789         d3_event.stopPropagation();
53790         if (operation.relatedEntityIds) {
53791           utilHighlightEntities(operation.relatedEntityIds(), false, context);
53792         }
53793         if (operation.disabled()) {
53794           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
53795             context.ui().flash.duration(4e3).iconName("#iD-operation-" + operation.id).iconClass("operation disabled").label(operation.tooltip())();
53796           }
53797         } else {
53798           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
53799             context.ui().flash.duration(2e3).iconName("#iD-operation-" + operation.id).iconClass("operation").label(operation.annotation() || operation.title)();
53800           }
53801           operation();
53802           editMenu.close();
53803         }
53804         lastPointerUpType = null;
53805       }
53806       dispatch10.call("toggled", this, true);
53807     };
53808     function updatePosition() {
53809       if (!_menu || _menu.empty())
53810         return;
53811       var anchorLoc = context.projection(_anchorLocLonLat);
53812       var viewport = context.surfaceRect();
53813       if (anchorLoc[0] < 0 || anchorLoc[0] > viewport.width || anchorLoc[1] < 0 || anchorLoc[1] > viewport.height) {
53814         editMenu.close();
53815         return;
53816       }
53817       var menuLeft = displayOnLeft(viewport);
53818       var offset = [0, 0];
53819       offset[0] = menuLeft ? -1 * (_menuSideMargin + _menuWidth) : _menuSideMargin;
53820       if (_menuTop) {
53821         if (anchorLoc[1] - _menuHeight < _vpTopMargin) {
53822           offset[1] = -anchorLoc[1] + _vpTopMargin;
53823         } else {
53824           offset[1] = -_menuHeight;
53825         }
53826       } else {
53827         if (anchorLoc[1] + _menuHeight > viewport.height - _vpBottomMargin) {
53828           offset[1] = -anchorLoc[1] - _menuHeight + viewport.height - _vpBottomMargin;
53829         } else {
53830           offset[1] = 0;
53831         }
53832       }
53833       var origin = geoVecAdd(anchorLoc, offset);
53834       _menu.style("left", origin[0] + "px").style("top", origin[1] + "px");
53835       var tooltipSide = tooltipPosition(viewport, menuLeft);
53836       _tooltips.forEach(function(tooltip) {
53837         tooltip.placement(tooltipSide);
53838       });
53839       function displayOnLeft(viewport2) {
53840         if (_mainLocalizer.textDirection() === "ltr") {
53841           if (anchorLoc[0] + _menuSideMargin + _menuWidth > viewport2.width - _vpSideMargin) {
53842             return true;
53843           }
53844           return false;
53845         } else {
53846           if (anchorLoc[0] - _menuSideMargin - _menuWidth < _vpSideMargin) {
53847             return false;
53848           }
53849           return true;
53850         }
53851       }
53852       function tooltipPosition(viewport2, menuLeft2) {
53853         if (_mainLocalizer.textDirection() === "ltr") {
53854           if (menuLeft2) {
53855             return "left";
53856           }
53857           if (anchorLoc[0] + _menuSideMargin + _menuWidth + _tooltipWidth > viewport2.width - _vpSideMargin) {
53858             return "left";
53859           }
53860           return "right";
53861         } else {
53862           if (!menuLeft2) {
53863             return "right";
53864           }
53865           if (anchorLoc[0] - _menuSideMargin - _menuWidth - _tooltipWidth < _vpSideMargin) {
53866             return "right";
53867           }
53868           return "left";
53869         }
53870       }
53871     }
53872     editMenu.close = function() {
53873       context.map().on("move.edit-menu", null).on("drawn.edit-menu", null);
53874       _menu.remove();
53875       _tooltips = [];
53876       dispatch10.call("toggled", this, false);
53877     };
53878     editMenu.anchorLoc = function(val) {
53879       if (!arguments.length)
53880         return _anchorLoc;
53881       _anchorLoc = val;
53882       _anchorLocLonLat = context.projection.invert(_anchorLoc);
53883       return editMenu;
53884     };
53885     editMenu.triggerType = function(val) {
53886       if (!arguments.length)
53887         return _triggerType;
53888       _triggerType = val;
53889       return editMenu;
53890     };
53891     editMenu.operations = function(val) {
53892       if (!arguments.length)
53893         return _operations;
53894       _operations = val;
53895       return editMenu;
53896     };
53897     return utilRebind(editMenu, dispatch10, "on");
53898   }
53899
53900   // modules/ui/feature_info.js
53901   function uiFeatureInfo(context) {
53902     function update(selection2) {
53903       var features = context.features();
53904       var stats = features.stats();
53905       var count = 0;
53906       var hiddenList = features.hidden().map(function(k) {
53907         if (stats[k]) {
53908           count += stats[k];
53909           return _t.append("inspector.title_count", {
53910             title: _t("feature." + k + ".description"),
53911             count: stats[k]
53912           });
53913         }
53914         return null;
53915       }).filter(Boolean);
53916       selection2.text("");
53917       if (hiddenList.length) {
53918         var tooltipBehavior = uiTooltip().placement("top").title(function() {
53919           return (selection3) => {
53920             hiddenList.forEach((hiddenFeature) => {
53921               selection3.append("div").call(hiddenFeature);
53922             });
53923           };
53924         });
53925         selection2.append("a").attr("class", "chip").attr("href", "#").call(_t.append("feature_info.hidden_warning", { count })).call(tooltipBehavior).on("click", function(d3_event) {
53926           tooltipBehavior.hide();
53927           d3_event.preventDefault();
53928           context.ui().togglePanes(context.container().select(".map-panes .map-data-pane"));
53929         });
53930       }
53931       selection2.classed("hide", !hiddenList.length);
53932     }
53933     return function(selection2) {
53934       update(selection2);
53935       context.features().on("change.feature_info", function() {
53936         update(selection2);
53937       });
53938     };
53939   }
53940
53941   // modules/ui/flash.js
53942   function uiFlash(context) {
53943     var _flashTimer;
53944     var _duration = 2e3;
53945     var _iconName = "#iD-icon-no";
53946     var _iconClass = "disabled";
53947     var _label = (s) => s.text("");
53948     function flash() {
53949       if (_flashTimer) {
53950         _flashTimer.stop();
53951       }
53952       context.container().select(".main-footer-wrap").classed("footer-hide", true).classed("footer-show", false);
53953       context.container().select(".flash-wrap").classed("footer-hide", false).classed("footer-show", true);
53954       var content = context.container().select(".flash-wrap").selectAll(".flash-content").data([0]);
53955       var contentEnter = content.enter().append("div").attr("class", "flash-content");
53956       var iconEnter = contentEnter.append("svg").attr("class", "flash-icon icon").append("g").attr("transform", "translate(10,10)");
53957       iconEnter.append("circle").attr("r", 9);
53958       iconEnter.append("use").attr("transform", "translate(-7,-7)").attr("width", "14").attr("height", "14");
53959       contentEnter.append("div").attr("class", "flash-text");
53960       content = content.merge(contentEnter);
53961       content.selectAll(".flash-icon").attr("class", "icon flash-icon " + (_iconClass || ""));
53962       content.selectAll(".flash-icon use").attr("xlink:href", _iconName);
53963       content.selectAll(".flash-text").attr("class", "flash-text").call(_label);
53964       _flashTimer = timeout_default(function() {
53965         _flashTimer = null;
53966         context.container().select(".main-footer-wrap").classed("footer-hide", false).classed("footer-show", true);
53967         context.container().select(".flash-wrap").classed("footer-hide", true).classed("footer-show", false);
53968       }, _duration);
53969       return content;
53970     }
53971     flash.duration = function(_) {
53972       if (!arguments.length)
53973         return _duration;
53974       _duration = _;
53975       return flash;
53976     };
53977     flash.label = function(_) {
53978       if (!arguments.length)
53979         return _label;
53980       if (typeof _ !== "function") {
53981         _label = (selection2) => selection2.text(_);
53982       } else {
53983         _label = (selection2) => selection2.text("").call(_);
53984       }
53985       return flash;
53986     };
53987     flash.iconName = function(_) {
53988       if (!arguments.length)
53989         return _iconName;
53990       _iconName = _;
53991       return flash;
53992     };
53993     flash.iconClass = function(_) {
53994       if (!arguments.length)
53995         return _iconClass;
53996       _iconClass = _;
53997       return flash;
53998     };
53999     return flash;
54000   }
54001
54002   // modules/ui/full_screen.js
54003   function uiFullScreen(context) {
54004     var element = context.container().node();
54005     function getFullScreenFn() {
54006       if (element.requestFullscreen) {
54007         return element.requestFullscreen;
54008       } else if (element.msRequestFullscreen) {
54009         return element.msRequestFullscreen;
54010       } else if (element.mozRequestFullScreen) {
54011         return element.mozRequestFullScreen;
54012       } else if (element.webkitRequestFullscreen) {
54013         return element.webkitRequestFullscreen;
54014       }
54015     }
54016     function getExitFullScreenFn() {
54017       if (document.exitFullscreen) {
54018         return document.exitFullscreen;
54019       } else if (document.msExitFullscreen) {
54020         return document.msExitFullscreen;
54021       } else if (document.mozCancelFullScreen) {
54022         return document.mozCancelFullScreen;
54023       } else if (document.webkitExitFullscreen) {
54024         return document.webkitExitFullscreen;
54025       }
54026     }
54027     function isFullScreen() {
54028       return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
54029     }
54030     function isSupported() {
54031       return !!getFullScreenFn();
54032     }
54033     function fullScreen(d3_event) {
54034       d3_event.preventDefault();
54035       if (!isFullScreen()) {
54036         getFullScreenFn().apply(element);
54037       } else {
54038         getExitFullScreenFn().apply(document);
54039       }
54040     }
54041     return function() {
54042       if (!isSupported())
54043         return;
54044       var detected = utilDetect();
54045       var keys2 = detected.os === "mac" ? [uiCmd("\u2303\u2318F"), "f11"] : ["f11"];
54046       context.keybinding().on(keys2, fullScreen);
54047     };
54048   }
54049
54050   // modules/ui/geolocate.js
54051   function uiGeolocate(context) {
54052     var _geolocationOptions = {
54053       // prioritize speed and power usage over precision
54054       enableHighAccuracy: false,
54055       // don't hang indefinitely getting the location
54056       timeout: 6e3
54057       // 6sec
54058     };
54059     var _locating = uiLoading(context).message(_t.html("geolocate.locating")).blocking(true);
54060     var _layer = context.layers().layer("geolocate");
54061     var _position;
54062     var _extent;
54063     var _timeoutID;
54064     var _button = select_default2(null);
54065     function click() {
54066       if (context.inIntro())
54067         return;
54068       if (!_layer.enabled() && !_locating.isShown()) {
54069         _timeoutID = setTimeout(
54070           error,
54071           1e4
54072           /* 10sec */
54073         );
54074         context.container().call(_locating);
54075         navigator.geolocation.getCurrentPosition(success, error, _geolocationOptions);
54076       } else {
54077         _locating.close();
54078         _layer.enabled(null, false);
54079         updateButtonState();
54080       }
54081     }
54082     function zoomTo() {
54083       context.enter(modeBrowse(context));
54084       var map2 = context.map();
54085       _layer.enabled(_position, true);
54086       updateButtonState();
54087       map2.centerZoomEase(_extent.center(), Math.min(20, map2.extentZoom(_extent)));
54088     }
54089     function success(geolocation) {
54090       _position = geolocation;
54091       var coords = _position.coords;
54092       _extent = geoExtent([coords.longitude, coords.latitude]).padByMeters(coords.accuracy);
54093       zoomTo();
54094       finish();
54095     }
54096     function error() {
54097       if (_position) {
54098         zoomTo();
54099       } else {
54100         context.ui().flash.label(_t.append("geolocate.location_unavailable")).iconName("#iD-icon-geolocate")();
54101       }
54102       finish();
54103     }
54104     function finish() {
54105       _locating.close();
54106       if (_timeoutID) {
54107         clearTimeout(_timeoutID);
54108       }
54109       _timeoutID = void 0;
54110     }
54111     function updateButtonState() {
54112       _button.classed("active", _layer.enabled());
54113       _button.attr("aria-pressed", _layer.enabled());
54114     }
54115     return function(selection2) {
54116       if (!navigator.geolocation || !navigator.geolocation.getCurrentPosition)
54117         return;
54118       _button = selection2.append("button").on("click", click).attr("aria-pressed", false).call(svgIcon("#iD-icon-geolocate", "light")).call(
54119         uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _t.append("geolocate.title")).keys([_t("geolocate.key")])
54120       );
54121       context.keybinding().on(_t("geolocate.key"), click);
54122     };
54123   }
54124
54125   // modules/ui/panels/background.js
54126   function uiPanelBackground(context) {
54127     var background = context.background();
54128     var _currSourceName = null;
54129     var _metadata = {};
54130     var _metadataKeys = [
54131       "zoom",
54132       "vintage",
54133       "source",
54134       "description",
54135       "resolution",
54136       "accuracy"
54137     ];
54138     var debouncedRedraw = debounce_default(redraw, 250);
54139     function redraw(selection2) {
54140       var source = background.baseLayerSource();
54141       if (!source)
54142         return;
54143       var isDG = source.id.match(/^DigitalGlobe/i) !== null;
54144       var sourceLabel = source.label();
54145       if (_currSourceName !== sourceLabel) {
54146         _currSourceName = sourceLabel;
54147         _metadata = {};
54148       }
54149       selection2.text("");
54150       var list = selection2.append("ul").attr("class", "background-info");
54151       list.append("li").call(_currSourceName);
54152       _metadataKeys.forEach(function(k) {
54153         if (isDG && k === "vintage")
54154           return;
54155         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]);
54156       });
54157       debouncedGetMetadata(selection2);
54158       var toggleTiles = context.getDebug("tile") ? "hide_tiles" : "show_tiles";
54159       selection2.append("a").call(_t.append("info_panels.background." + toggleTiles)).attr("href", "#").attr("class", "button button-toggle-tiles").on("click", function(d3_event) {
54160         d3_event.preventDefault();
54161         context.setDebug("tile", !context.getDebug("tile"));
54162         selection2.call(redraw);
54163       });
54164       if (isDG) {
54165         var key = source.id + "-vintage";
54166         var sourceVintage = context.background().findSource(key);
54167         var showsVintage = context.background().showsLayer(sourceVintage);
54168         var toggleVintage = showsVintage ? "hide_vintage" : "show_vintage";
54169         selection2.append("a").call(_t.append("info_panels.background." + toggleVintage)).attr("href", "#").attr("class", "button button-toggle-vintage").on("click", function(d3_event) {
54170           d3_event.preventDefault();
54171           context.background().toggleOverlayLayer(sourceVintage);
54172           selection2.call(redraw);
54173         });
54174       }
54175       ["DigitalGlobe-Premium", "DigitalGlobe-Standard"].forEach(function(layerId) {
54176         if (source.id !== layerId) {
54177           var key2 = layerId + "-vintage";
54178           var sourceVintage2 = context.background().findSource(key2);
54179           if (context.background().showsLayer(sourceVintage2)) {
54180             context.background().toggleOverlayLayer(sourceVintage2);
54181           }
54182         }
54183       });
54184     }
54185     var debouncedGetMetadata = debounce_default(getMetadata, 250);
54186     function getMetadata(selection2) {
54187       var tile = context.container().select(".layer-background img.tile-center");
54188       if (tile.empty())
54189         return;
54190       var sourceName = _currSourceName;
54191       var d = tile.datum();
54192       var zoom = d && d.length >= 3 && d[2] || Math.floor(context.map().zoom());
54193       var center = context.map().center();
54194       _metadata.zoom = String(zoom);
54195       selection2.selectAll(".background-info-list-zoom").classed("hide", false).selectAll(".background-info-span-zoom").text(_metadata.zoom);
54196       if (!d || !d.length >= 3)
54197         return;
54198       background.baseLayerSource().getMetadata(center, d, function(err, result) {
54199         if (err || _currSourceName !== sourceName)
54200           return;
54201         var vintage = result.vintage;
54202         _metadata.vintage = vintage && vintage.range || _t("info_panels.background.unknown");
54203         selection2.selectAll(".background-info-list-vintage").classed("hide", false).selectAll(".background-info-span-vintage").text(_metadata.vintage);
54204         _metadataKeys.forEach(function(k) {
54205           if (k === "zoom" || k === "vintage")
54206             return;
54207           var val = result[k];
54208           _metadata[k] = val;
54209           selection2.selectAll(".background-info-list-" + k).classed("hide", !val).selectAll(".background-info-span-" + k).text(val);
54210         });
54211       });
54212     }
54213     var panel = function(selection2) {
54214       selection2.call(redraw);
54215       context.map().on("drawn.info-background", function() {
54216         selection2.call(debouncedRedraw);
54217       }).on("move.info-background", function() {
54218         selection2.call(debouncedGetMetadata);
54219       });
54220     };
54221     panel.off = function() {
54222       context.map().on("drawn.info-background", null).on("move.info-background", null);
54223     };
54224     panel.id = "background";
54225     panel.label = _t.append("info_panels.background.title");
54226     panel.key = _t("info_panels.background.key");
54227     return panel;
54228   }
54229
54230   // modules/ui/panels/history.js
54231   function uiPanelHistory(context) {
54232     var osm;
54233     function displayTimestamp(timestamp) {
54234       if (!timestamp)
54235         return _t("info_panels.history.unknown");
54236       var options2 = {
54237         day: "numeric",
54238         month: "short",
54239         year: "numeric",
54240         hour: "numeric",
54241         minute: "numeric",
54242         second: "numeric"
54243       };
54244       var d = new Date(timestamp);
54245       if (isNaN(d.getTime()))
54246         return _t("info_panels.history.unknown");
54247       return d.toLocaleString(_mainLocalizer.localeCode(), options2);
54248     }
54249     function displayUser(selection2, userName) {
54250       if (!userName) {
54251         selection2.append("span").call(_t.append("info_panels.history.unknown"));
54252         return;
54253       }
54254       selection2.append("span").attr("class", "user-name").text(userName);
54255       var links = selection2.append("div").attr("class", "links");
54256       if (osm) {
54257         links.append("a").attr("class", "user-osm-link").attr("href", osm.userURL(userName)).attr("target", "_blank").call(_t.append("info_panels.history.profile_link"));
54258       }
54259       links.append("a").attr("class", "user-hdyc-link").attr("href", "https://hdyc.neis-one.org/?" + userName).attr("target", "_blank").attr("tabindex", -1).text("HDYC");
54260     }
54261     function displayChangeset(selection2, changeset) {
54262       if (!changeset) {
54263         selection2.append("span").call(_t.append("info_panels.history.unknown"));
54264         return;
54265       }
54266       selection2.append("span").attr("class", "changeset-id").text(changeset);
54267       var links = selection2.append("div").attr("class", "links");
54268       if (osm) {
54269         links.append("a").attr("class", "changeset-osm-link").attr("href", osm.changesetURL(changeset)).attr("target", "_blank").call(_t.append("info_panels.history.changeset_link"));
54270       }
54271       links.append("a").attr("class", "changeset-osmcha-link").attr("href", "https://osmcha.org/changesets/" + changeset).attr("target", "_blank").text("OSMCha");
54272       links.append("a").attr("class", "changeset-achavi-link").attr("href", "https://overpass-api.de/achavi/?changeset=" + changeset).attr("target", "_blank").text("Achavi");
54273     }
54274     function redraw(selection2) {
54275       var selectedNoteID = context.selectedNoteID();
54276       osm = context.connection();
54277       var selected, note, entity;
54278       if (selectedNoteID && osm) {
54279         selected = [_t.html("note.note") + " " + selectedNoteID];
54280         note = osm.getNote(selectedNoteID);
54281       } else {
54282         selected = context.selectedIDs().filter(function(e) {
54283           return context.hasEntity(e);
54284         });
54285         if (selected.length) {
54286           entity = context.entity(selected[0]);
54287         }
54288       }
54289       var singular = selected.length === 1 ? selected[0] : null;
54290       selection2.html("");
54291       if (singular) {
54292         selection2.append("h4").attr("class", "history-heading").html(singular);
54293       } else {
54294         selection2.append("h4").attr("class", "history-heading").call(_t.append("info_panels.selected", { n: selected.length }));
54295       }
54296       if (!singular)
54297         return;
54298       if (entity) {
54299         selection2.call(redrawEntity, entity);
54300       } else if (note) {
54301         selection2.call(redrawNote, note);
54302       }
54303     }
54304     function redrawNote(selection2, note) {
54305       if (!note || note.isNew()) {
54306         selection2.append("div").call(_t.append("info_panels.history.note_no_history"));
54307         return;
54308       }
54309       var list = selection2.append("ul");
54310       list.append("li").call(_t.append("info_panels.history.note_comments", { suffix: ":" })).append("span").text(note.comments.length);
54311       if (note.comments.length) {
54312         list.append("li").call(_t.append("info_panels.history.note_created_date", { suffix: ":" })).append("span").text(displayTimestamp(note.comments[0].date));
54313         list.append("li").call(_t.append("info_panels.history.note_created_user", { suffix: ":" })).call(displayUser, note.comments[0].user);
54314       }
54315       if (osm) {
54316         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"));
54317       }
54318     }
54319     function redrawEntity(selection2, entity) {
54320       if (!entity || entity.isNew()) {
54321         selection2.append("div").call(_t.append("info_panels.history.no_history"));
54322         return;
54323       }
54324       var links = selection2.append("div").attr("class", "links");
54325       if (osm) {
54326         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"));
54327       }
54328       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");
54329       var list = selection2.append("ul");
54330       list.append("li").call(_t.append("info_panels.history.version", { suffix: ":" })).append("span").text(entity.version);
54331       list.append("li").call(_t.append("info_panels.history.last_edit", { suffix: ":" })).append("span").text(displayTimestamp(entity.timestamp));
54332       list.append("li").call(_t.append("info_panels.history.edited_by", { suffix: ":" })).call(displayUser, entity.user);
54333       list.append("li").call(_t.append("info_panels.history.changeset", { suffix: ":" })).call(displayChangeset, entity.changeset);
54334     }
54335     var panel = function(selection2) {
54336       selection2.call(redraw);
54337       context.map().on("drawn.info-history", function() {
54338         selection2.call(redraw);
54339       });
54340       context.on("enter.info-history", function() {
54341         selection2.call(redraw);
54342       });
54343     };
54344     panel.off = function() {
54345       context.map().on("drawn.info-history", null);
54346       context.on("enter.info-history", null);
54347     };
54348     panel.id = "history";
54349     panel.label = _t.append("info_panels.history.title");
54350     panel.key = _t("info_panels.history.key");
54351     return panel;
54352   }
54353
54354   // modules/util/units.js
54355   var OSM_PRECISION = 7;
54356   function displayLength(m, isImperial) {
54357     var d = m * (isImperial ? 3.28084 : 1);
54358     var unit2;
54359     if (isImperial) {
54360       if (d >= 5280) {
54361         d /= 5280;
54362         unit2 = "miles";
54363       } else {
54364         unit2 = "feet";
54365       }
54366     } else {
54367       if (d >= 1e3) {
54368         d /= 1e3;
54369         unit2 = "kilometers";
54370       } else {
54371         unit2 = "meters";
54372       }
54373     }
54374     return _t("units." + unit2, {
54375       quantity: d.toLocaleString(_mainLocalizer.localeCode(), {
54376         maximumSignificantDigits: 4
54377       })
54378     });
54379   }
54380   function displayArea(m2, isImperial) {
54381     var locale2 = _mainLocalizer.localeCode();
54382     var d = m2 * (isImperial ? 10.7639111056 : 1);
54383     var d1, d2, area;
54384     var unit1 = "";
54385     var unit2 = "";
54386     if (isImperial) {
54387       if (d >= 6969600) {
54388         d1 = d / 27878400;
54389         unit1 = "square_miles";
54390       } else {
54391         d1 = d;
54392         unit1 = "square_feet";
54393       }
54394       if (d > 4356 && d < 4356e4) {
54395         d2 = d / 43560;
54396         unit2 = "acres";
54397       }
54398     } else {
54399       if (d >= 25e4) {
54400         d1 = d / 1e6;
54401         unit1 = "square_kilometers";
54402       } else {
54403         d1 = d;
54404         unit1 = "square_meters";
54405       }
54406       if (d > 1e3 && d < 1e7) {
54407         d2 = d / 1e4;
54408         unit2 = "hectares";
54409       }
54410     }
54411     area = _t("units." + unit1, {
54412       quantity: d1.toLocaleString(locale2, {
54413         maximumSignificantDigits: 4
54414       })
54415     });
54416     if (d2) {
54417       return _t("units.area_pair", {
54418         area1: area,
54419         area2: _t("units." + unit2, {
54420           quantity: d2.toLocaleString(locale2, {
54421             maximumSignificantDigits: 2
54422           })
54423         })
54424       });
54425     } else {
54426       return area;
54427     }
54428   }
54429   function wrap(x, min3, max3) {
54430     var d = max3 - min3;
54431     return ((x - min3) % d + d) % d + min3;
54432   }
54433   function clamp2(x, min3, max3) {
54434     return Math.max(min3, Math.min(x, max3));
54435   }
54436   function displayCoordinate(deg, pos, neg) {
54437     var locale2 = _mainLocalizer.localeCode();
54438     var min3 = (Math.abs(deg) - Math.floor(Math.abs(deg))) * 60;
54439     var sec = (min3 - Math.floor(min3)) * 60;
54440     var displayDegrees = _t("units.arcdegrees", {
54441       quantity: Math.floor(Math.abs(deg)).toLocaleString(locale2)
54442     });
54443     var displayCoordinate2;
54444     if (Math.floor(sec) > 0) {
54445       displayCoordinate2 = displayDegrees + _t("units.arcminutes", {
54446         quantity: Math.floor(min3).toLocaleString(locale2)
54447       }) + _t("units.arcseconds", {
54448         quantity: Math.round(sec).toLocaleString(locale2)
54449       });
54450     } else if (Math.floor(min3) > 0) {
54451       displayCoordinate2 = displayDegrees + _t("units.arcminutes", {
54452         quantity: Math.round(min3).toLocaleString(locale2)
54453       });
54454     } else {
54455       displayCoordinate2 = _t("units.arcdegrees", {
54456         quantity: Math.round(Math.abs(deg)).toLocaleString(locale2)
54457       });
54458     }
54459     if (deg === 0) {
54460       return displayCoordinate2;
54461     } else {
54462       return _t("units.coordinate", {
54463         coordinate: displayCoordinate2,
54464         direction: _t("units." + (deg > 0 ? pos : neg))
54465       });
54466     }
54467   }
54468   function dmsCoordinatePair(coord2) {
54469     return _t("units.coordinate_pair", {
54470       latitude: displayCoordinate(clamp2(coord2[1], -90, 90), "north", "south"),
54471       longitude: displayCoordinate(wrap(coord2[0], -180, 180), "east", "west")
54472     });
54473   }
54474   function decimalCoordinatePair(coord2) {
54475     return _t("units.coordinate_pair", {
54476       latitude: clamp2(coord2[1], -90, 90).toFixed(OSM_PRECISION),
54477       longitude: wrap(coord2[0], -180, 180).toFixed(OSM_PRECISION)
54478     });
54479   }
54480
54481   // modules/ui/panels/location.js
54482   function uiPanelLocation(context) {
54483     var currLocation = "";
54484     function redraw(selection2) {
54485       selection2.html("");
54486       var list = selection2.append("ul");
54487       var coord2 = context.map().mouseCoordinates();
54488       if (coord2.some(isNaN)) {
54489         coord2 = context.map().center();
54490       }
54491       list.append("li").text(dmsCoordinatePair(coord2)).append("li").text(decimalCoordinatePair(coord2));
54492       selection2.append("div").attr("class", "location-info").text(currLocation || " ");
54493       debouncedGetLocation(selection2, coord2);
54494     }
54495     var debouncedGetLocation = debounce_default(getLocation, 250);
54496     function getLocation(selection2, coord2) {
54497       if (!services.geocoder) {
54498         currLocation = _t("info_panels.location.unknown_location");
54499         selection2.selectAll(".location-info").text(currLocation);
54500       } else {
54501         services.geocoder.reverse(coord2, function(err, result) {
54502           currLocation = result ? result.display_name : _t("info_panels.location.unknown_location");
54503           selection2.selectAll(".location-info").text(currLocation);
54504         });
54505       }
54506     }
54507     var panel = function(selection2) {
54508       selection2.call(redraw);
54509       context.surface().on(("PointerEvent" in window ? "pointer" : "mouse") + "move.info-location", function() {
54510         selection2.call(redraw);
54511       });
54512     };
54513     panel.off = function() {
54514       context.surface().on(".info-location", null);
54515     };
54516     panel.id = "location";
54517     panel.label = _t.append("info_panels.location.title");
54518     panel.key = _t("info_panels.location.key");
54519     return panel;
54520   }
54521
54522   // modules/ui/panels/measurement.js
54523   function uiPanelMeasurement(context) {
54524     function radiansToMeters(r) {
54525       return r * 63710071809e-4;
54526     }
54527     function steradiansToSqmeters(r) {
54528       return r / (4 * Math.PI) * 510065621724e3;
54529     }
54530     function toLineString(feature3) {
54531       if (feature3.type === "LineString")
54532         return feature3;
54533       var result = { type: "LineString", coordinates: [] };
54534       if (feature3.type === "Polygon") {
54535         result.coordinates = feature3.coordinates[0];
54536       } else if (feature3.type === "MultiPolygon") {
54537         result.coordinates = feature3.coordinates[0][0];
54538       }
54539       return result;
54540     }
54541     var _isImperial = !_mainLocalizer.usesMetric();
54542     function redraw(selection2) {
54543       var graph = context.graph();
54544       var selectedNoteID = context.selectedNoteID();
54545       var osm = services.osm;
54546       var localeCode = _mainLocalizer.localeCode();
54547       var heading;
54548       var center, location, centroid;
54549       var closed, geometry;
54550       var totalNodeCount, length = 0, area = 0, distance;
54551       if (selectedNoteID && osm) {
54552         var note = osm.getNote(selectedNoteID);
54553         heading = _t.html("note.note") + " " + selectedNoteID;
54554         location = note.loc;
54555         geometry = "note";
54556       } else {
54557         var selectedIDs = context.selectedIDs().filter(function(id2) {
54558           return context.hasEntity(id2);
54559         });
54560         var selected = selectedIDs.map(function(id2) {
54561           return context.entity(id2);
54562         });
54563         heading = selected.length === 1 ? selected[0].id : _t.html("info_panels.selected", { n: selected.length });
54564         if (selected.length) {
54565           var extent = geoExtent();
54566           for (var i2 in selected) {
54567             var entity = selected[i2];
54568             extent._extend(entity.extent(graph));
54569             geometry = entity.geometry(graph);
54570             if (geometry === "line" || geometry === "area") {
54571               closed = entity.type === "relation" || entity.isClosed() && !entity.isDegenerate();
54572               var feature3 = entity.asGeoJSON(graph);
54573               length += radiansToMeters(length_default(toLineString(feature3)));
54574               centroid = path_default(context.projection).centroid(entity.asGeoJSON(graph));
54575               centroid = centroid && context.projection.invert(centroid);
54576               if (!centroid || !isFinite(centroid[0]) || !isFinite(centroid[1])) {
54577                 centroid = entity.extent(graph).center();
54578               }
54579               if (closed) {
54580                 area += steradiansToSqmeters(entity.area(graph));
54581               }
54582             }
54583           }
54584           if (selected.length > 1) {
54585             geometry = null;
54586             closed = null;
54587             centroid = null;
54588           }
54589           if (selected.length === 2 && selected[0].type === "node" && selected[1].type === "node") {
54590             distance = geoSphericalDistance(selected[0].loc, selected[1].loc);
54591           }
54592           if (selected.length === 1 && selected[0].type === "node") {
54593             location = selected[0].loc;
54594           } else {
54595             totalNodeCount = utilGetAllNodes(selectedIDs, context.graph()).length;
54596           }
54597           if (!location && !centroid) {
54598             center = extent.center();
54599           }
54600         }
54601       }
54602       selection2.html("");
54603       if (heading) {
54604         selection2.append("h4").attr("class", "measurement-heading").html(heading);
54605       }
54606       var list = selection2.append("ul");
54607       var coordItem;
54608       if (geometry) {
54609         list.append("li").call(_t.append("info_panels.measurement.geometry", { suffix: ":" })).append("span").html(
54610           closed ? _t.html("info_panels.measurement.closed_" + geometry) : _t.html("geometry." + geometry)
54611         );
54612       }
54613       if (totalNodeCount) {
54614         list.append("li").call(_t.append("info_panels.measurement.node_count", { suffix: ":" })).append("span").text(totalNodeCount.toLocaleString(localeCode));
54615       }
54616       if (area) {
54617         list.append("li").call(_t.append("info_panels.measurement.area", { suffix: ":" })).append("span").text(displayArea(area, _isImperial));
54618       }
54619       if (length) {
54620         list.append("li").call(_t.append("info_panels.measurement." + (closed ? "perimeter" : "length"), { suffix: ":" })).append("span").text(displayLength(length, _isImperial));
54621       }
54622       if (typeof distance === "number") {
54623         list.append("li").call(_t.append("info_panels.measurement.distance", { suffix: ":" })).append("span").text(displayLength(distance, _isImperial));
54624       }
54625       if (location) {
54626         coordItem = list.append("li").call(_t.append("info_panels.measurement.location", { suffix: ":" }));
54627         coordItem.append("span").text(dmsCoordinatePair(location));
54628         coordItem.append("span").text(decimalCoordinatePair(location));
54629       }
54630       if (centroid) {
54631         coordItem = list.append("li").call(_t.append("info_panels.measurement.centroid", { suffix: ":" }));
54632         coordItem.append("span").text(dmsCoordinatePair(centroid));
54633         coordItem.append("span").text(decimalCoordinatePair(centroid));
54634       }
54635       if (center) {
54636         coordItem = list.append("li").call(_t.append("info_panels.measurement.center", { suffix: ":" }));
54637         coordItem.append("span").text(dmsCoordinatePair(center));
54638         coordItem.append("span").text(decimalCoordinatePair(center));
54639       }
54640       if (length || area || typeof distance === "number") {
54641         var toggle = _isImperial ? "imperial" : "metric";
54642         selection2.append("a").call(_t.append("info_panels.measurement." + toggle)).attr("href", "#").attr("class", "button button-toggle-units").on("click", function(d3_event) {
54643           d3_event.preventDefault();
54644           _isImperial = !_isImperial;
54645           selection2.call(redraw);
54646         });
54647       }
54648     }
54649     var panel = function(selection2) {
54650       selection2.call(redraw);
54651       context.map().on("drawn.info-measurement", function() {
54652         selection2.call(redraw);
54653       });
54654       context.on("enter.info-measurement", function() {
54655         selection2.call(redraw);
54656       });
54657     };
54658     panel.off = function() {
54659       context.map().on("drawn.info-measurement", null);
54660       context.on("enter.info-measurement", null);
54661     };
54662     panel.id = "measurement";
54663     panel.label = _t.append("info_panels.measurement.title");
54664     panel.key = _t("info_panels.measurement.key");
54665     return panel;
54666   }
54667
54668   // modules/ui/panels/index.js
54669   var uiInfoPanels = {
54670     background: uiPanelBackground,
54671     history: uiPanelHistory,
54672     location: uiPanelLocation,
54673     measurement: uiPanelMeasurement
54674   };
54675
54676   // modules/ui/info.js
54677   function uiInfo(context) {
54678     var ids = Object.keys(uiInfoPanels);
54679     var wasActive = ["measurement"];
54680     var panels = {};
54681     var active = {};
54682     ids.forEach(function(k) {
54683       if (!panels[k]) {
54684         panels[k] = uiInfoPanels[k](context);
54685         active[k] = false;
54686       }
54687     });
54688     function info(selection2) {
54689       function redraw() {
54690         var activeids = ids.filter(function(k) {
54691           return active[k];
54692         }).sort();
54693         var containers = infoPanels.selectAll(".panel-container").data(activeids, function(k) {
54694           return k;
54695         });
54696         containers.exit().style("opacity", 1).transition().duration(200).style("opacity", 0).on("end", function(d) {
54697           select_default2(this).call(panels[d].off).remove();
54698         });
54699         var enter = containers.enter().append("div").attr("class", function(d) {
54700           return "fillD2 panel-container panel-container-" + d;
54701         });
54702         enter.style("opacity", 0).transition().duration(200).style("opacity", 1);
54703         var title = enter.append("div").attr("class", "panel-title fillD2");
54704         title.append("h3").each(function(d) {
54705           return panels[d].label(select_default2(this));
54706         });
54707         title.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function(d3_event, d) {
54708           d3_event.stopImmediatePropagation();
54709           d3_event.preventDefault();
54710           info.toggle(d);
54711         }).call(svgIcon("#iD-icon-close"));
54712         enter.append("div").attr("class", function(d) {
54713           return "panel-content panel-content-" + d;
54714         });
54715         infoPanels.selectAll(".panel-content").each(function(d) {
54716           select_default2(this).call(panels[d]);
54717         });
54718       }
54719       info.toggle = function(which) {
54720         var activeids = ids.filter(function(k) {
54721           return active[k];
54722         });
54723         if (which) {
54724           active[which] = !active[which];
54725           if (activeids.length === 1 && activeids[0] === which) {
54726             wasActive = [which];
54727           }
54728           context.container().select("." + which + "-panel-toggle-item").classed("active", active[which]).select("input").property("checked", active[which]);
54729         } else {
54730           if (activeids.length) {
54731             wasActive = activeids;
54732             activeids.forEach(function(k) {
54733               active[k] = false;
54734             });
54735           } else {
54736             wasActive.forEach(function(k) {
54737               active[k] = true;
54738             });
54739           }
54740         }
54741         redraw();
54742       };
54743       var infoPanels = selection2.selectAll(".info-panels").data([0]);
54744       infoPanels = infoPanels.enter().append("div").attr("class", "info-panels").merge(infoPanels);
54745       redraw();
54746       context.keybinding().on(uiCmd("\u2318" + _t("info_panels.key")), function(d3_event) {
54747         d3_event.stopImmediatePropagation();
54748         d3_event.preventDefault();
54749         info.toggle();
54750       });
54751       ids.forEach(function(k) {
54752         var key = _t("info_panels." + k + ".key", { default: null });
54753         if (!key)
54754           return;
54755         context.keybinding().on(uiCmd("\u2318\u21E7" + key), function(d3_event) {
54756           d3_event.stopImmediatePropagation();
54757           d3_event.preventDefault();
54758           info.toggle(k);
54759         });
54760       });
54761     }
54762     return info;
54763   }
54764
54765   // modules/ui/intro/helper.js
54766   function pointBox(loc, context) {
54767     var rect = context.surfaceRect();
54768     var point2 = context.curtainProjection(loc);
54769     return {
54770       left: point2[0] + rect.left - 40,
54771       top: point2[1] + rect.top - 60,
54772       width: 80,
54773       height: 90
54774     };
54775   }
54776   function pad(locOrBox, padding, context) {
54777     var box;
54778     if (locOrBox instanceof Array) {
54779       var rect = context.surfaceRect();
54780       var point2 = context.curtainProjection(locOrBox);
54781       box = {
54782         left: point2[0] + rect.left,
54783         top: point2[1] + rect.top
54784       };
54785     } else {
54786       box = locOrBox;
54787     }
54788     return {
54789       left: box.left - padding,
54790       top: box.top - padding,
54791       width: (box.width || 0) + 2 * padding,
54792       height: (box.width || 0) + 2 * padding
54793     };
54794   }
54795   function icon(name, svgklass, useklass) {
54796     return '<svg class="icon ' + (svgklass || "") + '"><use xlink:href="' + name + '"' + (useklass ? ' class="' + useklass + '"' : "") + "></use></svg>";
54797   }
54798   var helpStringReplacements;
54799   function helpHtml(id2, replacements) {
54800     if (!helpStringReplacements) {
54801       helpStringReplacements = {
54802         // insert icons corresponding to various UI elements
54803         point_icon: icon("#iD-icon-point", "inline"),
54804         line_icon: icon("#iD-icon-line", "inline"),
54805         area_icon: icon("#iD-icon-area", "inline"),
54806         note_icon: icon("#iD-icon-note", "inline add-note"),
54807         plus: icon("#iD-icon-plus", "inline"),
54808         minus: icon("#iD-icon-minus", "inline"),
54809         layers_icon: icon("#iD-icon-layers", "inline"),
54810         data_icon: icon("#iD-icon-data", "inline"),
54811         inspect: icon("#iD-icon-inspect", "inline"),
54812         help_icon: icon("#iD-icon-help", "inline"),
54813         undo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo", "inline"),
54814         redo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-undo" : "#iD-icon-redo", "inline"),
54815         save_icon: icon("#iD-icon-save", "inline"),
54816         // operation icons
54817         circularize_icon: icon("#iD-operation-circularize", "inline operation"),
54818         continue_icon: icon("#iD-operation-continue", "inline operation"),
54819         copy_icon: icon("#iD-operation-copy", "inline operation"),
54820         delete_icon: icon("#iD-operation-delete", "inline operation"),
54821         disconnect_icon: icon("#iD-operation-disconnect", "inline operation"),
54822         downgrade_icon: icon("#iD-operation-downgrade", "inline operation"),
54823         extract_icon: icon("#iD-operation-extract", "inline operation"),
54824         merge_icon: icon("#iD-operation-merge", "inline operation"),
54825         move_icon: icon("#iD-operation-move", "inline operation"),
54826         orthogonalize_icon: icon("#iD-operation-orthogonalize", "inline operation"),
54827         paste_icon: icon("#iD-operation-paste", "inline operation"),
54828         reflect_long_icon: icon("#iD-operation-reflect-long", "inline operation"),
54829         reflect_short_icon: icon("#iD-operation-reflect-short", "inline operation"),
54830         reverse_icon: icon("#iD-operation-reverse", "inline operation"),
54831         rotate_icon: icon("#iD-operation-rotate", "inline operation"),
54832         split_icon: icon("#iD-operation-split", "inline operation"),
54833         straighten_icon: icon("#iD-operation-straighten", "inline operation"),
54834         // interaction icons
54835         leftclick: icon("#iD-walkthrough-mouse-left", "inline operation"),
54836         rightclick: icon("#iD-walkthrough-mouse-right", "inline operation"),
54837         mousewheel_icon: icon("#iD-walkthrough-mousewheel", "inline operation"),
54838         tap_icon: icon("#iD-walkthrough-tap", "inline operation"),
54839         doubletap_icon: icon("#iD-walkthrough-doubletap", "inline operation"),
54840         longpress_icon: icon("#iD-walkthrough-longpress", "inline operation"),
54841         touchdrag_icon: icon("#iD-walkthrough-touchdrag", "inline operation"),
54842         pinch_icon: icon("#iD-walkthrough-pinch-apart", "inline operation"),
54843         // insert keys; may be localized and platform-dependent
54844         shift: uiCmd.display("\u21E7"),
54845         alt: uiCmd.display("\u2325"),
54846         return: uiCmd.display("\u21B5"),
54847         esc: _t.html("shortcuts.key.esc"),
54848         space: _t.html("shortcuts.key.space"),
54849         add_note_key: _t.html("modes.add_note.key"),
54850         help_key: _t.html("help.key"),
54851         shortcuts_key: _t.html("shortcuts.toggle.key"),
54852         // reference localized UI labels directly so that they'll always match
54853         save: _t.html("save.title"),
54854         undo: _t.html("undo.title"),
54855         redo: _t.html("redo.title"),
54856         upload: _t.html("commit.save"),
54857         point: _t.html("modes.add_point.title"),
54858         line: _t.html("modes.add_line.title"),
54859         area: _t.html("modes.add_area.title"),
54860         note: _t.html("modes.add_note.label"),
54861         circularize: _t.html("operations.circularize.title"),
54862         continue: _t.html("operations.continue.title"),
54863         copy: _t.html("operations.copy.title"),
54864         delete: _t.html("operations.delete.title"),
54865         disconnect: _t.html("operations.disconnect.title"),
54866         downgrade: _t.html("operations.downgrade.title"),
54867         extract: _t.html("operations.extract.title"),
54868         merge: _t.html("operations.merge.title"),
54869         move: _t.html("operations.move.title"),
54870         orthogonalize: _t.html("operations.orthogonalize.title"),
54871         paste: _t.html("operations.paste.title"),
54872         reflect_long: _t.html("operations.reflect.title.long"),
54873         reflect_short: _t.html("operations.reflect.title.short"),
54874         reverse: _t.html("operations.reverse.title"),
54875         rotate: _t.html("operations.rotate.title"),
54876         split: _t.html("operations.split.title"),
54877         straighten: _t.html("operations.straighten.title"),
54878         map_data: _t.html("map_data.title"),
54879         osm_notes: _t.html("map_data.layers.notes.title"),
54880         fields: _t.html("inspector.fields"),
54881         tags: _t.html("inspector.tags"),
54882         relations: _t.html("inspector.relations"),
54883         new_relation: _t.html("inspector.new_relation"),
54884         turn_restrictions: _t.html("_tagging.presets.fields.restrictions.label"),
54885         background_settings: _t.html("background.description"),
54886         imagery_offset: _t.html("background.fix_misalignment"),
54887         start_the_walkthrough: _t.html("splash.walkthrough"),
54888         help: _t.html("help.title"),
54889         ok: _t.html("intro.ok")
54890       };
54891       for (var key in helpStringReplacements) {
54892         helpStringReplacements[key] = { html: helpStringReplacements[key] };
54893       }
54894     }
54895     var reps;
54896     if (replacements) {
54897       reps = Object.assign(replacements, helpStringReplacements);
54898     } else {
54899       reps = helpStringReplacements;
54900     }
54901     return _t.html(id2, reps).replace(/\`(.*?)\`/g, "<kbd>$1</kbd>");
54902   }
54903   function slugify(text2) {
54904     return text2.toString().toLowerCase().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
54905   }
54906   var missingStrings = {};
54907   function checkKey(key, text2) {
54908     if (_t(key, { default: void 0 }) === void 0) {
54909       if (missingStrings.hasOwnProperty(key))
54910         return;
54911       missingStrings[key] = text2;
54912       var missing = key + ": " + text2;
54913       if (typeof console !== "undefined")
54914         console.log(missing);
54915     }
54916   }
54917   function localize(obj) {
54918     var key;
54919     var name = obj.tags && obj.tags.name;
54920     if (name) {
54921       key = "intro.graph.name." + slugify(name);
54922       obj.tags.name = _t(key, { default: name });
54923       checkKey(key, name);
54924     }
54925     var street = obj.tags && obj.tags["addr:street"];
54926     if (street) {
54927       key = "intro.graph.name." + slugify(street);
54928       obj.tags["addr:street"] = _t(key, { default: street });
54929       checkKey(key, street);
54930       var addrTags = [
54931         "block_number",
54932         "city",
54933         "county",
54934         "district",
54935         "hamlet",
54936         "neighbourhood",
54937         "postcode",
54938         "province",
54939         "quarter",
54940         "state",
54941         "subdistrict",
54942         "suburb"
54943       ];
54944       addrTags.forEach(function(k) {
54945         var key2 = "intro.graph." + k;
54946         var tag = "addr:" + k;
54947         var val = obj.tags && obj.tags[tag];
54948         var str2 = _t(key2, { default: val });
54949         if (str2) {
54950           if (str2.match(/^<.*>$/) !== null) {
54951             delete obj.tags[tag];
54952           } else {
54953             obj.tags[tag] = str2;
54954           }
54955         }
54956       });
54957     }
54958     return obj;
54959   }
54960   function isMostlySquare(points) {
54961     var threshold = 15;
54962     var lowerBound = Math.cos((90 - threshold) * Math.PI / 180);
54963     var upperBound = Math.cos(threshold * Math.PI / 180);
54964     for (var i2 = 0; i2 < points.length; i2++) {
54965       var a = points[(i2 - 1 + points.length) % points.length];
54966       var origin = points[i2];
54967       var b = points[(i2 + 1) % points.length];
54968       var dotp = geoVecNormalizedDot(a, b, origin);
54969       var mag = Math.abs(dotp);
54970       if (mag > lowerBound && mag < upperBound) {
54971         return false;
54972       }
54973     }
54974     return true;
54975   }
54976   function selectMenuItem(context, operation) {
54977     return context.container().select(".edit-menu .edit-menu-item-" + operation);
54978   }
54979   function transitionTime(point1, point2) {
54980     var distance = geoSphericalDistance(point1, point2);
54981     if (distance === 0) {
54982       return 0;
54983     } else if (distance < 80) {
54984       return 500;
54985     } else {
54986       return 1e3;
54987     }
54988   }
54989
54990   // modules/ui/toggle.js
54991   function uiToggle(show, callback) {
54992     return function(selection2) {
54993       selection2.style("opacity", show ? 0 : 1).classed("hide", false).transition().style("opacity", show ? 1 : 0).on("end", function() {
54994         select_default2(this).classed("hide", !show).style("opacity", null);
54995         if (callback)
54996           callback.apply(this);
54997       });
54998     };
54999   }
55000
55001   // modules/ui/curtain.js
55002   function uiCurtain(containerNode) {
55003     var surface = select_default2(null), tooltip = select_default2(null), darkness = select_default2(null);
55004     function curtain(selection2) {
55005       surface = selection2.append("svg").attr("class", "curtain").style("top", 0).style("left", 0);
55006       darkness = surface.append("path").attr("x", 0).attr("y", 0).attr("class", "curtain-darkness");
55007       select_default2(window).on("resize.curtain", resize);
55008       tooltip = selection2.append("div").attr("class", "tooltip");
55009       tooltip.append("div").attr("class", "popover-arrow");
55010       tooltip.append("div").attr("class", "popover-inner");
55011       resize();
55012       function resize() {
55013         surface.attr("width", containerNode.clientWidth).attr("height", containerNode.clientHeight);
55014         curtain.cut(darkness.datum());
55015       }
55016     }
55017     curtain.reveal = function(box, html2, options2) {
55018       options2 = options2 || {};
55019       if (typeof box === "string") {
55020         box = select_default2(box).node();
55021       }
55022       if (box && box.getBoundingClientRect) {
55023         box = copyBox(box.getBoundingClientRect());
55024         var containerRect = containerNode.getBoundingClientRect();
55025         box.top -= containerRect.top;
55026         box.left -= containerRect.left;
55027       }
55028       if (box && options2.padding) {
55029         box.top -= options2.padding;
55030         box.left -= options2.padding;
55031         box.bottom += options2.padding;
55032         box.right += options2.padding;
55033         box.height += options2.padding * 2;
55034         box.width += options2.padding * 2;
55035       }
55036       var tooltipBox;
55037       if (options2.tooltipBox) {
55038         tooltipBox = options2.tooltipBox;
55039         if (typeof tooltipBox === "string") {
55040           tooltipBox = select_default2(tooltipBox).node();
55041         }
55042         if (tooltipBox && tooltipBox.getBoundingClientRect) {
55043           tooltipBox = copyBox(tooltipBox.getBoundingClientRect());
55044         }
55045       } else {
55046         tooltipBox = box;
55047       }
55048       if (tooltipBox && html2) {
55049         if (html2.indexOf("**") !== -1) {
55050           if (html2.indexOf("<span") === 0) {
55051             html2 = html2.replace(/^(<span.*?>)(.+?)(\*\*)/, "$1<span>$2</span>$3");
55052           } else {
55053             html2 = html2.replace(/^(.+?)(\*\*)/, "<span>$1</span>$2");
55054           }
55055           html2 = html2.replace(/\*\*(.*?)\*\*/g, '<span class="instruction">$1</span>');
55056         }
55057         html2 = html2.replace(/\*(.*?)\*/g, "<em>$1</em>");
55058         html2 = html2.replace(/\{br\}/g, "<br/><br/>");
55059         if (options2.buttonText && options2.buttonCallback) {
55060           html2 += '<div class="button-section"><button href="#" class="button action">' + options2.buttonText + "</button></div>";
55061         }
55062         var classes = "curtain-tooltip popover tooltip arrowed in " + (options2.tooltipClass || "");
55063         tooltip.classed(classes, true).selectAll(".popover-inner").html(html2);
55064         if (options2.buttonText && options2.buttonCallback) {
55065           var button = tooltip.selectAll(".button-section .button.action");
55066           button.on("click", function(d3_event) {
55067             d3_event.preventDefault();
55068             options2.buttonCallback();
55069           });
55070         }
55071         var tip = copyBox(tooltip.node().getBoundingClientRect()), w = containerNode.clientWidth, h = containerNode.clientHeight, tooltipWidth = 200, tooltipArrow = 5, side, pos;
55072         if (options2.tooltipClass === "intro-mouse") {
55073           tip.height += 80;
55074         }
55075         if (tooltipBox.top + tooltipBox.height > h) {
55076           tooltipBox.height -= tooltipBox.top + tooltipBox.height - h;
55077         }
55078         if (tooltipBox.left + tooltipBox.width > w) {
55079           tooltipBox.width -= tooltipBox.left + tooltipBox.width - w;
55080         }
55081         if (tooltipBox.top + tooltipBox.height < 100) {
55082           side = "bottom";
55083           pos = [
55084             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
55085             tooltipBox.top + tooltipBox.height
55086           ];
55087         } else if (tooltipBox.top > h - 140) {
55088           side = "top";
55089           pos = [
55090             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
55091             tooltipBox.top - tip.height
55092           ];
55093         } else {
55094           var tipY = tooltipBox.top + tooltipBox.height / 2 - tip.height / 2;
55095           if (_mainLocalizer.textDirection() === "rtl") {
55096             if (tooltipBox.left - tooltipWidth - tooltipArrow < 70) {
55097               side = "right";
55098               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
55099             } else {
55100               side = "left";
55101               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
55102             }
55103           } else {
55104             if (tooltipBox.left + tooltipBox.width + tooltipArrow + tooltipWidth > w - 70) {
55105               side = "left";
55106               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
55107             } else {
55108               side = "right";
55109               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
55110             }
55111           }
55112         }
55113         if (options2.duration !== 0 || !tooltip.classed(side)) {
55114           tooltip.call(uiToggle(true));
55115         }
55116         tooltip.style("top", pos[1] + "px").style("left", pos[0] + "px").attr("class", classes + " " + side);
55117         var shiftY = 0;
55118         if (side === "left" || side === "right") {
55119           if (pos[1] < 60) {
55120             shiftY = 60 - pos[1];
55121           } else if (pos[1] + tip.height > h - 100) {
55122             shiftY = h - pos[1] - tip.height - 100;
55123           }
55124         }
55125         tooltip.selectAll(".popover-inner").style("top", shiftY + "px");
55126       } else {
55127         tooltip.classed("in", false).call(uiToggle(false));
55128       }
55129       curtain.cut(box, options2.duration);
55130       return tooltip;
55131     };
55132     curtain.cut = function(datum2, duration) {
55133       darkness.datum(datum2).interrupt();
55134       var selection2;
55135       if (duration === 0) {
55136         selection2 = darkness;
55137       } else {
55138         selection2 = darkness.transition().duration(duration || 600).ease(linear2);
55139       }
55140       selection2.attr("d", function(d) {
55141         var containerWidth = containerNode.clientWidth;
55142         var containerHeight = containerNode.clientHeight;
55143         var string = "M 0,0 L 0," + containerHeight + " L " + containerWidth + "," + containerHeight + "L" + containerWidth + ",0 Z";
55144         if (!d)
55145           return string;
55146         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";
55147       });
55148     };
55149     curtain.remove = function() {
55150       surface.remove();
55151       tooltip.remove();
55152       select_default2(window).on("resize.curtain", null);
55153     };
55154     function copyBox(src) {
55155       return {
55156         top: src.top,
55157         right: src.right,
55158         bottom: src.bottom,
55159         left: src.left,
55160         width: src.width,
55161         height: src.height
55162       };
55163     }
55164     return curtain;
55165   }
55166
55167   // modules/ui/intro/welcome.js
55168   function uiIntroWelcome(context, reveal) {
55169     var dispatch10 = dispatch_default("done");
55170     var chapter = {
55171       title: "intro.welcome.title"
55172     };
55173     function welcome() {
55174       context.map().centerZoom([-85.63591, 41.94285], 19);
55175       reveal(
55176         ".intro-nav-wrap .chapter-welcome",
55177         helpHtml("intro.welcome.welcome"),
55178         { buttonText: _t.html("intro.ok"), buttonCallback: practice }
55179       );
55180     }
55181     function practice() {
55182       reveal(
55183         ".intro-nav-wrap .chapter-welcome",
55184         helpHtml("intro.welcome.practice"),
55185         { buttonText: _t.html("intro.ok"), buttonCallback: words }
55186       );
55187     }
55188     function words() {
55189       reveal(
55190         ".intro-nav-wrap .chapter-welcome",
55191         helpHtml("intro.welcome.words"),
55192         { buttonText: _t.html("intro.ok"), buttonCallback: chapters }
55193       );
55194     }
55195     function chapters() {
55196       dispatch10.call("done");
55197       reveal(
55198         ".intro-nav-wrap .chapter-navigation",
55199         helpHtml("intro.welcome.chapters", { next: _t("intro.navigation.title") })
55200       );
55201     }
55202     chapter.enter = function() {
55203       welcome();
55204     };
55205     chapter.exit = function() {
55206       context.container().select(".curtain-tooltip.intro-mouse").selectAll(".counter").remove();
55207     };
55208     chapter.restart = function() {
55209       chapter.exit();
55210       chapter.enter();
55211     };
55212     return utilRebind(chapter, dispatch10, "on");
55213   }
55214
55215   // modules/ui/intro/navigation.js
55216   function uiIntroNavigation(context, reveal) {
55217     var dispatch10 = dispatch_default("done");
55218     var timeouts = [];
55219     var hallId = "n2061";
55220     var townHall = [-85.63591, 41.94285];
55221     var springStreetId = "w397";
55222     var springStreetEndId = "n1834";
55223     var springStreet = [-85.63582, 41.94255];
55224     var onewayField = _mainPresetIndex.field("oneway");
55225     var maxspeedField = _mainPresetIndex.field("maxspeed");
55226     var chapter = {
55227       title: "intro.navigation.title"
55228     };
55229     function timeout2(f2, t) {
55230       timeouts.push(window.setTimeout(f2, t));
55231     }
55232     function eventCancel(d3_event) {
55233       d3_event.stopPropagation();
55234       d3_event.preventDefault();
55235     }
55236     function isTownHallSelected() {
55237       var ids = context.selectedIDs();
55238       return ids.length === 1 && ids[0] === hallId;
55239     }
55240     function dragMap() {
55241       context.enter(modeBrowse(context));
55242       context.history().reset("initial");
55243       var msec = transitionTime(townHall, context.map().center());
55244       if (msec) {
55245         reveal(null, null, { duration: 0 });
55246       }
55247       context.map().centerZoomEase(townHall, 19, msec);
55248       timeout2(function() {
55249         var centerStart = context.map().center();
55250         var textId = context.lastPointerType() === "mouse" ? "drag" : "drag_touch";
55251         var dragString = helpHtml("intro.navigation.map_info") + "{br}" + helpHtml("intro.navigation." + textId);
55252         reveal(".surface", dragString);
55253         context.map().on("drawn.intro", function() {
55254           reveal(".surface", dragString, { duration: 0 });
55255         });
55256         context.map().on("move.intro", function() {
55257           var centerNow = context.map().center();
55258           if (centerStart[0] !== centerNow[0] || centerStart[1] !== centerNow[1]) {
55259             context.map().on("move.intro", null);
55260             timeout2(function() {
55261               continueTo(zoomMap);
55262             }, 3e3);
55263           }
55264         });
55265       }, msec + 100);
55266       function continueTo(nextStep) {
55267         context.map().on("move.intro drawn.intro", null);
55268         nextStep();
55269       }
55270     }
55271     function zoomMap() {
55272       var zoomStart = context.map().zoom();
55273       var textId = context.lastPointerType() === "mouse" ? "zoom" : "zoom_touch";
55274       var zoomString = helpHtml("intro.navigation." + textId);
55275       reveal(".surface", zoomString);
55276       context.map().on("drawn.intro", function() {
55277         reveal(".surface", zoomString, { duration: 0 });
55278       });
55279       context.map().on("move.intro", function() {
55280         if (context.map().zoom() !== zoomStart) {
55281           context.map().on("move.intro", null);
55282           timeout2(function() {
55283             continueTo(features);
55284           }, 3e3);
55285         }
55286       });
55287       function continueTo(nextStep) {
55288         context.map().on("move.intro drawn.intro", null);
55289         nextStep();
55290       }
55291     }
55292     function features() {
55293       var onClick = function() {
55294         continueTo(pointsLinesAreas);
55295       };
55296       reveal(
55297         ".surface",
55298         helpHtml("intro.navigation.features"),
55299         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
55300       );
55301       context.map().on("drawn.intro", function() {
55302         reveal(
55303           ".surface",
55304           helpHtml("intro.navigation.features"),
55305           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
55306         );
55307       });
55308       function continueTo(nextStep) {
55309         context.map().on("drawn.intro", null);
55310         nextStep();
55311       }
55312     }
55313     function pointsLinesAreas() {
55314       var onClick = function() {
55315         continueTo(nodesWays);
55316       };
55317       reveal(
55318         ".surface",
55319         helpHtml("intro.navigation.points_lines_areas"),
55320         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
55321       );
55322       context.map().on("drawn.intro", function() {
55323         reveal(
55324           ".surface",
55325           helpHtml("intro.navigation.points_lines_areas"),
55326           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
55327         );
55328       });
55329       function continueTo(nextStep) {
55330         context.map().on("drawn.intro", null);
55331         nextStep();
55332       }
55333     }
55334     function nodesWays() {
55335       var onClick = function() {
55336         continueTo(clickTownHall);
55337       };
55338       reveal(
55339         ".surface",
55340         helpHtml("intro.navigation.nodes_ways"),
55341         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
55342       );
55343       context.map().on("drawn.intro", function() {
55344         reveal(
55345           ".surface",
55346           helpHtml("intro.navigation.nodes_ways"),
55347           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
55348         );
55349       });
55350       function continueTo(nextStep) {
55351         context.map().on("drawn.intro", null);
55352         nextStep();
55353       }
55354     }
55355     function clickTownHall() {
55356       context.enter(modeBrowse(context));
55357       context.history().reset("initial");
55358       var entity = context.hasEntity(hallId);
55359       if (!entity)
55360         return;
55361       reveal(null, null, { duration: 0 });
55362       context.map().centerZoomEase(entity.loc, 19, 500);
55363       timeout2(function() {
55364         var entity2 = context.hasEntity(hallId);
55365         if (!entity2)
55366           return;
55367         var box = pointBox(entity2.loc, context);
55368         var textId = context.lastPointerType() === "mouse" ? "click_townhall" : "tap_townhall";
55369         reveal(box, helpHtml("intro.navigation." + textId));
55370         context.map().on("move.intro drawn.intro", function() {
55371           var entity3 = context.hasEntity(hallId);
55372           if (!entity3)
55373             return;
55374           var box2 = pointBox(entity3.loc, context);
55375           reveal(box2, helpHtml("intro.navigation." + textId), { duration: 0 });
55376         });
55377         context.on("enter.intro", function() {
55378           if (isTownHallSelected())
55379             continueTo(selectedTownHall);
55380         });
55381       }, 550);
55382       context.history().on("change.intro", function() {
55383         if (!context.hasEntity(hallId)) {
55384           continueTo(clickTownHall);
55385         }
55386       });
55387       function continueTo(nextStep) {
55388         context.on("enter.intro", null);
55389         context.map().on("move.intro drawn.intro", null);
55390         context.history().on("change.intro", null);
55391         nextStep();
55392       }
55393     }
55394     function selectedTownHall() {
55395       if (!isTownHallSelected())
55396         return clickTownHall();
55397       var entity = context.hasEntity(hallId);
55398       if (!entity)
55399         return clickTownHall();
55400       var box = pointBox(entity.loc, context);
55401       var onClick = function() {
55402         continueTo(editorTownHall);
55403       };
55404       reveal(
55405         box,
55406         helpHtml("intro.navigation.selected_townhall"),
55407         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
55408       );
55409       context.map().on("move.intro drawn.intro", function() {
55410         var entity2 = context.hasEntity(hallId);
55411         if (!entity2)
55412           return;
55413         var box2 = pointBox(entity2.loc, context);
55414         reveal(
55415           box2,
55416           helpHtml("intro.navigation.selected_townhall"),
55417           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
55418         );
55419       });
55420       context.history().on("change.intro", function() {
55421         if (!context.hasEntity(hallId)) {
55422           continueTo(clickTownHall);
55423         }
55424       });
55425       function continueTo(nextStep) {
55426         context.map().on("move.intro drawn.intro", null);
55427         context.history().on("change.intro", null);
55428         nextStep();
55429       }
55430     }
55431     function editorTownHall() {
55432       if (!isTownHallSelected())
55433         return clickTownHall();
55434       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
55435       var onClick = function() {
55436         continueTo(presetTownHall);
55437       };
55438       reveal(
55439         ".entity-editor-pane",
55440         helpHtml("intro.navigation.editor_townhall"),
55441         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
55442       );
55443       context.on("exit.intro", function() {
55444         continueTo(clickTownHall);
55445       });
55446       context.history().on("change.intro", function() {
55447         if (!context.hasEntity(hallId)) {
55448           continueTo(clickTownHall);
55449         }
55450       });
55451       function continueTo(nextStep) {
55452         context.on("exit.intro", null);
55453         context.history().on("change.intro", null);
55454         context.container().select(".inspector-wrap").on("wheel.intro", null);
55455         nextStep();
55456       }
55457     }
55458     function presetTownHall() {
55459       if (!isTownHallSelected())
55460         return clickTownHall();
55461       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
55462       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
55463       var entity = context.entity(context.selectedIDs()[0]);
55464       var preset = _mainPresetIndex.match(entity, context.graph());
55465       var onClick = function() {
55466         continueTo(fieldsTownHall);
55467       };
55468       reveal(
55469         ".entity-editor-pane .section-feature-type",
55470         helpHtml("intro.navigation.preset_townhall", { preset: preset.name() }),
55471         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
55472       );
55473       context.on("exit.intro", function() {
55474         continueTo(clickTownHall);
55475       });
55476       context.history().on("change.intro", function() {
55477         if (!context.hasEntity(hallId)) {
55478           continueTo(clickTownHall);
55479         }
55480       });
55481       function continueTo(nextStep) {
55482         context.on("exit.intro", null);
55483         context.history().on("change.intro", null);
55484         context.container().select(".inspector-wrap").on("wheel.intro", null);
55485         nextStep();
55486       }
55487     }
55488     function fieldsTownHall() {
55489       if (!isTownHallSelected())
55490         return clickTownHall();
55491       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
55492       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
55493       var onClick = function() {
55494         continueTo(closeTownHall);
55495       };
55496       reveal(
55497         ".entity-editor-pane .section-preset-fields",
55498         helpHtml("intro.navigation.fields_townhall"),
55499         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
55500       );
55501       context.on("exit.intro", function() {
55502         continueTo(clickTownHall);
55503       });
55504       context.history().on("change.intro", function() {
55505         if (!context.hasEntity(hallId)) {
55506           continueTo(clickTownHall);
55507         }
55508       });
55509       function continueTo(nextStep) {
55510         context.on("exit.intro", null);
55511         context.history().on("change.intro", null);
55512         context.container().select(".inspector-wrap").on("wheel.intro", null);
55513         nextStep();
55514       }
55515     }
55516     function closeTownHall() {
55517       if (!isTownHallSelected())
55518         return clickTownHall();
55519       var selector = ".entity-editor-pane button.close svg use";
55520       var href = select_default2(selector).attr("href") || "#iD-icon-close";
55521       reveal(
55522         ".entity-editor-pane",
55523         helpHtml("intro.navigation.close_townhall", { button: { html: icon(href, "inline") } })
55524       );
55525       context.on("exit.intro", function() {
55526         continueTo(searchStreet);
55527       });
55528       context.history().on("change.intro", function() {
55529         var selector2 = ".entity-editor-pane button.close svg use";
55530         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
55531         reveal(
55532           ".entity-editor-pane",
55533           helpHtml("intro.navigation.close_townhall", { button: { html: icon(href2, "inline") } }),
55534           { duration: 0 }
55535         );
55536       });
55537       function continueTo(nextStep) {
55538         context.on("exit.intro", null);
55539         context.history().on("change.intro", null);
55540         nextStep();
55541       }
55542     }
55543     function searchStreet() {
55544       context.enter(modeBrowse(context));
55545       context.history().reset("initial");
55546       var msec = transitionTime(springStreet, context.map().center());
55547       if (msec) {
55548         reveal(null, null, { duration: 0 });
55549       }
55550       context.map().centerZoomEase(springStreet, 19, msec);
55551       timeout2(function() {
55552         reveal(
55553           ".search-header input",
55554           helpHtml("intro.navigation.search_street", { name: _t("intro.graph.name.spring-street") })
55555         );
55556         context.container().select(".search-header input").on("keyup.intro", checkSearchResult);
55557       }, msec + 100);
55558     }
55559     function checkSearchResult() {
55560       var first = context.container().select(".feature-list-item:nth-child(0n+2)");
55561       var firstName = first.select(".entity-name");
55562       var name = _t("intro.graph.name.spring-street");
55563       if (!firstName.empty() && firstName.html() === name) {
55564         reveal(
55565           first.node(),
55566           helpHtml("intro.navigation.choose_street", { name }),
55567           { duration: 300 }
55568         );
55569         context.on("exit.intro", function() {
55570           continueTo(selectedStreet);
55571         });
55572         context.container().select(".search-header input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
55573       }
55574       function continueTo(nextStep) {
55575         context.on("exit.intro", null);
55576         context.container().select(".search-header input").on("keydown.intro", null).on("keyup.intro", null);
55577         nextStep();
55578       }
55579     }
55580     function selectedStreet() {
55581       if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
55582         return searchStreet();
55583       }
55584       var onClick = function() {
55585         continueTo(editorStreet);
55586       };
55587       var entity = context.entity(springStreetEndId);
55588       var box = pointBox(entity.loc, context);
55589       box.height = 500;
55590       reveal(
55591         box,
55592         helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
55593         { duration: 600, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
55594       );
55595       timeout2(function() {
55596         context.map().on("move.intro drawn.intro", function() {
55597           var entity2 = context.hasEntity(springStreetEndId);
55598           if (!entity2)
55599             return;
55600           var box2 = pointBox(entity2.loc, context);
55601           box2.height = 500;
55602           reveal(
55603             box2,
55604             helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
55605             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
55606           );
55607         });
55608       }, 600);
55609       context.on("enter.intro", function(mode) {
55610         if (!context.hasEntity(springStreetId)) {
55611           return continueTo(searchStreet);
55612         }
55613         var ids = context.selectedIDs();
55614         if (mode.id !== "select" || !ids.length || ids[0] !== springStreetId) {
55615           context.enter(modeSelect(context, [springStreetId]));
55616         }
55617       });
55618       context.history().on("change.intro", function() {
55619         if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
55620           timeout2(function() {
55621             continueTo(searchStreet);
55622           }, 300);
55623         }
55624       });
55625       function continueTo(nextStep) {
55626         context.map().on("move.intro drawn.intro", null);
55627         context.on("enter.intro", null);
55628         context.history().on("change.intro", null);
55629         nextStep();
55630       }
55631     }
55632     function editorStreet() {
55633       var selector = ".entity-editor-pane button.close svg use";
55634       var href = select_default2(selector).attr("href") || "#iD-icon-close";
55635       reveal(".entity-editor-pane", helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
55636         button: { html: icon(href, "inline") },
55637         field1: onewayField.title(),
55638         field2: maxspeedField.title()
55639       }));
55640       context.on("exit.intro", function() {
55641         continueTo(play);
55642       });
55643       context.history().on("change.intro", function() {
55644         var selector2 = ".entity-editor-pane button.close svg use";
55645         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
55646         reveal(
55647           ".entity-editor-pane",
55648           helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
55649             button: { html: icon(href2, "inline") },
55650             field1: onewayField.title(),
55651             field2: maxspeedField.title()
55652           }),
55653           { duration: 0 }
55654         );
55655       });
55656       function continueTo(nextStep) {
55657         context.on("exit.intro", null);
55658         context.history().on("change.intro", null);
55659         nextStep();
55660       }
55661     }
55662     function play() {
55663       dispatch10.call("done");
55664       reveal(
55665         ".ideditor",
55666         helpHtml("intro.navigation.play", { next: _t("intro.points.title") }),
55667         {
55668           tooltipBox: ".intro-nav-wrap .chapter-point",
55669           buttonText: _t.html("intro.ok"),
55670           buttonCallback: function() {
55671             reveal(".ideditor");
55672           }
55673         }
55674       );
55675     }
55676     chapter.enter = function() {
55677       dragMap();
55678     };
55679     chapter.exit = function() {
55680       timeouts.forEach(window.clearTimeout);
55681       context.on("enter.intro exit.intro", null);
55682       context.map().on("move.intro drawn.intro", null);
55683       context.history().on("change.intro", null);
55684       context.container().select(".inspector-wrap").on("wheel.intro", null);
55685       context.container().select(".search-header input").on("keydown.intro keyup.intro", null);
55686     };
55687     chapter.restart = function() {
55688       chapter.exit();
55689       chapter.enter();
55690     };
55691     return utilRebind(chapter, dispatch10, "on");
55692   }
55693
55694   // modules/ui/intro/point.js
55695   function uiIntroPoint(context, reveal) {
55696     var dispatch10 = dispatch_default("done");
55697     var timeouts = [];
55698     var intersection = [-85.63279, 41.94394];
55699     var building = [-85.632422, 41.944045];
55700     var cafePreset = _mainPresetIndex.item("amenity/cafe");
55701     var _pointID = null;
55702     var chapter = {
55703       title: "intro.points.title"
55704     };
55705     function timeout2(f2, t) {
55706       timeouts.push(window.setTimeout(f2, t));
55707     }
55708     function eventCancel(d3_event) {
55709       d3_event.stopPropagation();
55710       d3_event.preventDefault();
55711     }
55712     function addPoint() {
55713       context.enter(modeBrowse(context));
55714       context.history().reset("initial");
55715       var msec = transitionTime(intersection, context.map().center());
55716       if (msec) {
55717         reveal(null, null, { duration: 0 });
55718       }
55719       context.map().centerZoomEase(intersection, 19, msec);
55720       timeout2(function() {
55721         var tooltip = reveal(
55722           "button.add-point",
55723           helpHtml("intro.points.points_info") + "{br}" + helpHtml("intro.points.add_point")
55724         );
55725         _pointID = null;
55726         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-points");
55727         context.on("enter.intro", function(mode) {
55728           if (mode.id !== "add-point")
55729             return;
55730           continueTo(placePoint);
55731         });
55732       }, msec + 100);
55733       function continueTo(nextStep) {
55734         context.on("enter.intro", null);
55735         nextStep();
55736       }
55737     }
55738     function placePoint() {
55739       if (context.mode().id !== "add-point") {
55740         return chapter.restart();
55741       }
55742       var pointBox2 = pad(building, 150, context);
55743       var textId = context.lastPointerType() === "mouse" ? "place_point" : "place_point_touch";
55744       reveal(pointBox2, helpHtml("intro.points." + textId));
55745       context.map().on("move.intro drawn.intro", function() {
55746         pointBox2 = pad(building, 150, context);
55747         reveal(pointBox2, helpHtml("intro.points." + textId), { duration: 0 });
55748       });
55749       context.on("enter.intro", function(mode) {
55750         if (mode.id !== "select")
55751           return chapter.restart();
55752         _pointID = context.mode().selectedIDs()[0];
55753         continueTo(searchPreset);
55754       });
55755       function continueTo(nextStep) {
55756         context.map().on("move.intro drawn.intro", null);
55757         context.on("enter.intro", null);
55758         nextStep();
55759       }
55760     }
55761     function searchPreset() {
55762       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
55763         return addPoint();
55764       }
55765       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
55766       context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
55767       reveal(
55768         ".preset-search-input",
55769         helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
55770       );
55771       context.on("enter.intro", function(mode) {
55772         if (!_pointID || !context.hasEntity(_pointID)) {
55773           return continueTo(addPoint);
55774         }
55775         var ids = context.selectedIDs();
55776         if (mode.id !== "select" || !ids.length || ids[0] !== _pointID) {
55777           context.enter(modeSelect(context, [_pointID]));
55778           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
55779           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
55780           reveal(
55781             ".preset-search-input",
55782             helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
55783           );
55784           context.history().on("change.intro", null);
55785         }
55786       });
55787       function checkPresetSearch() {
55788         var first = context.container().select(".preset-list-item:first-child");
55789         if (first.classed("preset-amenity-cafe")) {
55790           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
55791           reveal(
55792             first.select(".preset-list-button").node(),
55793             helpHtml("intro.points.choose_cafe", { preset: cafePreset.name() }),
55794             { duration: 300 }
55795           );
55796           context.history().on("change.intro", function() {
55797             continueTo(aboutFeatureEditor);
55798           });
55799         }
55800       }
55801       function continueTo(nextStep) {
55802         context.on("enter.intro", null);
55803         context.history().on("change.intro", null);
55804         context.container().select(".inspector-wrap").on("wheel.intro", null);
55805         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
55806         nextStep();
55807       }
55808     }
55809     function aboutFeatureEditor() {
55810       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
55811         return addPoint();
55812       }
55813       timeout2(function() {
55814         reveal(".entity-editor-pane", helpHtml("intro.points.feature_editor"), {
55815           tooltipClass: "intro-points-describe",
55816           buttonText: _t.html("intro.ok"),
55817           buttonCallback: function() {
55818             continueTo(addName);
55819           }
55820         });
55821       }, 400);
55822       context.on("exit.intro", function() {
55823         continueTo(reselectPoint);
55824       });
55825       function continueTo(nextStep) {
55826         context.on("exit.intro", null);
55827         nextStep();
55828       }
55829     }
55830     function addName() {
55831       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
55832         return addPoint();
55833       }
55834       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
55835       var addNameString = helpHtml("intro.points.fields_info") + "{br}" + helpHtml("intro.points.add_name");
55836       timeout2(function() {
55837         var entity = context.entity(_pointID);
55838         if (entity.tags.name) {
55839           var tooltip = reveal(".entity-editor-pane", addNameString, {
55840             tooltipClass: "intro-points-describe",
55841             buttonText: _t.html("intro.ok"),
55842             buttonCallback: function() {
55843               continueTo(addCloseEditor);
55844             }
55845           });
55846           tooltip.select(".instruction").style("display", "none");
55847         } else {
55848           reveal(
55849             ".entity-editor-pane",
55850             addNameString,
55851             { tooltipClass: "intro-points-describe" }
55852           );
55853         }
55854       }, 400);
55855       context.history().on("change.intro", function() {
55856         continueTo(addCloseEditor);
55857       });
55858       context.on("exit.intro", function() {
55859         continueTo(reselectPoint);
55860       });
55861       function continueTo(nextStep) {
55862         context.on("exit.intro", null);
55863         context.history().on("change.intro", null);
55864         nextStep();
55865       }
55866     }
55867     function addCloseEditor() {
55868       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
55869       var selector = ".entity-editor-pane button.close svg use";
55870       var href = select_default2(selector).attr("href") || "#iD-icon-close";
55871       context.on("exit.intro", function() {
55872         continueTo(reselectPoint);
55873       });
55874       reveal(
55875         ".entity-editor-pane",
55876         helpHtml("intro.points.add_close", { button: { html: icon(href, "inline") } })
55877       );
55878       function continueTo(nextStep) {
55879         context.on("exit.intro", null);
55880         nextStep();
55881       }
55882     }
55883     function reselectPoint() {
55884       if (!_pointID)
55885         return chapter.restart();
55886       var entity = context.hasEntity(_pointID);
55887       if (!entity)
55888         return chapter.restart();
55889       var oldPreset = _mainPresetIndex.match(entity, context.graph());
55890       context.replace(actionChangePreset(_pointID, oldPreset, cafePreset));
55891       context.enter(modeBrowse(context));
55892       var msec = transitionTime(entity.loc, context.map().center());
55893       if (msec) {
55894         reveal(null, null, { duration: 0 });
55895       }
55896       context.map().centerEase(entity.loc, msec);
55897       timeout2(function() {
55898         var box = pointBox(entity.loc, context);
55899         reveal(box, helpHtml("intro.points.reselect"), { duration: 600 });
55900         timeout2(function() {
55901           context.map().on("move.intro drawn.intro", function() {
55902             var entity2 = context.hasEntity(_pointID);
55903             if (!entity2)
55904               return chapter.restart();
55905             var box2 = pointBox(entity2.loc, context);
55906             reveal(box2, helpHtml("intro.points.reselect"), { duration: 0 });
55907           });
55908         }, 600);
55909         context.on("enter.intro", function(mode) {
55910           if (mode.id !== "select")
55911             return;
55912           continueTo(updatePoint);
55913         });
55914       }, msec + 100);
55915       function continueTo(nextStep) {
55916         context.map().on("move.intro drawn.intro", null);
55917         context.on("enter.intro", null);
55918         nextStep();
55919       }
55920     }
55921     function updatePoint() {
55922       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
55923         return continueTo(reselectPoint);
55924       }
55925       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
55926       context.on("exit.intro", function() {
55927         continueTo(reselectPoint);
55928       });
55929       context.history().on("change.intro", function() {
55930         continueTo(updateCloseEditor);
55931       });
55932       timeout2(function() {
55933         reveal(
55934           ".entity-editor-pane",
55935           helpHtml("intro.points.update"),
55936           { tooltipClass: "intro-points-describe" }
55937         );
55938       }, 400);
55939       function continueTo(nextStep) {
55940         context.on("exit.intro", null);
55941         context.history().on("change.intro", null);
55942         nextStep();
55943       }
55944     }
55945     function updateCloseEditor() {
55946       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
55947         return continueTo(reselectPoint);
55948       }
55949       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
55950       context.on("exit.intro", function() {
55951         continueTo(rightClickPoint);
55952       });
55953       timeout2(function() {
55954         reveal(
55955           ".entity-editor-pane",
55956           helpHtml("intro.points.update_close", { button: { html: icon("#iD-icon-close", "inline") } })
55957         );
55958       }, 500);
55959       function continueTo(nextStep) {
55960         context.on("exit.intro", null);
55961         nextStep();
55962       }
55963     }
55964     function rightClickPoint() {
55965       if (!_pointID)
55966         return chapter.restart();
55967       var entity = context.hasEntity(_pointID);
55968       if (!entity)
55969         return chapter.restart();
55970       context.enter(modeBrowse(context));
55971       var box = pointBox(entity.loc, context);
55972       var textId = context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch";
55973       reveal(box, helpHtml("intro.points." + textId), { duration: 600 });
55974       timeout2(function() {
55975         context.map().on("move.intro", function() {
55976           var entity2 = context.hasEntity(_pointID);
55977           if (!entity2)
55978             return chapter.restart();
55979           var box2 = pointBox(entity2.loc, context);
55980           reveal(box2, helpHtml("intro.points." + textId), { duration: 0 });
55981         });
55982       }, 600);
55983       context.on("enter.intro", function(mode) {
55984         if (mode.id !== "select")
55985           return;
55986         var ids = context.selectedIDs();
55987         if (ids.length !== 1 || ids[0] !== _pointID)
55988           return;
55989         timeout2(function() {
55990           var node = selectMenuItem(context, "delete").node();
55991           if (!node)
55992             return;
55993           continueTo(enterDelete);
55994         }, 50);
55995       });
55996       function continueTo(nextStep) {
55997         context.on("enter.intro", null);
55998         context.map().on("move.intro", null);
55999         nextStep();
56000       }
56001     }
56002     function enterDelete() {
56003       if (!_pointID)
56004         return chapter.restart();
56005       var entity = context.hasEntity(_pointID);
56006       if (!entity)
56007         return chapter.restart();
56008       var node = selectMenuItem(context, "delete").node();
56009       if (!node) {
56010         return continueTo(rightClickPoint);
56011       }
56012       reveal(
56013         ".edit-menu",
56014         helpHtml("intro.points.delete"),
56015         { padding: 50 }
56016       );
56017       timeout2(function() {
56018         context.map().on("move.intro", function() {
56019           reveal(
56020             ".edit-menu",
56021             helpHtml("intro.points.delete"),
56022             { duration: 0, padding: 50 }
56023           );
56024         });
56025       }, 300);
56026       context.on("exit.intro", function() {
56027         if (!_pointID)
56028           return chapter.restart();
56029         var entity2 = context.hasEntity(_pointID);
56030         if (entity2)
56031           return continueTo(rightClickPoint);
56032       });
56033       context.history().on("change.intro", function(changed) {
56034         if (changed.deleted().length) {
56035           continueTo(undo);
56036         }
56037       });
56038       function continueTo(nextStep) {
56039         context.map().on("move.intro", null);
56040         context.history().on("change.intro", null);
56041         context.on("exit.intro", null);
56042         nextStep();
56043       }
56044     }
56045     function undo() {
56046       context.history().on("change.intro", function() {
56047         continueTo(play);
56048       });
56049       reveal(
56050         ".top-toolbar button.undo-button",
56051         helpHtml("intro.points.undo")
56052       );
56053       function continueTo(nextStep) {
56054         context.history().on("change.intro", null);
56055         nextStep();
56056       }
56057     }
56058     function play() {
56059       dispatch10.call("done");
56060       reveal(
56061         ".ideditor",
56062         helpHtml("intro.points.play", { next: _t("intro.areas.title") }),
56063         {
56064           tooltipBox: ".intro-nav-wrap .chapter-area",
56065           buttonText: _t.html("intro.ok"),
56066           buttonCallback: function() {
56067             reveal(".ideditor");
56068           }
56069         }
56070       );
56071     }
56072     chapter.enter = function() {
56073       addPoint();
56074     };
56075     chapter.exit = function() {
56076       timeouts.forEach(window.clearTimeout);
56077       context.on("enter.intro exit.intro", null);
56078       context.map().on("move.intro drawn.intro", null);
56079       context.history().on("change.intro", null);
56080       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
56081       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
56082     };
56083     chapter.restart = function() {
56084       chapter.exit();
56085       chapter.enter();
56086     };
56087     return utilRebind(chapter, dispatch10, "on");
56088   }
56089
56090   // modules/ui/intro/area.js
56091   function uiIntroArea(context, reveal) {
56092     var dispatch10 = dispatch_default("done");
56093     var playground = [-85.63552, 41.94159];
56094     var playgroundPreset = _mainPresetIndex.item("leisure/playground");
56095     var nameField = _mainPresetIndex.field("name");
56096     var descriptionField = _mainPresetIndex.field("description");
56097     var timeouts = [];
56098     var _areaID;
56099     var chapter = {
56100       title: "intro.areas.title"
56101     };
56102     function timeout2(f2, t) {
56103       timeouts.push(window.setTimeout(f2, t));
56104     }
56105     function eventCancel(d3_event) {
56106       d3_event.stopPropagation();
56107       d3_event.preventDefault();
56108     }
56109     function revealPlayground(center, text2, options2) {
56110       var padding = 180 * Math.pow(2, context.map().zoom() - 19.5);
56111       var box = pad(center, padding, context);
56112       reveal(box, text2, options2);
56113     }
56114     function addArea() {
56115       context.enter(modeBrowse(context));
56116       context.history().reset("initial");
56117       _areaID = null;
56118       var msec = transitionTime(playground, context.map().center());
56119       if (msec) {
56120         reveal(null, null, { duration: 0 });
56121       }
56122       context.map().centerZoomEase(playground, 19, msec);
56123       timeout2(function() {
56124         var tooltip = reveal(
56125           "button.add-area",
56126           helpHtml("intro.areas.add_playground")
56127         );
56128         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-areas");
56129         context.on("enter.intro", function(mode) {
56130           if (mode.id !== "add-area")
56131             return;
56132           continueTo(startPlayground);
56133         });
56134       }, msec + 100);
56135       function continueTo(nextStep) {
56136         context.on("enter.intro", null);
56137         nextStep();
56138       }
56139     }
56140     function startPlayground() {
56141       if (context.mode().id !== "add-area") {
56142         return chapter.restart();
56143       }
56144       _areaID = null;
56145       context.map().zoomEase(19.5, 500);
56146       timeout2(function() {
56147         var textId = context.lastPointerType() === "mouse" ? "starting_node_click" : "starting_node_tap";
56148         var startDrawString = helpHtml("intro.areas.start_playground") + helpHtml("intro.areas." + textId);
56149         revealPlayground(
56150           playground,
56151           startDrawString,
56152           { duration: 250 }
56153         );
56154         timeout2(function() {
56155           context.map().on("move.intro drawn.intro", function() {
56156             revealPlayground(
56157               playground,
56158               startDrawString,
56159               { duration: 0 }
56160             );
56161           });
56162           context.on("enter.intro", function(mode) {
56163             if (mode.id !== "draw-area")
56164               return chapter.restart();
56165             continueTo(continuePlayground);
56166           });
56167         }, 250);
56168       }, 550);
56169       function continueTo(nextStep) {
56170         context.map().on("move.intro drawn.intro", null);
56171         context.on("enter.intro", null);
56172         nextStep();
56173       }
56174     }
56175     function continuePlayground() {
56176       if (context.mode().id !== "draw-area") {
56177         return chapter.restart();
56178       }
56179       _areaID = null;
56180       revealPlayground(
56181         playground,
56182         helpHtml("intro.areas.continue_playground"),
56183         { duration: 250 }
56184       );
56185       timeout2(function() {
56186         context.map().on("move.intro drawn.intro", function() {
56187           revealPlayground(
56188             playground,
56189             helpHtml("intro.areas.continue_playground"),
56190             { duration: 0 }
56191           );
56192         });
56193       }, 250);
56194       context.on("enter.intro", function(mode) {
56195         if (mode.id === "draw-area") {
56196           var entity = context.hasEntity(context.selectedIDs()[0]);
56197           if (entity && entity.nodes.length >= 6) {
56198             return continueTo(finishPlayground);
56199           } else {
56200             return;
56201           }
56202         } else if (mode.id === "select") {
56203           _areaID = context.selectedIDs()[0];
56204           return continueTo(searchPresets);
56205         } else {
56206           return chapter.restart();
56207         }
56208       });
56209       function continueTo(nextStep) {
56210         context.map().on("move.intro drawn.intro", null);
56211         context.on("enter.intro", null);
56212         nextStep();
56213       }
56214     }
56215     function finishPlayground() {
56216       if (context.mode().id !== "draw-area") {
56217         return chapter.restart();
56218       }
56219       _areaID = null;
56220       var finishString = helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.areas.finish_playground");
56221       revealPlayground(
56222         playground,
56223         finishString,
56224         { duration: 250 }
56225       );
56226       timeout2(function() {
56227         context.map().on("move.intro drawn.intro", function() {
56228           revealPlayground(
56229             playground,
56230             finishString,
56231             { duration: 0 }
56232           );
56233         });
56234       }, 250);
56235       context.on("enter.intro", function(mode) {
56236         if (mode.id === "draw-area") {
56237           return;
56238         } else if (mode.id === "select") {
56239           _areaID = context.selectedIDs()[0];
56240           return continueTo(searchPresets);
56241         } else {
56242           return chapter.restart();
56243         }
56244       });
56245       function continueTo(nextStep) {
56246         context.map().on("move.intro drawn.intro", null);
56247         context.on("enter.intro", null);
56248         nextStep();
56249       }
56250     }
56251     function searchPresets() {
56252       if (!_areaID || !context.hasEntity(_areaID)) {
56253         return addArea();
56254       }
56255       var ids = context.selectedIDs();
56256       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
56257         context.enter(modeSelect(context, [_areaID]));
56258       }
56259       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
56260       timeout2(function() {
56261         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
56262         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
56263         reveal(
56264           ".preset-search-input",
56265           helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
56266         );
56267       }, 400);
56268       context.on("enter.intro", function(mode) {
56269         if (!_areaID || !context.hasEntity(_areaID)) {
56270           return continueTo(addArea);
56271         }
56272         var ids2 = context.selectedIDs();
56273         if (mode.id !== "select" || !ids2.length || ids2[0] !== _areaID) {
56274           context.enter(modeSelect(context, [_areaID]));
56275           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
56276           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
56277           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
56278           reveal(
56279             ".preset-search-input",
56280             helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
56281           );
56282           context.history().on("change.intro", null);
56283         }
56284       });
56285       function checkPresetSearch() {
56286         var first = context.container().select(".preset-list-item:first-child");
56287         if (first.classed("preset-leisure-playground")) {
56288           reveal(
56289             first.select(".preset-list-button").node(),
56290             helpHtml("intro.areas.choose_playground", { preset: playgroundPreset.name() }),
56291             { duration: 300 }
56292           );
56293           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
56294           context.history().on("change.intro", function() {
56295             continueTo(clickAddField);
56296           });
56297         }
56298       }
56299       function continueTo(nextStep) {
56300         context.container().select(".inspector-wrap").on("wheel.intro", null);
56301         context.on("enter.intro", null);
56302         context.history().on("change.intro", null);
56303         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
56304         nextStep();
56305       }
56306     }
56307     function clickAddField() {
56308       if (!_areaID || !context.hasEntity(_areaID)) {
56309         return addArea();
56310       }
56311       var ids = context.selectedIDs();
56312       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
56313         return searchPresets();
56314       }
56315       if (!context.container().select(".form-field-description").empty()) {
56316         return continueTo(describePlayground);
56317       }
56318       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
56319       timeout2(function() {
56320         context.container().select(".inspector-wrap .panewrap").style("right", "0%");
56321         var entity = context.entity(_areaID);
56322         if (entity.tags.description) {
56323           return continueTo(play);
56324         }
56325         var box = context.container().select(".more-fields").node().getBoundingClientRect();
56326         if (box.top > 300) {
56327           var pane = context.container().select(".entity-editor-pane .inspector-body");
56328           var start2 = pane.node().scrollTop;
56329           var end = start2 + (box.top - 300);
56330           pane.transition().duration(250).tween("scroll.inspector", function() {
56331             var node = this;
56332             var i2 = number_default(start2, end);
56333             return function(t) {
56334               node.scrollTop = i2(t);
56335             };
56336           });
56337         }
56338         timeout2(function() {
56339           reveal(
56340             ".more-fields .combobox-input",
56341             helpHtml("intro.areas.add_field", {
56342               name: nameField.title(),
56343               description: descriptionField.title()
56344             }),
56345             { duration: 300 }
56346           );
56347           context.container().select(".more-fields .combobox-input").on("click.intro", function() {
56348             var watcher;
56349             watcher = window.setInterval(function() {
56350               if (!context.container().select("div.combobox").empty()) {
56351                 window.clearInterval(watcher);
56352                 continueTo(chooseDescriptionField);
56353               }
56354             }, 300);
56355           });
56356         }, 300);
56357       }, 400);
56358       context.on("exit.intro", function() {
56359         return continueTo(searchPresets);
56360       });
56361       function continueTo(nextStep) {
56362         context.container().select(".inspector-wrap").on("wheel.intro", null);
56363         context.container().select(".more-fields .combobox-input").on("click.intro", null);
56364         context.on("exit.intro", null);
56365         nextStep();
56366       }
56367     }
56368     function chooseDescriptionField() {
56369       if (!_areaID || !context.hasEntity(_areaID)) {
56370         return addArea();
56371       }
56372       var ids = context.selectedIDs();
56373       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
56374         return searchPresets();
56375       }
56376       if (!context.container().select(".form-field-description").empty()) {
56377         return continueTo(describePlayground);
56378       }
56379       if (context.container().select("div.combobox").empty()) {
56380         return continueTo(clickAddField);
56381       }
56382       var watcher;
56383       watcher = window.setInterval(function() {
56384         if (context.container().select("div.combobox").empty()) {
56385           window.clearInterval(watcher);
56386           timeout2(function() {
56387             if (context.container().select(".form-field-description").empty()) {
56388               continueTo(retryChooseDescription);
56389             } else {
56390               continueTo(describePlayground);
56391             }
56392           }, 300);
56393         }
56394       }, 300);
56395       reveal(
56396         "div.combobox",
56397         helpHtml("intro.areas.choose_field", { field: descriptionField.title() }),
56398         { duration: 300 }
56399       );
56400       context.on("exit.intro", function() {
56401         return continueTo(searchPresets);
56402       });
56403       function continueTo(nextStep) {
56404         if (watcher)
56405           window.clearInterval(watcher);
56406         context.on("exit.intro", null);
56407         nextStep();
56408       }
56409     }
56410     function describePlayground() {
56411       if (!_areaID || !context.hasEntity(_areaID)) {
56412         return addArea();
56413       }
56414       var ids = context.selectedIDs();
56415       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
56416         return searchPresets();
56417       }
56418       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
56419       if (context.container().select(".form-field-description").empty()) {
56420         return continueTo(retryChooseDescription);
56421       }
56422       context.on("exit.intro", function() {
56423         continueTo(play);
56424       });
56425       reveal(
56426         ".entity-editor-pane",
56427         helpHtml("intro.areas.describe_playground", { button: { html: icon("#iD-icon-close", "inline") } }),
56428         { duration: 300 }
56429       );
56430       function continueTo(nextStep) {
56431         context.on("exit.intro", null);
56432         nextStep();
56433       }
56434     }
56435     function retryChooseDescription() {
56436       if (!_areaID || !context.hasEntity(_areaID)) {
56437         return addArea();
56438       }
56439       var ids = context.selectedIDs();
56440       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
56441         return searchPresets();
56442       }
56443       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
56444       reveal(
56445         ".entity-editor-pane",
56446         helpHtml("intro.areas.retry_add_field", { field: descriptionField.title() }),
56447         {
56448           buttonText: _t.html("intro.ok"),
56449           buttonCallback: function() {
56450             continueTo(clickAddField);
56451           }
56452         }
56453       );
56454       context.on("exit.intro", function() {
56455         return continueTo(searchPresets);
56456       });
56457       function continueTo(nextStep) {
56458         context.on("exit.intro", null);
56459         nextStep();
56460       }
56461     }
56462     function play() {
56463       dispatch10.call("done");
56464       reveal(
56465         ".ideditor",
56466         helpHtml("intro.areas.play", { next: _t("intro.lines.title") }),
56467         {
56468           tooltipBox: ".intro-nav-wrap .chapter-line",
56469           buttonText: _t.html("intro.ok"),
56470           buttonCallback: function() {
56471             reveal(".ideditor");
56472           }
56473         }
56474       );
56475     }
56476     chapter.enter = function() {
56477       addArea();
56478     };
56479     chapter.exit = function() {
56480       timeouts.forEach(window.clearTimeout);
56481       context.on("enter.intro exit.intro", null);
56482       context.map().on("move.intro drawn.intro", null);
56483       context.history().on("change.intro", null);
56484       context.container().select(".inspector-wrap").on("wheel.intro", null);
56485       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
56486       context.container().select(".more-fields .combobox-input").on("click.intro", null);
56487     };
56488     chapter.restart = function() {
56489       chapter.exit();
56490       chapter.enter();
56491     };
56492     return utilRebind(chapter, dispatch10, "on");
56493   }
56494
56495   // modules/ui/intro/line.js
56496   function uiIntroLine(context, reveal) {
56497     var dispatch10 = dispatch_default("done");
56498     var timeouts = [];
56499     var _tulipRoadID = null;
56500     var flowerRoadID = "w646";
56501     var tulipRoadStart = [-85.6297754121684, 41.95805253325314];
56502     var tulipRoadMidpoint = [-85.62975395449628, 41.95787501510204];
56503     var tulipRoadIntersection = [-85.62974496187628, 41.95742515554585];
56504     var roadCategory = _mainPresetIndex.item("category-road_minor");
56505     var residentialPreset = _mainPresetIndex.item("highway/residential");
56506     var woodRoadID = "w525";
56507     var woodRoadEndID = "n2862";
56508     var woodRoadAddNode = [-85.62390110349587, 41.95397111462291];
56509     var woodRoadDragEndpoint = [-85.623867390213, 41.95466987786487];
56510     var woodRoadDragMidpoint = [-85.62386254803509, 41.95430395953872];
56511     var washingtonStreetID = "w522";
56512     var twelfthAvenueID = "w1";
56513     var eleventhAvenueEndID = "n3550";
56514     var twelfthAvenueEndID = "n5";
56515     var _washingtonSegmentID = null;
56516     var eleventhAvenueEnd = context.entity(eleventhAvenueEndID).loc;
56517     var twelfthAvenueEnd = context.entity(twelfthAvenueEndID).loc;
56518     var deleteLinesLoc = [-85.6219395542764, 41.95228033922477];
56519     var twelfthAvenue = [-85.62219310052491, 41.952505413152956];
56520     var chapter = {
56521       title: "intro.lines.title"
56522     };
56523     function timeout2(f2, t) {
56524       timeouts.push(window.setTimeout(f2, t));
56525     }
56526     function eventCancel(d3_event) {
56527       d3_event.stopPropagation();
56528       d3_event.preventDefault();
56529     }
56530     function addLine() {
56531       context.enter(modeBrowse(context));
56532       context.history().reset("initial");
56533       var msec = transitionTime(tulipRoadStart, context.map().center());
56534       if (msec) {
56535         reveal(null, null, { duration: 0 });
56536       }
56537       context.map().centerZoomEase(tulipRoadStart, 18.5, msec);
56538       timeout2(function() {
56539         var tooltip = reveal(
56540           "button.add-line",
56541           helpHtml("intro.lines.add_line")
56542         );
56543         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-lines");
56544         context.on("enter.intro", function(mode) {
56545           if (mode.id !== "add-line")
56546             return;
56547           continueTo(startLine);
56548         });
56549       }, msec + 100);
56550       function continueTo(nextStep) {
56551         context.on("enter.intro", null);
56552         nextStep();
56553       }
56554     }
56555     function startLine() {
56556       if (context.mode().id !== "add-line")
56557         return chapter.restart();
56558       _tulipRoadID = null;
56559       var padding = 70 * Math.pow(2, context.map().zoom() - 18);
56560       var box = pad(tulipRoadStart, padding, context);
56561       box.height = box.height + 100;
56562       var textId = context.lastPointerType() === "mouse" ? "start_line" : "start_line_tap";
56563       var startLineString = helpHtml("intro.lines.missing_road") + "{br}" + helpHtml("intro.lines.line_draw_info") + helpHtml("intro.lines." + textId);
56564       reveal(box, startLineString);
56565       context.map().on("move.intro drawn.intro", function() {
56566         padding = 70 * Math.pow(2, context.map().zoom() - 18);
56567         box = pad(tulipRoadStart, padding, context);
56568         box.height = box.height + 100;
56569         reveal(box, startLineString, { duration: 0 });
56570       });
56571       context.on("enter.intro", function(mode) {
56572         if (mode.id !== "draw-line")
56573           return chapter.restart();
56574         continueTo(drawLine);
56575       });
56576       function continueTo(nextStep) {
56577         context.map().on("move.intro drawn.intro", null);
56578         context.on("enter.intro", null);
56579         nextStep();
56580       }
56581     }
56582     function drawLine() {
56583       if (context.mode().id !== "draw-line")
56584         return chapter.restart();
56585       _tulipRoadID = context.mode().selectedIDs()[0];
56586       context.map().centerEase(tulipRoadMidpoint, 500);
56587       timeout2(function() {
56588         var padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
56589         var box = pad(tulipRoadMidpoint, padding, context);
56590         box.height = box.height * 2;
56591         reveal(
56592           box,
56593           helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") })
56594         );
56595         context.map().on("move.intro drawn.intro", function() {
56596           padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
56597           box = pad(tulipRoadMidpoint, padding, context);
56598           box.height = box.height * 2;
56599           reveal(
56600             box,
56601             helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") }),
56602             { duration: 0 }
56603           );
56604         });
56605       }, 550);
56606       context.history().on("change.intro", function() {
56607         if (isLineConnected()) {
56608           continueTo(continueLine);
56609         }
56610       });
56611       context.on("enter.intro", function(mode) {
56612         if (mode.id === "draw-line") {
56613           return;
56614         } else if (mode.id === "select") {
56615           continueTo(retryIntersect);
56616           return;
56617         } else {
56618           return chapter.restart();
56619         }
56620       });
56621       function continueTo(nextStep) {
56622         context.map().on("move.intro drawn.intro", null);
56623         context.history().on("change.intro", null);
56624         context.on("enter.intro", null);
56625         nextStep();
56626       }
56627     }
56628     function isLineConnected() {
56629       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
56630       if (!entity)
56631         return false;
56632       var drawNodes = context.graph().childNodes(entity);
56633       return drawNodes.some(function(node) {
56634         return context.graph().parentWays(node).some(function(parent) {
56635           return parent.id === flowerRoadID;
56636         });
56637       });
56638     }
56639     function retryIntersect() {
56640       select_default2(window).on("pointerdown.intro mousedown.intro", eventCancel, true);
56641       var box = pad(tulipRoadIntersection, 80, context);
56642       reveal(
56643         box,
56644         helpHtml("intro.lines.retry_intersect", { name: _t("intro.graph.name.flower-street") })
56645       );
56646       timeout2(chapter.restart, 3e3);
56647     }
56648     function continueLine() {
56649       if (context.mode().id !== "draw-line")
56650         return chapter.restart();
56651       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
56652       if (!entity)
56653         return chapter.restart();
56654       context.map().centerEase(tulipRoadIntersection, 500);
56655       var continueLineText = helpHtml("intro.lines.continue_line") + "{br}" + helpHtml("intro.lines.finish_line_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.lines.finish_road");
56656       reveal(".surface", continueLineText);
56657       context.on("enter.intro", function(mode) {
56658         if (mode.id === "draw-line") {
56659           return;
56660         } else if (mode.id === "select") {
56661           return continueTo(chooseCategoryRoad);
56662         } else {
56663           return chapter.restart();
56664         }
56665       });
56666       function continueTo(nextStep) {
56667         context.on("enter.intro", null);
56668         nextStep();
56669       }
56670     }
56671     function chooseCategoryRoad() {
56672       if (context.mode().id !== "select")
56673         return chapter.restart();
56674       context.on("exit.intro", function() {
56675         return chapter.restart();
56676       });
56677       var button = context.container().select(".preset-category-road_minor .preset-list-button");
56678       if (button.empty())
56679         return chapter.restart();
56680       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
56681       timeout2(function() {
56682         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
56683         reveal(
56684           button.node(),
56685           helpHtml("intro.lines.choose_category_road", { category: roadCategory.name() })
56686         );
56687         button.on("click.intro", function() {
56688           continueTo(choosePresetResidential);
56689         });
56690       }, 400);
56691       function continueTo(nextStep) {
56692         context.container().select(".inspector-wrap").on("wheel.intro", null);
56693         context.container().select(".preset-list-button").on("click.intro", null);
56694         context.on("exit.intro", null);
56695         nextStep();
56696       }
56697     }
56698     function choosePresetResidential() {
56699       if (context.mode().id !== "select")
56700         return chapter.restart();
56701       context.on("exit.intro", function() {
56702         return chapter.restart();
56703       });
56704       var subgrid = context.container().select(".preset-category-road_minor .subgrid");
56705       if (subgrid.empty())
56706         return chapter.restart();
56707       subgrid.selectAll(":not(.preset-highway-residential) .preset-list-button").on("click.intro", function() {
56708         continueTo(retryPresetResidential);
56709       });
56710       subgrid.selectAll(".preset-highway-residential .preset-list-button").on("click.intro", function() {
56711         continueTo(nameRoad);
56712       });
56713       timeout2(function() {
56714         reveal(
56715           subgrid.node(),
56716           helpHtml("intro.lines.choose_preset_residential", { preset: residentialPreset.name() }),
56717           { tooltipBox: ".preset-highway-residential .preset-list-button", duration: 300 }
56718         );
56719       }, 300);
56720       function continueTo(nextStep) {
56721         context.container().select(".preset-list-button").on("click.intro", null);
56722         context.on("exit.intro", null);
56723         nextStep();
56724       }
56725     }
56726     function retryPresetResidential() {
56727       if (context.mode().id !== "select")
56728         return chapter.restart();
56729       context.on("exit.intro", function() {
56730         return chapter.restart();
56731       });
56732       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
56733       timeout2(function() {
56734         var button = context.container().select(".entity-editor-pane .preset-list-button");
56735         reveal(
56736           button.node(),
56737           helpHtml("intro.lines.retry_preset_residential", { preset: residentialPreset.name() })
56738         );
56739         button.on("click.intro", function() {
56740           continueTo(chooseCategoryRoad);
56741         });
56742       }, 500);
56743       function continueTo(nextStep) {
56744         context.container().select(".inspector-wrap").on("wheel.intro", null);
56745         context.container().select(".preset-list-button").on("click.intro", null);
56746         context.on("exit.intro", null);
56747         nextStep();
56748       }
56749     }
56750     function nameRoad() {
56751       context.on("exit.intro", function() {
56752         continueTo(didNameRoad);
56753       });
56754       timeout2(function() {
56755         reveal(
56756           ".entity-editor-pane",
56757           helpHtml("intro.lines.name_road", { button: { html: icon("#iD-icon-close", "inline") } }),
56758           { tooltipClass: "intro-lines-name_road" }
56759         );
56760       }, 500);
56761       function continueTo(nextStep) {
56762         context.on("exit.intro", null);
56763         nextStep();
56764       }
56765     }
56766     function didNameRoad() {
56767       context.history().checkpoint("doneAddLine");
56768       timeout2(function() {
56769         reveal(".surface", helpHtml("intro.lines.did_name_road"), {
56770           buttonText: _t.html("intro.ok"),
56771           buttonCallback: function() {
56772             continueTo(updateLine);
56773           }
56774         });
56775       }, 500);
56776       function continueTo(nextStep) {
56777         nextStep();
56778       }
56779     }
56780     function updateLine() {
56781       context.history().reset("doneAddLine");
56782       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
56783         return chapter.restart();
56784       }
56785       var msec = transitionTime(woodRoadDragMidpoint, context.map().center());
56786       if (msec) {
56787         reveal(null, null, { duration: 0 });
56788       }
56789       context.map().centerZoomEase(woodRoadDragMidpoint, 19, msec);
56790       timeout2(function() {
56791         var padding = 250 * Math.pow(2, context.map().zoom() - 19);
56792         var box = pad(woodRoadDragMidpoint, padding, context);
56793         var advance = function() {
56794           continueTo(addNode);
56795         };
56796         reveal(
56797           box,
56798           helpHtml("intro.lines.update_line"),
56799           { buttonText: _t.html("intro.ok"), buttonCallback: advance }
56800         );
56801         context.map().on("move.intro drawn.intro", function() {
56802           var padding2 = 250 * Math.pow(2, context.map().zoom() - 19);
56803           var box2 = pad(woodRoadDragMidpoint, padding2, context);
56804           reveal(
56805             box2,
56806             helpHtml("intro.lines.update_line"),
56807             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
56808           );
56809         });
56810       }, msec + 100);
56811       function continueTo(nextStep) {
56812         context.map().on("move.intro drawn.intro", null);
56813         nextStep();
56814       }
56815     }
56816     function addNode() {
56817       context.history().reset("doneAddLine");
56818       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
56819         return chapter.restart();
56820       }
56821       var padding = 40 * Math.pow(2, context.map().zoom() - 19);
56822       var box = pad(woodRoadAddNode, padding, context);
56823       var addNodeString = helpHtml("intro.lines.add_node" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
56824       reveal(box, addNodeString);
56825       context.map().on("move.intro drawn.intro", function() {
56826         var padding2 = 40 * Math.pow(2, context.map().zoom() - 19);
56827         var box2 = pad(woodRoadAddNode, padding2, context);
56828         reveal(box2, addNodeString, { duration: 0 });
56829       });
56830       context.history().on("change.intro", function(changed) {
56831         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
56832           return continueTo(updateLine);
56833         }
56834         if (changed.created().length === 1) {
56835           timeout2(function() {
56836             continueTo(startDragEndpoint);
56837           }, 500);
56838         }
56839       });
56840       context.on("enter.intro", function(mode) {
56841         if (mode.id !== "select") {
56842           continueTo(updateLine);
56843         }
56844       });
56845       function continueTo(nextStep) {
56846         context.map().on("move.intro drawn.intro", null);
56847         context.history().on("change.intro", null);
56848         context.on("enter.intro", null);
56849         nextStep();
56850       }
56851     }
56852     function startDragEndpoint() {
56853       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
56854         return continueTo(updateLine);
56855       }
56856       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
56857       var box = pad(woodRoadDragEndpoint, padding, context);
56858       var startDragString = helpHtml("intro.lines.start_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch")) + helpHtml("intro.lines.drag_to_intersection");
56859       reveal(box, startDragString);
56860       context.map().on("move.intro drawn.intro", function() {
56861         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
56862           return continueTo(updateLine);
56863         }
56864         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
56865         var box2 = pad(woodRoadDragEndpoint, padding2, context);
56866         reveal(box2, startDragString, { duration: 0 });
56867         var entity = context.entity(woodRoadEndID);
56868         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) <= 4) {
56869           continueTo(finishDragEndpoint);
56870         }
56871       });
56872       function continueTo(nextStep) {
56873         context.map().on("move.intro drawn.intro", null);
56874         nextStep();
56875       }
56876     }
56877     function finishDragEndpoint() {
56878       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
56879         return continueTo(updateLine);
56880       }
56881       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
56882       var box = pad(woodRoadDragEndpoint, padding, context);
56883       var finishDragString = helpHtml("intro.lines.spot_looks_good") + helpHtml("intro.lines.finish_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
56884       reveal(box, finishDragString);
56885       context.map().on("move.intro drawn.intro", function() {
56886         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
56887           return continueTo(updateLine);
56888         }
56889         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
56890         var box2 = pad(woodRoadDragEndpoint, padding2, context);
56891         reveal(box2, finishDragString, { duration: 0 });
56892         var entity = context.entity(woodRoadEndID);
56893         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) > 4) {
56894           continueTo(startDragEndpoint);
56895         }
56896       });
56897       context.on("enter.intro", function() {
56898         continueTo(startDragMidpoint);
56899       });
56900       function continueTo(nextStep) {
56901         context.map().on("move.intro drawn.intro", null);
56902         context.on("enter.intro", null);
56903         nextStep();
56904       }
56905     }
56906     function startDragMidpoint() {
56907       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
56908         return continueTo(updateLine);
56909       }
56910       if (context.selectedIDs().indexOf(woodRoadID) === -1) {
56911         context.enter(modeSelect(context, [woodRoadID]));
56912       }
56913       var padding = 80 * Math.pow(2, context.map().zoom() - 19);
56914       var box = pad(woodRoadDragMidpoint, padding, context);
56915       reveal(box, helpHtml("intro.lines.start_drag_midpoint"));
56916       context.map().on("move.intro drawn.intro", function() {
56917         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
56918           return continueTo(updateLine);
56919         }
56920         var padding2 = 80 * Math.pow(2, context.map().zoom() - 19);
56921         var box2 = pad(woodRoadDragMidpoint, padding2, context);
56922         reveal(box2, helpHtml("intro.lines.start_drag_midpoint"), { duration: 0 });
56923       });
56924       context.history().on("change.intro", function(changed) {
56925         if (changed.created().length === 1) {
56926           continueTo(continueDragMidpoint);
56927         }
56928       });
56929       context.on("enter.intro", function(mode) {
56930         if (mode.id !== "select") {
56931           context.enter(modeSelect(context, [woodRoadID]));
56932         }
56933       });
56934       function continueTo(nextStep) {
56935         context.map().on("move.intro drawn.intro", null);
56936         context.history().on("change.intro", null);
56937         context.on("enter.intro", null);
56938         nextStep();
56939       }
56940     }
56941     function continueDragMidpoint() {
56942       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
56943         return continueTo(updateLine);
56944       }
56945       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
56946       var box = pad(woodRoadDragEndpoint, padding, context);
56947       box.height += 400;
56948       var advance = function() {
56949         context.history().checkpoint("doneUpdateLine");
56950         continueTo(deleteLines);
56951       };
56952       reveal(
56953         box,
56954         helpHtml("intro.lines.continue_drag_midpoint"),
56955         { buttonText: _t.html("intro.ok"), buttonCallback: advance }
56956       );
56957       context.map().on("move.intro drawn.intro", function() {
56958         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
56959           return continueTo(updateLine);
56960         }
56961         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
56962         var box2 = pad(woodRoadDragEndpoint, padding2, context);
56963         box2.height += 400;
56964         reveal(
56965           box2,
56966           helpHtml("intro.lines.continue_drag_midpoint"),
56967           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
56968         );
56969       });
56970       function continueTo(nextStep) {
56971         context.map().on("move.intro drawn.intro", null);
56972         nextStep();
56973       }
56974     }
56975     function deleteLines() {
56976       context.history().reset("doneUpdateLine");
56977       context.enter(modeBrowse(context));
56978       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
56979         return chapter.restart();
56980       }
56981       var msec = transitionTime(deleteLinesLoc, context.map().center());
56982       if (msec) {
56983         reveal(null, null, { duration: 0 });
56984       }
56985       context.map().centerZoomEase(deleteLinesLoc, 18, msec);
56986       timeout2(function() {
56987         var padding = 200 * Math.pow(2, context.map().zoom() - 18);
56988         var box = pad(deleteLinesLoc, padding, context);
56989         box.top -= 200;
56990         box.height += 400;
56991         var advance = function() {
56992           continueTo(rightClickIntersection);
56993         };
56994         reveal(
56995           box,
56996           helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
56997           { buttonText: _t.html("intro.ok"), buttonCallback: advance }
56998         );
56999         context.map().on("move.intro drawn.intro", function() {
57000           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
57001           var box2 = pad(deleteLinesLoc, padding2, context);
57002           box2.top -= 200;
57003           box2.height += 400;
57004           reveal(
57005             box2,
57006             helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
57007             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
57008           );
57009         });
57010         context.history().on("change.intro", function() {
57011           timeout2(function() {
57012             continueTo(deleteLines);
57013           }, 500);
57014         });
57015       }, msec + 100);
57016       function continueTo(nextStep) {
57017         context.map().on("move.intro drawn.intro", null);
57018         context.history().on("change.intro", null);
57019         nextStep();
57020       }
57021     }
57022     function rightClickIntersection() {
57023       context.history().reset("doneUpdateLine");
57024       context.enter(modeBrowse(context));
57025       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
57026       var rightClickString = helpHtml("intro.lines.split_street", {
57027         street1: _t("intro.graph.name.11th-avenue"),
57028         street2: _t("intro.graph.name.washington-street")
57029       }) + helpHtml("intro.lines." + (context.lastPointerType() === "mouse" ? "rightclick_intersection" : "edit_menu_intersection_touch"));
57030       timeout2(function() {
57031         var padding = 60 * Math.pow(2, context.map().zoom() - 18);
57032         var box = pad(eleventhAvenueEnd, padding, context);
57033         reveal(box, rightClickString);
57034         context.map().on("move.intro drawn.intro", function() {
57035           var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
57036           var box2 = pad(eleventhAvenueEnd, padding2, context);
57037           reveal(
57038             box2,
57039             rightClickString,
57040             { duration: 0 }
57041           );
57042         });
57043         context.on("enter.intro", function(mode) {
57044           if (mode.id !== "select")
57045             return;
57046           var ids = context.selectedIDs();
57047           if (ids.length !== 1 || ids[0] !== eleventhAvenueEndID)
57048             return;
57049           timeout2(function() {
57050             var node = selectMenuItem(context, "split").node();
57051             if (!node)
57052               return;
57053             continueTo(splitIntersection);
57054           }, 50);
57055         });
57056         context.history().on("change.intro", function() {
57057           timeout2(function() {
57058             continueTo(deleteLines);
57059           }, 300);
57060         });
57061       }, 600);
57062       function continueTo(nextStep) {
57063         context.map().on("move.intro drawn.intro", null);
57064         context.on("enter.intro", null);
57065         context.history().on("change.intro", null);
57066         nextStep();
57067       }
57068     }
57069     function splitIntersection() {
57070       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
57071         return continueTo(deleteLines);
57072       }
57073       var node = selectMenuItem(context, "split").node();
57074       if (!node) {
57075         return continueTo(rightClickIntersection);
57076       }
57077       var wasChanged = false;
57078       _washingtonSegmentID = null;
57079       reveal(
57080         ".edit-menu",
57081         helpHtml(
57082           "intro.lines.split_intersection",
57083           { street: _t("intro.graph.name.washington-street") }
57084         ),
57085         { padding: 50 }
57086       );
57087       context.map().on("move.intro drawn.intro", function() {
57088         var node2 = selectMenuItem(context, "split").node();
57089         if (!wasChanged && !node2) {
57090           return continueTo(rightClickIntersection);
57091         }
57092         reveal(
57093           ".edit-menu",
57094           helpHtml(
57095             "intro.lines.split_intersection",
57096             { street: _t("intro.graph.name.washington-street") }
57097           ),
57098           { duration: 0, padding: 50 }
57099         );
57100       });
57101       context.history().on("change.intro", function(changed) {
57102         wasChanged = true;
57103         timeout2(function() {
57104           if (context.history().undoAnnotation() === _t("operations.split.annotation.line", { n: 1 })) {
57105             _washingtonSegmentID = changed.created()[0].id;
57106             continueTo(didSplit);
57107           } else {
57108             _washingtonSegmentID = null;
57109             continueTo(retrySplit);
57110           }
57111         }, 300);
57112       });
57113       function continueTo(nextStep) {
57114         context.map().on("move.intro drawn.intro", null);
57115         context.history().on("change.intro", null);
57116         nextStep();
57117       }
57118     }
57119     function retrySplit() {
57120       context.enter(modeBrowse(context));
57121       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
57122       var advance = function() {
57123         continueTo(rightClickIntersection);
57124       };
57125       var padding = 60 * Math.pow(2, context.map().zoom() - 18);
57126       var box = pad(eleventhAvenueEnd, padding, context);
57127       reveal(
57128         box,
57129         helpHtml("intro.lines.retry_split"),
57130         { buttonText: _t.html("intro.ok"), buttonCallback: advance }
57131       );
57132       context.map().on("move.intro drawn.intro", function() {
57133         var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
57134         var box2 = pad(eleventhAvenueEnd, padding2, context);
57135         reveal(
57136           box2,
57137           helpHtml("intro.lines.retry_split"),
57138           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
57139         );
57140       });
57141       function continueTo(nextStep) {
57142         context.map().on("move.intro drawn.intro", null);
57143         nextStep();
57144       }
57145     }
57146     function didSplit() {
57147       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
57148         return continueTo(rightClickIntersection);
57149       }
57150       var ids = context.selectedIDs();
57151       var string = "intro.lines.did_split_" + (ids.length > 1 ? "multi" : "single");
57152       var street = _t("intro.graph.name.washington-street");
57153       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
57154       var box = pad(twelfthAvenue, padding, context);
57155       box.width = box.width / 2;
57156       reveal(
57157         box,
57158         helpHtml(string, { street1: street, street2: street }),
57159         { duration: 500 }
57160       );
57161       timeout2(function() {
57162         context.map().centerZoomEase(twelfthAvenue, 18, 500);
57163         context.map().on("move.intro drawn.intro", function() {
57164           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
57165           var box2 = pad(twelfthAvenue, padding2, context);
57166           box2.width = box2.width / 2;
57167           reveal(
57168             box2,
57169             helpHtml(string, { street1: street, street2: street }),
57170             { duration: 0 }
57171           );
57172         });
57173       }, 600);
57174       context.on("enter.intro", function() {
57175         var ids2 = context.selectedIDs();
57176         if (ids2.length === 1 && ids2[0] === _washingtonSegmentID) {
57177           continueTo(multiSelect);
57178         }
57179       });
57180       context.history().on("change.intro", function() {
57181         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
57182           return continueTo(rightClickIntersection);
57183         }
57184       });
57185       function continueTo(nextStep) {
57186         context.map().on("move.intro drawn.intro", null);
57187         context.on("enter.intro", null);
57188         context.history().on("change.intro", null);
57189         nextStep();
57190       }
57191     }
57192     function multiSelect() {
57193       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
57194         return continueTo(rightClickIntersection);
57195       }
57196       var ids = context.selectedIDs();
57197       var hasWashington = ids.indexOf(_washingtonSegmentID) !== -1;
57198       var hasTwelfth = ids.indexOf(twelfthAvenueID) !== -1;
57199       if (hasWashington && hasTwelfth) {
57200         return continueTo(multiRightClick);
57201       } else if (!hasWashington && !hasTwelfth) {
57202         return continueTo(didSplit);
57203       }
57204       context.map().centerZoomEase(twelfthAvenue, 18, 500);
57205       timeout2(function() {
57206         var selected, other, padding, box;
57207         if (hasWashington) {
57208           selected = _t("intro.graph.name.washington-street");
57209           other = _t("intro.graph.name.12th-avenue");
57210           padding = 60 * Math.pow(2, context.map().zoom() - 18);
57211           box = pad(twelfthAvenueEnd, padding, context);
57212           box.width *= 3;
57213         } else {
57214           selected = _t("intro.graph.name.12th-avenue");
57215           other = _t("intro.graph.name.washington-street");
57216           padding = 200 * Math.pow(2, context.map().zoom() - 18);
57217           box = pad(twelfthAvenue, padding, context);
57218           box.width /= 2;
57219         }
57220         reveal(
57221           box,
57222           helpHtml(
57223             "intro.lines.multi_select",
57224             { selected, other1: other }
57225           ) + " " + helpHtml(
57226             "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
57227             { selected, other2: other }
57228           )
57229         );
57230         context.map().on("move.intro drawn.intro", function() {
57231           if (hasWashington) {
57232             selected = _t("intro.graph.name.washington-street");
57233             other = _t("intro.graph.name.12th-avenue");
57234             padding = 60 * Math.pow(2, context.map().zoom() - 18);
57235             box = pad(twelfthAvenueEnd, padding, context);
57236             box.width *= 3;
57237           } else {
57238             selected = _t("intro.graph.name.12th-avenue");
57239             other = _t("intro.graph.name.washington-street");
57240             padding = 200 * Math.pow(2, context.map().zoom() - 18);
57241             box = pad(twelfthAvenue, padding, context);
57242             box.width /= 2;
57243           }
57244           reveal(
57245             box,
57246             helpHtml(
57247               "intro.lines.multi_select",
57248               { selected, other1: other }
57249             ) + " " + helpHtml(
57250               "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
57251               { selected, other2: other }
57252             ),
57253             { duration: 0 }
57254           );
57255         });
57256         context.on("enter.intro", function() {
57257           continueTo(multiSelect);
57258         });
57259         context.history().on("change.intro", function() {
57260           if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
57261             return continueTo(rightClickIntersection);
57262           }
57263         });
57264       }, 600);
57265       function continueTo(nextStep) {
57266         context.map().on("move.intro drawn.intro", null);
57267         context.on("enter.intro", null);
57268         context.history().on("change.intro", null);
57269         nextStep();
57270       }
57271     }
57272     function multiRightClick() {
57273       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
57274         return continueTo(rightClickIntersection);
57275       }
57276       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
57277       var box = pad(twelfthAvenue, padding, context);
57278       var rightClickString = helpHtml("intro.lines.multi_select_success") + helpHtml("intro.lines.multi_" + (context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch"));
57279       reveal(box, rightClickString);
57280       context.map().on("move.intro drawn.intro", function() {
57281         var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
57282         var box2 = pad(twelfthAvenue, padding2, context);
57283         reveal(box2, rightClickString, { duration: 0 });
57284       });
57285       context.ui().editMenu().on("toggled.intro", function(open) {
57286         if (!open)
57287           return;
57288         timeout2(function() {
57289           var ids = context.selectedIDs();
57290           if (ids.length === 2 && ids.indexOf(twelfthAvenueID) !== -1 && ids.indexOf(_washingtonSegmentID) !== -1) {
57291             var node = selectMenuItem(context, "delete").node();
57292             if (!node)
57293               return;
57294             continueTo(multiDelete);
57295           } else if (ids.length === 1 && ids.indexOf(_washingtonSegmentID) !== -1) {
57296             return continueTo(multiSelect);
57297           } else {
57298             return continueTo(didSplit);
57299           }
57300         }, 300);
57301       });
57302       context.history().on("change.intro", function() {
57303         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
57304           return continueTo(rightClickIntersection);
57305         }
57306       });
57307       function continueTo(nextStep) {
57308         context.map().on("move.intro drawn.intro", null);
57309         context.ui().editMenu().on("toggled.intro", null);
57310         context.history().on("change.intro", null);
57311         nextStep();
57312       }
57313     }
57314     function multiDelete() {
57315       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
57316         return continueTo(rightClickIntersection);
57317       }
57318       var node = selectMenuItem(context, "delete").node();
57319       if (!node)
57320         return continueTo(multiRightClick);
57321       reveal(
57322         ".edit-menu",
57323         helpHtml("intro.lines.multi_delete"),
57324         { padding: 50 }
57325       );
57326       context.map().on("move.intro drawn.intro", function() {
57327         reveal(
57328           ".edit-menu",
57329           helpHtml("intro.lines.multi_delete"),
57330           { duration: 0, padding: 50 }
57331         );
57332       });
57333       context.on("exit.intro", function() {
57334         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
57335           return continueTo(multiSelect);
57336         }
57337       });
57338       context.history().on("change.intro", function() {
57339         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
57340           continueTo(retryDelete);
57341         } else {
57342           continueTo(play);
57343         }
57344       });
57345       function continueTo(nextStep) {
57346         context.map().on("move.intro drawn.intro", null);
57347         context.on("exit.intro", null);
57348         context.history().on("change.intro", null);
57349         nextStep();
57350       }
57351     }
57352     function retryDelete() {
57353       context.enter(modeBrowse(context));
57354       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
57355       var box = pad(twelfthAvenue, padding, context);
57356       reveal(box, helpHtml("intro.lines.retry_delete"), {
57357         buttonText: _t.html("intro.ok"),
57358         buttonCallback: function() {
57359           continueTo(multiSelect);
57360         }
57361       });
57362       function continueTo(nextStep) {
57363         nextStep();
57364       }
57365     }
57366     function play() {
57367       dispatch10.call("done");
57368       reveal(
57369         ".ideditor",
57370         helpHtml("intro.lines.play", { next: _t("intro.buildings.title") }),
57371         {
57372           tooltipBox: ".intro-nav-wrap .chapter-building",
57373           buttonText: _t.html("intro.ok"),
57374           buttonCallback: function() {
57375             reveal(".ideditor");
57376           }
57377         }
57378       );
57379     }
57380     chapter.enter = function() {
57381       addLine();
57382     };
57383     chapter.exit = function() {
57384       timeouts.forEach(window.clearTimeout);
57385       select_default2(window).on("pointerdown.intro mousedown.intro", null, true);
57386       context.on("enter.intro exit.intro", null);
57387       context.map().on("move.intro drawn.intro", null);
57388       context.history().on("change.intro", null);
57389       context.container().select(".inspector-wrap").on("wheel.intro", null);
57390       context.container().select(".preset-list-button").on("click.intro", null);
57391     };
57392     chapter.restart = function() {
57393       chapter.exit();
57394       chapter.enter();
57395     };
57396     return utilRebind(chapter, dispatch10, "on");
57397   }
57398
57399   // modules/ui/intro/building.js
57400   function uiIntroBuilding(context, reveal) {
57401     var dispatch10 = dispatch_default("done");
57402     var house = [-85.62815, 41.95638];
57403     var tank = [-85.62732, 41.95347];
57404     var buildingCatetory = _mainPresetIndex.item("category-building");
57405     var housePreset = _mainPresetIndex.item("building/house");
57406     var tankPreset = _mainPresetIndex.item("man_made/storage_tank");
57407     var timeouts = [];
57408     var _houseID = null;
57409     var _tankID = null;
57410     var chapter = {
57411       title: "intro.buildings.title"
57412     };
57413     function timeout2(f2, t) {
57414       timeouts.push(window.setTimeout(f2, t));
57415     }
57416     function eventCancel(d3_event) {
57417       d3_event.stopPropagation();
57418       d3_event.preventDefault();
57419     }
57420     function revealHouse(center, text2, options2) {
57421       var padding = 160 * Math.pow(2, context.map().zoom() - 20);
57422       var box = pad(center, padding, context);
57423       reveal(box, text2, options2);
57424     }
57425     function revealTank(center, text2, options2) {
57426       var padding = 190 * Math.pow(2, context.map().zoom() - 19.5);
57427       var box = pad(center, padding, context);
57428       reveal(box, text2, options2);
57429     }
57430     function addHouse() {
57431       context.enter(modeBrowse(context));
57432       context.history().reset("initial");
57433       _houseID = null;
57434       var msec = transitionTime(house, context.map().center());
57435       if (msec) {
57436         reveal(null, null, { duration: 0 });
57437       }
57438       context.map().centerZoomEase(house, 19, msec);
57439       timeout2(function() {
57440         var tooltip = reveal(
57441           "button.add-area",
57442           helpHtml("intro.buildings.add_building")
57443         );
57444         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-buildings");
57445         context.on("enter.intro", function(mode) {
57446           if (mode.id !== "add-area")
57447             return;
57448           continueTo(startHouse);
57449         });
57450       }, msec + 100);
57451       function continueTo(nextStep) {
57452         context.on("enter.intro", null);
57453         nextStep();
57454       }
57455     }
57456     function startHouse() {
57457       if (context.mode().id !== "add-area") {
57458         return continueTo(addHouse);
57459       }
57460       _houseID = null;
57461       context.map().zoomEase(20, 500);
57462       timeout2(function() {
57463         var startString = helpHtml("intro.buildings.start_building") + helpHtml("intro.buildings.building_corner_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
57464         revealHouse(house, startString);
57465         context.map().on("move.intro drawn.intro", function() {
57466           revealHouse(house, startString, { duration: 0 });
57467         });
57468         context.on("enter.intro", function(mode) {
57469           if (mode.id !== "draw-area")
57470             return chapter.restart();
57471           continueTo(continueHouse);
57472         });
57473       }, 550);
57474       function continueTo(nextStep) {
57475         context.map().on("move.intro drawn.intro", null);
57476         context.on("enter.intro", null);
57477         nextStep();
57478       }
57479     }
57480     function continueHouse() {
57481       if (context.mode().id !== "draw-area") {
57482         return continueTo(addHouse);
57483       }
57484       _houseID = null;
57485       var continueString = helpHtml("intro.buildings.continue_building") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_building");
57486       revealHouse(house, continueString);
57487       context.map().on("move.intro drawn.intro", function() {
57488         revealHouse(house, continueString, { duration: 0 });
57489       });
57490       context.on("enter.intro", function(mode) {
57491         if (mode.id === "draw-area") {
57492           return;
57493         } else if (mode.id === "select") {
57494           var graph = context.graph();
57495           var way = context.entity(context.selectedIDs()[0]);
57496           var nodes = graph.childNodes(way);
57497           var points = utilArrayUniq(nodes).map(function(n2) {
57498             return context.projection(n2.loc);
57499           });
57500           if (isMostlySquare(points)) {
57501             _houseID = way.id;
57502             return continueTo(chooseCategoryBuilding);
57503           } else {
57504             return continueTo(retryHouse);
57505           }
57506         } else {
57507           return chapter.restart();
57508         }
57509       });
57510       function continueTo(nextStep) {
57511         context.map().on("move.intro drawn.intro", null);
57512         context.on("enter.intro", null);
57513         nextStep();
57514       }
57515     }
57516     function retryHouse() {
57517       var onClick = function() {
57518         continueTo(addHouse);
57519       };
57520       revealHouse(
57521         house,
57522         helpHtml("intro.buildings.retry_building"),
57523         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57524       );
57525       context.map().on("move.intro drawn.intro", function() {
57526         revealHouse(
57527           house,
57528           helpHtml("intro.buildings.retry_building"),
57529           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57530         );
57531       });
57532       function continueTo(nextStep) {
57533         context.map().on("move.intro drawn.intro", null);
57534         nextStep();
57535       }
57536     }
57537     function chooseCategoryBuilding() {
57538       if (!_houseID || !context.hasEntity(_houseID)) {
57539         return addHouse();
57540       }
57541       var ids = context.selectedIDs();
57542       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
57543         context.enter(modeSelect(context, [_houseID]));
57544       }
57545       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
57546       timeout2(function() {
57547         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
57548         var button = context.container().select(".preset-category-building .preset-list-button");
57549         reveal(
57550           button.node(),
57551           helpHtml("intro.buildings.choose_category_building", { category: buildingCatetory.name() })
57552         );
57553         button.on("click.intro", function() {
57554           button.on("click.intro", null);
57555           continueTo(choosePresetHouse);
57556         });
57557       }, 400);
57558       context.on("enter.intro", function(mode) {
57559         if (!_houseID || !context.hasEntity(_houseID)) {
57560           return continueTo(addHouse);
57561         }
57562         var ids2 = context.selectedIDs();
57563         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
57564           return continueTo(chooseCategoryBuilding);
57565         }
57566       });
57567       function continueTo(nextStep) {
57568         context.container().select(".inspector-wrap").on("wheel.intro", null);
57569         context.container().select(".preset-list-button").on("click.intro", null);
57570         context.on("enter.intro", null);
57571         nextStep();
57572       }
57573     }
57574     function choosePresetHouse() {
57575       if (!_houseID || !context.hasEntity(_houseID)) {
57576         return addHouse();
57577       }
57578       var ids = context.selectedIDs();
57579       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
57580         context.enter(modeSelect(context, [_houseID]));
57581       }
57582       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
57583       timeout2(function() {
57584         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
57585         var button = context.container().select(".preset-building-house .preset-list-button");
57586         reveal(
57587           button.node(),
57588           helpHtml("intro.buildings.choose_preset_house", { preset: housePreset.name() }),
57589           { duration: 300 }
57590         );
57591         button.on("click.intro", function() {
57592           button.on("click.intro", null);
57593           continueTo(closeEditorHouse);
57594         });
57595       }, 400);
57596       context.on("enter.intro", function(mode) {
57597         if (!_houseID || !context.hasEntity(_houseID)) {
57598           return continueTo(addHouse);
57599         }
57600         var ids2 = context.selectedIDs();
57601         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
57602           return continueTo(chooseCategoryBuilding);
57603         }
57604       });
57605       function continueTo(nextStep) {
57606         context.container().select(".inspector-wrap").on("wheel.intro", null);
57607         context.container().select(".preset-list-button").on("click.intro", null);
57608         context.on("enter.intro", null);
57609         nextStep();
57610       }
57611     }
57612     function closeEditorHouse() {
57613       if (!_houseID || !context.hasEntity(_houseID)) {
57614         return addHouse();
57615       }
57616       var ids = context.selectedIDs();
57617       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
57618         context.enter(modeSelect(context, [_houseID]));
57619       }
57620       context.history().checkpoint("hasHouse");
57621       context.on("exit.intro", function() {
57622         continueTo(rightClickHouse);
57623       });
57624       timeout2(function() {
57625         reveal(
57626           ".entity-editor-pane",
57627           helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
57628         );
57629       }, 500);
57630       function continueTo(nextStep) {
57631         context.on("exit.intro", null);
57632         nextStep();
57633       }
57634     }
57635     function rightClickHouse() {
57636       if (!_houseID)
57637         return chapter.restart();
57638       context.enter(modeBrowse(context));
57639       context.history().reset("hasHouse");
57640       var zoom = context.map().zoom();
57641       if (zoom < 20) {
57642         zoom = 20;
57643       }
57644       context.map().centerZoomEase(house, zoom, 500);
57645       context.on("enter.intro", function(mode) {
57646         if (mode.id !== "select")
57647           return;
57648         var ids = context.selectedIDs();
57649         if (ids.length !== 1 || ids[0] !== _houseID)
57650           return;
57651         timeout2(function() {
57652           var node = selectMenuItem(context, "orthogonalize").node();
57653           if (!node)
57654             return;
57655           continueTo(clickSquare);
57656         }, 50);
57657       });
57658       context.map().on("move.intro drawn.intro", function() {
57659         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_building" : "edit_menu_building_touch"));
57660         revealHouse(house, rightclickString, { duration: 0 });
57661       });
57662       context.history().on("change.intro", function() {
57663         continueTo(rightClickHouse);
57664       });
57665       function continueTo(nextStep) {
57666         context.on("enter.intro", null);
57667         context.map().on("move.intro drawn.intro", null);
57668         context.history().on("change.intro", null);
57669         nextStep();
57670       }
57671     }
57672     function clickSquare() {
57673       if (!_houseID)
57674         return chapter.restart();
57675       var entity = context.hasEntity(_houseID);
57676       if (!entity)
57677         return continueTo(rightClickHouse);
57678       var node = selectMenuItem(context, "orthogonalize").node();
57679       if (!node) {
57680         return continueTo(rightClickHouse);
57681       }
57682       var wasChanged = false;
57683       reveal(
57684         ".edit-menu",
57685         helpHtml("intro.buildings.square_building"),
57686         { padding: 50 }
57687       );
57688       context.on("enter.intro", function(mode) {
57689         if (mode.id === "browse") {
57690           continueTo(rightClickHouse);
57691         } else if (mode.id === "move" || mode.id === "rotate") {
57692           continueTo(retryClickSquare);
57693         }
57694       });
57695       context.map().on("move.intro", function() {
57696         var node2 = selectMenuItem(context, "orthogonalize").node();
57697         if (!wasChanged && !node2) {
57698           return continueTo(rightClickHouse);
57699         }
57700         reveal(
57701           ".edit-menu",
57702           helpHtml("intro.buildings.square_building"),
57703           { duration: 0, padding: 50 }
57704         );
57705       });
57706       context.history().on("change.intro", function() {
57707         wasChanged = true;
57708         context.history().on("change.intro", null);
57709         timeout2(function() {
57710           if (context.history().undoAnnotation() === _t("operations.orthogonalize.annotation.feature", { n: 1 })) {
57711             continueTo(doneSquare);
57712           } else {
57713             continueTo(retryClickSquare);
57714           }
57715         }, 500);
57716       });
57717       function continueTo(nextStep) {
57718         context.on("enter.intro", null);
57719         context.map().on("move.intro", null);
57720         context.history().on("change.intro", null);
57721         nextStep();
57722       }
57723     }
57724     function retryClickSquare() {
57725       context.enter(modeBrowse(context));
57726       revealHouse(house, helpHtml("intro.buildings.retry_square"), {
57727         buttonText: _t.html("intro.ok"),
57728         buttonCallback: function() {
57729           continueTo(rightClickHouse);
57730         }
57731       });
57732       function continueTo(nextStep) {
57733         nextStep();
57734       }
57735     }
57736     function doneSquare() {
57737       context.history().checkpoint("doneSquare");
57738       revealHouse(house, helpHtml("intro.buildings.done_square"), {
57739         buttonText: _t.html("intro.ok"),
57740         buttonCallback: function() {
57741           continueTo(addTank);
57742         }
57743       });
57744       function continueTo(nextStep) {
57745         nextStep();
57746       }
57747     }
57748     function addTank() {
57749       context.enter(modeBrowse(context));
57750       context.history().reset("doneSquare");
57751       _tankID = null;
57752       var msec = transitionTime(tank, context.map().center());
57753       if (msec) {
57754         reveal(null, null, { duration: 0 });
57755       }
57756       context.map().centerZoomEase(tank, 19.5, msec);
57757       timeout2(function() {
57758         reveal(
57759           "button.add-area",
57760           helpHtml("intro.buildings.add_tank")
57761         );
57762         context.on("enter.intro", function(mode) {
57763           if (mode.id !== "add-area")
57764             return;
57765           continueTo(startTank);
57766         });
57767       }, msec + 100);
57768       function continueTo(nextStep) {
57769         context.on("enter.intro", null);
57770         nextStep();
57771       }
57772     }
57773     function startTank() {
57774       if (context.mode().id !== "add-area") {
57775         return continueTo(addTank);
57776       }
57777       _tankID = null;
57778       timeout2(function() {
57779         var startString = helpHtml("intro.buildings.start_tank") + helpHtml("intro.buildings.tank_edge_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
57780         revealTank(tank, startString);
57781         context.map().on("move.intro drawn.intro", function() {
57782           revealTank(tank, startString, { duration: 0 });
57783         });
57784         context.on("enter.intro", function(mode) {
57785           if (mode.id !== "draw-area")
57786             return chapter.restart();
57787           continueTo(continueTank);
57788         });
57789       }, 550);
57790       function continueTo(nextStep) {
57791         context.map().on("move.intro drawn.intro", null);
57792         context.on("enter.intro", null);
57793         nextStep();
57794       }
57795     }
57796     function continueTank() {
57797       if (context.mode().id !== "draw-area") {
57798         return continueTo(addTank);
57799       }
57800       _tankID = null;
57801       var continueString = helpHtml("intro.buildings.continue_tank") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_tank");
57802       revealTank(tank, continueString);
57803       context.map().on("move.intro drawn.intro", function() {
57804         revealTank(tank, continueString, { duration: 0 });
57805       });
57806       context.on("enter.intro", function(mode) {
57807         if (mode.id === "draw-area") {
57808           return;
57809         } else if (mode.id === "select") {
57810           _tankID = context.selectedIDs()[0];
57811           return continueTo(searchPresetTank);
57812         } else {
57813           return continueTo(addTank);
57814         }
57815       });
57816       function continueTo(nextStep) {
57817         context.map().on("move.intro drawn.intro", null);
57818         context.on("enter.intro", null);
57819         nextStep();
57820       }
57821     }
57822     function searchPresetTank() {
57823       if (!_tankID || !context.hasEntity(_tankID)) {
57824         return addTank();
57825       }
57826       var ids = context.selectedIDs();
57827       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
57828         context.enter(modeSelect(context, [_tankID]));
57829       }
57830       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
57831       timeout2(function() {
57832         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
57833         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
57834         reveal(
57835           ".preset-search-input",
57836           helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
57837         );
57838       }, 400);
57839       context.on("enter.intro", function(mode) {
57840         if (!_tankID || !context.hasEntity(_tankID)) {
57841           return continueTo(addTank);
57842         }
57843         var ids2 = context.selectedIDs();
57844         if (mode.id !== "select" || !ids2.length || ids2[0] !== _tankID) {
57845           context.enter(modeSelect(context, [_tankID]));
57846           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
57847           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
57848           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
57849           reveal(
57850             ".preset-search-input",
57851             helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
57852           );
57853           context.history().on("change.intro", null);
57854         }
57855       });
57856       function checkPresetSearch() {
57857         var first = context.container().select(".preset-list-item:first-child");
57858         if (first.classed("preset-man_made-storage_tank")) {
57859           reveal(
57860             first.select(".preset-list-button").node(),
57861             helpHtml("intro.buildings.choose_tank", { preset: tankPreset.name() }),
57862             { duration: 300 }
57863           );
57864           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
57865           context.history().on("change.intro", function() {
57866             continueTo(closeEditorTank);
57867           });
57868         }
57869       }
57870       function continueTo(nextStep) {
57871         context.container().select(".inspector-wrap").on("wheel.intro", null);
57872         context.on("enter.intro", null);
57873         context.history().on("change.intro", null);
57874         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
57875         nextStep();
57876       }
57877     }
57878     function closeEditorTank() {
57879       if (!_tankID || !context.hasEntity(_tankID)) {
57880         return addTank();
57881       }
57882       var ids = context.selectedIDs();
57883       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
57884         context.enter(modeSelect(context, [_tankID]));
57885       }
57886       context.history().checkpoint("hasTank");
57887       context.on("exit.intro", function() {
57888         continueTo(rightClickTank);
57889       });
57890       timeout2(function() {
57891         reveal(
57892           ".entity-editor-pane",
57893           helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
57894         );
57895       }, 500);
57896       function continueTo(nextStep) {
57897         context.on("exit.intro", null);
57898         nextStep();
57899       }
57900     }
57901     function rightClickTank() {
57902       if (!_tankID)
57903         return continueTo(addTank);
57904       context.enter(modeBrowse(context));
57905       context.history().reset("hasTank");
57906       context.map().centerEase(tank, 500);
57907       timeout2(function() {
57908         context.on("enter.intro", function(mode) {
57909           if (mode.id !== "select")
57910             return;
57911           var ids = context.selectedIDs();
57912           if (ids.length !== 1 || ids[0] !== _tankID)
57913             return;
57914           timeout2(function() {
57915             var node = selectMenuItem(context, "circularize").node();
57916             if (!node)
57917               return;
57918             continueTo(clickCircle);
57919           }, 50);
57920         });
57921         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_tank" : "edit_menu_tank_touch"));
57922         revealTank(tank, rightclickString);
57923         context.map().on("move.intro drawn.intro", function() {
57924           revealTank(tank, rightclickString, { duration: 0 });
57925         });
57926         context.history().on("change.intro", function() {
57927           continueTo(rightClickTank);
57928         });
57929       }, 600);
57930       function continueTo(nextStep) {
57931         context.on("enter.intro", null);
57932         context.map().on("move.intro drawn.intro", null);
57933         context.history().on("change.intro", null);
57934         nextStep();
57935       }
57936     }
57937     function clickCircle() {
57938       if (!_tankID)
57939         return chapter.restart();
57940       var entity = context.hasEntity(_tankID);
57941       if (!entity)
57942         return continueTo(rightClickTank);
57943       var node = selectMenuItem(context, "circularize").node();
57944       if (!node) {
57945         return continueTo(rightClickTank);
57946       }
57947       var wasChanged = false;
57948       reveal(
57949         ".edit-menu",
57950         helpHtml("intro.buildings.circle_tank"),
57951         { padding: 50 }
57952       );
57953       context.on("enter.intro", function(mode) {
57954         if (mode.id === "browse") {
57955           continueTo(rightClickTank);
57956         } else if (mode.id === "move" || mode.id === "rotate") {
57957           continueTo(retryClickCircle);
57958         }
57959       });
57960       context.map().on("move.intro", function() {
57961         var node2 = selectMenuItem(context, "circularize").node();
57962         if (!wasChanged && !node2) {
57963           return continueTo(rightClickTank);
57964         }
57965         reveal(
57966           ".edit-menu",
57967           helpHtml("intro.buildings.circle_tank"),
57968           { duration: 0, padding: 50 }
57969         );
57970       });
57971       context.history().on("change.intro", function() {
57972         wasChanged = true;
57973         context.history().on("change.intro", null);
57974         timeout2(function() {
57975           if (context.history().undoAnnotation() === _t("operations.circularize.annotation.feature", { n: 1 })) {
57976             continueTo(play);
57977           } else {
57978             continueTo(retryClickCircle);
57979           }
57980         }, 500);
57981       });
57982       function continueTo(nextStep) {
57983         context.on("enter.intro", null);
57984         context.map().on("move.intro", null);
57985         context.history().on("change.intro", null);
57986         nextStep();
57987       }
57988     }
57989     function retryClickCircle() {
57990       context.enter(modeBrowse(context));
57991       revealTank(tank, helpHtml("intro.buildings.retry_circle"), {
57992         buttonText: _t.html("intro.ok"),
57993         buttonCallback: function() {
57994           continueTo(rightClickTank);
57995         }
57996       });
57997       function continueTo(nextStep) {
57998         nextStep();
57999       }
58000     }
58001     function play() {
58002       dispatch10.call("done");
58003       reveal(
58004         ".ideditor",
58005         helpHtml("intro.buildings.play", { next: _t("intro.startediting.title") }),
58006         {
58007           tooltipBox: ".intro-nav-wrap .chapter-startEditing",
58008           buttonText: _t.html("intro.ok"),
58009           buttonCallback: function() {
58010             reveal(".ideditor");
58011           }
58012         }
58013       );
58014     }
58015     chapter.enter = function() {
58016       addHouse();
58017     };
58018     chapter.exit = function() {
58019       timeouts.forEach(window.clearTimeout);
58020       context.on("enter.intro exit.intro", null);
58021       context.map().on("move.intro drawn.intro", null);
58022       context.history().on("change.intro", null);
58023       context.container().select(".inspector-wrap").on("wheel.intro", null);
58024       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
58025       context.container().select(".more-fields .combobox-input").on("click.intro", null);
58026     };
58027     chapter.restart = function() {
58028       chapter.exit();
58029       chapter.enter();
58030     };
58031     return utilRebind(chapter, dispatch10, "on");
58032   }
58033
58034   // modules/ui/intro/start_editing.js
58035   function uiIntroStartEditing(context, reveal) {
58036     var dispatch10 = dispatch_default("done", "startEditing");
58037     var modalSelection = select_default2(null);
58038     var chapter = {
58039       title: "intro.startediting.title"
58040     };
58041     function showHelp() {
58042       reveal(
58043         ".map-control.help-control",
58044         helpHtml("intro.startediting.help"),
58045         {
58046           buttonText: _t.html("intro.ok"),
58047           buttonCallback: function() {
58048             shortcuts();
58049           }
58050         }
58051       );
58052     }
58053     function shortcuts() {
58054       reveal(
58055         ".map-control.help-control",
58056         helpHtml("intro.startediting.shortcuts"),
58057         {
58058           buttonText: _t.html("intro.ok"),
58059           buttonCallback: function() {
58060             showSave();
58061           }
58062         }
58063       );
58064     }
58065     function showSave() {
58066       context.container().selectAll(".shaded").remove();
58067       reveal(
58068         ".top-toolbar button.save",
58069         helpHtml("intro.startediting.save"),
58070         {
58071           buttonText: _t.html("intro.ok"),
58072           buttonCallback: function() {
58073             showStart();
58074           }
58075         }
58076       );
58077     }
58078     function showStart() {
58079       context.container().selectAll(".shaded").remove();
58080       modalSelection = uiModal(context.container());
58081       modalSelection.select(".modal").attr("class", "modal-splash modal");
58082       modalSelection.selectAll(".close").remove();
58083       var startbutton = modalSelection.select(".content").attr("class", "fillL").append("button").attr("class", "modal-section huge-modal-button").on("click", function() {
58084         modalSelection.remove();
58085       });
58086       startbutton.append("svg").attr("class", "illustration").append("use").attr("xlink:href", "#iD-logo-walkthrough");
58087       startbutton.append("h2").call(_t.append("intro.startediting.start"));
58088       dispatch10.call("startEditing");
58089     }
58090     chapter.enter = function() {
58091       showHelp();
58092     };
58093     chapter.exit = function() {
58094       modalSelection.remove();
58095       context.container().selectAll(".shaded").remove();
58096     };
58097     return utilRebind(chapter, dispatch10, "on");
58098   }
58099
58100   // modules/ui/intro/intro.js
58101   var chapterUi = {
58102     welcome: uiIntroWelcome,
58103     navigation: uiIntroNavigation,
58104     point: uiIntroPoint,
58105     area: uiIntroArea,
58106     line: uiIntroLine,
58107     building: uiIntroBuilding,
58108     startEditing: uiIntroStartEditing
58109   };
58110   var chapterFlow = [
58111     "welcome",
58112     "navigation",
58113     "point",
58114     "area",
58115     "line",
58116     "building",
58117     "startEditing"
58118   ];
58119   function uiIntro(context) {
58120     const INTRO_IMAGERY = "EsriWorldImageryClarity";
58121     let _introGraph = {};
58122     let _currChapter;
58123     function intro(selection2) {
58124       _mainFileFetcher.get("intro_graph").then((dataIntroGraph) => {
58125         for (let id2 in dataIntroGraph) {
58126           if (!_introGraph[id2]) {
58127             _introGraph[id2] = osmEntity(localize(dataIntroGraph[id2]));
58128           }
58129         }
58130         selection2.call(startIntro);
58131       }).catch(function() {
58132       });
58133     }
58134     function startIntro(selection2) {
58135       context.enter(modeBrowse(context));
58136       let osm = context.connection();
58137       let history = context.history().toJSON();
58138       let hash = window.location.hash;
58139       let center = context.map().center();
58140       let zoom = context.map().zoom();
58141       let background = context.background().baseLayerSource();
58142       let overlays = context.background().overlayLayerSources();
58143       let opacity = context.container().selectAll(".main-map .layer-background").style("opacity");
58144       let caches = osm && osm.caches();
58145       let baseEntities = context.history().graph().base().entities;
58146       context.ui().sidebar.expand();
58147       context.container().selectAll("button.sidebar-toggle").classed("disabled", true);
58148       context.inIntro(true);
58149       if (osm) {
58150         osm.toggle(false).reset();
58151       }
58152       context.history().reset();
58153       context.history().merge(Object.values(coreGraph().load(_introGraph).entities));
58154       context.history().checkpoint("initial");
58155       let imagery = context.background().findSource(INTRO_IMAGERY);
58156       if (imagery) {
58157         context.background().baseLayerSource(imagery);
58158       } else {
58159         context.background().bing();
58160       }
58161       overlays.forEach((d) => context.background().toggleOverlayLayer(d));
58162       let layers = context.layers();
58163       layers.all().forEach((item) => {
58164         if (typeof item.layer.enabled === "function") {
58165           item.layer.enabled(item.id === "osm");
58166         }
58167       });
58168       context.container().selectAll(".main-map .layer-background").style("opacity", 1);
58169       let curtain = uiCurtain(context.container().node());
58170       selection2.call(curtain);
58171       corePreferences("walkthrough_started", "yes");
58172       let storedProgress = corePreferences("walkthrough_progress") || "";
58173       let progress = storedProgress.split(";").filter(Boolean);
58174       let chapters = chapterFlow.map((chapter, i2) => {
58175         let s = chapterUi[chapter](context, curtain.reveal).on("done", () => {
58176           buttons.filter((d) => d.title === s.title).classed("finished", true);
58177           if (i2 < chapterFlow.length - 1) {
58178             const next = chapterFlow[i2 + 1];
58179             context.container().select(`button.chapter-${next}`).classed("next", true);
58180           }
58181           progress.push(chapter);
58182           corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
58183         });
58184         return s;
58185       });
58186       chapters[chapters.length - 1].on("startEditing", () => {
58187         progress.push("startEditing");
58188         corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
58189         let incomplete = utilArrayDifference(chapterFlow, progress);
58190         if (!incomplete.length) {
58191           corePreferences("walkthrough_completed", "yes");
58192         }
58193         curtain.remove();
58194         navwrap.remove();
58195         context.container().selectAll(".main-map .layer-background").style("opacity", opacity);
58196         context.container().selectAll("button.sidebar-toggle").classed("disabled", false);
58197         if (osm) {
58198           osm.toggle(true).reset().caches(caches);
58199         }
58200         context.history().reset().merge(Object.values(baseEntities));
58201         context.background().baseLayerSource(background);
58202         overlays.forEach((d) => context.background().toggleOverlayLayer(d));
58203         if (history) {
58204           context.history().fromJSON(history, false);
58205         }
58206         context.map().centerZoom(center, zoom);
58207         window.location.replace(hash);
58208         context.inIntro(false);
58209       });
58210       let navwrap = selection2.append("div").attr("class", "intro-nav-wrap fillD");
58211       navwrap.append("svg").attr("class", "intro-nav-wrap-logo").append("use").attr("xlink:href", "#iD-logo-walkthrough");
58212       let buttonwrap = navwrap.append("div").attr("class", "joined").selectAll("button.chapter");
58213       let buttons = buttonwrap.data(chapters).enter().append("button").attr("class", (d, i2) => `chapter chapter-${chapterFlow[i2]}`).on("click", enterChapter);
58214       buttons.append("span").html((d) => _t.html(d.title));
58215       buttons.append("span").attr("class", "status").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
58216       enterChapter(null, chapters[0]);
58217       function enterChapter(d3_event, newChapter) {
58218         if (_currChapter) {
58219           _currChapter.exit();
58220         }
58221         context.enter(modeBrowse(context));
58222         _currChapter = newChapter;
58223         _currChapter.enter();
58224         buttons.classed("next", false).classed("active", (d) => d.title === _currChapter.title);
58225       }
58226     }
58227     return intro;
58228   }
58229
58230   // modules/ui/issues_info.js
58231   function uiIssuesInfo(context) {
58232     var warningsItem = {
58233       id: "warnings",
58234       count: 0,
58235       iconID: "iD-icon-alert",
58236       descriptionID: "issues.warnings_and_errors"
58237     };
58238     var resolvedItem = {
58239       id: "resolved",
58240       count: 0,
58241       iconID: "iD-icon-apply",
58242       descriptionID: "issues.user_resolved_issues"
58243     };
58244     function update(selection2) {
58245       var shownItems = [];
58246       var liveIssues = context.validator().getIssues({
58247         what: corePreferences("validate-what") || "edited",
58248         where: corePreferences("validate-where") || "all"
58249       });
58250       if (liveIssues.length) {
58251         warningsItem.count = liveIssues.length;
58252         shownItems.push(warningsItem);
58253       }
58254       if (corePreferences("validate-what") === "all") {
58255         var resolvedIssues = context.validator().getResolvedIssues();
58256         if (resolvedIssues.length) {
58257           resolvedItem.count = resolvedIssues.length;
58258           shownItems.push(resolvedItem);
58259         }
58260       }
58261       var chips = selection2.selectAll(".chip").data(shownItems, function(d) {
58262         return d.id;
58263       });
58264       chips.exit().remove();
58265       var enter = chips.enter().append("a").attr("class", function(d) {
58266         return "chip " + d.id + "-count";
58267       }).attr("href", "#").each(function(d) {
58268         var chipSelection = select_default2(this);
58269         var tooltipBehavior = uiTooltip().placement("top").title(() => _t.append(d.descriptionID));
58270         chipSelection.call(tooltipBehavior).on("click", function(d3_event) {
58271           d3_event.preventDefault();
58272           tooltipBehavior.hide(select_default2(this));
58273           context.ui().togglePanes(context.container().select(".map-panes .issues-pane"));
58274         });
58275         chipSelection.call(svgIcon("#" + d.iconID));
58276       });
58277       enter.append("span").attr("class", "count");
58278       enter.merge(chips).selectAll("span.count").text(function(d) {
58279         return d.count.toString();
58280       });
58281     }
58282     return function(selection2) {
58283       update(selection2);
58284       context.validator().on("validated.infobox", function() {
58285         update(selection2);
58286       });
58287     };
58288   }
58289
58290   // modules/ui/map_in_map.js
58291   function uiMapInMap(context) {
58292     function mapInMap(selection2) {
58293       var backgroundLayer = rendererTileLayer(context);
58294       var overlayLayers = {};
58295       var projection2 = geoRawMercator();
58296       var dataLayer = svgData(projection2, context).showLabels(false);
58297       var debugLayer = svgDebug(projection2, context);
58298       var zoom = zoom_default2().scaleExtent([geoZoomToScale(0.5), geoZoomToScale(24)]).on("start", zoomStarted).on("zoom", zoomed).on("end", zoomEnded);
58299       var wrap2 = select_default2(null);
58300       var tiles = select_default2(null);
58301       var viewport = select_default2(null);
58302       var _isTransformed = false;
58303       var _isHidden = true;
58304       var _skipEvents = false;
58305       var _gesture = null;
58306       var _zDiff = 6;
58307       var _dMini;
58308       var _cMini;
58309       var _tStart;
58310       var _tCurr;
58311       var _timeoutID;
58312       function zoomStarted() {
58313         if (_skipEvents)
58314           return;
58315         _tStart = _tCurr = projection2.transform();
58316         _gesture = null;
58317       }
58318       function zoomed(d3_event) {
58319         if (_skipEvents)
58320           return;
58321         var x = d3_event.transform.x;
58322         var y = d3_event.transform.y;
58323         var k = d3_event.transform.k;
58324         var isZooming = k !== _tStart.k;
58325         var isPanning = x !== _tStart.x || y !== _tStart.y;
58326         if (!isZooming && !isPanning) {
58327           return;
58328         }
58329         if (!_gesture) {
58330           _gesture = isZooming ? "zoom" : "pan";
58331         }
58332         var tMini = projection2.transform();
58333         var tX, tY, scale;
58334         if (_gesture === "zoom") {
58335           scale = k / tMini.k;
58336           tX = (_cMini[0] / scale - _cMini[0]) * scale;
58337           tY = (_cMini[1] / scale - _cMini[1]) * scale;
58338         } else {
58339           k = tMini.k;
58340           scale = 1;
58341           tX = x - tMini.x;
58342           tY = y - tMini.y;
58343         }
58344         utilSetTransform(tiles, tX, tY, scale);
58345         utilSetTransform(viewport, 0, 0, scale);
58346         _isTransformed = true;
58347         _tCurr = identity2.translate(x, y).scale(k);
58348         var zMain = geoScaleToZoom(context.projection.scale());
58349         var zMini = geoScaleToZoom(k);
58350         _zDiff = zMain - zMini;
58351         queueRedraw();
58352       }
58353       function zoomEnded() {
58354         if (_skipEvents)
58355           return;
58356         if (_gesture !== "pan")
58357           return;
58358         updateProjection();
58359         _gesture = null;
58360         context.map().center(projection2.invert(_cMini));
58361       }
58362       function updateProjection() {
58363         var loc = context.map().center();
58364         var tMain = context.projection.transform();
58365         var zMain = geoScaleToZoom(tMain.k);
58366         var zMini = Math.max(zMain - _zDiff, 0.5);
58367         var kMini = geoZoomToScale(zMini);
58368         projection2.translate([tMain.x, tMain.y]).scale(kMini);
58369         var point2 = projection2(loc);
58370         var mouse = _gesture === "pan" ? geoVecSubtract([_tCurr.x, _tCurr.y], [_tStart.x, _tStart.y]) : [0, 0];
58371         var xMini = _cMini[0] - point2[0] + tMain.x + mouse[0];
58372         var yMini = _cMini[1] - point2[1] + tMain.y + mouse[1];
58373         projection2.translate([xMini, yMini]).clipExtent([[0, 0], _dMini]);
58374         _tCurr = projection2.transform();
58375         if (_isTransformed) {
58376           utilSetTransform(tiles, 0, 0);
58377           utilSetTransform(viewport, 0, 0);
58378           _isTransformed = false;
58379         }
58380         zoom.scaleExtent([geoZoomToScale(0.5), geoZoomToScale(zMain - 3)]);
58381         _skipEvents = true;
58382         wrap2.call(zoom.transform, _tCurr);
58383         _skipEvents = false;
58384       }
58385       function redraw() {
58386         clearTimeout(_timeoutID);
58387         if (_isHidden)
58388           return;
58389         updateProjection();
58390         var zMini = geoScaleToZoom(projection2.scale());
58391         tiles = wrap2.selectAll(".map-in-map-tiles").data([0]);
58392         tiles = tiles.enter().append("div").attr("class", "map-in-map-tiles").merge(tiles);
58393         backgroundLayer.source(context.background().baseLayerSource()).projection(projection2).dimensions(_dMini);
58394         var background = tiles.selectAll(".map-in-map-background").data([0]);
58395         background.enter().append("div").attr("class", "map-in-map-background").merge(background).call(backgroundLayer);
58396         var overlaySources = context.background().overlayLayerSources();
58397         var activeOverlayLayers = [];
58398         for (var i2 = 0; i2 < overlaySources.length; i2++) {
58399           if (overlaySources[i2].validZoom(zMini)) {
58400             if (!overlayLayers[i2])
58401               overlayLayers[i2] = rendererTileLayer(context);
58402             activeOverlayLayers.push(overlayLayers[i2].source(overlaySources[i2]).projection(projection2).dimensions(_dMini));
58403           }
58404         }
58405         var overlay = tiles.selectAll(".map-in-map-overlay").data([0]);
58406         overlay = overlay.enter().append("div").attr("class", "map-in-map-overlay").merge(overlay);
58407         var overlays = overlay.selectAll("div").data(activeOverlayLayers, function(d) {
58408           return d.source().name();
58409         });
58410         overlays.exit().remove();
58411         overlays = overlays.enter().append("div").merge(overlays).each(function(layer) {
58412           select_default2(this).call(layer);
58413         });
58414         var dataLayers = tiles.selectAll(".map-in-map-data").data([0]);
58415         dataLayers.exit().remove();
58416         dataLayers = dataLayers.enter().append("svg").attr("class", "map-in-map-data").merge(dataLayers).call(dataLayer).call(debugLayer);
58417         if (_gesture !== "pan") {
58418           var getPath = path_default(projection2);
58419           var bbox2 = { type: "Polygon", coordinates: [context.map().extent().polygon()] };
58420           viewport = wrap2.selectAll(".map-in-map-viewport").data([0]);
58421           viewport = viewport.enter().append("svg").attr("class", "map-in-map-viewport").merge(viewport);
58422           var path = viewport.selectAll(".map-in-map-bbox").data([bbox2]);
58423           path.enter().append("path").attr("class", "map-in-map-bbox").merge(path).attr("d", getPath).classed("thick", function(d) {
58424             return getPath.area(d) < 30;
58425           });
58426         }
58427       }
58428       function queueRedraw() {
58429         clearTimeout(_timeoutID);
58430         _timeoutID = setTimeout(function() {
58431           redraw();
58432         }, 750);
58433       }
58434       function toggle(d3_event) {
58435         if (d3_event)
58436           d3_event.preventDefault();
58437         _isHidden = !_isHidden;
58438         context.container().select(".minimap-toggle-item").classed("active", !_isHidden).select("input").property("checked", !_isHidden);
58439         if (_isHidden) {
58440           wrap2.style("display", "block").style("opacity", "1").transition().duration(200).style("opacity", "0").on("end", function() {
58441             selection2.selectAll(".map-in-map").style("display", "none");
58442           });
58443         } else {
58444           wrap2.style("display", "block").style("opacity", "0").transition().duration(200).style("opacity", "1").on("end", function() {
58445             redraw();
58446           });
58447         }
58448       }
58449       uiMapInMap.toggle = toggle;
58450       wrap2 = selection2.selectAll(".map-in-map").data([0]);
58451       wrap2 = wrap2.enter().append("div").attr("class", "map-in-map").style("display", _isHidden ? "none" : "block").call(zoom).on("dblclick.zoom", null).merge(wrap2);
58452       _dMini = [200, 150];
58453       _cMini = geoVecScale(_dMini, 0.5);
58454       context.map().on("drawn.map-in-map", function(drawn) {
58455         if (drawn.full === true) {
58456           redraw();
58457         }
58458       });
58459       redraw();
58460       context.keybinding().on(_t("background.minimap.key"), toggle);
58461     }
58462     return mapInMap;
58463   }
58464
58465   // modules/ui/notice.js
58466   function uiNotice(context) {
58467     return function(selection2) {
58468       var div = selection2.append("div").attr("class", "notice");
58469       var button = div.append("button").attr("class", "zoom-to notice fillD").on("click", function() {
58470         context.map().zoomEase(context.minEditableZoom());
58471       }).on("wheel", function(d3_event) {
58472         var e22 = new WheelEvent(d3_event.type, d3_event);
58473         context.surface().node().dispatchEvent(e22);
58474       });
58475       button.call(svgIcon("#iD-icon-plus", "pre-text")).append("span").attr("class", "label").call(_t.append("zoom_in_edit"));
58476       function disableTooHigh() {
58477         var canEdit = context.map().zoom() >= context.minEditableZoom();
58478         div.style("display", canEdit ? "none" : "block");
58479       }
58480       context.map().on("move.notice", debounce_default(disableTooHigh, 500));
58481       disableTooHigh();
58482     };
58483   }
58484
58485   // modules/ui/photoviewer.js
58486   function uiPhotoviewer(context) {
58487     var dispatch10 = dispatch_default("resize");
58488     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
58489     function photoviewer(selection2) {
58490       selection2.append("button").attr("class", "thumb-hide").attr("title", _t("icons.close")).on("click", function() {
58491         if (services.streetside) {
58492           services.streetside.hideViewer(context);
58493         }
58494         if (services.mapillary) {
58495           services.mapillary.hideViewer(context);
58496         }
58497         if (services.kartaview) {
58498           services.kartaview.hideViewer(context);
58499         }
58500       }).append("div").call(svgIcon("#iD-icon-close"));
58501       function preventDefault(d3_event) {
58502         d3_event.preventDefault();
58503       }
58504       selection2.append("button").attr("class", "resize-handle-xy").on("touchstart touchdown touchend", preventDefault).on(
58505         _pointerPrefix + "down",
58506         buildResizeListener(selection2, "resize", dispatch10, { resizeOnX: true, resizeOnY: true })
58507       );
58508       selection2.append("button").attr("class", "resize-handle-x").on("touchstart touchdown touchend", preventDefault).on(
58509         _pointerPrefix + "down",
58510         buildResizeListener(selection2, "resize", dispatch10, { resizeOnX: true })
58511       );
58512       selection2.append("button").attr("class", "resize-handle-y").on("touchstart touchdown touchend", preventDefault).on(
58513         _pointerPrefix + "down",
58514         buildResizeListener(selection2, "resize", dispatch10, { resizeOnY: true })
58515       );
58516       function buildResizeListener(target, eventName, dispatch11, options2) {
58517         var resizeOnX = !!options2.resizeOnX;
58518         var resizeOnY = !!options2.resizeOnY;
58519         var minHeight = options2.minHeight || 240;
58520         var minWidth = options2.minWidth || 320;
58521         var pointerId;
58522         var startX;
58523         var startY;
58524         var startWidth;
58525         var startHeight;
58526         function startResize(d3_event) {
58527           if (pointerId !== (d3_event.pointerId || "mouse"))
58528             return;
58529           d3_event.preventDefault();
58530           d3_event.stopPropagation();
58531           var mapSize = context.map().dimensions();
58532           if (resizeOnX) {
58533             var maxWidth = mapSize[0];
58534             var newWidth = clamp3(startWidth + d3_event.clientX - startX, minWidth, maxWidth);
58535             target.style("width", newWidth + "px");
58536           }
58537           if (resizeOnY) {
58538             var maxHeight = mapSize[1] - 90;
58539             var newHeight = clamp3(startHeight + startY - d3_event.clientY, minHeight, maxHeight);
58540             target.style("height", newHeight + "px");
58541           }
58542           dispatch11.call(eventName, target, utilGetDimensions(target, true));
58543         }
58544         function clamp3(num, min3, max3) {
58545           return Math.max(min3, Math.min(num, max3));
58546         }
58547         function stopResize(d3_event) {
58548           if (pointerId !== (d3_event.pointerId || "mouse"))
58549             return;
58550           d3_event.preventDefault();
58551           d3_event.stopPropagation();
58552           select_default2(window).on("." + eventName, null);
58553         }
58554         return function initResize(d3_event) {
58555           d3_event.preventDefault();
58556           d3_event.stopPropagation();
58557           pointerId = d3_event.pointerId || "mouse";
58558           startX = d3_event.clientX;
58559           startY = d3_event.clientY;
58560           var targetRect = target.node().getBoundingClientRect();
58561           startWidth = targetRect.width;
58562           startHeight = targetRect.height;
58563           select_default2(window).on(_pointerPrefix + "move." + eventName, startResize, false).on(_pointerPrefix + "up." + eventName, stopResize, false);
58564           if (_pointerPrefix === "pointer") {
58565             select_default2(window).on("pointercancel." + eventName, stopResize, false);
58566           }
58567         };
58568       }
58569     }
58570     photoviewer.onMapResize = function() {
58571       var photoviewer2 = context.container().select(".photoviewer");
58572       var content = context.container().select(".main-content");
58573       var mapDimensions = utilGetDimensions(content, true);
58574       var photoDimensions = utilGetDimensions(photoviewer2, true);
58575       if (photoDimensions[0] > mapDimensions[0] || photoDimensions[1] > mapDimensions[1] - 90) {
58576         var setPhotoDimensions = [
58577           Math.min(photoDimensions[0], mapDimensions[0]),
58578           Math.min(photoDimensions[1], mapDimensions[1] - 90)
58579         ];
58580         photoviewer2.style("width", setPhotoDimensions[0] + "px").style("height", setPhotoDimensions[1] + "px");
58581         dispatch10.call("resize", photoviewer2, setPhotoDimensions);
58582       }
58583     };
58584     return utilRebind(photoviewer, dispatch10, "on");
58585   }
58586
58587   // modules/ui/restore.js
58588   function uiRestore(context) {
58589     return function(selection2) {
58590       if (!context.history().hasRestorableChanges())
58591         return;
58592       let modalSelection = uiModal(selection2, true);
58593       modalSelection.select(".modal").attr("class", "modal fillL");
58594       let introModal = modalSelection.select(".content");
58595       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("restore.heading"));
58596       introModal.append("div").attr("class", "modal-section").append("p").call(_t.append("restore.description"));
58597       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
58598       let restore = buttonWrap.append("button").attr("class", "restore").on("click", () => {
58599         context.history().restore();
58600         modalSelection.remove();
58601       });
58602       restore.append("svg").attr("class", "logo logo-restore").append("use").attr("xlink:href", "#iD-logo-restore");
58603       restore.append("div").call(_t.append("restore.restore"));
58604       let reset = buttonWrap.append("button").attr("class", "reset").on("click", () => {
58605         context.history().clearSaved();
58606         modalSelection.remove();
58607       });
58608       reset.append("svg").attr("class", "logo logo-reset").append("use").attr("xlink:href", "#iD-logo-reset");
58609       reset.append("div").call(_t.append("restore.reset"));
58610       restore.node().focus();
58611     };
58612   }
58613
58614   // modules/ui/scale.js
58615   function uiScale(context) {
58616     var projection2 = context.projection, isImperial = !_mainLocalizer.usesMetric(), maxLength = 180, tickHeight = 8;
58617     function scaleDefs(loc1, loc2) {
58618       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;
58619       if (isImperial) {
58620         buckets = [528e4, 528e3, 52800, 5280, 500, 50, 5, 1];
58621       } else {
58622         buckets = [5e6, 5e5, 5e4, 5e3, 500, 50, 5, 1];
58623       }
58624       for (i2 = 0; i2 < buckets.length; i2++) {
58625         val = buckets[i2];
58626         if (dist >= val) {
58627           scale.dist = Math.floor(dist / val) * val;
58628           break;
58629         } else {
58630           scale.dist = +dist.toFixed(2);
58631         }
58632       }
58633       dLon = geoMetersToLon(scale.dist / conversion, lat);
58634       scale.px = Math.round(projection2([loc1[0] + dLon, loc1[1]])[0]);
58635       scale.text = displayLength(scale.dist / conversion, isImperial);
58636       return scale;
58637     }
58638     function update(selection2) {
58639       var dims = context.map().dimensions(), loc1 = projection2.invert([0, dims[1]]), loc2 = projection2.invert([maxLength, dims[1]]), scale = scaleDefs(loc1, loc2);
58640       selection2.select(".scale-path").attr("d", "M0.5,0.5v" + tickHeight + "h" + scale.px + "v-" + tickHeight);
58641       selection2.select(".scale-text").style(_mainLocalizer.textDirection() === "ltr" ? "left" : "right", scale.px + 16 + "px").text(scale.text);
58642     }
58643     return function(selection2) {
58644       function switchUnits() {
58645         isImperial = !isImperial;
58646         selection2.call(update);
58647       }
58648       var scalegroup = selection2.append("svg").attr("class", "scale").on("click", switchUnits).append("g").attr("transform", "translate(10,11)");
58649       scalegroup.append("path").attr("class", "scale-path");
58650       selection2.append("div").attr("class", "scale-text");
58651       selection2.call(update);
58652       context.map().on("move.scale", function() {
58653         update(selection2);
58654       });
58655     };
58656   }
58657
58658   // modules/ui/shortcuts.js
58659   function uiShortcuts(context) {
58660     var detected = utilDetect();
58661     var _activeTab = 0;
58662     var _modalSelection;
58663     var _selection = select_default2(null);
58664     var _dataShortcuts;
58665     function shortcutsModal(_modalSelection2) {
58666       _modalSelection2.select(".modal").classed("modal-shortcuts", true);
58667       var content = _modalSelection2.select(".content");
58668       content.append("div").attr("class", "modal-section header").append("h2").call(_t.append("shortcuts.title"));
58669       _mainFileFetcher.get("shortcuts").then(function(data) {
58670         _dataShortcuts = data;
58671         content.call(render);
58672       }).catch(function() {
58673       });
58674     }
58675     function render(selection2) {
58676       if (!_dataShortcuts)
58677         return;
58678       var wrapper = selection2.selectAll(".wrapper").data([0]);
58679       var wrapperEnter = wrapper.enter().append("div").attr("class", "wrapper modal-section");
58680       var tabsBar = wrapperEnter.append("div").attr("class", "tabs-bar");
58681       var shortcutsList = wrapperEnter.append("div").attr("class", "shortcuts-list");
58682       wrapper = wrapper.merge(wrapperEnter);
58683       var tabs = tabsBar.selectAll(".tab").data(_dataShortcuts);
58684       var tabsEnter = tabs.enter().append("a").attr("class", "tab").attr("href", "#").on("click", function(d3_event, d) {
58685         d3_event.preventDefault();
58686         var i2 = _dataShortcuts.indexOf(d);
58687         _activeTab = i2;
58688         render(selection2);
58689       });
58690       tabsEnter.append("span").html(function(d) {
58691         return _t.html(d.text);
58692       });
58693       wrapper.selectAll(".tab").classed("active", function(d, i2) {
58694         return i2 === _activeTab;
58695       });
58696       var shortcuts = shortcutsList.selectAll(".shortcut-tab").data(_dataShortcuts);
58697       var shortcutsEnter = shortcuts.enter().append("div").attr("class", function(d) {
58698         return "shortcut-tab shortcut-tab-" + d.tab;
58699       });
58700       var columnsEnter = shortcutsEnter.selectAll(".shortcut-column").data(function(d) {
58701         return d.columns;
58702       }).enter().append("table").attr("class", "shortcut-column");
58703       var rowsEnter = columnsEnter.selectAll(".shortcut-row").data(function(d) {
58704         return d.rows;
58705       }).enter().append("tr").attr("class", "shortcut-row");
58706       var sectionRows = rowsEnter.filter(function(d) {
58707         return !d.shortcuts;
58708       });
58709       sectionRows.append("td");
58710       sectionRows.append("td").attr("class", "shortcut-section").append("h3").html(function(d) {
58711         return _t.html(d.text);
58712       });
58713       var shortcutRows = rowsEnter.filter(function(d) {
58714         return d.shortcuts;
58715       });
58716       var shortcutKeys = shortcutRows.append("td").attr("class", "shortcut-keys");
58717       var modifierKeys = shortcutKeys.filter(function(d) {
58718         return d.modifiers;
58719       });
58720       modifierKeys.selectAll("kbd.modifier").data(function(d) {
58721         if (detected.os === "win" && d.text === "shortcuts.editing.commands.redo") {
58722           return ["\u2318"];
58723         } else if (detected.os !== "mac" && d.text === "shortcuts.browsing.display_options.fullscreen") {
58724           return [];
58725         } else {
58726           return d.modifiers;
58727         }
58728       }).enter().each(function() {
58729         var selection3 = select_default2(this);
58730         selection3.append("kbd").attr("class", "modifier").text(function(d) {
58731           return uiCmd.display(d);
58732         });
58733         selection3.append("span").text("+");
58734       });
58735       shortcutKeys.selectAll("kbd.shortcut").data(function(d) {
58736         var arr = d.shortcuts;
58737         if (detected.os === "win" && d.text === "shortcuts.editing.commands.redo") {
58738           arr = ["Y"];
58739         } else if (detected.os !== "mac" && d.text === "shortcuts.browsing.display_options.fullscreen") {
58740           arr = ["F11"];
58741         }
58742         arr = arr.map(function(s) {
58743           return uiCmd.display(s.indexOf(".") !== -1 ? _t(s) : s);
58744         });
58745         return utilArrayUniq(arr).map(function(s) {
58746           return {
58747             shortcut: s,
58748             separator: d.separator,
58749             suffix: d.suffix
58750           };
58751         });
58752       }).enter().each(function(d, i2, nodes) {
58753         var selection3 = select_default2(this);
58754         var click = d.shortcut.toLowerCase().match(/(.*).click/);
58755         if (click && click[1]) {
58756           selection3.call(svgIcon("#iD-walkthrough-mouse-" + click[1], "operation"));
58757         } else if (d.shortcut.toLowerCase() === "long-press") {
58758           selection3.call(svgIcon("#iD-walkthrough-longpress", "longpress operation"));
58759         } else if (d.shortcut.toLowerCase() === "tap") {
58760           selection3.call(svgIcon("#iD-walkthrough-tap", "tap operation"));
58761         } else {
58762           selection3.append("kbd").attr("class", "shortcut").text(function(d2) {
58763             return d2.shortcut;
58764           });
58765         }
58766         if (i2 < nodes.length - 1) {
58767           selection3.append("span").html(d.separator || "\xA0" + _t.html("shortcuts.or") + "\xA0");
58768         } else if (i2 === nodes.length - 1 && d.suffix) {
58769           selection3.append("span").text(d.suffix);
58770         }
58771       });
58772       shortcutKeys.filter(function(d) {
58773         return d.gesture;
58774       }).each(function() {
58775         var selection3 = select_default2(this);
58776         selection3.append("span").text("+");
58777         selection3.append("span").attr("class", "gesture").html(function(d) {
58778           return _t.html(d.gesture);
58779         });
58780       });
58781       shortcutRows.append("td").attr("class", "shortcut-desc").html(function(d) {
58782         return d.text ? _t.html(d.text) : "\xA0";
58783       });
58784       wrapper.selectAll(".shortcut-tab").style("display", function(d, i2) {
58785         return i2 === _activeTab ? "flex" : "none";
58786       });
58787     }
58788     return function(selection2, show) {
58789       _selection = selection2;
58790       if (show) {
58791         _modalSelection = uiModal(selection2);
58792         _modalSelection.call(shortcutsModal);
58793       } else {
58794         context.keybinding().on([_t("shortcuts.toggle.key"), "?"], function() {
58795           if (context.container().selectAll(".modal-shortcuts").size()) {
58796             if (_modalSelection) {
58797               _modalSelection.close();
58798               _modalSelection = null;
58799             }
58800           } else {
58801             _modalSelection = uiModal(_selection);
58802             _modalSelection.call(shortcutsModal);
58803           }
58804         });
58805       }
58806     };
58807   }
58808
58809   // modules/ui/data_header.js
58810   function uiDataHeader() {
58811     var _datum;
58812     function dataHeader(selection2) {
58813       var header = selection2.selectAll(".data-header").data(
58814         _datum ? [_datum] : [],
58815         function(d) {
58816           return d.__featurehash__;
58817         }
58818       );
58819       header.exit().remove();
58820       var headerEnter = header.enter().append("div").attr("class", "data-header");
58821       var iconEnter = headerEnter.append("div").attr("class", "data-header-icon");
58822       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-data", "note-fill"));
58823       headerEnter.append("div").attr("class", "data-header-label").call(_t.append("map_data.layers.custom.title"));
58824     }
58825     dataHeader.datum = function(val) {
58826       if (!arguments.length)
58827         return _datum;
58828       _datum = val;
58829       return this;
58830     };
58831     return dataHeader;
58832   }
58833
58834   // modules/ui/combobox.js
58835   var _comboHideTimerID;
58836   function uiCombobox(context, klass) {
58837     var dispatch10 = dispatch_default("accept", "cancel", "update");
58838     var container = context.container();
58839     var _suggestions = [];
58840     var _data = [];
58841     var _fetched = {};
58842     var _selected = null;
58843     var _canAutocomplete = true;
58844     var _caseSensitive = false;
58845     var _cancelFetch = false;
58846     var _minItems = 2;
58847     var _tDown = 0;
58848     var _mouseEnterHandler, _mouseLeaveHandler;
58849     var _fetcher = function(val, cb) {
58850       cb(_data.filter(function(d) {
58851         var terms = d.terms || [];
58852         terms.push(d.value);
58853         if (d.key) {
58854           terms.push(d.key);
58855         }
58856         return terms.some(function(term) {
58857           return term.toString().toLowerCase().indexOf(val.toLowerCase()) !== -1;
58858         });
58859       }));
58860     };
58861     var combobox = function(input, attachTo) {
58862       if (!input || input.empty())
58863         return;
58864       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() {
58865         var parent = this.parentNode;
58866         var sibling = this.nextSibling;
58867         select_default2(parent).selectAll(".combobox-caret").filter(function(d) {
58868           return d === input.node();
58869         }).data([input.node()]).enter().insert("div", function() {
58870           return sibling;
58871         }).attr("class", "combobox-caret").on("mousedown.combo-caret", function(d3_event) {
58872           d3_event.preventDefault();
58873           input.node().focus();
58874           mousedown(d3_event);
58875         }).on("mouseup.combo-caret", function(d3_event) {
58876           d3_event.preventDefault();
58877           mouseup(d3_event);
58878         });
58879       });
58880       function mousedown(d3_event) {
58881         if (d3_event.button !== 0)
58882           return;
58883         if (input.classed("disabled"))
58884           return;
58885         _tDown = +/* @__PURE__ */ new Date();
58886         var start2 = input.property("selectionStart");
58887         var end = input.property("selectionEnd");
58888         if (start2 !== end) {
58889           var val = utilGetSetValue(input);
58890           input.node().setSelectionRange(val.length, val.length);
58891           return;
58892         }
58893         input.on("mouseup.combo-input", mouseup);
58894       }
58895       function mouseup(d3_event) {
58896         input.on("mouseup.combo-input", null);
58897         if (d3_event.button !== 0)
58898           return;
58899         if (input.classed("disabled"))
58900           return;
58901         if (input.node() !== document.activeElement)
58902           return;
58903         var start2 = input.property("selectionStart");
58904         var end = input.property("selectionEnd");
58905         if (start2 !== end)
58906           return;
58907         var combo = container.selectAll(".combobox");
58908         if (combo.empty() || combo.datum() !== input.node()) {
58909           var tOrig = _tDown;
58910           window.setTimeout(function() {
58911             if (tOrig !== _tDown)
58912               return;
58913             fetchComboData("", function() {
58914               show();
58915               render();
58916             });
58917           }, 250);
58918         } else {
58919           hide();
58920         }
58921       }
58922       function focus() {
58923         fetchComboData("");
58924       }
58925       function blur() {
58926         _comboHideTimerID = window.setTimeout(hide, 75);
58927       }
58928       function show() {
58929         hide();
58930         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) {
58931           d3_event.preventDefault();
58932         });
58933         container.on("scroll.combo-scroll", render, true);
58934       }
58935       function hide() {
58936         if (_comboHideTimerID) {
58937           window.clearTimeout(_comboHideTimerID);
58938           _comboHideTimerID = void 0;
58939         }
58940         container.selectAll(".combobox").remove();
58941         container.on("scroll.combo-scroll", null);
58942       }
58943       function keydown(d3_event) {
58944         var shown = !container.selectAll(".combobox").empty();
58945         var tagName = input.node() ? input.node().tagName.toLowerCase() : "";
58946         switch (d3_event.keyCode) {
58947           case 8:
58948           case 46:
58949             d3_event.stopPropagation();
58950             _selected = null;
58951             render();
58952             input.on("input.combo-input", function() {
58953               var start2 = input.property("selectionStart");
58954               input.node().setSelectionRange(start2, start2);
58955               input.on("input.combo-input", change);
58956               change(false);
58957             });
58958             break;
58959           case 9:
58960             accept(d3_event);
58961             break;
58962           case 13:
58963             d3_event.preventDefault();
58964             d3_event.stopPropagation();
58965             accept(d3_event);
58966             break;
58967           case 38:
58968             if (tagName === "textarea" && !shown)
58969               return;
58970             d3_event.preventDefault();
58971             if (tagName === "input" && !shown) {
58972               show();
58973             }
58974             nav(-1);
58975             break;
58976           case 40:
58977             if (tagName === "textarea" && !shown)
58978               return;
58979             d3_event.preventDefault();
58980             if (tagName === "input" && !shown) {
58981               show();
58982             }
58983             nav(1);
58984             break;
58985         }
58986       }
58987       function keyup(d3_event) {
58988         switch (d3_event.keyCode) {
58989           case 27:
58990             cancel();
58991             break;
58992         }
58993       }
58994       function change(doAutoComplete) {
58995         if (doAutoComplete === void 0)
58996           doAutoComplete = true;
58997         fetchComboData(value(), function() {
58998           _selected = null;
58999           var val = input.property("value");
59000           if (_suggestions.length) {
59001             if (doAutoComplete && input.property("selectionEnd") === val.length) {
59002               _selected = tryAutocomplete();
59003             }
59004             if (!_selected) {
59005               _selected = val;
59006             }
59007           }
59008           if (val.length) {
59009             var combo = container.selectAll(".combobox");
59010             if (combo.empty()) {
59011               show();
59012             }
59013           } else {
59014             hide();
59015           }
59016           render();
59017         });
59018       }
59019       function nav(dir) {
59020         if (_suggestions.length) {
59021           var index = -1;
59022           for (var i2 = 0; i2 < _suggestions.length; i2++) {
59023             if (_selected && _suggestions[i2].value === _selected) {
59024               index = i2;
59025               break;
59026             }
59027           }
59028           index = Math.max(Math.min(index + dir, _suggestions.length - 1), 0);
59029           _selected = _suggestions[index].value;
59030           utilGetSetValue(input, _selected);
59031           dispatch10.call("update");
59032         }
59033         render();
59034         ensureVisible();
59035       }
59036       function ensureVisible() {
59037         var combo = container.selectAll(".combobox");
59038         if (combo.empty())
59039           return;
59040         var containerRect = container.node().getBoundingClientRect();
59041         var comboRect = combo.node().getBoundingClientRect();
59042         if (comboRect.bottom > containerRect.bottom) {
59043           var node = attachTo ? attachTo.node() : input.node();
59044           node.scrollIntoView({ behavior: "instant", block: "center" });
59045           render();
59046         }
59047         var selected = combo.selectAll(".combobox-option.selected").node();
59048         if (selected) {
59049           selected.scrollIntoView({ behavior: "smooth", block: "nearest" });
59050         }
59051       }
59052       function value() {
59053         var value2 = input.property("value");
59054         var start2 = input.property("selectionStart");
59055         var end = input.property("selectionEnd");
59056         if (start2 && end) {
59057           value2 = value2.substring(0, start2);
59058         }
59059         return value2;
59060       }
59061       function fetchComboData(v, cb) {
59062         _cancelFetch = false;
59063         _fetcher.call(input, v, function(results) {
59064           if (_cancelFetch)
59065             return;
59066           _suggestions = results;
59067           results.forEach(function(d) {
59068             _fetched[d.value] = d;
59069           });
59070           if (cb) {
59071             cb();
59072           }
59073         });
59074       }
59075       function tryAutocomplete() {
59076         if (!_canAutocomplete)
59077           return;
59078         var val = _caseSensitive ? value() : value().toLowerCase();
59079         if (!val)
59080           return;
59081         if (isFinite(val))
59082           return;
59083         const suggestionValues = [];
59084         _suggestions.forEach((s) => {
59085           suggestionValues.push(s.value);
59086           if (s.key && s.key !== s.value) {
59087             suggestionValues.push(s.key);
59088           }
59089         });
59090         var bestIndex = -1;
59091         for (var i2 = 0; i2 < suggestionValues.length; i2++) {
59092           var suggestion = suggestionValues[i2];
59093           var compare = _caseSensitive ? suggestion : suggestion.toLowerCase();
59094           if (compare === val) {
59095             bestIndex = i2;
59096             break;
59097           } else if (bestIndex === -1 && compare.indexOf(val) === 0) {
59098             bestIndex = i2;
59099           }
59100         }
59101         if (bestIndex !== -1) {
59102           var bestVal = suggestionValues[bestIndex];
59103           input.property("value", bestVal);
59104           input.node().setSelectionRange(val.length, bestVal.length);
59105           dispatch10.call("update");
59106           return bestVal;
59107         }
59108       }
59109       function render() {
59110         if (_suggestions.length < _minItems || document.activeElement !== input.node()) {
59111           hide();
59112           return;
59113         }
59114         var shown = !container.selectAll(".combobox").empty();
59115         if (!shown)
59116           return;
59117         var combo = container.selectAll(".combobox");
59118         var options2 = combo.selectAll(".combobox-option").data(_suggestions, function(d) {
59119           return d.value;
59120         });
59121         options2.exit().remove();
59122         options2.enter().append("a").attr("class", function(d) {
59123           return "combobox-option " + (d.klass || "");
59124         }).attr("title", function(d) {
59125           return d.title;
59126         }).each(function(d) {
59127           if (d.display) {
59128             d.display(select_default2(this));
59129           } else {
59130             select_default2(this).text(d.value);
59131           }
59132         }).on("mouseenter", _mouseEnterHandler).on("mouseleave", _mouseLeaveHandler).merge(options2).classed("selected", function(d) {
59133           return d.value === _selected || d.key === _selected;
59134         }).on("click.combo-option", accept).order();
59135         var node = attachTo ? attachTo.node() : input.node();
59136         var containerRect = container.node().getBoundingClientRect();
59137         var rect = node.getBoundingClientRect();
59138         combo.style("left", rect.left + 5 - containerRect.left + "px").style("width", rect.width - 10 + "px").style("top", rect.height + rect.top - containerRect.top + "px");
59139       }
59140       function accept(d3_event, d) {
59141         _cancelFetch = true;
59142         var thiz = input.node();
59143         if (d) {
59144           utilGetSetValue(input, d.value);
59145           utilTriggerEvent(input, "change");
59146         }
59147         var val = utilGetSetValue(input);
59148         thiz.setSelectionRange(val.length, val.length);
59149         d = _fetched[val];
59150         dispatch10.call("accept", thiz, d, val);
59151         hide();
59152       }
59153       function cancel() {
59154         _cancelFetch = true;
59155         var thiz = input.node();
59156         var val = utilGetSetValue(input);
59157         var start2 = input.property("selectionStart");
59158         var end = input.property("selectionEnd");
59159         val = val.slice(0, start2) + val.slice(end);
59160         utilGetSetValue(input, val);
59161         thiz.setSelectionRange(val.length, val.length);
59162         dispatch10.call("cancel", thiz);
59163         hide();
59164       }
59165     };
59166     combobox.canAutocomplete = function(val) {
59167       if (!arguments.length)
59168         return _canAutocomplete;
59169       _canAutocomplete = val;
59170       return combobox;
59171     };
59172     combobox.caseSensitive = function(val) {
59173       if (!arguments.length)
59174         return _caseSensitive;
59175       _caseSensitive = val;
59176       return combobox;
59177     };
59178     combobox.data = function(val) {
59179       if (!arguments.length)
59180         return _data;
59181       _data = val;
59182       return combobox;
59183     };
59184     combobox.fetcher = function(val) {
59185       if (!arguments.length)
59186         return _fetcher;
59187       _fetcher = val;
59188       return combobox;
59189     };
59190     combobox.minItems = function(val) {
59191       if (!arguments.length)
59192         return _minItems;
59193       _minItems = val;
59194       return combobox;
59195     };
59196     combobox.itemsMouseEnter = function(val) {
59197       if (!arguments.length)
59198         return _mouseEnterHandler;
59199       _mouseEnterHandler = val;
59200       return combobox;
59201     };
59202     combobox.itemsMouseLeave = function(val) {
59203       if (!arguments.length)
59204         return _mouseLeaveHandler;
59205       _mouseLeaveHandler = val;
59206       return combobox;
59207     };
59208     return utilRebind(combobox, dispatch10, "on");
59209   }
59210   uiCombobox.off = function(input, context) {
59211     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);
59212     context.container().on("scroll.combo-scroll", null);
59213   };
59214
59215   // modules/ui/disclosure.js
59216   function uiDisclosure(context, key, expandedDefault) {
59217     var dispatch10 = dispatch_default("toggled");
59218     var _expanded;
59219     var _label = utilFunctor("");
59220     var _updatePreference = true;
59221     var _content = function() {
59222     };
59223     var disclosure = function(selection2) {
59224       if (_expanded === void 0 || _expanded === null) {
59225         var preference = corePreferences("disclosure." + key + ".expanded");
59226         _expanded = preference === null ? !!expandedDefault : preference === "true";
59227       }
59228       var hideToggle = selection2.selectAll(".hide-toggle-" + key).data([0]);
59229       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"));
59230       hideToggleEnter.append("span").attr("class", "hide-toggle-text");
59231       hideToggle = hideToggleEnter.merge(hideToggle);
59232       hideToggle.on("click", toggle).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`)).attr("aria-expanded", _expanded).classed("expanded", _expanded);
59233       const label = _label();
59234       const labelSelection = hideToggle.selectAll(".hide-toggle-text");
59235       if (typeof label !== "function") {
59236         labelSelection.text(_label());
59237       } else {
59238         labelSelection.text("").call(label);
59239       }
59240       hideToggle.selectAll(".hide-toggle-icon").attr(
59241         "xlink:href",
59242         _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
59243       );
59244       var wrap2 = selection2.selectAll(".disclosure-wrap").data([0]);
59245       wrap2 = wrap2.enter().append("div").attr("class", "disclosure-wrap disclosure-wrap-" + key).merge(wrap2).classed("hide", !_expanded);
59246       if (_expanded) {
59247         wrap2.call(_content);
59248       }
59249       function toggle(d3_event) {
59250         d3_event.preventDefault();
59251         _expanded = !_expanded;
59252         if (_updatePreference) {
59253           corePreferences("disclosure." + key + ".expanded", _expanded);
59254         }
59255         hideToggle.classed("expanded", _expanded).attr("aria-expanded", _expanded).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`));
59256         hideToggle.selectAll(".hide-toggle-icon").attr(
59257           "xlink:href",
59258           _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
59259         );
59260         wrap2.call(uiToggle(_expanded));
59261         if (_expanded) {
59262           wrap2.call(_content);
59263         }
59264         dispatch10.call("toggled", this, _expanded);
59265       }
59266     };
59267     disclosure.label = function(val) {
59268       if (!arguments.length)
59269         return _label;
59270       _label = utilFunctor(val);
59271       return disclosure;
59272     };
59273     disclosure.expanded = function(val) {
59274       if (!arguments.length)
59275         return _expanded;
59276       _expanded = val;
59277       return disclosure;
59278     };
59279     disclosure.updatePreference = function(val) {
59280       if (!arguments.length)
59281         return _updatePreference;
59282       _updatePreference = val;
59283       return disclosure;
59284     };
59285     disclosure.content = function(val) {
59286       if (!arguments.length)
59287         return _content;
59288       _content = val;
59289       return disclosure;
59290     };
59291     return utilRebind(disclosure, dispatch10, "on");
59292   }
59293
59294   // modules/ui/section.js
59295   function uiSection(id2, context) {
59296     var _classes = utilFunctor("");
59297     var _shouldDisplay;
59298     var _content;
59299     var _disclosure;
59300     var _label;
59301     var _expandedByDefault = utilFunctor(true);
59302     var _disclosureContent;
59303     var _disclosureExpanded;
59304     var _containerSelection = select_default2(null);
59305     var section = {
59306       id: id2
59307     };
59308     section.classes = function(val) {
59309       if (!arguments.length)
59310         return _classes;
59311       _classes = utilFunctor(val);
59312       return section;
59313     };
59314     section.label = function(val) {
59315       if (!arguments.length)
59316         return _label;
59317       _label = utilFunctor(val);
59318       return section;
59319     };
59320     section.expandedByDefault = function(val) {
59321       if (!arguments.length)
59322         return _expandedByDefault;
59323       _expandedByDefault = utilFunctor(val);
59324       return section;
59325     };
59326     section.shouldDisplay = function(val) {
59327       if (!arguments.length)
59328         return _shouldDisplay;
59329       _shouldDisplay = utilFunctor(val);
59330       return section;
59331     };
59332     section.content = function(val) {
59333       if (!arguments.length)
59334         return _content;
59335       _content = val;
59336       return section;
59337     };
59338     section.disclosureContent = function(val) {
59339       if (!arguments.length)
59340         return _disclosureContent;
59341       _disclosureContent = val;
59342       return section;
59343     };
59344     section.disclosureExpanded = function(val) {
59345       if (!arguments.length)
59346         return _disclosureExpanded;
59347       _disclosureExpanded = val;
59348       return section;
59349     };
59350     section.render = function(selection2) {
59351       _containerSelection = selection2.selectAll(".section-" + id2).data([0]);
59352       var sectionEnter = _containerSelection.enter().append("div").attr("class", "section section-" + id2 + " " + (_classes && _classes() || ""));
59353       _containerSelection = sectionEnter.merge(_containerSelection);
59354       _containerSelection.call(renderContent);
59355     };
59356     section.reRender = function() {
59357       _containerSelection.call(renderContent);
59358     };
59359     section.selection = function() {
59360       return _containerSelection;
59361     };
59362     section.disclosure = function() {
59363       return _disclosure;
59364     };
59365     function renderContent(selection2) {
59366       if (_shouldDisplay) {
59367         var shouldDisplay = _shouldDisplay();
59368         selection2.classed("hide", !shouldDisplay);
59369         if (!shouldDisplay) {
59370           selection2.html("");
59371           return;
59372         }
59373       }
59374       if (_disclosureContent) {
59375         if (!_disclosure) {
59376           _disclosure = uiDisclosure(context, id2.replace(/-/g, "_"), _expandedByDefault()).label(_label || "").content(_disclosureContent);
59377         }
59378         if (_disclosureExpanded !== void 0) {
59379           _disclosure.expanded(_disclosureExpanded);
59380           _disclosureExpanded = void 0;
59381         }
59382         selection2.call(_disclosure);
59383         return;
59384       }
59385       if (_content) {
59386         selection2.call(_content);
59387       }
59388     }
59389     return section;
59390   }
59391
59392   // modules/ui/tag_reference.js
59393   function uiTagReference(what) {
59394     var wikibase = what.qid ? services.wikidata : services.osmWikibase;
59395     var tagReference = {};
59396     var _button = select_default2(null);
59397     var _body = select_default2(null);
59398     var _loaded;
59399     var _showing;
59400     function load() {
59401       if (!wikibase)
59402         return;
59403       _button.classed("tag-reference-loading", true);
59404       wikibase.getDocs(what, gotDocs);
59405     }
59406     function gotDocs(err, docs) {
59407       _body.html("");
59408       if (!docs || !docs.title) {
59409         _body.append("p").attr("class", "tag-reference-description").call(_t.append("inspector.no_documentation_key"));
59410         done();
59411         return;
59412       }
59413       if (docs.imageURL) {
59414         _body.append("img").attr("class", "tag-reference-wiki-image").attr("alt", docs.description).attr("src", docs.imageURL).on("load", function() {
59415           done();
59416         }).on("error", function() {
59417           select_default2(this).remove();
59418           done();
59419         });
59420       } else {
59421         done();
59422       }
59423       var tagReferenceDescription = _body.append("p").attr("class", "tag-reference-description").append("span");
59424       if (docs.description) {
59425         tagReferenceDescription = tagReferenceDescription.attr("class", "localized-text").attr("lang", docs.descriptionLocaleCode || "und").text(docs.description);
59426       } else {
59427         tagReferenceDescription = tagReferenceDescription.call(_t.append("inspector.no_documentation_key"));
59428       }
59429       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"));
59430       if (docs.wiki) {
59431         _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));
59432       }
59433       if (what.key === "comment") {
59434         _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"));
59435       }
59436     }
59437     function done() {
59438       _loaded = true;
59439       _button.classed("tag-reference-loading", false);
59440       _body.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1");
59441       _showing = true;
59442       _button.selectAll("svg.icon use").each(function() {
59443         var iconUse = select_default2(this);
59444         if (iconUse.attr("href") === "#iD-icon-info") {
59445           iconUse.attr("href", "#iD-icon-info-filled");
59446         }
59447       });
59448     }
59449     function hide() {
59450       _body.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
59451         _body.classed("expanded", false);
59452       });
59453       _showing = false;
59454       _button.selectAll("svg.icon use").each(function() {
59455         var iconUse = select_default2(this);
59456         if (iconUse.attr("href") === "#iD-icon-info-filled") {
59457           iconUse.attr("href", "#iD-icon-info");
59458         }
59459       });
59460     }
59461     tagReference.button = function(selection2, klass, iconName) {
59462       _button = selection2.selectAll(".tag-reference-button").data([0]);
59463       _button = _button.enter().append("button").attr("class", "tag-reference-button " + (klass || "")).attr("title", _t("icons.information")).call(svgIcon("#iD-icon-" + (iconName || "inspect"))).merge(_button);
59464       _button.on("click", function(d3_event) {
59465         d3_event.stopPropagation();
59466         d3_event.preventDefault();
59467         this.blur();
59468         if (_showing) {
59469           hide();
59470         } else if (_loaded) {
59471           done();
59472         } else {
59473           load();
59474         }
59475       });
59476     };
59477     tagReference.body = function(selection2) {
59478       var itemID = what.qid || what.key + "-" + (what.value || "");
59479       _body = selection2.selectAll(".tag-reference-body").data([itemID], function(d) {
59480         return d;
59481       });
59482       _body.exit().remove();
59483       _body = _body.enter().append("div").attr("class", "tag-reference-body").style("max-height", "0").style("opacity", "0").merge(_body);
59484       if (_showing === false) {
59485         hide();
59486       }
59487     };
59488     tagReference.showing = function(val) {
59489       if (!arguments.length)
59490         return _showing;
59491       _showing = val;
59492       return tagReference;
59493     };
59494     return tagReference;
59495   }
59496
59497   // modules/ui/field_help.js
59498   function uiFieldHelp(context, fieldName) {
59499     var fieldHelp = {};
59500     var _inspector = select_default2(null);
59501     var _wrap = select_default2(null);
59502     var _body = select_default2(null);
59503     var fieldHelpKeys = {
59504       restrictions: [
59505         ["about", [
59506           "about",
59507           "from_via_to",
59508           "maxdist",
59509           "maxvia"
59510         ]],
59511         ["inspecting", [
59512           "about",
59513           "from_shadow",
59514           "allow_shadow",
59515           "restrict_shadow",
59516           "only_shadow",
59517           "restricted",
59518           "only"
59519         ]],
59520         ["modifying", [
59521           "about",
59522           "indicators",
59523           "allow_turn",
59524           "restrict_turn",
59525           "only_turn"
59526         ]],
59527         ["tips", [
59528           "simple",
59529           "simple_example",
59530           "indirect",
59531           "indirect_example",
59532           "indirect_noedit"
59533         ]]
59534       ]
59535     };
59536     var fieldHelpHeadings = {};
59537     var replacements = {
59538       distField: { html: _t.html("restriction.controls.distance") },
59539       viaField: { html: _t.html("restriction.controls.via") },
59540       fromShadow: { html: icon("#iD-turn-shadow", "inline shadow from") },
59541       allowShadow: { html: icon("#iD-turn-shadow", "inline shadow allow") },
59542       restrictShadow: { html: icon("#iD-turn-shadow", "inline shadow restrict") },
59543       onlyShadow: { html: icon("#iD-turn-shadow", "inline shadow only") },
59544       allowTurn: { html: icon("#iD-turn-yes", "inline turn") },
59545       restrictTurn: { html: icon("#iD-turn-no", "inline turn") },
59546       onlyTurn: { html: icon("#iD-turn-only", "inline turn") }
59547     };
59548     var docs = fieldHelpKeys[fieldName].map(function(key) {
59549       var helpkey = "help.field." + fieldName + "." + key[0];
59550       var text2 = key[1].reduce(function(all, part) {
59551         var subkey = helpkey + "." + part;
59552         var depth = fieldHelpHeadings[subkey];
59553         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
59554         return all + hhh + _t.html(subkey, replacements) + "\n\n";
59555       }, "");
59556       return {
59557         key: helpkey,
59558         title: _t.html(helpkey + ".title"),
59559         html: marked(text2.trim())
59560       };
59561     });
59562     function show() {
59563       updatePosition();
59564       _body.classed("hide", false).style("opacity", "0").transition().duration(200).style("opacity", "1");
59565     }
59566     function hide() {
59567       _body.classed("hide", true).transition().duration(200).style("opacity", "0").on("end", function() {
59568         _body.classed("hide", true);
59569       });
59570     }
59571     function clickHelp(index) {
59572       var d = docs[index];
59573       var tkeys = fieldHelpKeys[fieldName][index][1];
59574       _body.selectAll(".field-help-nav-item").classed("active", function(d2, i2) {
59575         return i2 === index;
59576       });
59577       var content = _body.selectAll(".field-help-content").html(d.html);
59578       content.selectAll("p").attr("class", function(d2, i2) {
59579         return tkeys[i2];
59580       });
59581       if (d.key === "help.field.restrictions.inspecting") {
59582         content.insert("img", "p.from_shadow").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_inspect.gif"));
59583       } else if (d.key === "help.field.restrictions.modifying") {
59584         content.insert("img", "p.allow_turn").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_modify.gif"));
59585       }
59586     }
59587     fieldHelp.button = function(selection2) {
59588       if (_body.empty())
59589         return;
59590       var button = selection2.selectAll(".field-help-button").data([0]);
59591       button.enter().append("button").attr("class", "field-help-button").call(svgIcon("#iD-icon-help")).merge(button).on("click", function(d3_event) {
59592         d3_event.stopPropagation();
59593         d3_event.preventDefault();
59594         if (_body.classed("hide")) {
59595           show();
59596         } else {
59597           hide();
59598         }
59599       });
59600     };
59601     function updatePosition() {
59602       var wrap2 = _wrap.node();
59603       var inspector = _inspector.node();
59604       var wRect = wrap2.getBoundingClientRect();
59605       var iRect = inspector.getBoundingClientRect();
59606       _body.style("top", wRect.top + inspector.scrollTop - iRect.top + "px");
59607     }
59608     fieldHelp.body = function(selection2) {
59609       _wrap = selection2.selectAll(".form-field-input-wrap");
59610       if (_wrap.empty())
59611         return;
59612       _inspector = context.container().select(".sidebar .entity-editor-pane .inspector-body");
59613       if (_inspector.empty())
59614         return;
59615       _body = _inspector.selectAll(".field-help-body").data([0]);
59616       var enter = _body.enter().append("div").attr("class", "field-help-body hide");
59617       var titleEnter = enter.append("div").attr("class", "field-help-title cf");
59618       titleEnter.append("h2").attr("class", _mainLocalizer.textDirection() === "rtl" ? "fr" : "fl").call(_t.append("help.field." + fieldName + ".title"));
59619       titleEnter.append("button").attr("class", "fr close").attr("title", _t("icons.close")).on("click", function(d3_event) {
59620         d3_event.stopPropagation();
59621         d3_event.preventDefault();
59622         hide();
59623       }).call(svgIcon("#iD-icon-close"));
59624       var navEnter = enter.append("div").attr("class", "field-help-nav cf");
59625       var titles = docs.map(function(d) {
59626         return d.title;
59627       });
59628       navEnter.selectAll(".field-help-nav-item").data(titles).enter().append("div").attr("class", "field-help-nav-item").html(function(d) {
59629         return d;
59630       }).on("click", function(d3_event, d) {
59631         d3_event.stopPropagation();
59632         d3_event.preventDefault();
59633         clickHelp(titles.indexOf(d));
59634       });
59635       enter.append("div").attr("class", "field-help-content");
59636       _body = _body.merge(enter);
59637       clickHelp(0);
59638     };
59639     return fieldHelp;
59640   }
59641
59642   // modules/ui/fields/check.js
59643   function uiFieldCheck(field, context) {
59644     var dispatch10 = dispatch_default("change");
59645     var options2 = field.options;
59646     var values = [];
59647     var texts = [];
59648     var _tags;
59649     var input = select_default2(null);
59650     var text2 = select_default2(null);
59651     var label = select_default2(null);
59652     var reverser = select_default2(null);
59653     var _impliedYes;
59654     var _entityIDs = [];
59655     var _value;
59656     var stringsField = field.resolveReference("stringsCrossReference");
59657     if (!options2 && stringsField.options) {
59658       options2 = stringsField.options;
59659     }
59660     if (options2) {
59661       for (var i2 in options2) {
59662         var v = options2[i2];
59663         values.push(v === "undefined" ? void 0 : v);
59664         texts.push(stringsField.t.html("options." + v, { "default": v }));
59665       }
59666     } else {
59667       values = [void 0, "yes"];
59668       texts = [_t.html("inspector.unknown"), _t.html("inspector.check.yes")];
59669       if (field.type !== "defaultCheck") {
59670         values.push("no");
59671         texts.push(_t.html("inspector.check.no"));
59672       }
59673     }
59674     function checkImpliedYes() {
59675       _impliedYes = field.id === "oneway_yes";
59676       if (field.id === "oneway") {
59677         var entity = context.entity(_entityIDs[0]);
59678         for (var key in entity.tags) {
59679           if (key in osmOneWayTags && entity.tags[key] in osmOneWayTags[key]) {
59680             _impliedYes = true;
59681             texts[0] = _t.html("_tagging.presets.fields.oneway_yes.options.undefined");
59682             break;
59683           }
59684         }
59685       }
59686     }
59687     function reverserHidden() {
59688       if (!context.container().select("div.inspector-hover").empty())
59689         return true;
59690       return !(_value === "yes" || _impliedYes && !_value);
59691     }
59692     function reverserSetText(selection2) {
59693       var entity = _entityIDs.length && context.hasEntity(_entityIDs[0]);
59694       if (reverserHidden() || !entity)
59695         return selection2;
59696       var first = entity.first();
59697       var last = entity.isClosed() ? entity.nodes[entity.nodes.length - 2] : entity.last();
59698       var pseudoDirection = first < last;
59699       var icon2 = pseudoDirection ? "#iD-icon-forward" : "#iD-icon-backward";
59700       selection2.selectAll(".reverser-span").html("").call(_t.append("inspector.check.reverser")).call(svgIcon(icon2, "inline"));
59701       return selection2;
59702     }
59703     var check = function(selection2) {
59704       checkImpliedYes();
59705       label = selection2.selectAll(".form-field-input-wrap").data([0]);
59706       var enter = label.enter().append("label").attr("class", "form-field-input-wrap form-field-input-check");
59707       enter.append("input").property("indeterminate", field.type !== "defaultCheck").attr("type", "checkbox").attr("id", field.domId);
59708       enter.append("span").html(texts[0]).attr("class", "value");
59709       if (field.type === "onewayCheck") {
59710         enter.append("button").attr("class", "reverser" + (reverserHidden() ? " hide" : "")).append("span").attr("class", "reverser-span");
59711       }
59712       label = label.merge(enter);
59713       input = label.selectAll("input");
59714       text2 = label.selectAll("span.value");
59715       input.on("click", function(d3_event) {
59716         d3_event.stopPropagation();
59717         var t = {};
59718         if (Array.isArray(_tags[field.key])) {
59719           if (values.indexOf("yes") !== -1) {
59720             t[field.key] = "yes";
59721           } else {
59722             t[field.key] = values[0];
59723           }
59724         } else {
59725           t[field.key] = values[(values.indexOf(_value) + 1) % values.length];
59726         }
59727         if (t[field.key] === "reversible" || t[field.key] === "alternating") {
59728           t[field.key] = values[0];
59729         }
59730         dispatch10.call("change", this, t);
59731       });
59732       if (field.type === "onewayCheck") {
59733         reverser = label.selectAll(".reverser");
59734         reverser.call(reverserSetText).on("click", function(d3_event) {
59735           d3_event.preventDefault();
59736           d3_event.stopPropagation();
59737           context.perform(
59738             function(graph) {
59739               for (var i3 in _entityIDs) {
59740                 graph = actionReverse(_entityIDs[i3])(graph);
59741               }
59742               return graph;
59743             },
59744             _t("operations.reverse.annotation.line", { n: 1 })
59745           );
59746           context.validator().validate();
59747           select_default2(this).call(reverserSetText);
59748         });
59749       }
59750     };
59751     check.entityIDs = function(val) {
59752       if (!arguments.length)
59753         return _entityIDs;
59754       _entityIDs = val;
59755       return check;
59756     };
59757     check.tags = function(tags) {
59758       _tags = tags;
59759       function isChecked(val) {
59760         return val !== "no" && val !== "" && val !== void 0 && val !== null;
59761       }
59762       function textFor(val) {
59763         if (val === "")
59764           val = void 0;
59765         var index = values.indexOf(val);
59766         return index !== -1 ? texts[index] : '"' + val + '"';
59767       }
59768       checkImpliedYes();
59769       var isMixed = Array.isArray(tags[field.key]);
59770       _value = !isMixed && tags[field.key] && tags[field.key].toLowerCase();
59771       if (field.type === "onewayCheck" && (_value === "1" || _value === "-1")) {
59772         _value = "yes";
59773       }
59774       input.property("indeterminate", isMixed || field.type !== "defaultCheck" && !_value).property("checked", isChecked(_value));
59775       text2.html(isMixed ? _t.html("inspector.multiple_values") : textFor(_value)).classed("mixed", isMixed);
59776       label.classed("set", !!_value);
59777       if (field.type === "onewayCheck") {
59778         reverser.classed("hide", reverserHidden()).call(reverserSetText);
59779       }
59780     };
59781     check.focus = function() {
59782       input.node().focus();
59783     };
59784     return utilRebind(check, dispatch10, "on");
59785   }
59786
59787   // modules/ui/length_indicator.js
59788   function uiLengthIndicator(maxChars) {
59789     var _wrap = select_default2(null);
59790     var _tooltip = uiPopover("tooltip max-length-warning").placement("bottom").hasArrow(true).content(() => (selection2) => {
59791       selection2.text("");
59792       selection2.call(svgIcon("#iD-icon-alert", "inline"));
59793       selection2.call(_t.append("inspector.max_length_reached", { maxChars }));
59794     });
59795     var _silent = false;
59796     var lengthIndicator = function(selection2) {
59797       _wrap = selection2.selectAll("span.length-indicator-wrap").data([0]);
59798       _wrap = _wrap.enter().append("span").merge(_wrap).classed("length-indicator-wrap", true);
59799       selection2.call(_tooltip);
59800     };
59801     lengthIndicator.update = function(val) {
59802       const strLen = utilUnicodeCharsCount(utilCleanOsmString(val, Number.POSITIVE_INFINITY));
59803       let indicator = _wrap.selectAll("span.length-indicator").data([strLen]);
59804       indicator.enter().append("span").merge(indicator).classed("length-indicator", true).classed("limit-reached", (d) => d > maxChars).style("border-right-width", (d) => `${Math.abs(maxChars - d) * 2}px`).style("margin-right", (d) => d > maxChars ? `${(maxChars - d) * 2}px` : 0).style("opacity", (d) => d > maxChars * 0.8 ? Math.min(1, (d / maxChars - 0.8) / (1 - 0.8)) : 0).style("pointer-events", (d) => d > maxChars * 0.8 ? null : "none");
59805       if (_silent)
59806         return;
59807       if (strLen > maxChars) {
59808         _tooltip.show();
59809       } else {
59810         _tooltip.hide();
59811       }
59812     };
59813     lengthIndicator.silent = function(val) {
59814       if (!arguments.length)
59815         return _silent;
59816       _silent = val;
59817       return lengthIndicator;
59818     };
59819     return lengthIndicator;
59820   }
59821
59822   // modules/ui/fields/combo.js
59823   function uiFieldCombo(field, context) {
59824     var dispatch10 = dispatch_default("change");
59825     var _isMulti = field.type === "multiCombo" || field.type === "manyCombo";
59826     var _isNetwork = field.type === "networkCombo";
59827     var _isSemi = field.type === "semiCombo";
59828     var _showTagInfoSuggestions = field.type !== "manyCombo" && field.autoSuggestions !== false;
59829     var _allowCustomValues = field.type !== "manyCombo" && field.customValues !== false;
59830     var _snake_case = field.snake_case || field.snake_case === void 0;
59831     var _combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(field.caseSensitive).minItems(1);
59832     var _container = select_default2(null);
59833     var _inputWrap = select_default2(null);
59834     var _input = select_default2(null);
59835     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
59836     var _comboData = [];
59837     var _multiData = [];
59838     var _entityIDs = [];
59839     var _tags;
59840     var _countryCode;
59841     var _staticPlaceholder;
59842     var _dataDeprecated = [];
59843     _mainFileFetcher.get("deprecated").then(function(d) {
59844       _dataDeprecated = d;
59845     }).catch(function() {
59846     });
59847     if (_isMulti && field.key && /[^:]$/.test(field.key)) {
59848       field.key += ":";
59849     }
59850     function snake(s) {
59851       return s.replace(/\s+/g, "_");
59852     }
59853     function clean2(s) {
59854       return s.split(";").map(function(s2) {
59855         return s2.trim();
59856       }).join(";");
59857     }
59858     function tagValue(dval) {
59859       dval = clean2(dval || "");
59860       var found = getOptions(true).find(function(o) {
59861         return o.key && clean2(o.value) === dval;
59862       });
59863       if (found)
59864         return found.key;
59865       if (field.type === "typeCombo" && !dval) {
59866         return "yes";
59867       }
59868       return restrictTagValueSpelling(dval) || void 0;
59869     }
59870     function restrictTagValueSpelling(dval) {
59871       if (_snake_case) {
59872         dval = snake(dval);
59873       }
59874       if (!field.caseSensitive) {
59875         dval = dval.toLowerCase();
59876       }
59877       return dval;
59878     }
59879     function getLabelId(field2, v) {
59880       return field2.hasTextForStringId(`options.${v}.title`) ? `options.${v}.title` : `options.${v}`;
59881     }
59882     function displayValue(tval) {
59883       tval = tval || "";
59884       var stringsField = field.resolveReference("stringsCrossReference");
59885       const labelId = getLabelId(stringsField, tval);
59886       if (stringsField.hasTextForStringId(labelId)) {
59887         return stringsField.t(labelId, { default: tval });
59888       }
59889       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
59890         return "";
59891       }
59892       return tval;
59893     }
59894     function renderValue(tval) {
59895       tval = tval || "";
59896       var stringsField = field.resolveReference("stringsCrossReference");
59897       const labelId = getLabelId(stringsField, tval);
59898       if (stringsField.hasTextForStringId(labelId)) {
59899         return stringsField.t.append(labelId, { default: tval });
59900       }
59901       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
59902         tval = "";
59903       }
59904       return (selection2) => selection2.text(tval);
59905     }
59906     function objectDifference(a, b) {
59907       return a.filter(function(d1) {
59908         return !b.some(function(d2) {
59909           return d1.value === d2.value;
59910         });
59911       });
59912     }
59913     function initCombo(selection2, attachTo) {
59914       if (!_allowCustomValues) {
59915         selection2.attr("readonly", "readonly");
59916       }
59917       if (_showTagInfoSuggestions && services.taginfo) {
59918         selection2.call(_combobox.fetcher(setTaginfoValues), attachTo);
59919         setTaginfoValues("", setPlaceholder);
59920       } else {
59921         selection2.call(_combobox, attachTo);
59922         setTimeout(() => setStaticValues(setPlaceholder), 0);
59923       }
59924     }
59925     function getOptions(allOptions) {
59926       var stringsField = field.resolveReference("stringsCrossReference");
59927       if (!(field.options || stringsField.options))
59928         return [];
59929       let options2;
59930       if (allOptions !== true) {
59931         options2 = field.options || stringsField.options;
59932       } else {
59933         options2 = [].concat(field.options, stringsField.options).filter(Boolean);
59934       }
59935       return options2.map(function(v) {
59936         const labelId = getLabelId(stringsField, v);
59937         return {
59938           key: v,
59939           value: stringsField.t(labelId, { default: v }),
59940           title: stringsField.t(`options.${v}.description`, { default: v }),
59941           display: addComboboxIcons(stringsField.t.append(labelId, { default: v }), v),
59942           klass: stringsField.hasTextForStringId(labelId) ? "" : "raw-option"
59943         };
59944       });
59945     }
59946     function setStaticValues(callback, filter2) {
59947       _comboData = getOptions();
59948       if (filter2 !== void 0) {
59949         _comboData = _comboData.filter(filter2);
59950       }
59951       _comboData = objectDifference(_comboData, _multiData);
59952       _combobox.data(_comboData);
59953       if (callback)
59954         callback(_comboData);
59955     }
59956     function setTaginfoValues(q, callback) {
59957       var queryFilter = (d) => d.value.toLowerCase().includes(q.toLowerCase()) || d.key.toLowerCase().includes(q.toLowerCase());
59958       setStaticValues(callback, queryFilter);
59959       var stringsField = field.resolveReference("stringsCrossReference");
59960       var fn = _isMulti ? "multikeys" : "values";
59961       var query = (_isMulti ? field.key : "") + q;
59962       var hasCountryPrefix = _isNetwork && _countryCode && _countryCode.indexOf(q.toLowerCase()) === 0;
59963       if (hasCountryPrefix) {
59964         query = _countryCode + ":";
59965       }
59966       var params = {
59967         debounce: q !== "",
59968         key: field.key,
59969         query
59970       };
59971       if (_entityIDs.length) {
59972         params.geometry = context.graph().geometry(_entityIDs[0]);
59973       }
59974       services.taginfo[fn](params, function(err, data) {
59975         if (err)
59976           return;
59977         data = data.filter((d) => field.type !== "typeCombo" || d.value !== "yes");
59978         data = data.filter((d) => {
59979           var value = d.value;
59980           if (_isMulti) {
59981             value = value.slice(field.key.length);
59982           }
59983           return value === restrictTagValueSpelling(value);
59984         });
59985         var deprecatedValues = osmEntity.deprecatedTagValuesByKey(_dataDeprecated)[field.key];
59986         if (deprecatedValues) {
59987           data = data.filter((d) => !deprecatedValues.includes(d.value));
59988         }
59989         if (hasCountryPrefix) {
59990           data = data.filter((d) => d.value.toLowerCase().indexOf(_countryCode + ":") === 0);
59991         }
59992         const additionalOptions = (field.options || stringsField.options || []).filter((v) => !data.some((dv) => dv.value === (_isMulti ? field.key + v : v))).map((v) => ({ value: v }));
59993         _container.classed("empty-combobox", data.length === 0);
59994         _comboData = data.concat(additionalOptions).map(function(d) {
59995           var v = d.value;
59996           if (_isMulti)
59997             v = v.replace(field.key, "");
59998           const labelId = getLabelId(stringsField, v);
59999           var isLocalizable = stringsField.hasTextForStringId(labelId);
60000           var label = stringsField.t(labelId, { default: v });
60001           return {
60002             key: v,
60003             value: label,
60004             title: stringsField.t(`options.${v}.description`, { default: isLocalizable ? v : d.title !== label ? d.title : "" }),
60005             display: addComboboxIcons(stringsField.t.append(labelId, { default: v }), v),
60006             klass: isLocalizable ? "" : "raw-option"
60007           };
60008         });
60009         _comboData = _comboData.filter(queryFilter);
60010         _comboData = objectDifference(_comboData, _multiData);
60011         if (callback)
60012           callback(_comboData);
60013       });
60014     }
60015     function addComboboxIcons(disp, value) {
60016       const iconsField = field.resolveReference("iconsCrossReference");
60017       if (iconsField.icons) {
60018         return function(selection2) {
60019           var span = selection2.insert("span", ":first-child").attr("class", "tag-value-icon");
60020           if (iconsField.icons[value]) {
60021             span.call(svgIcon(`#${iconsField.icons[value]}`));
60022           }
60023           disp.call(this, selection2);
60024         };
60025       }
60026       return disp;
60027     }
60028     function setPlaceholder(values) {
60029       if (_isMulti || _isSemi) {
60030         _staticPlaceholder = field.placeholder() || _t("inspector.add");
60031       } else {
60032         var vals = values.map(function(d) {
60033           return d.value;
60034         }).filter(function(s) {
60035           return s.length < 20;
60036         });
60037         var placeholders = vals.length > 1 ? vals : values.map(function(d) {
60038           return d.key;
60039         });
60040         _staticPlaceholder = field.placeholder() || placeholders.slice(0, 3).join(", ");
60041       }
60042       if (!/(…|\.\.\.)$/.test(_staticPlaceholder)) {
60043         _staticPlaceholder += "\u2026";
60044       }
60045       var ph;
60046       if (!_isMulti && !_isSemi && _tags && Array.isArray(_tags[field.key])) {
60047         ph = _t("inspector.multiple_values");
60048       } else {
60049         ph = _staticPlaceholder;
60050       }
60051       _container.selectAll("input").attr("placeholder", ph);
60052       var hideAdd = !_allowCustomValues && !values.length;
60053       _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
60054     }
60055     function change() {
60056       var t = {};
60057       var val;
60058       if (_isMulti || _isSemi) {
60059         var vals;
60060         if (_isMulti) {
60061           vals = [tagValue(utilGetSetValue(_input))];
60062         } else if (_isSemi) {
60063           val = tagValue(utilGetSetValue(_input)) || "";
60064           val = val.replace(/,/g, ";");
60065           vals = val.split(";");
60066         }
60067         vals = vals.filter(Boolean);
60068         if (!vals.length)
60069           return;
60070         _container.classed("active", false);
60071         utilGetSetValue(_input, "");
60072         if (_isMulti) {
60073           utilArrayUniq(vals).forEach(function(v) {
60074             var key = (field.key || "") + v;
60075             if (_tags) {
60076               var old = _tags[key];
60077               if (typeof old === "string" && old.toLowerCase() !== "no")
60078                 return;
60079             }
60080             key = context.cleanTagKey(key);
60081             field.keys.push(key);
60082             t[key] = "yes";
60083           });
60084         } else if (_isSemi) {
60085           var arr = _multiData.map(function(d) {
60086             return d.key;
60087           });
60088           arr = arr.concat(vals);
60089           t[field.key] = context.cleanTagValue(utilArrayUniq(arr).filter(Boolean).join(";"));
60090         }
60091         window.setTimeout(function() {
60092           _input.node().focus();
60093         }, 10);
60094       } else {
60095         var rawValue = utilGetSetValue(_input);
60096         if (!rawValue && Array.isArray(_tags[field.key]))
60097           return;
60098         val = context.cleanTagValue(tagValue(rawValue));
60099         t[field.key] = val || void 0;
60100       }
60101       dispatch10.call("change", this, t);
60102     }
60103     function removeMultikey(d3_event, d) {
60104       d3_event.preventDefault();
60105       d3_event.stopPropagation();
60106       var t = {};
60107       if (_isMulti) {
60108         t[d.key] = void 0;
60109       } else if (_isSemi) {
60110         var arr = _multiData.map(function(md) {
60111           return md.key === d.key ? null : md.key;
60112         }).filter(Boolean);
60113         arr = utilArrayUniq(arr);
60114         t[field.key] = arr.length ? arr.join(";") : void 0;
60115         _lengthIndicator.update(t[field.key]);
60116       }
60117       dispatch10.call("change", this, t);
60118     }
60119     function invertMultikey(d3_event, d) {
60120       d3_event.preventDefault();
60121       d3_event.stopPropagation();
60122       var t = {};
60123       if (_isMulti) {
60124         t[d.key] = _tags[d.key] === "yes" ? "no" : "yes";
60125       }
60126       dispatch10.call("change", this, t);
60127     }
60128     function combo(selection2) {
60129       _container = selection2.selectAll(".form-field-input-wrap").data([0]);
60130       var type2 = _isMulti || _isSemi ? "multicombo" : "combo";
60131       _container = _container.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + type2).merge(_container);
60132       if (_isMulti || _isSemi) {
60133         _container = _container.selectAll(".chiplist").data([0]);
60134         var listClass = "chiplist";
60135         if (field.key === "destination" || field.key === "via") {
60136           listClass += " full-line-chips";
60137         }
60138         _container = _container.enter().append("ul").attr("class", listClass).on("click", function() {
60139           window.setTimeout(function() {
60140             _input.node().focus();
60141           }, 10);
60142         }).merge(_container);
60143         _inputWrap = _container.selectAll(".input-wrap").data([0]);
60144         _inputWrap = _inputWrap.enter().append("li").attr("class", "input-wrap").merge(_inputWrap);
60145         var hideAdd = !_allowCustomValues && !_comboData.length;
60146         _inputWrap.style("display", hideAdd ? "none" : null);
60147         _input = _inputWrap.selectAll("input").data([0]);
60148       } else {
60149         _input = _container.selectAll("input").data([0]);
60150       }
60151       _input = _input.enter().append("input").attr("type", "text").attr("id", field.domId).call(utilNoAuto).call(initCombo, selection2).merge(_input);
60152       if (_isSemi) {
60153         _inputWrap.call(_lengthIndicator);
60154       } else if (!_isMulti) {
60155         _container.call(_lengthIndicator);
60156       }
60157       if (_isNetwork) {
60158         var extent = combinedEntityExtent();
60159         var countryCode = extent && iso1A2Code(extent.center());
60160         _countryCode = countryCode && countryCode.toLowerCase();
60161       }
60162       _input.on("change", change).on("blur", change).on("input", function() {
60163         let val = utilGetSetValue(_input);
60164         updateIcon(val);
60165         if (_isSemi && _tags[field.key]) {
60166           val += ";" + _tags[field.key];
60167         }
60168         _lengthIndicator.update(val);
60169       });
60170       _input.on("keydown.field", function(d3_event) {
60171         switch (d3_event.keyCode) {
60172           case 13:
60173             _input.node().blur();
60174             d3_event.stopPropagation();
60175             break;
60176         }
60177       });
60178       if (_isMulti || _isSemi) {
60179         _combobox.on("accept", function() {
60180           _input.node().blur();
60181           _input.node().focus();
60182         });
60183         _input.on("focus", function() {
60184           _container.classed("active", true);
60185         });
60186       }
60187       _combobox.on("cancel", function() {
60188         _input.node().blur();
60189       }).on("update", function() {
60190         updateIcon(utilGetSetValue(_input));
60191       });
60192     }
60193     function updateIcon(value) {
60194       value = tagValue(value);
60195       let container = _container;
60196       if (field.type === "multiCombo" || field.type === "semiCombo") {
60197         container = _container.select(".input-wrap");
60198       }
60199       const iconsField = field.resolveReference("iconsCrossReference");
60200       if (iconsField.icons) {
60201         container.selectAll(".tag-value-icon").remove();
60202         if (iconsField.icons[value]) {
60203           container.selectAll(".tag-value-icon").data([value]).enter().insert("div", "input").attr("class", "tag-value-icon").call(svgIcon(`#${iconsField.icons[value]}`));
60204         }
60205       }
60206     }
60207     combo.tags = function(tags) {
60208       _tags = tags;
60209       var stringsField = field.resolveReference("stringsCrossReference");
60210       var isMixed = Array.isArray(tags[field.key]);
60211       var showsValue = (value) => !isMixed && value && !(field.type === "typeCombo" && value === "yes");
60212       var isRawValue = (value) => showsValue(value) && !stringsField.hasTextForStringId(`options.${value}`) && !stringsField.hasTextForStringId(`options.${value}.title`);
60213       var isKnownValue = (value) => showsValue(value) && !isRawValue(value);
60214       var isReadOnly = !_allowCustomValues;
60215       if (_isMulti || _isSemi) {
60216         _multiData = [];
60217         var maxLength;
60218         if (_isMulti) {
60219           for (var k in tags) {
60220             if (field.key && k.indexOf(field.key) !== 0)
60221               continue;
60222             if (!field.key && field.keys.indexOf(k) === -1)
60223               continue;
60224             var v = tags[k];
60225             var suffix = field.key ? k.slice(field.key.length) : k;
60226             _multiData.push({
60227               key: k,
60228               value: displayValue(suffix),
60229               display: addComboboxIcons(renderValue(suffix), suffix),
60230               state: typeof v === "string" ? v.toLowerCase() : "",
60231               isMixed: Array.isArray(v)
60232             });
60233           }
60234           if (field.key) {
60235             field.keys = _multiData.map(function(d) {
60236               return d.key;
60237             });
60238             maxLength = context.maxCharsForTagKey() - utilUnicodeCharsCount(field.key);
60239           } else {
60240             maxLength = context.maxCharsForTagKey();
60241           }
60242         } else if (_isSemi) {
60243           var allValues = [];
60244           var commonValues;
60245           if (Array.isArray(tags[field.key])) {
60246             tags[field.key].forEach(function(tagVal) {
60247               var thisVals = utilArrayUniq((tagVal || "").split(";")).filter(Boolean);
60248               allValues = allValues.concat(thisVals);
60249               if (!commonValues) {
60250                 commonValues = thisVals;
60251               } else {
60252                 commonValues = commonValues.filter((value) => thisVals.includes(value));
60253               }
60254             });
60255             allValues = utilArrayUniq(allValues).filter(Boolean);
60256           } else {
60257             allValues = utilArrayUniq((tags[field.key] || "").split(";")).filter(Boolean);
60258             commonValues = allValues;
60259           }
60260           _multiData = allValues.map(function(v2) {
60261             return {
60262               key: v2,
60263               value: displayValue(v2),
60264               display: addComboboxIcons(renderValue(v2), v2),
60265               isMixed: !commonValues.includes(v2)
60266             };
60267           });
60268           var currLength = utilUnicodeCharsCount(commonValues.join(";"));
60269           maxLength = context.maxCharsForTagValue() - currLength;
60270           if (currLength > 0) {
60271             maxLength -= 1;
60272           }
60273         }
60274         maxLength = Math.max(0, maxLength);
60275         var hideAdd = maxLength <= 0 || !_allowCustomValues && !_comboData.length;
60276         _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
60277         var allowDragAndDrop = _isSemi && !Array.isArray(tags[field.key]);
60278         var chips = _container.selectAll(".chip").data(_multiData);
60279         chips.exit().remove();
60280         var enter = chips.enter().insert("li", ".input-wrap").attr("class", "chip");
60281         enter.append("span");
60282         enter.append("a");
60283         chips = chips.merge(enter).order().classed("raw-value", function(d) {
60284           var k2 = d.key;
60285           if (_isMulti)
60286             k2 = k2.replace(field.key, "");
60287           return !stringsField.hasTextForStringId("options." + k2);
60288         }).classed("draggable", allowDragAndDrop).classed("mixed", function(d) {
60289           return d.isMixed;
60290         }).attr("title", function(d) {
60291           if (d.isMixed) {
60292             return _t("inspector.unshared_value_tooltip");
60293           }
60294           if (!["yes", "no"].includes(d.state)) {
60295             return d.state;
60296           }
60297           return null;
60298         }).classed("negated", (d) => d.state === "no");
60299         if (!_isSemi) {
60300           chips.selectAll("input[type=checkbox]").remove();
60301           chips.insert("input", "span").attr("type", "checkbox").property("checked", (d) => d.state === "yes").property("indeterminate", (d) => d.isMixed || !["yes", "no"].includes(d.state)).on("click", invertMultikey);
60302         }
60303         if (allowDragAndDrop) {
60304           registerDragAndDrop(chips);
60305         }
60306         chips.select("span").each(function(d) {
60307           const selection2 = select_default2(this);
60308           if (d.display) {
60309             selection2.text("");
60310             d.display(selection2);
60311           } else {
60312             selection2.text(d.value);
60313           }
60314         });
60315         chips.select("a").attr("href", "#").on("click", removeMultikey).attr("class", "remove").text("\xD7");
60316         updateIcon("");
60317       } else {
60318         var mixedValues = isMixed && tags[field.key].map(function(val) {
60319           return displayValue(val);
60320         }).filter(Boolean);
60321         utilGetSetValue(_input, !isMixed ? displayValue(tags[field.key]) : "").data([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) {
60322           if (isReadOnly && isKnownValue(tags[field.key]) && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
60323             d3_event.preventDefault();
60324             d3_event.stopPropagation();
60325             var t = {};
60326             t[field.key] = void 0;
60327             dispatch10.call("change", this, t);
60328           }
60329         });
60330         if (!Array.isArray(tags[field.key])) {
60331           updateIcon(tags[field.key]);
60332         }
60333         if (!isMixed) {
60334           _lengthIndicator.update(tags[field.key]);
60335         }
60336       }
60337       const refreshStyles = () => {
60338         _input.data([tagValue(utilGetSetValue(_input))]).classed("raw-value", isRawValue).classed("known-value", isKnownValue);
60339       };
60340       _input.on("input.refreshStyles", refreshStyles);
60341       _combobox.on("update.refreshStyles", refreshStyles);
60342       refreshStyles();
60343     };
60344     function registerDragAndDrop(selection2) {
60345       var dragOrigin, targetIndex;
60346       selection2.call(
60347         drag_default().on("start", function(d3_event) {
60348           dragOrigin = {
60349             x: d3_event.x,
60350             y: d3_event.y
60351           };
60352           targetIndex = null;
60353         }).on("drag", function(d3_event) {
60354           var x = d3_event.x - dragOrigin.x, y = d3_event.y - dragOrigin.y;
60355           if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
60356           Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) <= 5)
60357             return;
60358           var index = selection2.nodes().indexOf(this);
60359           select_default2(this).classed("dragging", true);
60360           targetIndex = null;
60361           var targetIndexOffsetTop = null;
60362           var draggedTagWidth = select_default2(this).node().offsetWidth;
60363           if (field.key === "destination" || field.key === "via") {
60364             _container.selectAll(".chip").style("transform", function(d2, index2) {
60365               var node = select_default2(this).node();
60366               if (index === index2) {
60367                 return "translate(" + x + "px, " + y + "px)";
60368               } else if (index2 > index && d3_event.y > node.offsetTop) {
60369                 if (targetIndex === null || index2 > targetIndex) {
60370                   targetIndex = index2;
60371                 }
60372                 return "translateY(-100%)";
60373               } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
60374                 if (targetIndex === null || index2 < targetIndex) {
60375                   targetIndex = index2;
60376                 }
60377                 return "translateY(100%)";
60378               }
60379               return null;
60380             });
60381           } else {
60382             _container.selectAll(".chip").each(function(d2, index2) {
60383               var node = select_default2(this).node();
60384               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) {
60385                 targetIndex = index2;
60386                 targetIndexOffsetTop = node.offsetTop;
60387               }
60388             }).style("transform", function(d2, index2) {
60389               var node = select_default2(this).node();
60390               if (index === index2) {
60391                 return "translate(" + x + "px, " + y + "px)";
60392               }
60393               if (node.offsetTop === targetIndexOffsetTop) {
60394                 if (index2 < index && index2 >= targetIndex) {
60395                   return "translateX(" + draggedTagWidth + "px)";
60396                 } else if (index2 > index && index2 <= targetIndex) {
60397                   return "translateX(-" + draggedTagWidth + "px)";
60398                 }
60399               }
60400               return null;
60401             });
60402           }
60403         }).on("end", function() {
60404           if (!select_default2(this).classed("dragging")) {
60405             return;
60406           }
60407           var index = selection2.nodes().indexOf(this);
60408           select_default2(this).classed("dragging", false);
60409           _container.selectAll(".chip").style("transform", null);
60410           if (typeof targetIndex === "number") {
60411             var element = _multiData[index];
60412             _multiData.splice(index, 1);
60413             _multiData.splice(targetIndex, 0, element);
60414             var t = {};
60415             if (_multiData.length) {
60416               t[field.key] = _multiData.map(function(element2) {
60417                 return element2.key;
60418               }).join(";");
60419             } else {
60420               t[field.key] = void 0;
60421             }
60422             dispatch10.call("change", this, t);
60423           }
60424           dragOrigin = void 0;
60425           targetIndex = void 0;
60426         })
60427       );
60428     }
60429     combo.focus = function() {
60430       _input.node().focus();
60431     };
60432     combo.entityIDs = function(val) {
60433       if (!arguments.length)
60434         return _entityIDs;
60435       _entityIDs = val;
60436       return combo;
60437     };
60438     function combinedEntityExtent() {
60439       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
60440     }
60441     return utilRebind(combo, dispatch10, "on");
60442   }
60443
60444   // modules/ui/fields/input.js
60445   var likelyRawNumberFormat = /^-?(0\.\d*|\d*\.\d{0,2}(\d{4,})?|\d{4,}\.\d{3})$/;
60446   function uiFieldText(field, context) {
60447     var dispatch10 = dispatch_default("change");
60448     var input = select_default2(null);
60449     var outlinkButton = select_default2(null);
60450     var wrap2 = select_default2(null);
60451     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
60452     var _entityIDs = [];
60453     var _tags;
60454     var _phoneFormats = {};
60455     const isDirectionField = field.key.split(":").some((keyPart) => keyPart === "direction");
60456     const formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
60457     const parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
60458     const countDecimalPlaces = _mainLocalizer.decimalPlaceCounter(_mainLocalizer.languageCode());
60459     if (field.type === "tel") {
60460       _mainFileFetcher.get("phone_formats").then(function(d) {
60461         _phoneFormats = d;
60462         updatePhonePlaceholder();
60463       }).catch(function() {
60464       });
60465     }
60466     function calcLocked() {
60467       var isLocked = (field.id === "brand" || field.id === "network" || field.id === "operator" || field.id === "flag") && _entityIDs.length && _entityIDs.some(function(entityID) {
60468         var entity = context.graph().hasEntity(entityID);
60469         if (!entity)
60470           return false;
60471         if (entity.tags.wikidata)
60472           return true;
60473         var preset = _mainPresetIndex.match(entity, context.graph());
60474         var isSuggestion = preset && preset.suggestion;
60475         var which = field.id;
60476         return isSuggestion && !!entity.tags[which] && !!entity.tags[which + ":wikidata"];
60477       });
60478       field.locked(isLocked);
60479     }
60480     function i2(selection2) {
60481       calcLocked();
60482       var isLocked = field.locked();
60483       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
60484       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
60485       input = wrap2.selectAll("input").data([0]);
60486       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);
60487       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
60488       wrap2.call(_lengthIndicator);
60489       if (field.type === "tel") {
60490         updatePhonePlaceholder();
60491       } else if (field.type === "number") {
60492         var rtl = _mainLocalizer.textDirection() === "rtl";
60493         input.attr("type", "text");
60494         var inc = field.increment;
60495         var buttons = wrap2.selectAll(".increment, .decrement").data(rtl ? [inc, -inc] : [-inc, inc]);
60496         buttons.enter().append("button").attr("class", function(d) {
60497           var which = d > 0 ? "increment" : "decrement";
60498           return "form-field-button " + which;
60499         }).attr("title", function(d) {
60500           var which = d > 0 ? "increment" : "decrement";
60501           return _t(`inspector.${which}`);
60502         }).merge(buttons).on("click", function(d3_event, d) {
60503           d3_event.preventDefault();
60504           var isMixed = Array.isArray(_tags[field.key]);
60505           if (isMixed)
60506             return;
60507           var raw_vals = input.node().value || "0";
60508           var vals = raw_vals.split(";");
60509           vals = vals.map(function(v) {
60510             v = v.trim();
60511             const isRawNumber = likelyRawNumberFormat.test(v);
60512             var num = isRawNumber ? parseFloat(v) : parseLocaleFloat(v);
60513             if (isDirectionField) {
60514               const compassDir = cardinal[v.toLowerCase()];
60515               if (compassDir !== void 0) {
60516                 num = compassDir;
60517               }
60518             }
60519             if (!isFinite(num))
60520               return v;
60521             num = parseFloat(num);
60522             if (!isFinite(num))
60523               return v;
60524             num += d;
60525             if (isDirectionField) {
60526               num = (num % 360 + 360) % 360;
60527             }
60528             return formatFloat(clamped(num), isRawNumber ? v.includes(".") ? v.split(".")[1].length : 0 : countDecimalPlaces(v));
60529           });
60530           input.node().value = vals.join(";");
60531           change()();
60532         });
60533       } else if (field.type === "identifier" && field.urlFormat && field.pattern) {
60534         input.attr("type", "text");
60535         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
60536         outlinkButton.enter().append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", function() {
60537           var domainResults = /^https?:\/\/(.{1,}?)\//.exec(field.urlFormat);
60538           if (domainResults.length >= 2 && domainResults[1]) {
60539             var domain2 = domainResults[1];
60540             return _t("icons.view_on", { domain: domain2 });
60541           }
60542           return "";
60543         }).on("click", function(d3_event) {
60544           d3_event.preventDefault();
60545           var value = validIdentifierValueForLink();
60546           if (value) {
60547             var url = field.urlFormat.replace(/{value}/, encodeURIComponent(value));
60548             window.open(url, "_blank");
60549           }
60550         }).merge(outlinkButton);
60551       } else if (field.type === "url") {
60552         input.attr("type", "text");
60553         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
60554         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) {
60555           d3_event.preventDefault();
60556           const value = validIdentifierValueForLink();
60557           if (value)
60558             window.open(value, "_blank");
60559         }).merge(outlinkButton);
60560       } else if (field.type === "colour") {
60561         input.attr("type", "text");
60562         updateColourPreview();
60563       } else if (field.type === "date") {
60564         input.attr("type", "text");
60565         updateDateField();
60566       }
60567     }
60568     function updateColourPreview() {
60569       function isColourValid(colour2) {
60570         if (!colour2.match(/^(#([0-9a-fA-F]{3}){1,2}|\w+)$/)) {
60571           return false;
60572         } else if (!CSS.supports("color", colour2) || ["unset", "inherit", "initial", "revert"].includes(colour2)) {
60573           return false;
60574         }
60575         return true;
60576       }
60577       wrap2.selectAll(".colour-preview").remove();
60578       const colour = utilGetSetValue(input);
60579       if (!isColourValid(colour) && colour !== "") {
60580         wrap2.selectAll("input.colour-selector").remove();
60581         wrap2.selectAll(".form-field-button").remove();
60582         return;
60583       }
60584       var colourSelector = wrap2.selectAll(".colour-selector").data([0]);
60585       colourSelector.enter().append("input").attr("type", "color").attr("class", "colour-selector").on("input", debounce_default(function(d3_event) {
60586         d3_event.preventDefault();
60587         var colour2 = this.value;
60588         if (!isColourValid(colour2))
60589           return;
60590         utilGetSetValue(input, this.value);
60591         change()();
60592         updateColourPreview();
60593       }, 100));
60594       wrap2.selectAll("input.colour-selector").attr("value", colour);
60595       var chooserButton = wrap2.selectAll(".colour-preview").data([colour]);
60596       chooserButton = chooserButton.enter().append("div").attr("class", "form-field-button colour-preview").append("div").style("background-color", (d) => d).attr("class", "colour-box");
60597       if (colour === "") {
60598         chooserButton = chooserButton.call(svgIcon("#iD-icon-edit"));
60599       }
60600       chooserButton.on("click", () => wrap2.select(".colour-selector").node().showPicker());
60601     }
60602     function updateDateField() {
60603       function isDateValid(date2) {
60604         return date2.match(/^[0-9]{4}(-[0-9]{2}(-[0-9]{2})?)?$/);
60605       }
60606       const date = utilGetSetValue(input);
60607       const now3 = /* @__PURE__ */ new Date();
60608       const today = new Date(now3.getTime() - now3.getTimezoneOffset() * 6e4).toISOString().split("T")[0];
60609       if ((field.key === "check_date" || field.key === "survey:date") && date !== today) {
60610         wrap2.selectAll(".date-set-today").data([0]).enter().append("button").attr("class", "form-field-button date-set-today").call(svgIcon("#fas-rotate")).call(uiTooltip().title(() => _t.append("inspector.set_today"))).on("click", () => {
60611           utilGetSetValue(input, today);
60612           change()();
60613           updateDateField();
60614         });
60615       } else {
60616         wrap2.selectAll(".date-set-today").remove();
60617       }
60618       if (!isDateValid(date) && date !== "") {
60619         wrap2.selectAll("input.date-selector").remove();
60620         wrap2.selectAll(".date-calendar").remove();
60621         return;
60622       }
60623       if (utilDetect().browser !== "Safari") {
60624         var dateSelector = wrap2.selectAll(".date-selector").data([0]);
60625         dateSelector.enter().append("input").attr("type", "date").attr("class", "date-selector").on("input", debounce_default(function(d3_event) {
60626           d3_event.preventDefault();
60627           var date2 = this.value;
60628           if (!isDateValid(date2))
60629             return;
60630           utilGetSetValue(input, this.value);
60631           change()();
60632           updateDateField();
60633         }, 100));
60634         wrap2.selectAll("input.date-selector").attr("value", date);
60635         var calendarButton = wrap2.selectAll(".date-calendar").data([date]);
60636         calendarButton = calendarButton.enter().append("button").attr("class", "form-field-button date-calendar").call(svgIcon("#fas-calendar-days"));
60637         calendarButton.on("click", () => wrap2.select(".date-selector").node().showPicker());
60638       }
60639     }
60640     function updatePhonePlaceholder() {
60641       if (input.empty() || !Object.keys(_phoneFormats).length)
60642         return;
60643       var extent = combinedEntityExtent();
60644       var countryCode = extent && iso1A2Code(extent.center());
60645       var format2 = countryCode && _phoneFormats[countryCode.toLowerCase()];
60646       if (format2)
60647         input.attr("placeholder", format2);
60648     }
60649     function validIdentifierValueForLink() {
60650       const value = utilGetSetValue(input).trim();
60651       if (field.type === "url" && value) {
60652         try {
60653           return new URL(value).href;
60654         } catch (e) {
60655           return null;
60656         }
60657       }
60658       if (field.type === "identifier" && field.pattern) {
60659         return value && value.match(new RegExp(field.pattern))[0];
60660       }
60661       return null;
60662     }
60663     function clamped(num) {
60664       if (field.minValue !== void 0) {
60665         num = Math.max(num, field.minValue);
60666       }
60667       if (field.maxValue !== void 0) {
60668         num = Math.min(num, field.maxValue);
60669       }
60670       return num;
60671     }
60672     function getVals(tags) {
60673       if (field.keys) {
60674         const multiSelection = context.selectedIDs();
60675         tags = multiSelection.length > 1 ? context.selectedIDs().map((id2) => context.graph().entity(id2)).map((entity) => entity.tags) : [tags];
60676         return tags.map((tags2) => new Set(field.keys.reduce((acc, key) => acc.concat(tags2[key]), []).filter(Boolean))).map((vals) => vals.size === 0 ? /* @__PURE__ */ new Set([void 0]) : vals).reduce((a, b) => /* @__PURE__ */ new Set([...a, ...b]));
60677       } else {
60678         return new Set([].concat(tags[field.key]));
60679       }
60680     }
60681     function change(onInput) {
60682       return function() {
60683         var t = {};
60684         var val = utilGetSetValue(input);
60685         if (!onInput)
60686           val = context.cleanTagValue(val);
60687         if (!val && getVals(_tags).size > 1)
60688           return;
60689         var displayVal = val;
60690         if (field.type === "number" && val) {
60691           var numbers2 = val.split(";");
60692           numbers2 = numbers2.map(function(v) {
60693             if (likelyRawNumberFormat.test(v)) {
60694               return v;
60695             }
60696             var num = parseLocaleFloat(v);
60697             const fractionDigits = countDecimalPlaces(v);
60698             return isFinite(num) ? clamped(num).toFixed(fractionDigits) : v;
60699           });
60700           val = numbers2.join(";");
60701         }
60702         if (!onInput)
60703           utilGetSetValue(input, displayVal);
60704         t[field.key] = val || void 0;
60705         if (field.keys) {
60706           dispatch10.call("change", this, (tags) => {
60707             if (field.keys.some((key) => tags[key])) {
60708               field.keys.filter((key) => tags[key]).forEach((key) => {
60709                 tags[key] = val || void 0;
60710               });
60711             } else {
60712               tags[field.key] = val || void 0;
60713             }
60714             return tags;
60715           }, onInput);
60716         } else {
60717           dispatch10.call("change", this, t, onInput);
60718         }
60719       };
60720     }
60721     i2.entityIDs = function(val) {
60722       if (!arguments.length)
60723         return _entityIDs;
60724       _entityIDs = val;
60725       return i2;
60726     };
60727     i2.tags = function(tags) {
60728       _tags = tags;
60729       const vals = getVals(tags);
60730       const isMixed = vals.size > 1;
60731       var val = vals.size === 1 ? [...vals][0] : "";
60732       var shouldUpdate;
60733       if (field.type === "number" && val) {
60734         var numbers2 = val.split(";");
60735         var oriNumbers = utilGetSetValue(input).split(";");
60736         if (numbers2.length !== oriNumbers.length)
60737           shouldUpdate = true;
60738         numbers2 = numbers2.map(function(v) {
60739           v = v.trim();
60740           var num = Number(v);
60741           if (!isFinite(num) || v === "")
60742             return v;
60743           const fractionDigits = v.includes(".") ? v.split(".")[1].length : 0;
60744           return formatFloat(num, fractionDigits);
60745         });
60746         val = numbers2.join(";");
60747         shouldUpdate = (inputValue, setValue) => {
60748           const inputNums = inputValue.split(";").map(
60749             (setVal) => likelyRawNumberFormat.test(setVal) ? parseFloat(setVal) : parseLocaleFloat(setVal)
60750           );
60751           const setNums = setValue.split(";").map(parseLocaleFloat);
60752           return !isEqual_default(inputNums, setNums);
60753         };
60754       }
60755       utilGetSetValue(input, val, shouldUpdate).attr("title", isMixed ? [...vals].join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : field.placeholder() || _t("inspector.unknown")).classed("mixed", isMixed);
60756       if (field.type === "number") {
60757         const buttons = wrap2.selectAll(".increment, .decrement");
60758         if (isMixed) {
60759           buttons.attr("disabled", "disabled").classed("disabled", true);
60760         } else {
60761           var raw_vals = tags[field.key] || "0";
60762           const canIncDec = raw_vals.split(";").some((val2) => isFinite(Number(val2)) || isDirectionField && cardinal[val2.trim().toLowerCase()]);
60763           buttons.attr("disabled", canIncDec ? null : "disabled").classed("disabled", !canIncDec);
60764         }
60765       }
60766       if (field.type === "tel")
60767         updatePhonePlaceholder();
60768       if (field.type === "colour")
60769         updateColourPreview();
60770       if (field.type === "date")
60771         updateDateField();
60772       if (outlinkButton && !outlinkButton.empty()) {
60773         var disabled = !validIdentifierValueForLink();
60774         outlinkButton.classed("disabled", disabled);
60775       }
60776       if (!isMixed) {
60777         _lengthIndicator.update(tags[field.key]);
60778       }
60779     };
60780     i2.focus = function() {
60781       var node = input.node();
60782       if (node)
60783         node.focus();
60784     };
60785     function combinedEntityExtent() {
60786       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
60787     }
60788     return utilRebind(i2, dispatch10, "on");
60789   }
60790
60791   // modules/ui/fields/access.js
60792   function uiFieldAccess(field, context) {
60793     var dispatch10 = dispatch_default("change");
60794     var items = select_default2(null);
60795     var _tags;
60796     function access(selection2) {
60797       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
60798       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
60799       var list = wrap2.selectAll("ul").data([0]);
60800       list = list.enter().append("ul").attr("class", "rows").merge(list);
60801       items = list.selectAll("li").data(field.keys);
60802       var enter = items.enter().append("li").attr("class", function(d) {
60803         return "labeled-input preset-access-" + d;
60804       });
60805       enter.append("span").attr("class", "label preset-label-access").attr("for", function(d) {
60806         return "preset-input-access-" + d;
60807       }).html(function(d) {
60808         return field.t.html("types." + d);
60809       });
60810       enter.append("div").attr("class", "preset-input-access-wrap").append("input").attr("type", "text").attr("class", function(d) {
60811         return "preset-input-access preset-input-access-" + d;
60812       }).call(utilNoAuto).each(function(d) {
60813         select_default2(this).call(
60814           uiCombobox(context, "access-" + d).data(access.options(d))
60815         );
60816       });
60817       items = items.merge(enter);
60818       wrap2.selectAll(".preset-input-access").on("change", change).on("blur", change);
60819     }
60820     function change(d3_event, d) {
60821       var tag = {};
60822       var value = context.cleanTagValue(utilGetSetValue(select_default2(this)));
60823       if (!value && typeof _tags[d] !== "string")
60824         return;
60825       tag[d] = value || void 0;
60826       dispatch10.call("change", this, tag);
60827     }
60828     access.options = function(type2) {
60829       var options2 = [
60830         "yes",
60831         "no",
60832         "designated",
60833         "permissive",
60834         "destination",
60835         "customers",
60836         "private",
60837         "permit",
60838         "unknown"
60839       ];
60840       if (type2 === "access") {
60841         options2 = options2.filter((v) => v !== "yes" && v !== "designated");
60842       }
60843       if (type2 === "bicycle") {
60844         options2.splice(options2.length - 4, 0, "dismount");
60845       }
60846       var stringsField = field.resolveReference("stringsCrossReference");
60847       return options2.map(function(option) {
60848         return {
60849           title: stringsField.t("options." + option + ".description"),
60850           value: option
60851         };
60852       });
60853     };
60854     const placeholdersByTag = {
60855       highway: {
60856         footway: {
60857           foot: "designated",
60858           motor_vehicle: "no"
60859         },
60860         steps: {
60861           foot: "yes",
60862           motor_vehicle: "no",
60863           bicycle: "no",
60864           horse: "no"
60865         },
60866         pedestrian: {
60867           foot: "yes",
60868           motor_vehicle: "no"
60869         },
60870         cycleway: {
60871           motor_vehicle: "no",
60872           bicycle: "designated"
60873         },
60874         bridleway: {
60875           motor_vehicle: "no",
60876           horse: "designated"
60877         },
60878         path: {
60879           foot: "yes",
60880           motor_vehicle: "no",
60881           bicycle: "yes",
60882           horse: "yes"
60883         },
60884         motorway: {
60885           foot: "no",
60886           motor_vehicle: "yes",
60887           bicycle: "no",
60888           horse: "no"
60889         },
60890         trunk: {
60891           motor_vehicle: "yes"
60892         },
60893         primary: {
60894           foot: "yes",
60895           motor_vehicle: "yes",
60896           bicycle: "yes",
60897           horse: "yes"
60898         },
60899         secondary: {
60900           foot: "yes",
60901           motor_vehicle: "yes",
60902           bicycle: "yes",
60903           horse: "yes"
60904         },
60905         tertiary: {
60906           foot: "yes",
60907           motor_vehicle: "yes",
60908           bicycle: "yes",
60909           horse: "yes"
60910         },
60911         residential: {
60912           foot: "yes",
60913           motor_vehicle: "yes",
60914           bicycle: "yes",
60915           horse: "yes"
60916         },
60917         unclassified: {
60918           foot: "yes",
60919           motor_vehicle: "yes",
60920           bicycle: "yes",
60921           horse: "yes"
60922         },
60923         service: {
60924           foot: "yes",
60925           motor_vehicle: "yes",
60926           bicycle: "yes",
60927           horse: "yes"
60928         },
60929         motorway_link: {
60930           foot: "no",
60931           motor_vehicle: "yes",
60932           bicycle: "no",
60933           horse: "no"
60934         },
60935         trunk_link: {
60936           motor_vehicle: "yes"
60937         },
60938         primary_link: {
60939           foot: "yes",
60940           motor_vehicle: "yes",
60941           bicycle: "yes",
60942           horse: "yes"
60943         },
60944         secondary_link: {
60945           foot: "yes",
60946           motor_vehicle: "yes",
60947           bicycle: "yes",
60948           horse: "yes"
60949         },
60950         tertiary_link: {
60951           foot: "yes",
60952           motor_vehicle: "yes",
60953           bicycle: "yes",
60954           horse: "yes"
60955         },
60956         construction: {
60957           access: "no"
60958         }
60959       },
60960       barrier: {
60961         bollard: {
60962           access: "no",
60963           bicycle: "yes",
60964           foot: "yes"
60965         },
60966         bus_trap: {
60967           motor_vehicle: "no",
60968           psv: "yes",
60969           foot: "yes",
60970           bicycle: "yes"
60971         },
60972         city_wall: {
60973           access: "no"
60974         },
60975         coupure: {
60976           access: "yes"
60977         },
60978         cycle_barrier: {
60979           motor_vehicle: "no"
60980         },
60981         ditch: {
60982           access: "no"
60983         },
60984         entrance: {
60985           access: "yes"
60986         },
60987         fence: {
60988           access: "no"
60989         },
60990         hedge: {
60991           access: "no"
60992         },
60993         jersey_barrier: {
60994           access: "no"
60995         },
60996         motorcycle_barrier: {
60997           motor_vehicle: "no"
60998         },
60999         rail_guard: {
61000           access: "no"
61001         }
61002       }
61003     };
61004     access.tags = function(tags) {
61005       _tags = tags;
61006       utilGetSetValue(items.selectAll(".preset-input-access"), function(d) {
61007         return typeof tags[d] === "string" ? tags[d] : "";
61008       }).classed("mixed", function(d) {
61009         return tags[d] && Array.isArray(tags[d]);
61010       }).attr("title", function(d) {
61011         return tags[d] && Array.isArray(tags[d]) && tags[d].filter(Boolean).join("\n");
61012       }).attr("placeholder", function(d) {
61013         if (tags[d] && Array.isArray(tags[d])) {
61014           return _t("inspector.multiple_values");
61015         }
61016         if (d === "bicycle" || d === "motor_vehicle") {
61017           if (tags.vehicle && typeof tags.vehicle === "string") {
61018             return tags.vehicle;
61019           }
61020         }
61021         if (tags.access && typeof tags.access === "string") {
61022           return tags.access;
61023         }
61024         function getPlaceholdersByTag(key, placeholdersByKey) {
61025           if (typeof tags[key] === "string") {
61026             if (placeholdersByKey[tags[key]] && placeholdersByKey[tags[key]][d]) {
61027               return placeholdersByKey[tags[key]][d];
61028             }
61029           } else {
61030             var impliedAccesses = tags[key].filter(Boolean).map(function(val) {
61031               return placeholdersByKey[val] && placeholdersByKey[val][d];
61032             }).filter(Boolean);
61033             if (impliedAccesses.length === tags[key].length && new Set(impliedAccesses).size === 1) {
61034               return impliedAccesses[0];
61035             }
61036           }
61037         }
61038         for (const key in placeholdersByTag) {
61039           if (tags[key]) {
61040             const impliedAccess = getPlaceholdersByTag(key, placeholdersByTag[key]);
61041             if (impliedAccess) {
61042               return impliedAccess;
61043             }
61044           }
61045         }
61046         if (d === "access" && !tags.barrier) {
61047           return "yes";
61048         }
61049         return field.placeholder();
61050       });
61051     };
61052     access.focus = function() {
61053       items.selectAll(".preset-input-access").node().focus();
61054     };
61055     return utilRebind(access, dispatch10, "on");
61056   }
61057
61058   // modules/ui/fields/address.js
61059   function uiFieldAddress(field, context) {
61060     var dispatch10 = dispatch_default("change");
61061     var _selection = select_default2(null);
61062     var _wrap = select_default2(null);
61063     var addrField = _mainPresetIndex.field("address");
61064     var _entityIDs = [];
61065     var _tags;
61066     var _countryCode;
61067     var _addressFormats = [{
61068       format: [
61069         ["housenumber", "street"],
61070         ["city", "postcode"]
61071       ]
61072     }];
61073     _mainFileFetcher.get("address_formats").then(function(d) {
61074       _addressFormats = d;
61075       if (!_selection.empty()) {
61076         _selection.call(address);
61077       }
61078     }).catch(function() {
61079     });
61080     function getNear(isAddressable, type2, searchRadius, resultProp) {
61081       var extent = combinedEntityExtent();
61082       var l = extent.center();
61083       var box = geoExtent(l).padByMeters(searchRadius);
61084       var features = context.history().intersects(box).filter(isAddressable).map((d) => {
61085         let dist = geoSphericalDistance(d.extent(context.graph()).center(), l);
61086         if (d.type === "way") {
61087           var loc = context.projection([
61088             (extent[0][0] + extent[1][0]) / 2,
61089             (extent[0][1] + extent[1][1]) / 2
61090           ]);
61091           var choice = geoChooseEdge(context.graph().childNodes(d), loc, context.projection);
61092           dist = Math.min(dist, choice.distance);
61093         }
61094         const value = resultProp && d.tags[resultProp] ? d.tags[resultProp] : d.tags.name;
61095         let title = value;
61096         if (type2 === "street") {
61097           title = `${addrField.t("placeholders.street")}: ${title}`;
61098         } else if (type2 === "place") {
61099           title = `${addrField.t("placeholders.place")}: ${title}`;
61100         }
61101         return {
61102           title,
61103           value,
61104           dist,
61105           type: type2,
61106           klass: `address-${type2}`
61107         };
61108       }).sort(function(a, b) {
61109         return a.dist - b.dist;
61110       });
61111       return utilArrayUniqBy(features, "value");
61112     }
61113     function getNearStreets() {
61114       function isAddressable(d) {
61115         return d.tags.highway && d.tags.name && d.type === "way";
61116       }
61117       return getNear(isAddressable, "street", 200);
61118     }
61119     function getNearPlaces() {
61120       function isAddressable(d) {
61121         if (d.tags.name) {
61122           if (d.tags.place)
61123             return true;
61124           if (d.tags.boundary === "administrative" && d.tags.admin_level > 8)
61125             return true;
61126         }
61127         return false;
61128       }
61129       return getNear(isAddressable, "place", 200);
61130     }
61131     function getNearCities() {
61132       function isAddressable(d) {
61133         if (d.tags.name) {
61134           if (d.tags.boundary === "administrative" && d.tags.admin_level === "8")
61135             return true;
61136           if (d.tags.border_type === "city")
61137             return true;
61138           if (d.tags.place === "city" || d.tags.place === "town" || d.tags.place === "village")
61139             return true;
61140         }
61141         if (d.tags[`${field.key}:city`])
61142           return true;
61143         return false;
61144       }
61145       return getNear(isAddressable, "city", 200, `${field.key}:city`);
61146     }
61147     function getNearPostcodes() {
61148       return [...new Set([].concat(getNearValues("postcode")).concat(getNear((d) => d.tags.postal_code, "postcode", 200, "postal_code")))];
61149     }
61150     function getNearValues(key) {
61151       const tagKey = `${field.key}:${key}`;
61152       function hasTag(d) {
61153         return _entityIDs.indexOf(d.id) === -1 && d.tags[tagKey];
61154       }
61155       return getNear(hasTag, key, 200, tagKey);
61156     }
61157     function updateForCountryCode() {
61158       if (!_countryCode)
61159         return;
61160       var addressFormat;
61161       for (var i2 = 0; i2 < _addressFormats.length; i2++) {
61162         var format2 = _addressFormats[i2];
61163         if (!format2.countryCodes) {
61164           addressFormat = format2;
61165         } else if (format2.countryCodes.indexOf(_countryCode) !== -1) {
61166           addressFormat = format2;
61167           break;
61168         }
61169       }
61170       var dropdowns = addressFormat.dropdowns || [
61171         "city",
61172         "county",
61173         "country",
61174         "district",
61175         "hamlet",
61176         "neighbourhood",
61177         "place",
61178         "postcode",
61179         "province",
61180         "quarter",
61181         "state",
61182         "street",
61183         "street+place",
61184         "subdistrict",
61185         "suburb"
61186       ];
61187       var widths = addressFormat.widths || {
61188         housenumber: 1 / 5,
61189         unit: 1 / 5,
61190         street: 1 / 2,
61191         place: 1 / 2,
61192         city: 2 / 3,
61193         state: 1 / 4,
61194         postcode: 1 / 3
61195       };
61196       function row(r) {
61197         var total = r.reduce(function(sum, key) {
61198           return sum + (widths[key] || 0.5);
61199         }, 0);
61200         return r.map(function(key) {
61201           return {
61202             id: key,
61203             width: (widths[key] || 0.5) / total
61204           };
61205         });
61206       }
61207       var rows = _wrap.selectAll(".addr-row").data(addressFormat.format, function(d) {
61208         return d.toString();
61209       });
61210       rows.exit().remove();
61211       rows.enter().append("div").attr("class", "addr-row").selectAll("input").data(row).enter().append("input").property("type", "text").call(updatePlaceholder).attr("class", function(d) {
61212         return "addr-" + d.id;
61213       }).call(utilNoAuto).each(addDropdown).style("width", function(d) {
61214         return d.width * 100 + "%";
61215       });
61216       function addDropdown(d) {
61217         if (dropdowns.indexOf(d.id) === -1)
61218           return;
61219         var nearValues;
61220         switch (d.id) {
61221           case "street":
61222             nearValues = getNearStreets;
61223             break;
61224           case "place":
61225             nearValues = getNearPlaces;
61226             break;
61227           case "street+place":
61228             nearValues = () => [].concat(getNearStreets()).concat(getNearPlaces());
61229             d.isAutoStreetPlace = true;
61230             d.id = _tags[`${field.key}:place`] ? "place" : "street";
61231             break;
61232           case "city":
61233             nearValues = getNearCities;
61234             break;
61235           case "postcode":
61236             nearValues = getNearPostcodes;
61237             break;
61238           default:
61239             nearValues = getNearValues;
61240         }
61241         select_default2(this).call(
61242           uiCombobox(context, `address-${d.isAutoStreetPlace ? "street-place" : d.id}`).minItems(1).caseSensitive(true).fetcher(function(typedValue, callback) {
61243             typedValue = typedValue.toLowerCase();
61244             callback(nearValues(d.id).filter((v) => v.value.toLowerCase().indexOf(typedValue) !== -1));
61245           }).on("accept", function(selected) {
61246             if (d.isAutoStreetPlace) {
61247               d.id = selected ? selected.type : "street";
61248             }
61249           })
61250         );
61251       }
61252       _wrap.selectAll("input").on("blur", change()).on("change", change());
61253       _wrap.selectAll("input:not(.combobox-input)").on("input", change(true));
61254       if (_tags)
61255         updateTags(_tags);
61256     }
61257     function address(selection2) {
61258       _selection = selection2;
61259       _wrap = selection2.selectAll(".form-field-input-wrap").data([0]);
61260       _wrap = _wrap.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(_wrap);
61261       var extent = combinedEntityExtent();
61262       if (extent) {
61263         var countryCode;
61264         if (context.inIntro()) {
61265           countryCode = _t("intro.graph.countrycode");
61266         } else {
61267           var center = extent.center();
61268           countryCode = iso1A2Code(center);
61269         }
61270         if (countryCode) {
61271           _countryCode = countryCode.toLowerCase();
61272           updateForCountryCode();
61273         }
61274       }
61275     }
61276     function change(onInput) {
61277       return function() {
61278         setTimeout(() => {
61279           var tags = {};
61280           _wrap.selectAll("input").each(function(subfield) {
61281             var key = field.key + ":" + subfield.id;
61282             var value = this.value;
61283             if (!onInput)
61284               value = context.cleanTagValue(value);
61285             if (Array.isArray(_tags[key]) && !value)
61286               return;
61287             if (subfield.isAutoStreetPlace) {
61288               if (subfield.id === "street") {
61289                 tags[`${field.key}:place`] = void 0;
61290               } else if (subfield.id === "place") {
61291                 tags[`${field.key}:street`] = void 0;
61292               }
61293             }
61294             tags[key] = value || void 0;
61295           });
61296           dispatch10.call("change", this, tags, onInput);
61297         }, 0);
61298       };
61299     }
61300     function updatePlaceholder(inputSelection) {
61301       return inputSelection.attr("placeholder", function(subfield) {
61302         if (_tags && Array.isArray(_tags[field.key + ":" + subfield.id])) {
61303           return _t("inspector.multiple_values");
61304         }
61305         if (subfield.isAutoStreetPlace) {
61306           return `${getLocalPlaceholder("street")} / ${getLocalPlaceholder("place")}`;
61307         }
61308         return getLocalPlaceholder(subfield.id);
61309       });
61310     }
61311     function getLocalPlaceholder(key) {
61312       if (_countryCode) {
61313         var localkey = key + "!" + _countryCode;
61314         var tkey = addrField.hasTextForStringId("placeholders." + localkey) ? localkey : key;
61315         return addrField.t("placeholders." + tkey);
61316       }
61317     }
61318     function updateTags(tags) {
61319       utilGetSetValue(_wrap.selectAll("input"), (subfield) => {
61320         var val;
61321         if (subfield.isAutoStreetPlace) {
61322           const streetKey = `${field.key}:street`;
61323           const placeKey = `${field.key}:place`;
61324           if (tags[streetKey] !== void 0 || tags[placeKey] === void 0) {
61325             val = tags[streetKey];
61326             subfield.id = "street";
61327           } else {
61328             val = tags[placeKey];
61329             subfield.id = "place";
61330           }
61331         } else {
61332           val = tags[`${field.key}:${subfield.id}`];
61333         }
61334         return typeof val === "string" ? val : "";
61335       }).attr("title", function(subfield) {
61336         var val = tags[field.key + ":" + subfield.id];
61337         return val && Array.isArray(val) ? val.filter(Boolean).join("\n") : void 0;
61338       }).classed("mixed", function(subfield) {
61339         return Array.isArray(tags[field.key + ":" + subfield.id]);
61340       }).call(updatePlaceholder);
61341     }
61342     function combinedEntityExtent() {
61343       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
61344     }
61345     address.entityIDs = function(val) {
61346       if (!arguments.length)
61347         return _entityIDs;
61348       _entityIDs = val;
61349       return address;
61350     };
61351     address.tags = function(tags) {
61352       _tags = tags;
61353       updateTags(tags);
61354     };
61355     address.focus = function() {
61356       var node = _wrap.selectAll("input").node();
61357       if (node)
61358         node.focus();
61359     };
61360     return utilRebind(address, dispatch10, "on");
61361   }
61362
61363   // modules/ui/fields/directional_combo.js
61364   function uiFieldDirectionalCombo(field, context) {
61365     var dispatch10 = dispatch_default("change");
61366     var items = select_default2(null);
61367     var wrap2 = select_default2(null);
61368     var _tags;
61369     var _combos = {};
61370     if (field.type === "cycleway") {
61371       field = {
61372         ...field,
61373         key: field.keys[0],
61374         keys: field.keys.slice(1)
61375       };
61376     }
61377     function directionalCombo(selection2) {
61378       function stripcolon(s) {
61379         return s.replace(":", "");
61380       }
61381       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
61382       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
61383       var div = wrap2.selectAll("ul").data([0]);
61384       div = div.enter().append("ul").attr("class", "rows").merge(div);
61385       items = div.selectAll("li").data(field.keys);
61386       var enter = items.enter().append("li").attr("class", function(d) {
61387         return "labeled-input preset-directionalcombo-" + stripcolon(d);
61388       });
61389       enter.append("span").attr("class", "label preset-label-directionalcombo").attr("for", function(d) {
61390         return "preset-input-directionalcombo-" + stripcolon(d);
61391       }).html(function(d) {
61392         return field.t.html("types." + d);
61393       });
61394       enter.append("div").attr("class", "preset-input-directionalcombo-wrap form-field-input-wrap").each(function(key) {
61395         const subField = {
61396           ...field,
61397           type: "combo",
61398           key
61399         };
61400         const combo = uiFieldCombo(subField, context);
61401         combo.on("change", (t) => change(key, t[key]));
61402         _combos[key] = combo;
61403         select_default2(this).call(combo);
61404       });
61405       items = items.merge(enter);
61406       wrap2.selectAll(".preset-input-directionalcombo").on("change", change).on("blur", change);
61407     }
61408     function change(key, newValue) {
61409       const commonKey = field.key;
61410       const otherKey = key === field.keys[0] ? field.keys[1] : field.keys[0];
61411       dispatch10.call("change", this, (tags) => {
61412         const otherValue = tags[otherKey] || tags[commonKey];
61413         if (newValue === otherValue) {
61414           tags[commonKey] = newValue;
61415           delete tags[key];
61416           delete tags[otherKey];
61417         } else {
61418           tags[key] = newValue;
61419           delete tags[commonKey];
61420           tags[otherKey] = otherValue;
61421         }
61422         return tags;
61423       });
61424     }
61425     directionalCombo.tags = function(tags) {
61426       _tags = tags;
61427       const commonKey = field.key;
61428       for (let key in _combos) {
61429         const uniqueValues = [...new Set([].concat(_tags[commonKey]).concat(_tags[key]).filter(Boolean))];
61430         _combos[key].tags({ [key]: uniqueValues.length > 1 ? uniqueValues : uniqueValues[0] });
61431       }
61432     };
61433     directionalCombo.focus = function() {
61434       var node = wrap2.selectAll("input").node();
61435       if (node)
61436         node.focus();
61437     };
61438     return utilRebind(directionalCombo, dispatch10, "on");
61439   }
61440
61441   // modules/ui/fields/lanes.js
61442   function uiFieldLanes(field, context) {
61443     var dispatch10 = dispatch_default("change");
61444     var LANE_WIDTH = 40;
61445     var LANE_HEIGHT = 200;
61446     var _entityIDs = [];
61447     function lanes(selection2) {
61448       var lanesData = context.entity(_entityIDs[0]).lanes();
61449       if (!context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode) {
61450         selection2.call(lanes.off);
61451         return;
61452       }
61453       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
61454       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
61455       var surface = wrap2.selectAll(".surface").data([0]);
61456       var d = utilGetDimensions(wrap2);
61457       var freeSpace = d[0] - lanesData.lanes.length * LANE_WIDTH * 1.5 + LANE_WIDTH * 0.5;
61458       surface = surface.enter().append("svg").attr("width", d[0]).attr("height", 300).attr("class", "surface").merge(surface);
61459       var lanesSelection = surface.selectAll(".lanes").data([0]);
61460       lanesSelection = lanesSelection.enter().append("g").attr("class", "lanes").merge(lanesSelection);
61461       lanesSelection.attr("transform", function() {
61462         return "translate(" + freeSpace / 2 + ", 0)";
61463       });
61464       var lane = lanesSelection.selectAll(".lane").data(lanesData.lanes);
61465       lane.exit().remove();
61466       var enter = lane.enter().append("g").attr("class", "lane");
61467       enter.append("g").append("rect").attr("y", 50).attr("width", LANE_WIDTH).attr("height", LANE_HEIGHT);
61468       enter.append("g").attr("class", "forward").append("text").attr("y", 40).attr("x", 14).text("\u25B2");
61469       enter.append("g").attr("class", "bothways").append("text").attr("y", 40).attr("x", 14).text("\u25B2\u25BC");
61470       enter.append("g").attr("class", "backward").append("text").attr("y", 40).attr("x", 14).text("\u25BC");
61471       lane = lane.merge(enter);
61472       lane.attr("transform", function(d2) {
61473         return "translate(" + LANE_WIDTH * d2.index * 1.5 + ", 0)";
61474       });
61475       lane.select(".forward").style("visibility", function(d2) {
61476         return d2.direction === "forward" ? "visible" : "hidden";
61477       });
61478       lane.select(".bothways").style("visibility", function(d2) {
61479         return d2.direction === "bothways" ? "visible" : "hidden";
61480       });
61481       lane.select(".backward").style("visibility", function(d2) {
61482         return d2.direction === "backward" ? "visible" : "hidden";
61483       });
61484     }
61485     lanes.entityIDs = function(val) {
61486       _entityIDs = val;
61487     };
61488     lanes.tags = function() {
61489     };
61490     lanes.focus = function() {
61491     };
61492     lanes.off = function() {
61493     };
61494     return utilRebind(lanes, dispatch10, "on");
61495   }
61496   uiFieldLanes.supportsMultiselection = false;
61497
61498   // modules/ui/fields/localized.js
61499   var _languagesArray = [];
61500   function uiFieldLocalized(field, context) {
61501     var dispatch10 = dispatch_default("change", "input");
61502     var wikipedia = services.wikipedia;
61503     var input = select_default2(null);
61504     var localizedInputs = select_default2(null);
61505     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
61506     var _countryCode;
61507     var _tags;
61508     _mainFileFetcher.get("languages").then(loadLanguagesArray).catch(function() {
61509     });
61510     var _territoryLanguages = {};
61511     _mainFileFetcher.get("territory_languages").then(function(d) {
61512       _territoryLanguages = d;
61513     }).catch(function() {
61514     });
61515     var langCombo = uiCombobox(context, "localized-lang").fetcher(fetchLanguages).minItems(0);
61516     var _selection = select_default2(null);
61517     var _multilingual = [];
61518     var _buttonTip = uiTooltip().title(() => _t.append("translate.translate")).placement("left");
61519     var _wikiTitles;
61520     var _entityIDs = [];
61521     function loadLanguagesArray(dataLanguages) {
61522       if (_languagesArray.length !== 0)
61523         return;
61524       var replacements = {
61525         sr: "sr-Cyrl",
61526         // in OSM, `sr` implies Cyrillic
61527         "sr-Cyrl": false
61528         // `sr-Cyrl` isn't used in OSM
61529       };
61530       for (var code in dataLanguages) {
61531         if (replacements[code] === false)
61532           continue;
61533         var metaCode = code;
61534         if (replacements[code])
61535           metaCode = replacements[code];
61536         _languagesArray.push({
61537           localName: _mainLocalizer.languageName(metaCode, { localOnly: true }),
61538           nativeName: dataLanguages[metaCode].nativeName,
61539           code,
61540           label: _mainLocalizer.languageName(metaCode)
61541         });
61542       }
61543     }
61544     function calcLocked() {
61545       var isLocked = field.id === "name" && _entityIDs.length && _entityIDs.some(function(entityID) {
61546         var entity = context.graph().hasEntity(entityID);
61547         if (!entity)
61548           return false;
61549         if (entity.tags.wikidata)
61550           return true;
61551         if (entity.tags["name:etymology:wikidata"])
61552           return true;
61553         var preset = _mainPresetIndex.match(entity, context.graph());
61554         if (preset) {
61555           var isSuggestion = preset.suggestion;
61556           var fields = preset.fields(entity.extent(context.graph()).center());
61557           var showsBrandField = fields.some(function(d) {
61558             return d.id === "brand";
61559           });
61560           var showsOperatorField = fields.some(function(d) {
61561             return d.id === "operator";
61562           });
61563           var setsName = preset.addTags.name;
61564           var setsBrandWikidata = preset.addTags["brand:wikidata"];
61565           var setsOperatorWikidata = preset.addTags["operator:wikidata"];
61566           return isSuggestion && setsName && (setsBrandWikidata && !showsBrandField || setsOperatorWikidata && !showsOperatorField);
61567         }
61568         return false;
61569       });
61570       field.locked(isLocked);
61571     }
61572     function calcMultilingual(tags) {
61573       var existingLangsOrdered = _multilingual.map(function(item2) {
61574         return item2.lang;
61575       });
61576       var existingLangs = new Set(existingLangsOrdered.filter(Boolean));
61577       for (var k in tags) {
61578         var m = k.match(/^(.*):([a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?)$/);
61579         if (m && m[1] === field.key && m[2]) {
61580           var item = { lang: m[2], value: tags[k] };
61581           if (existingLangs.has(item.lang)) {
61582             _multilingual[existingLangsOrdered.indexOf(item.lang)].value = item.value;
61583             existingLangs.delete(item.lang);
61584           } else {
61585             _multilingual.push(item);
61586           }
61587         }
61588       }
61589       _multilingual.forEach(function(item2) {
61590         if (item2.lang && existingLangs.has(item2.lang)) {
61591           item2.value = "";
61592         }
61593       });
61594     }
61595     function localized(selection2) {
61596       _selection = selection2;
61597       calcLocked();
61598       var isLocked = field.locked();
61599       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
61600       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
61601       input = wrap2.selectAll(".localized-main").data([0]);
61602       input = input.enter().append("input").attr("type", "text").attr("id", field.domId).attr("class", "localized-main").call(utilNoAuto).merge(input);
61603       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
61604       wrap2.call(_lengthIndicator);
61605       var translateButton = wrap2.selectAll(".localized-add").data([0]);
61606       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);
61607       translateButton.classed("disabled", !!isLocked).call(isLocked ? _buttonTip.destroy : _buttonTip).on("click", addNew);
61608       if (_tags && !_multilingual.length) {
61609         calcMultilingual(_tags);
61610       }
61611       localizedInputs = selection2.selectAll(".localized-multilingual").data([0]);
61612       localizedInputs = localizedInputs.enter().append("div").attr("class", "localized-multilingual").merge(localizedInputs);
61613       localizedInputs.call(renderMultilingual);
61614       localizedInputs.selectAll("button, input").classed("disabled", !!isLocked).attr("readonly", isLocked || null);
61615       selection2.selectAll(".combobox-caret").classed("nope", true);
61616       function addNew(d3_event) {
61617         d3_event.preventDefault();
61618         if (field.locked())
61619           return;
61620         var defaultLang = _mainLocalizer.languageCode().toLowerCase();
61621         var langExists = _multilingual.find(function(datum2) {
61622           return datum2.lang === defaultLang;
61623         });
61624         var isLangEn = defaultLang.indexOf("en") > -1;
61625         if (isLangEn || langExists) {
61626           defaultLang = "";
61627           langExists = _multilingual.find(function(datum2) {
61628             return datum2.lang === defaultLang;
61629           });
61630         }
61631         if (!langExists) {
61632           _multilingual.unshift({ lang: defaultLang, value: "" });
61633           localizedInputs.call(renderMultilingual);
61634         }
61635       }
61636       function change(onInput) {
61637         return function(d3_event) {
61638           if (field.locked()) {
61639             d3_event.preventDefault();
61640             return;
61641           }
61642           var val = utilGetSetValue(select_default2(this));
61643           if (!onInput)
61644             val = context.cleanTagValue(val);
61645           if (!val && Array.isArray(_tags[field.key]))
61646             return;
61647           var t = {};
61648           t[field.key] = val || void 0;
61649           dispatch10.call("change", this, t, onInput);
61650         };
61651       }
61652     }
61653     function key(lang) {
61654       return field.key + ":" + lang;
61655     }
61656     function changeLang(d3_event, d) {
61657       var tags = {};
61658       var lang = utilGetSetValue(select_default2(this)).toLowerCase();
61659       var language = _languagesArray.find(function(d2) {
61660         return d2.label.toLowerCase() === lang || d2.localName && d2.localName.toLowerCase() === lang || d2.nativeName && d2.nativeName.toLowerCase() === lang;
61661       });
61662       if (language)
61663         lang = language.code;
61664       if (d.lang && d.lang !== lang) {
61665         tags[key(d.lang)] = void 0;
61666       }
61667       var newKey = lang && context.cleanTagKey(key(lang));
61668       var value = utilGetSetValue(select_default2(this.parentNode).selectAll(".localized-value"));
61669       if (newKey && value) {
61670         tags[newKey] = value;
61671       } else if (newKey && _wikiTitles && _wikiTitles[d.lang]) {
61672         tags[newKey] = _wikiTitles[d.lang];
61673       }
61674       d.lang = lang;
61675       dispatch10.call("change", this, tags);
61676     }
61677     function changeValue(d3_event, d) {
61678       if (!d.lang)
61679         return;
61680       var value = context.cleanTagValue(utilGetSetValue(select_default2(this))) || void 0;
61681       if (!value && Array.isArray(d.value))
61682         return;
61683       var t = {};
61684       t[key(d.lang)] = value;
61685       d.value = value;
61686       dispatch10.call("change", this, t);
61687     }
61688     function fetchLanguages(value, cb) {
61689       var v = value.toLowerCase();
61690       var langCodes = [_mainLocalizer.localeCode(), _mainLocalizer.languageCode()];
61691       if (_countryCode && _territoryLanguages[_countryCode]) {
61692         langCodes = langCodes.concat(_territoryLanguages[_countryCode]);
61693       }
61694       var langItems = [];
61695       langCodes.forEach(function(code) {
61696         var langItem = _languagesArray.find(function(item) {
61697           return item.code === code;
61698         });
61699         if (langItem)
61700           langItems.push(langItem);
61701       });
61702       langItems = utilArrayUniq(langItems.concat(_languagesArray));
61703       cb(langItems.filter(function(d) {
61704         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;
61705       }).map(function(d) {
61706         return { value: d.label };
61707       }));
61708     }
61709     function renderMultilingual(selection2) {
61710       var entries = selection2.selectAll("div.entry").data(_multilingual, function(d) {
61711         return d.lang;
61712       });
61713       entries.exit().style("top", "0").style("max-height", "240px").transition().duration(200).style("opacity", "0").style("max-height", "0px").remove();
61714       var entriesEnter = entries.enter().append("div").attr("class", "entry").each(function(_, index) {
61715         var wrap2 = select_default2(this);
61716         var domId = utilUniqueDomId(index);
61717         var label = wrap2.append("label").attr("class", "field-label").attr("for", domId);
61718         var text2 = label.append("span").attr("class", "label-text");
61719         text2.append("span").attr("class", "label-textvalue").call(_t.append("translate.localized_translation_label"));
61720         text2.append("span").attr("class", "label-textannotation");
61721         label.append("button").attr("class", "remove-icon-multilingual").attr("title", _t("icons.remove")).on("click", function(d3_event, d) {
61722           if (field.locked())
61723             return;
61724           d3_event.preventDefault();
61725           _multilingual.splice(_multilingual.indexOf(d), 1);
61726           var langKey = d.lang && key(d.lang);
61727           if (langKey && langKey in _tags) {
61728             delete _tags[langKey];
61729             var t = {};
61730             t[langKey] = void 0;
61731             dispatch10.call("change", this, t);
61732             return;
61733           }
61734           renderMultilingual(selection2);
61735         }).call(svgIcon("#iD-operation-delete"));
61736         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);
61737         wrap2.append("input").attr("type", "text").attr("class", "localized-value").on("blur", changeValue).on("change", changeValue);
61738       });
61739       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() {
61740         select_default2(this).style("max-height", "").style("overflow", "visible");
61741       });
61742       entries = entries.merge(entriesEnter);
61743       entries.order();
61744       entries.classed("present", true);
61745       utilGetSetValue(entries.select(".localized-lang"), function(d) {
61746         var langItem = _languagesArray.find(function(item) {
61747           return item.code === d.lang;
61748         });
61749         if (langItem)
61750           return langItem.label;
61751         return d.lang;
61752       });
61753       utilGetSetValue(entries.select(".localized-value"), function(d) {
61754         return typeof d.value === "string" ? d.value : "";
61755       }).attr("title", function(d) {
61756         return Array.isArray(d.value) ? d.value.filter(Boolean).join("\n") : null;
61757       }).attr("placeholder", function(d) {
61758         return Array.isArray(d.value) ? _t("inspector.multiple_values") : _t("translate.localized_translation_name");
61759       }).classed("mixed", function(d) {
61760         return Array.isArray(d.value);
61761       });
61762     }
61763     localized.tags = function(tags) {
61764       _tags = tags;
61765       if (typeof tags.wikipedia === "string" && !_wikiTitles) {
61766         _wikiTitles = {};
61767         var wm = tags.wikipedia.match(/([^:]+):(.+)/);
61768         if (wm && wm[0] && wm[1]) {
61769           wikipedia.translations(wm[1], wm[2], function(err, d) {
61770             if (err || !d)
61771               return;
61772             _wikiTitles = d;
61773           });
61774         }
61775       }
61776       var isMixed = Array.isArray(tags[field.key]);
61777       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);
61778       calcMultilingual(tags);
61779       _selection.call(localized);
61780       if (!isMixed) {
61781         _lengthIndicator.update(tags[field.key]);
61782       }
61783     };
61784     localized.focus = function() {
61785       input.node().focus();
61786     };
61787     localized.entityIDs = function(val) {
61788       if (!arguments.length)
61789         return _entityIDs;
61790       _entityIDs = val;
61791       _multilingual = [];
61792       loadCountryCode();
61793       return localized;
61794     };
61795     function loadCountryCode() {
61796       var extent = combinedEntityExtent();
61797       var countryCode = extent && iso1A2Code(extent.center());
61798       _countryCode = countryCode && countryCode.toLowerCase();
61799     }
61800     function combinedEntityExtent() {
61801       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
61802     }
61803     return utilRebind(localized, dispatch10, "on");
61804   }
61805
61806   // modules/ui/fields/roadheight.js
61807   function uiFieldRoadheight(field, context) {
61808     var dispatch10 = dispatch_default("change");
61809     var primaryUnitInput = select_default2(null);
61810     var primaryInput = select_default2(null);
61811     var secondaryInput = select_default2(null);
61812     var secondaryUnitInput = select_default2(null);
61813     var _entityIDs = [];
61814     var _tags;
61815     var _isImperial;
61816     var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
61817     var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
61818     var primaryUnits = [
61819       {
61820         value: "m",
61821         title: _t("inspector.roadheight.meter")
61822       },
61823       {
61824         value: "ft",
61825         title: _t("inspector.roadheight.foot")
61826       }
61827     ];
61828     var unitCombo = uiCombobox(context, "roadheight-unit").data(primaryUnits);
61829     function roadheight(selection2) {
61830       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
61831       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
61832       primaryInput = wrap2.selectAll("input.roadheight-number").data([0]);
61833       primaryInput = primaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-number").attr("id", field.domId).call(utilNoAuto).merge(primaryInput);
61834       primaryInput.on("change", change).on("blur", change);
61835       var loc = combinedEntityExtent().center();
61836       _isImperial = roadHeightUnit(loc) === "ft";
61837       primaryUnitInput = wrap2.selectAll("input.roadheight-unit").data([0]);
61838       primaryUnitInput = primaryUnitInput.enter().append("input").attr("type", "text").attr("class", "roadheight-unit").call(unitCombo).merge(primaryUnitInput);
61839       primaryUnitInput.on("blur", changeUnits).on("change", changeUnits);
61840       secondaryInput = wrap2.selectAll("input.roadheight-secondary-number").data([0]);
61841       secondaryInput = secondaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-secondary-number").call(utilNoAuto).merge(secondaryInput);
61842       secondaryInput.on("change", change).on("blur", change);
61843       secondaryUnitInput = wrap2.selectAll("input.roadheight-secondary-unit").data([0]);
61844       secondaryUnitInput = secondaryUnitInput.enter().append("input").attr("type", "text").call(utilNoAuto).classed("disabled", true).classed("roadheight-secondary-unit", true).attr("readonly", "readonly").merge(secondaryUnitInput);
61845       function changeUnits() {
61846         var primaryUnit = utilGetSetValue(primaryUnitInput);
61847         if (primaryUnit === "m") {
61848           _isImperial = false;
61849         } else if (primaryUnit === "ft") {
61850           _isImperial = true;
61851         }
61852         utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
61853         setUnitSuggestions();
61854         change();
61855       }
61856     }
61857     function setUnitSuggestions() {
61858       utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
61859     }
61860     function change() {
61861       var tag = {};
61862       var primaryValue = utilGetSetValue(primaryInput).trim();
61863       var secondaryValue = utilGetSetValue(secondaryInput).trim();
61864       if (!primaryValue && !secondaryValue && Array.isArray(_tags[field.key]))
61865         return;
61866       if (!primaryValue && !secondaryValue) {
61867         tag[field.key] = void 0;
61868       } else {
61869         var rawPrimaryValue = likelyRawNumberFormat.test(primaryValue) ? parseFloat(primaryValue) : parseLocaleFloat(primaryValue);
61870         if (isNaN(rawPrimaryValue))
61871           rawPrimaryValue = primaryValue;
61872         var rawSecondaryValue = likelyRawNumberFormat.test(secondaryValue) ? parseFloat(secondaryValue) : parseLocaleFloat(secondaryValue);
61873         if (isNaN(rawSecondaryValue))
61874           rawSecondaryValue = secondaryValue;
61875         if (isNaN(rawPrimaryValue) || isNaN(rawSecondaryValue) || !_isImperial) {
61876           tag[field.key] = context.cleanTagValue(rawPrimaryValue);
61877         } else {
61878           if (rawPrimaryValue !== "") {
61879             rawPrimaryValue = rawPrimaryValue + "'";
61880           }
61881           if (rawSecondaryValue !== "") {
61882             rawSecondaryValue = rawSecondaryValue + '"';
61883           }
61884           tag[field.key] = context.cleanTagValue(rawPrimaryValue + rawSecondaryValue);
61885         }
61886       }
61887       dispatch10.call("change", this, tag);
61888     }
61889     roadheight.tags = function(tags) {
61890       _tags = tags;
61891       var primaryValue = tags[field.key];
61892       var secondaryValue;
61893       var isMixed = Array.isArray(primaryValue);
61894       if (!isMixed) {
61895         if (primaryValue && (primaryValue.indexOf("'") >= 0 || primaryValue.indexOf('"') >= 0)) {
61896           secondaryValue = primaryValue.match(/(-?[\d.]+)"/);
61897           if (secondaryValue !== null) {
61898             secondaryValue = formatFloat(parseFloat(secondaryValue[1]));
61899           }
61900           primaryValue = primaryValue.match(/(-?[\d.]+)'/);
61901           if (primaryValue !== null) {
61902             primaryValue = formatFloat(parseFloat(primaryValue[1]));
61903           }
61904           _isImperial = true;
61905         } else if (primaryValue) {
61906           var rawValue = primaryValue;
61907           primaryValue = parseFloat(rawValue);
61908           if (isNaN(primaryValue)) {
61909             primaryValue = rawValue;
61910           } else {
61911             primaryValue = formatFloat(primaryValue);
61912           }
61913           _isImperial = false;
61914         }
61915       }
61916       setUnitSuggestions();
61917       var inchesPlaceholder = formatFloat(0);
61918       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);
61919       utilGetSetValue(secondaryInput, typeof secondaryValue === "string" ? secondaryValue : "").attr("placeholder", isMixed ? _t("inspector.multiple_values") : _isImperial ? inchesPlaceholder : null).classed("mixed", isMixed).classed("disabled", !_isImperial).attr("readonly", _isImperial ? null : "readonly");
61920       secondaryUnitInput.attr("value", _isImperial ? _t("inspector.roadheight.inch") : null);
61921     };
61922     roadheight.focus = function() {
61923       primaryInput.node().focus();
61924     };
61925     roadheight.entityIDs = function(val) {
61926       _entityIDs = val;
61927     };
61928     function combinedEntityExtent() {
61929       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
61930     }
61931     return utilRebind(roadheight, dispatch10, "on");
61932   }
61933
61934   // modules/ui/fields/roadspeed.js
61935   function uiFieldRoadspeed(field, context) {
61936     var dispatch10 = dispatch_default("change");
61937     var unitInput = select_default2(null);
61938     var input = select_default2(null);
61939     var _entityIDs = [];
61940     var _tags;
61941     var _isImperial;
61942     var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
61943     var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
61944     var speedCombo = uiCombobox(context, "roadspeed");
61945     var unitCombo = uiCombobox(context, "roadspeed-unit").data(["km/h", "mph"].map(comboValues));
61946     var metricValues = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120];
61947     var imperialValues = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80];
61948     function roadspeed(selection2) {
61949       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
61950       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
61951       input = wrap2.selectAll("input.roadspeed-number").data([0]);
61952       input = input.enter().append("input").attr("type", "text").attr("class", "roadspeed-number").attr("id", field.domId).call(utilNoAuto).call(speedCombo).merge(input);
61953       input.on("change", change).on("blur", change);
61954       var loc = combinedEntityExtent().center();
61955       _isImperial = roadSpeedUnit(loc) === "mph";
61956       unitInput = wrap2.selectAll("input.roadspeed-unit").data([0]);
61957       unitInput = unitInput.enter().append("input").attr("type", "text").attr("class", "roadspeed-unit").attr("aria-label", _t("inspector.speed_unit")).call(unitCombo).merge(unitInput);
61958       unitInput.on("blur", changeUnits).on("change", changeUnits);
61959       function changeUnits() {
61960         var unit2 = utilGetSetValue(unitInput);
61961         if (unit2 === "km/h") {
61962           _isImperial = false;
61963         } else if (unit2 === "mph") {
61964           _isImperial = true;
61965         }
61966         utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
61967         setUnitSuggestions();
61968         change();
61969       }
61970     }
61971     function setUnitSuggestions() {
61972       speedCombo.data((_isImperial ? imperialValues : metricValues).map(comboValues));
61973       utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
61974     }
61975     function comboValues(d) {
61976       return {
61977         value: formatFloat(d),
61978         title: formatFloat(d)
61979       };
61980     }
61981     function change() {
61982       var tag = {};
61983       var value = utilGetSetValue(input).trim();
61984       if (!value && Array.isArray(_tags[field.key]))
61985         return;
61986       if (!value) {
61987         tag[field.key] = void 0;
61988       } else {
61989         var rawValue = likelyRawNumberFormat.test(value) ? parseFloat(value) : parseLocaleFloat(value);
61990         if (isNaN(rawValue))
61991           rawValue = value;
61992         if (isNaN(rawValue) || !_isImperial) {
61993           tag[field.key] = context.cleanTagValue(rawValue);
61994         } else {
61995           tag[field.key] = context.cleanTagValue(rawValue + " mph");
61996         }
61997       }
61998       dispatch10.call("change", this, tag);
61999     }
62000     roadspeed.tags = function(tags) {
62001       _tags = tags;
62002       var rawValue = tags[field.key];
62003       var value = rawValue;
62004       var isMixed = Array.isArray(value);
62005       if (!isMixed) {
62006         if (rawValue && rawValue.indexOf("mph") >= 0) {
62007           _isImperial = true;
62008         } else if (rawValue) {
62009           _isImperial = false;
62010         }
62011         value = parseInt(value, 10);
62012         if (isNaN(value)) {
62013           value = rawValue;
62014         } else {
62015           value = formatFloat(value);
62016         }
62017       }
62018       setUnitSuggestions();
62019       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);
62020     };
62021     roadspeed.focus = function() {
62022       input.node().focus();
62023     };
62024     roadspeed.entityIDs = function(val) {
62025       _entityIDs = val;
62026     };
62027     function combinedEntityExtent() {
62028       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
62029     }
62030     return utilRebind(roadspeed, dispatch10, "on");
62031   }
62032
62033   // modules/ui/fields/radio.js
62034   function uiFieldRadio(field, context) {
62035     var dispatch10 = dispatch_default("change");
62036     var placeholder = select_default2(null);
62037     var wrap2 = select_default2(null);
62038     var labels = select_default2(null);
62039     var radios = select_default2(null);
62040     var radioData = (field.options || field.keys).slice();
62041     var typeField;
62042     var layerField;
62043     var _oldType = {};
62044     var _entityIDs = [];
62045     function selectedKey() {
62046       var node = wrap2.selectAll(".form-field-input-radio label.active input");
62047       return !node.empty() && node.datum();
62048     }
62049     function radio(selection2) {
62050       selection2.classed("preset-radio", true);
62051       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
62052       var enter = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-radio");
62053       enter.append("span").attr("class", "placeholder");
62054       wrap2 = wrap2.merge(enter);
62055       placeholder = wrap2.selectAll(".placeholder");
62056       labels = wrap2.selectAll("label").data(radioData);
62057       enter = labels.enter().append("label");
62058       var stringsField = field.resolveReference("stringsCrossReference");
62059       enter.append("input").attr("type", "radio").attr("name", field.id).attr("value", function(d) {
62060         return stringsField.t("options." + d, { "default": d });
62061       }).attr("checked", false);
62062       enter.append("span").each(function(d) {
62063         stringsField.t.append("options." + d, { "default": d })(select_default2(this));
62064       });
62065       labels = labels.merge(enter);
62066       radios = labels.selectAll("input").on("change", changeRadio);
62067     }
62068     function structureExtras(selection2, tags) {
62069       var selected = selectedKey() || tags.layer !== void 0;
62070       var type2 = _mainPresetIndex.field(selected);
62071       var layer = _mainPresetIndex.field("layer");
62072       var showLayer = selected === "bridge" || selected === "tunnel" || tags.layer !== void 0;
62073       var extrasWrap = selection2.selectAll(".structure-extras-wrap").data(selected ? [0] : []);
62074       extrasWrap.exit().remove();
62075       extrasWrap = extrasWrap.enter().append("div").attr("class", "structure-extras-wrap").merge(extrasWrap);
62076       var list = extrasWrap.selectAll("ul").data([0]);
62077       list = list.enter().append("ul").attr("class", "rows").merge(list);
62078       if (type2) {
62079         if (!typeField || typeField.id !== selected) {
62080           typeField = uiField(context, type2, _entityIDs, { wrap: false }).on("change", changeType);
62081         }
62082         typeField.tags(tags);
62083       } else {
62084         typeField = null;
62085       }
62086       var typeItem = list.selectAll(".structure-type-item").data(typeField ? [typeField] : [], function(d) {
62087         return d.id;
62088       });
62089       typeItem.exit().remove();
62090       var typeEnter = typeItem.enter().insert("li", ":first-child").attr("class", "labeled-input structure-type-item");
62091       typeEnter.append("span").attr("class", "label structure-label-type").attr("for", "preset-input-" + selected).call(_t.append("inspector.radio.structure.type"));
62092       typeEnter.append("div").attr("class", "structure-input-type-wrap");
62093       typeItem = typeItem.merge(typeEnter);
62094       if (typeField) {
62095         typeItem.selectAll(".structure-input-type-wrap").call(typeField.render);
62096       }
62097       if (layer && showLayer) {
62098         if (!layerField) {
62099           layerField = uiField(context, layer, _entityIDs, { wrap: false }).on("change", changeLayer);
62100         }
62101         layerField.tags(tags);
62102         field.keys = utilArrayUnion(field.keys, ["layer"]);
62103       } else {
62104         layerField = null;
62105         field.keys = field.keys.filter(function(k) {
62106           return k !== "layer";
62107         });
62108       }
62109       var layerItem = list.selectAll(".structure-layer-item").data(layerField ? [layerField] : []);
62110       layerItem.exit().remove();
62111       var layerEnter = layerItem.enter().append("li").attr("class", "labeled-input structure-layer-item");
62112       layerEnter.append("span").attr("class", "label structure-label-layer").attr("for", "preset-input-layer").call(_t.append("inspector.radio.structure.layer"));
62113       layerEnter.append("div").attr("class", "structure-input-layer-wrap");
62114       layerItem = layerItem.merge(layerEnter);
62115       if (layerField) {
62116         layerItem.selectAll(".structure-input-layer-wrap").call(layerField.render);
62117       }
62118     }
62119     function changeType(t, onInput) {
62120       var key = selectedKey();
62121       if (!key)
62122         return;
62123       var val = t[key];
62124       if (val !== "no") {
62125         _oldType[key] = val;
62126       }
62127       if (field.type === "structureRadio") {
62128         if (val === "no" || key !== "bridge" && key !== "tunnel" || key === "tunnel" && val === "building_passage") {
62129           t.layer = void 0;
62130         }
62131         if (t.layer === void 0) {
62132           if (key === "bridge" && val !== "no") {
62133             t.layer = "1";
62134           }
62135           if (key === "tunnel" && val !== "no" && val !== "building_passage") {
62136             t.layer = "-1";
62137           }
62138         }
62139       }
62140       dispatch10.call("change", this, t, onInput);
62141     }
62142     function changeLayer(t, onInput) {
62143       if (t.layer === "0") {
62144         t.layer = void 0;
62145       }
62146       dispatch10.call("change", this, t, onInput);
62147     }
62148     function changeRadio() {
62149       var t = {};
62150       var activeKey;
62151       if (field.key) {
62152         t[field.key] = void 0;
62153       }
62154       radios.each(function(d) {
62155         var active = select_default2(this).property("checked");
62156         if (active)
62157           activeKey = d;
62158         if (field.key) {
62159           if (active)
62160             t[field.key] = d;
62161         } else {
62162           var val = _oldType[activeKey] || "yes";
62163           t[d] = active ? val : void 0;
62164         }
62165       });
62166       if (field.type === "structureRadio") {
62167         if (activeKey === "bridge") {
62168           t.layer = "1";
62169         } else if (activeKey === "tunnel" && t.tunnel !== "building_passage") {
62170           t.layer = "-1";
62171         } else {
62172           t.layer = void 0;
62173         }
62174       }
62175       dispatch10.call("change", this, t);
62176     }
62177     radio.tags = function(tags) {
62178       function isOptionChecked(d) {
62179         if (field.key) {
62180           return tags[field.key] === d;
62181         }
62182         return !!(typeof tags[d] === "string" && tags[d].toLowerCase() !== "no");
62183       }
62184       function isMixed(d) {
62185         if (field.key) {
62186           return Array.isArray(tags[field.key]) && tags[field.key].includes(d);
62187         }
62188         return Array.isArray(tags[d]);
62189       }
62190       radios.property("checked", function(d) {
62191         return isOptionChecked(d) && (field.key || field.options.filter(isOptionChecked).length === 1);
62192       });
62193       labels.classed("active", function(d) {
62194         if (field.key) {
62195           return Array.isArray(tags[field.key]) && tags[field.key].includes(d) || tags[field.key] === d;
62196         }
62197         return Array.isArray(tags[d]) && tags[d].some((v) => typeof v === "string" && v.toLowerCase() !== "no") || !!(typeof tags[d] === "string" && tags[d].toLowerCase() !== "no");
62198       }).classed("mixed", isMixed).attr("title", function(d) {
62199         return isMixed(d) ? _t("inspector.unshared_value_tooltip") : null;
62200       });
62201       var selection2 = radios.filter(function() {
62202         return this.checked;
62203       });
62204       if (selection2.empty()) {
62205         placeholder.text("");
62206         placeholder.call(_t.append("inspector.none"));
62207       } else {
62208         placeholder.text(selection2.attr("value"));
62209         _oldType[selection2.datum()] = tags[selection2.datum()];
62210       }
62211       if (field.type === "structureRadio") {
62212         if (!!tags.waterway && !_oldType.tunnel) {
62213           _oldType.tunnel = "culvert";
62214         }
62215         wrap2.call(structureExtras, tags);
62216       }
62217     };
62218     radio.focus = function() {
62219       radios.node().focus();
62220     };
62221     radio.entityIDs = function(val) {
62222       if (!arguments.length)
62223         return _entityIDs;
62224       _entityIDs = val;
62225       _oldType = {};
62226       return radio;
62227     };
62228     radio.isAllowed = function() {
62229       return _entityIDs.length === 1;
62230     };
62231     return utilRebind(radio, dispatch10, "on");
62232   }
62233
62234   // modules/ui/fields/restrictions.js
62235   function uiFieldRestrictions(field, context) {
62236     var dispatch10 = dispatch_default("change");
62237     var breathe = behaviorBreathe(context);
62238     corePreferences("turn-restriction-via-way", null);
62239     var storedViaWay = corePreferences("turn-restriction-via-way0");
62240     var storedDistance = corePreferences("turn-restriction-distance");
62241     var _maxViaWay = storedViaWay !== null ? +storedViaWay : 0;
62242     var _maxDistance = storedDistance ? +storedDistance : 30;
62243     var _initialized2 = false;
62244     var _parent = select_default2(null);
62245     var _container = select_default2(null);
62246     var _oldTurns;
62247     var _graph;
62248     var _vertexID;
62249     var _intersection;
62250     var _fromWayID;
62251     var _lastXPos;
62252     function restrictions(selection2) {
62253       _parent = selection2;
62254       if (_vertexID && (context.graph() !== _graph || !_intersection)) {
62255         _graph = context.graph();
62256         _intersection = osmIntersection(_graph, _vertexID, _maxDistance);
62257       }
62258       var isOK = _intersection && _intersection.vertices.length && // has vertices
62259       _intersection.vertices.filter(function(vertex) {
62260         return vertex.id === _vertexID;
62261       }).length && _intersection.ways.length > 2 && // has more than 2 ways
62262       _intersection.ways.filter(function(way) {
62263         return way.__to;
62264       }).length > 1;
62265       select_default2(selection2.node().parentNode).classed("hide", !isOK);
62266       if (!isOK || !context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode || !selection2.node().parentNode.parentNode) {
62267         selection2.call(restrictions.off);
62268         return;
62269       }
62270       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
62271       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
62272       var container = wrap2.selectAll(".restriction-container").data([0]);
62273       var containerEnter = container.enter().append("div").attr("class", "restriction-container");
62274       containerEnter.append("div").attr("class", "restriction-help");
62275       _container = containerEnter.merge(container).call(renderViewer);
62276       var controls = wrap2.selectAll(".restriction-controls").data([0]);
62277       controls.enter().append("div").attr("class", "restriction-controls-container").append("div").attr("class", "restriction-controls").merge(controls).call(renderControls);
62278     }
62279     function renderControls(selection2) {
62280       var distControl = selection2.selectAll(".restriction-distance").data([0]);
62281       distControl.exit().remove();
62282       var distControlEnter = distControl.enter().append("div").attr("class", "restriction-control restriction-distance");
62283       distControlEnter.append("span").attr("class", "restriction-control-label restriction-distance-label").call(_t.append("restriction.controls.distance", { suffix: ":" }));
62284       distControlEnter.append("input").attr("class", "restriction-distance-input").attr("type", "range").attr("min", "20").attr("max", "50").attr("step", "5");
62285       distControlEnter.append("span").attr("class", "restriction-distance-text");
62286       selection2.selectAll(".restriction-distance-input").property("value", _maxDistance).on("input", function() {
62287         var val = select_default2(this).property("value");
62288         _maxDistance = +val;
62289         _intersection = null;
62290         _container.selectAll(".layer-osm .layer-turns *").remove();
62291         corePreferences("turn-restriction-distance", _maxDistance);
62292         _parent.call(restrictions);
62293       });
62294       selection2.selectAll(".restriction-distance-text").call(displayMaxDistance(_maxDistance));
62295       var viaControl = selection2.selectAll(".restriction-via-way").data([0]);
62296       viaControl.exit().remove();
62297       var viaControlEnter = viaControl.enter().append("div").attr("class", "restriction-control restriction-via-way");
62298       viaControlEnter.append("span").attr("class", "restriction-control-label restriction-via-way-label").call(_t.append("restriction.controls.via", { suffix: ":" }));
62299       viaControlEnter.append("input").attr("class", "restriction-via-way-input").attr("type", "range").attr("min", "0").attr("max", "2").attr("step", "1");
62300       viaControlEnter.append("span").attr("class", "restriction-via-way-text");
62301       selection2.selectAll(".restriction-via-way-input").property("value", _maxViaWay).on("input", function() {
62302         var val = select_default2(this).property("value");
62303         _maxViaWay = +val;
62304         _container.selectAll(".layer-osm .layer-turns *").remove();
62305         corePreferences("turn-restriction-via-way0", _maxViaWay);
62306         _parent.call(restrictions);
62307       });
62308       selection2.selectAll(".restriction-via-way-text").call(displayMaxVia(_maxViaWay));
62309     }
62310     function renderViewer(selection2) {
62311       if (!_intersection)
62312         return;
62313       var vgraph = _intersection.graph;
62314       var filter2 = utilFunctor(true);
62315       var projection2 = geoRawMercator();
62316       var sdims = utilGetDimensions(context.container().select(".sidebar"));
62317       var d = [sdims[0] - 50, 370];
62318       var c = geoVecScale(d, 0.5);
62319       var z = 22;
62320       projection2.scale(geoZoomToScale(z));
62321       var extent = geoExtent();
62322       for (var i2 = 0; i2 < _intersection.vertices.length; i2++) {
62323         extent._extend(_intersection.vertices[i2].extent());
62324       }
62325       var padTop = 35;
62326       if (_intersection.vertices.length > 1) {
62327         var hPadding = Math.min(160, Math.max(110, d[0] * 0.4));
62328         var vPadding = 160;
62329         var tl = projection2([extent[0][0], extent[1][1]]);
62330         var br = projection2([extent[1][0], extent[0][1]]);
62331         var hFactor = (br[0] - tl[0]) / (d[0] - hPadding);
62332         var vFactor = (br[1] - tl[1]) / (d[1] - vPadding - padTop);
62333         var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
62334         var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
62335         z = z - Math.max(hZoomDiff, vZoomDiff);
62336         projection2.scale(geoZoomToScale(z));
62337       }
62338       var extentCenter = projection2(extent.center());
62339       extentCenter[1] = extentCenter[1] - padTop / 2;
62340       projection2.translate(geoVecSubtract(c, extentCenter)).clipExtent([[0, 0], d]);
62341       var drawLayers = svgLayers(projection2, context).only(["osm", "touch"]).dimensions(d);
62342       var drawVertices = svgVertices(projection2, context);
62343       var drawLines = svgLines(projection2, context);
62344       var drawTurns = svgTurns(projection2, context);
62345       var firstTime = selection2.selectAll(".surface").empty();
62346       selection2.call(drawLayers);
62347       var surface = selection2.selectAll(".surface").classed("tr", true);
62348       if (firstTime) {
62349         _initialized2 = true;
62350         surface.call(breathe);
62351       }
62352       if (_fromWayID && !vgraph.hasEntity(_fromWayID)) {
62353         _fromWayID = null;
62354         _oldTurns = null;
62355       }
62356       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));
62357       surface.on("click.restrictions", click).on("mouseover.restrictions", mouseover);
62358       surface.selectAll(".selected").classed("selected", false);
62359       surface.selectAll(".related").classed("related", false);
62360       var way;
62361       if (_fromWayID) {
62362         way = vgraph.entity(_fromWayID);
62363         surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
62364       }
62365       document.addEventListener("resizeWindow", function() {
62366         utilSetDimensions(_container, null);
62367         redraw(1);
62368       }, false);
62369       updateHints(null);
62370       function click(d3_event) {
62371         surface.call(breathe.off).call(breathe);
62372         var datum2 = d3_event.target.__data__;
62373         var entity = datum2 && datum2.properties && datum2.properties.entity;
62374         if (entity) {
62375           datum2 = entity;
62376         }
62377         if (datum2 instanceof osmWay && (datum2.__from || datum2.__via)) {
62378           _fromWayID = datum2.id;
62379           _oldTurns = null;
62380           redraw();
62381         } else if (datum2 instanceof osmTurn) {
62382           var actions, extraActions, turns, i3;
62383           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
62384           if (datum2.restrictionID && !datum2.direct) {
62385             return;
62386           } else if (datum2.restrictionID && !datum2.only) {
62387             var seen = {};
62388             var datumOnly = JSON.parse(JSON.stringify(datum2));
62389             datumOnly.only = true;
62390             restrictionType = restrictionType.replace(/^no/, "only");
62391             turns = _intersection.turns(_fromWayID, 2);
62392             extraActions = [];
62393             _oldTurns = [];
62394             for (i3 = 0; i3 < turns.length; i3++) {
62395               var turn = turns[i3];
62396               if (seen[turn.restrictionID])
62397                 continue;
62398               if (turn.direct && turn.path[1] === datum2.path[1]) {
62399                 seen[turns[i3].restrictionID] = true;
62400                 turn.restrictionType = osmInferRestriction(vgraph, turn, projection2);
62401                 _oldTurns.push(turn);
62402                 extraActions.push(actionUnrestrictTurn(turn));
62403               }
62404             }
62405             actions = _intersection.actions.concat(extraActions, [
62406               actionRestrictTurn(datumOnly, restrictionType),
62407               _t("operations.restriction.annotation.create")
62408             ]);
62409           } else if (datum2.restrictionID) {
62410             turns = _oldTurns || [];
62411             extraActions = [];
62412             for (i3 = 0; i3 < turns.length; i3++) {
62413               if (turns[i3].key !== datum2.key) {
62414                 extraActions.push(actionRestrictTurn(turns[i3], turns[i3].restrictionType));
62415               }
62416             }
62417             _oldTurns = null;
62418             actions = _intersection.actions.concat(extraActions, [
62419               actionUnrestrictTurn(datum2),
62420               _t("operations.restriction.annotation.delete")
62421             ]);
62422           } else {
62423             actions = _intersection.actions.concat([
62424               actionRestrictTurn(datum2, restrictionType),
62425               _t("operations.restriction.annotation.create")
62426             ]);
62427           }
62428           context.perform.apply(context, actions);
62429           var s = surface.selectAll("." + datum2.key);
62430           datum2 = s.empty() ? null : s.datum();
62431           updateHints(datum2);
62432         } else {
62433           _fromWayID = null;
62434           _oldTurns = null;
62435           redraw();
62436         }
62437       }
62438       function mouseover(d3_event) {
62439         var datum2 = d3_event.target.__data__;
62440         updateHints(datum2);
62441       }
62442       _lastXPos = _lastXPos || sdims[0];
62443       function redraw(minChange) {
62444         var xPos = -1;
62445         if (minChange) {
62446           xPos = utilGetDimensions(context.container().select(".sidebar"))[0];
62447         }
62448         if (!minChange || minChange && Math.abs(xPos - _lastXPos) >= minChange) {
62449           if (context.hasEntity(_vertexID)) {
62450             _lastXPos = xPos;
62451             _container.call(renderViewer);
62452           }
62453         }
62454       }
62455       function highlightPathsFrom(wayID) {
62456         surface.selectAll(".related").classed("related", false).classed("allow", false).classed("restrict", false).classed("only", false);
62457         surface.selectAll("." + wayID).classed("related", true);
62458         if (wayID) {
62459           var turns = _intersection.turns(wayID, _maxViaWay);
62460           for (var i3 = 0; i3 < turns.length; i3++) {
62461             var turn = turns[i3];
62462             var ids = [turn.to.way];
62463             var klass = turn.no ? "restrict" : turn.only ? "only" : "allow";
62464             if (turn.only || turns.length === 1) {
62465               if (turn.via.ways) {
62466                 ids = ids.concat(turn.via.ways);
62467               }
62468             } else if (turn.to.way === wayID) {
62469               continue;
62470             }
62471             surface.selectAll(utilEntitySelector(ids)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
62472           }
62473         }
62474       }
62475       function updateHints(datum2) {
62476         var help = _container.selectAll(".restriction-help").html("");
62477         var placeholders = {};
62478         ["from", "via", "to"].forEach(function(k) {
62479           placeholders[k] = { html: '<span class="qualifier">' + _t("restriction.help." + k) + "</span>" };
62480         });
62481         var entity = datum2 && datum2.properties && datum2.properties.entity;
62482         if (entity) {
62483           datum2 = entity;
62484         }
62485         if (_fromWayID) {
62486           way = vgraph.entity(_fromWayID);
62487           surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
62488         }
62489         if (datum2 instanceof osmWay && datum2.__from) {
62490           way = datum2;
62491           highlightPathsFrom(_fromWayID ? null : way.id);
62492           surface.selectAll("." + way.id).classed("related", true);
62493           var clickSelect = !_fromWayID || _fromWayID !== way.id;
62494           help.append("div").html(_t.html("restriction.help." + (clickSelect ? "select_from_name" : "from_name"), {
62495             from: placeholders.from,
62496             fromName: displayName(way.id, vgraph)
62497           }));
62498         } else if (datum2 instanceof osmTurn) {
62499           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
62500           var turnType = restrictionType.replace(/^(only|no)\_/, "");
62501           var indirect = datum2.direct === false ? _t.html("restriction.help.indirect") : "";
62502           var klass, turnText, nextText;
62503           if (datum2.no) {
62504             klass = "restrict";
62505             turnText = _t.html("restriction.help.turn.no_" + turnType, { indirect: { html: indirect } });
62506             nextText = _t.html("restriction.help.turn.only_" + turnType, { indirect: "" });
62507           } else if (datum2.only) {
62508             klass = "only";
62509             turnText = _t.html("restriction.help.turn.only_" + turnType, { indirect: { html: indirect } });
62510             nextText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: "" });
62511           } else {
62512             klass = "allow";
62513             turnText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: { html: indirect } });
62514             nextText = _t.html("restriction.help.turn.no_" + turnType, { indirect: "" });
62515           }
62516           help.append("div").attr("class", "qualifier " + klass).html(turnText);
62517           help.append("div").html(_t.html("restriction.help.from_name_to_name", {
62518             from: placeholders.from,
62519             fromName: displayName(datum2.from.way, vgraph),
62520             to: placeholders.to,
62521             toName: displayName(datum2.to.way, vgraph)
62522           }));
62523           if (datum2.via.ways && datum2.via.ways.length) {
62524             var names = [];
62525             for (var i3 = 0; i3 < datum2.via.ways.length; i3++) {
62526               var prev = names[names.length - 1];
62527               var curr = displayName(datum2.via.ways[i3], vgraph);
62528               if (!prev || curr !== prev) {
62529                 names.push(curr);
62530               }
62531             }
62532             help.append("div").html(_t.html("restriction.help.via_names", {
62533               via: placeholders.via,
62534               viaNames: names.join(", ")
62535             }));
62536           }
62537           if (!indirect) {
62538             help.append("div").html(_t.html("restriction.help.toggle", { turn: { html: nextText.trim() } }));
62539           }
62540           highlightPathsFrom(null);
62541           var alongIDs = datum2.path.slice();
62542           surface.selectAll(utilEntitySelector(alongIDs)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
62543         } else {
62544           highlightPathsFrom(null);
62545           if (_fromWayID) {
62546             help.append("div").html(_t.html("restriction.help.from_name", {
62547               from: placeholders.from,
62548               fromName: displayName(_fromWayID, vgraph)
62549             }));
62550           } else {
62551             help.append("div").html(_t.html("restriction.help.select_from", {
62552               from: placeholders.from
62553             }));
62554           }
62555         }
62556       }
62557     }
62558     function displayMaxDistance(maxDist) {
62559       return (selection2) => {
62560         var isImperial = !_mainLocalizer.usesMetric();
62561         var opts;
62562         if (isImperial) {
62563           var distToFeet = {
62564             // imprecise conversion for prettier display
62565             20: 70,
62566             25: 85,
62567             30: 100,
62568             35: 115,
62569             40: 130,
62570             45: 145,
62571             50: 160
62572           }[maxDist];
62573           opts = { distance: _t("units.feet", { quantity: distToFeet }) };
62574         } else {
62575           opts = { distance: _t("units.meters", { quantity: maxDist }) };
62576         }
62577         return selection2.html("").call(_t.append("restriction.controls.distance_up_to", opts));
62578       };
62579     }
62580     function displayMaxVia(maxVia) {
62581       return (selection2) => {
62582         selection2 = selection2.html("");
62583         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"));
62584       };
62585     }
62586     function displayName(entityID, graph) {
62587       var entity = graph.entity(entityID);
62588       var name = utilDisplayName(entity) || "";
62589       var matched = _mainPresetIndex.match(entity, graph);
62590       var type2 = matched && matched.name() || utilDisplayType(entity.id);
62591       return name || type2;
62592     }
62593     restrictions.entityIDs = function(val) {
62594       _intersection = null;
62595       _fromWayID = null;
62596       _oldTurns = null;
62597       _vertexID = val[0];
62598     };
62599     restrictions.tags = function() {
62600     };
62601     restrictions.focus = function() {
62602     };
62603     restrictions.off = function(selection2) {
62604       if (!_initialized2)
62605         return;
62606       selection2.selectAll(".surface").call(breathe.off).on("click.restrictions", null).on("mouseover.restrictions", null);
62607       select_default2(window).on("resize.restrictions", null);
62608     };
62609     return utilRebind(restrictions, dispatch10, "on");
62610   }
62611   uiFieldRestrictions.supportsMultiselection = false;
62612
62613   // modules/ui/fields/textarea.js
62614   function uiFieldTextarea(field, context) {
62615     var dispatch10 = dispatch_default("change");
62616     var input = select_default2(null);
62617     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue()).silent(field.usage === "changeset" && field.key === "comment");
62618     var _tags;
62619     function textarea(selection2) {
62620       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
62621       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).style("position", "relative").merge(wrap2);
62622       input = wrap2.selectAll("textarea").data([0]);
62623       input = input.enter().append("textarea").attr("id", field.domId).call(utilNoAuto).on("input", change(true)).on("blur", change()).on("change", change()).merge(input);
62624       wrap2.call(_lengthIndicator);
62625       function change(onInput) {
62626         return function() {
62627           var val = utilGetSetValue(input);
62628           if (!onInput)
62629             val = context.cleanTagValue(val);
62630           if (!val && Array.isArray(_tags[field.key]))
62631             return;
62632           var t = {};
62633           t[field.key] = val || void 0;
62634           dispatch10.call("change", this, t, onInput);
62635         };
62636       }
62637     }
62638     textarea.tags = function(tags) {
62639       _tags = tags;
62640       var isMixed = Array.isArray(tags[field.key]);
62641       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);
62642       if (!isMixed) {
62643         _lengthIndicator.update(tags[field.key]);
62644       }
62645     };
62646     textarea.focus = function() {
62647       input.node().focus();
62648     };
62649     return utilRebind(textarea, dispatch10, "on");
62650   }
62651
62652   // modules/ui/fields/wikidata.js
62653   function uiFieldWikidata(field, context) {
62654     var wikidata = services.wikidata;
62655     var dispatch10 = dispatch_default("change");
62656     var _selection = select_default2(null);
62657     var _searchInput = select_default2(null);
62658     var _qid = null;
62659     var _wikidataEntity = null;
62660     var _wikiURL = "";
62661     var _entityIDs = [];
62662     var _wikipediaKey = field.keys && field.keys.find(function(key) {
62663       return key.includes("wikipedia");
62664     });
62665     var _hintKey = field.key === "wikidata" ? "name" : field.key.split(":")[0];
62666     var combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(true).minItems(1);
62667     function wiki(selection2) {
62668       _selection = selection2;
62669       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
62670       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
62671       var list = wrap2.selectAll("ul").data([0]);
62672       list = list.enter().append("ul").attr("class", "rows").merge(list);
62673       var searchRow = list.selectAll("li.wikidata-search").data([0]);
62674       var searchRowEnter = searchRow.enter().append("li").attr("class", "wikidata-search");
62675       searchRowEnter.append("input").attr("type", "text").attr("id", field.domId).style("flex", "1").call(utilNoAuto).on("focus", function() {
62676         var node = select_default2(this).node();
62677         node.setSelectionRange(0, node.value.length);
62678       }).on("blur", function() {
62679         setLabelForEntity();
62680       }).call(combobox.fetcher(fetchWikidataItems));
62681       combobox.on("accept", function(d) {
62682         if (d) {
62683           _qid = d.id;
62684           change();
62685         }
62686       }).on("cancel", function() {
62687         setLabelForEntity();
62688       });
62689       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) {
62690         d3_event.preventDefault();
62691         if (_wikiURL)
62692           window.open(_wikiURL, "_blank");
62693       });
62694       searchRow = searchRow.merge(searchRowEnter);
62695       _searchInput = searchRow.select("input");
62696       var wikidataProperties = ["description", "identifier"];
62697       var items = list.selectAll("li.labeled-input").data(wikidataProperties);
62698       var enter = items.enter().append("li").attr("class", function(d) {
62699         return "labeled-input preset-wikidata-" + d;
62700       });
62701       enter.append("span").attr("class", "label").html(function(d) {
62702         return _t.html("wikidata." + d);
62703       });
62704       enter.append("input").attr("type", "text").call(utilNoAuto).classed("disabled", "true").attr("readonly", "true");
62705       enter.append("button").attr("class", "form-field-button").attr("title", _t("icons.copy")).call(svgIcon("#iD-operation-copy")).on("click", function(d3_event) {
62706         d3_event.preventDefault();
62707         select_default2(this.parentNode).select("input").node().select();
62708         document.execCommand("copy");
62709       });
62710     }
62711     function fetchWikidataItems(q, callback) {
62712       if (!q && _hintKey) {
62713         for (var i2 in _entityIDs) {
62714           var entity = context.hasEntity(_entityIDs[i2]);
62715           if (entity.tags[_hintKey]) {
62716             q = entity.tags[_hintKey];
62717             break;
62718           }
62719         }
62720       }
62721       wikidata.itemsForSearchQuery(q, function(err, data) {
62722         if (err) {
62723           if (err !== "No query")
62724             console.error(err);
62725           return;
62726         }
62727         var result = data.map(function(item) {
62728           return {
62729             id: item.id,
62730             value: item.display.label.value + " (" + item.id + ")",
62731             display: (selection2) => selection2.append("span").attr("class", "localized-text").attr("lang", item.display.label.language).text(item.display.label.value),
62732             title: item.display.description && item.display.description.value,
62733             terms: item.aliases
62734           };
62735         });
62736         if (callback)
62737           callback(result);
62738       });
62739     }
62740     function change() {
62741       var syncTags = {};
62742       syncTags[field.key] = _qid;
62743       dispatch10.call("change", this, syncTags);
62744       var initGraph = context.graph();
62745       var initEntityIDs = _entityIDs;
62746       wikidata.entityByQID(_qid, function(err, entity) {
62747         if (err)
62748           return;
62749         if (context.graph() !== initGraph)
62750           return;
62751         if (!entity.sitelinks)
62752           return;
62753         var langs = wikidata.languagesToQuery();
62754         ["labels", "descriptions"].forEach(function(key) {
62755           if (!entity[key])
62756             return;
62757           var valueLangs = Object.keys(entity[key]);
62758           if (valueLangs.length === 0)
62759             return;
62760           var valueLang = valueLangs[0];
62761           if (langs.indexOf(valueLang) === -1) {
62762             langs.push(valueLang);
62763           }
62764         });
62765         var newWikipediaValue;
62766         if (_wikipediaKey) {
62767           var foundPreferred;
62768           for (var i2 in langs) {
62769             var lang = langs[i2];
62770             var siteID = lang.replace("-", "_") + "wiki";
62771             if (entity.sitelinks[siteID]) {
62772               foundPreferred = true;
62773               newWikipediaValue = lang + ":" + entity.sitelinks[siteID].title;
62774               break;
62775             }
62776           }
62777           if (!foundPreferred) {
62778             var wikiSiteKeys = Object.keys(entity.sitelinks).filter(function(site) {
62779               return site.endsWith("wiki");
62780             });
62781             if (wikiSiteKeys.length === 0) {
62782               newWikipediaValue = null;
62783             } else {
62784               var wikiLang = wikiSiteKeys[0].slice(0, -4).replace("_", "-");
62785               var wikiTitle = entity.sitelinks[wikiSiteKeys[0]].title;
62786               newWikipediaValue = wikiLang + ":" + wikiTitle;
62787             }
62788           }
62789         }
62790         if (newWikipediaValue) {
62791           newWikipediaValue = context.cleanTagValue(newWikipediaValue);
62792         }
62793         if (typeof newWikipediaValue === "undefined")
62794           return;
62795         var actions = initEntityIDs.map(function(entityID) {
62796           var entity2 = context.hasEntity(entityID);
62797           if (!entity2)
62798             return null;
62799           var currTags = Object.assign({}, entity2.tags);
62800           if (newWikipediaValue === null) {
62801             if (!currTags[_wikipediaKey])
62802               return null;
62803             delete currTags[_wikipediaKey];
62804           } else {
62805             currTags[_wikipediaKey] = newWikipediaValue;
62806           }
62807           return actionChangeTags(entityID, currTags);
62808         }).filter(Boolean);
62809         if (!actions.length)
62810           return;
62811         context.overwrite(
62812           function actionUpdateWikipediaTags(graph) {
62813             actions.forEach(function(action) {
62814               graph = action(graph);
62815             });
62816             return graph;
62817           },
62818           context.history().undoAnnotation()
62819         );
62820       });
62821     }
62822     function setLabelForEntity() {
62823       var label = "";
62824       if (_wikidataEntity) {
62825         label = entityPropertyForDisplay(_wikidataEntity, "labels");
62826         if (label.length === 0) {
62827           label = _wikidataEntity.id.toString();
62828         }
62829       }
62830       utilGetSetValue(_searchInput, label);
62831     }
62832     wiki.tags = function(tags) {
62833       var isMixed = Array.isArray(tags[field.key]);
62834       _searchInput.attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : "").classed("mixed", isMixed);
62835       _qid = typeof tags[field.key] === "string" && tags[field.key] || "";
62836       if (!/^Q[0-9]*$/.test(_qid)) {
62837         unrecognized();
62838         return;
62839       }
62840       _wikiURL = "https://wikidata.org/wiki/" + _qid;
62841       wikidata.entityByQID(_qid, function(err, entity) {
62842         if (err) {
62843           unrecognized();
62844           return;
62845         }
62846         _wikidataEntity = entity;
62847         setLabelForEntity();
62848         var description = entityPropertyForDisplay(entity, "descriptions");
62849         _selection.select("button.wiki-link").classed("disabled", false);
62850         _selection.select(".preset-wikidata-description").style("display", function() {
62851           return description.length > 0 ? "flex" : "none";
62852         }).select("input").attr("value", description);
62853         _selection.select(".preset-wikidata-identifier").style("display", function() {
62854           return entity.id ? "flex" : "none";
62855         }).select("input").attr("value", entity.id);
62856       });
62857       function unrecognized() {
62858         _wikidataEntity = null;
62859         setLabelForEntity();
62860         _selection.select(".preset-wikidata-description").style("display", "none");
62861         _selection.select(".preset-wikidata-identifier").style("display", "none");
62862         _selection.select("button.wiki-link").classed("disabled", true);
62863         if (_qid && _qid !== "") {
62864           _wikiURL = "https://wikidata.org/wiki/Special:Search?search=" + _qid;
62865         } else {
62866           _wikiURL = "";
62867         }
62868       }
62869     };
62870     function entityPropertyForDisplay(wikidataEntity, propKey) {
62871       if (!wikidataEntity[propKey])
62872         return "";
62873       var propObj = wikidataEntity[propKey];
62874       var langKeys = Object.keys(propObj);
62875       if (langKeys.length === 0)
62876         return "";
62877       var langs = wikidata.languagesToQuery();
62878       for (var i2 in langs) {
62879         var lang = langs[i2];
62880         var valueObj = propObj[lang];
62881         if (valueObj && valueObj.value && valueObj.value.length > 0)
62882           return valueObj.value;
62883       }
62884       return propObj[langKeys[0]].value;
62885     }
62886     wiki.entityIDs = function(val) {
62887       if (!arguments.length)
62888         return _entityIDs;
62889       _entityIDs = val;
62890       return wiki;
62891     };
62892     wiki.focus = function() {
62893       _searchInput.node().focus();
62894     };
62895     return utilRebind(wiki, dispatch10, "on");
62896   }
62897
62898   // modules/ui/fields/wikipedia.js
62899   function uiFieldWikipedia(field, context) {
62900     const dispatch10 = dispatch_default("change");
62901     const wikipedia = services.wikipedia;
62902     const wikidata = services.wikidata;
62903     let _langInput = select_default2(null);
62904     let _titleInput = select_default2(null);
62905     let _wikiURL = "";
62906     let _entityIDs;
62907     let _tags;
62908     let _dataWikipedia = [];
62909     _mainFileFetcher.get("wmf_sitematrix").then((d) => {
62910       _dataWikipedia = d;
62911       if (_tags)
62912         updateForTags(_tags);
62913     }).catch(() => {
62914     });
62915     const langCombo = uiCombobox(context, "wikipedia-lang").fetcher((value, callback) => {
62916       const v = value.toLowerCase();
62917       callback(
62918         _dataWikipedia.filter((d) => {
62919           return d[0].toLowerCase().indexOf(v) >= 0 || d[1].toLowerCase().indexOf(v) >= 0 || d[2].toLowerCase().indexOf(v) >= 0;
62920         }).map((d) => ({ value: d[1] }))
62921       );
62922     });
62923     const titleCombo = uiCombobox(context, "wikipedia-title").fetcher((value, callback) => {
62924       if (!value) {
62925         value = "";
62926         for (let i2 in _entityIDs) {
62927           let entity = context.hasEntity(_entityIDs[i2]);
62928           if (entity.tags.name) {
62929             value = entity.tags.name;
62930             break;
62931           }
62932         }
62933       }
62934       const searchfn = value.length > 7 ? wikipedia.search : wikipedia.suggestions;
62935       searchfn(language()[2], value, (query, data) => {
62936         callback(data.map((d) => ({ value: d })));
62937       });
62938     });
62939     function wiki(selection2) {
62940       let wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
62941       wrap2 = wrap2.enter().append("div").attr("class", `form-field-input-wrap form-field-input-${field.type}`).merge(wrap2);
62942       let langContainer = wrap2.selectAll(".wiki-lang-container").data([0]);
62943       langContainer = langContainer.enter().append("div").attr("class", "wiki-lang-container").merge(langContainer);
62944       _langInput = langContainer.selectAll("input.wiki-lang").data([0]);
62945       _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);
62946       _langInput.on("blur", changeLang).on("change", changeLang);
62947       let titleContainer = wrap2.selectAll(".wiki-title-container").data([0]);
62948       titleContainer = titleContainer.enter().append("div").attr("class", "wiki-title-container").merge(titleContainer);
62949       _titleInput = titleContainer.selectAll("input.wiki-title").data([0]);
62950       _titleInput = _titleInput.enter().append("input").attr("type", "text").attr("class", "wiki-title").attr("id", field.domId).call(utilNoAuto).call(titleCombo).merge(_titleInput);
62951       _titleInput.on("blur", function() {
62952         change(true);
62953       }).on("change", function() {
62954         change(false);
62955       });
62956       let link2 = titleContainer.selectAll(".wiki-link").data([0]);
62957       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);
62958       link2.on("click", (d3_event) => {
62959         d3_event.preventDefault();
62960         if (_wikiURL)
62961           window.open(_wikiURL, "_blank");
62962       });
62963     }
62964     function defaultLanguageInfo(skipEnglishFallback) {
62965       const langCode = _mainLocalizer.languageCode().toLowerCase();
62966       for (let i2 in _dataWikipedia) {
62967         let d = _dataWikipedia[i2];
62968         if (d[2] === langCode)
62969           return d;
62970       }
62971       return skipEnglishFallback ? ["", "", ""] : ["English", "English", "en"];
62972     }
62973     function language(skipEnglishFallback) {
62974       const value = utilGetSetValue(_langInput).toLowerCase();
62975       for (let i2 in _dataWikipedia) {
62976         let d = _dataWikipedia[i2];
62977         if (d[0].toLowerCase() === value || d[1].toLowerCase() === value || d[2] === value)
62978           return d;
62979       }
62980       return defaultLanguageInfo(skipEnglishFallback);
62981     }
62982     function changeLang() {
62983       utilGetSetValue(_langInput, language()[1]);
62984       change(true);
62985     }
62986     function change(skipWikidata) {
62987       let value = utilGetSetValue(_titleInput);
62988       const m = value.match(/https?:\/\/([-a-z]+)\.wikipedia\.org\/(?:wiki|\1-[-a-z]+)\/([^#]+)(?:#(.+))?/);
62989       const langInfo = m && _dataWikipedia.find((d) => m[1] === d[2]);
62990       let syncTags = {};
62991       if (langInfo) {
62992         const nativeLangName = langInfo[1];
62993         value = decodeURIComponent(m[2]).replace(/_/g, " ");
62994         if (m[3]) {
62995           let anchor;
62996           anchor = decodeURIComponent(m[3]);
62997           value += "#" + anchor.replace(/_/g, " ");
62998         }
62999         value = value.slice(0, 1).toUpperCase() + value.slice(1);
63000         utilGetSetValue(_langInput, nativeLangName);
63001         utilGetSetValue(_titleInput, value);
63002       }
63003       if (value) {
63004         syncTags.wikipedia = context.cleanTagValue(language()[2] + ":" + value);
63005       } else {
63006         syncTags.wikipedia = void 0;
63007       }
63008       dispatch10.call("change", this, syncTags);
63009       if (skipWikidata || !value || !language()[2])
63010         return;
63011       const initGraph = context.graph();
63012       const initEntityIDs = _entityIDs;
63013       wikidata.itemsByTitle(language()[2], value, (err, data) => {
63014         if (err || !data || !Object.keys(data).length)
63015           return;
63016         if (context.graph() !== initGraph)
63017           return;
63018         const qids = Object.keys(data);
63019         const value2 = qids && qids.find((id2) => id2.match(/^Q\d+$/));
63020         let actions = initEntityIDs.map((entityID) => {
63021           let entity = context.entity(entityID).tags;
63022           let currTags = Object.assign({}, entity);
63023           if (currTags.wikidata !== value2) {
63024             currTags.wikidata = value2;
63025             return actionChangeTags(entityID, currTags);
63026           }
63027           return null;
63028         }).filter(Boolean);
63029         if (!actions.length)
63030           return;
63031         context.overwrite(
63032           function actionUpdateWikidataTags(graph) {
63033             actions.forEach(function(action) {
63034               graph = action(graph);
63035             });
63036             return graph;
63037           },
63038           context.history().undoAnnotation()
63039         );
63040       });
63041     }
63042     wiki.tags = (tags) => {
63043       _tags = tags;
63044       updateForTags(tags);
63045     };
63046     function updateForTags(tags) {
63047       const value = typeof tags[field.key] === "string" ? tags[field.key] : "";
63048       const m = value.match(/([^:]+):([^#]+)(?:#(.+))?/);
63049       const tagLang = m && m[1];
63050       const tagArticleTitle = m && m[2];
63051       let anchor = m && m[3];
63052       const tagLangInfo = tagLang && _dataWikipedia.find((d) => tagLang === d[2]);
63053       if (tagLangInfo) {
63054         const nativeLangName = tagLangInfo[1];
63055         utilGetSetValue(_langInput, nativeLangName);
63056         utilGetSetValue(_titleInput, tagArticleTitle + (anchor ? "#" + anchor : ""));
63057         if (anchor) {
63058           try {
63059             anchor = encodeURIComponent(anchor.replace(/ /g, "_")).replace(/%/g, ".");
63060           } catch (e) {
63061             anchor = anchor.replace(/ /g, "_");
63062           }
63063         }
63064         _wikiURL = "https://" + tagLang + ".wikipedia.org/wiki/" + tagArticleTitle.replace(/ /g, "_") + (anchor ? "#" + anchor : "");
63065       } else {
63066         utilGetSetValue(_titleInput, value);
63067         if (value && value !== "") {
63068           utilGetSetValue(_langInput, "");
63069           const defaultLangInfo = defaultLanguageInfo();
63070           _wikiURL = `https://${defaultLangInfo[2]}.wikipedia.org/w/index.php?fulltext=1&search=${value}`;
63071         } else {
63072           const shownOrDefaultLangInfo = language(
63073             true
63074             /* skipEnglishFallback */
63075           );
63076           utilGetSetValue(_langInput, shownOrDefaultLangInfo[1]);
63077           _wikiURL = "";
63078         }
63079       }
63080     }
63081     wiki.entityIDs = (val) => {
63082       if (!arguments.length)
63083         return _entityIDs;
63084       _entityIDs = val;
63085       return wiki;
63086     };
63087     wiki.focus = () => {
63088       _titleInput.node().focus();
63089     };
63090     return utilRebind(wiki, dispatch10, "on");
63091   }
63092   uiFieldWikipedia.supportsMultiselection = false;
63093
63094   // modules/ui/fields/index.js
63095   var uiFields = {
63096     access: uiFieldAccess,
63097     address: uiFieldAddress,
63098     check: uiFieldCheck,
63099     colour: uiFieldText,
63100     combo: uiFieldCombo,
63101     cycleway: uiFieldDirectionalCombo,
63102     date: uiFieldText,
63103     defaultCheck: uiFieldCheck,
63104     directionalCombo: uiFieldDirectionalCombo,
63105     email: uiFieldText,
63106     identifier: uiFieldText,
63107     lanes: uiFieldLanes,
63108     localized: uiFieldLocalized,
63109     roadheight: uiFieldRoadheight,
63110     roadspeed: uiFieldRoadspeed,
63111     manyCombo: uiFieldCombo,
63112     multiCombo: uiFieldCombo,
63113     networkCombo: uiFieldCombo,
63114     number: uiFieldText,
63115     onewayCheck: uiFieldCheck,
63116     radio: uiFieldRadio,
63117     restrictions: uiFieldRestrictions,
63118     semiCombo: uiFieldCombo,
63119     structureRadio: uiFieldRadio,
63120     tel: uiFieldText,
63121     text: uiFieldText,
63122     textarea: uiFieldTextarea,
63123     typeCombo: uiFieldCombo,
63124     url: uiFieldText,
63125     wikidata: uiFieldWikidata,
63126     wikipedia: uiFieldWikipedia
63127   };
63128
63129   // modules/ui/field.js
63130   function uiField(context, presetField2, entityIDs, options2) {
63131     options2 = Object.assign({
63132       show: true,
63133       wrap: true,
63134       remove: true,
63135       revert: true,
63136       info: true
63137     }, options2);
63138     var dispatch10 = dispatch_default("change", "revert");
63139     var field = Object.assign({}, presetField2);
63140     field.domId = utilUniqueDomId("form-field-" + field.safeid);
63141     var _show = options2.show;
63142     var _state = "";
63143     var _tags = {};
63144     var _entityExtent;
63145     if (entityIDs && entityIDs.length) {
63146       _entityExtent = entityIDs.reduce(function(extent, entityID) {
63147         var entity = context.graph().entity(entityID);
63148         return extent.extend(entity.extent(context.graph()));
63149       }, geoExtent());
63150     }
63151     var _locked = false;
63152     var _lockedTip = uiTooltip().title(() => _t.append("inspector.lock.suggestion", { label: field.title })).placement("bottom");
63153     if (_show && !field.impl) {
63154       createField();
63155     }
63156     function createField() {
63157       field.impl = uiFields[field.type](field, context).on("change", function(t, onInput) {
63158         dispatch10.call("change", field, t, onInput);
63159       });
63160       if (entityIDs) {
63161         field.entityIDs = entityIDs;
63162         if (field.impl.entityIDs) {
63163           field.impl.entityIDs(entityIDs);
63164         }
63165       }
63166     }
63167     function allKeys() {
63168       let keys2 = field.keys || [field.key];
63169       if (field.type === "directionalCombo" && field.key) {
63170         keys2 = keys2.concat(field.key);
63171       }
63172       return keys2;
63173     }
63174     function isModified() {
63175       if (!entityIDs || !entityIDs.length)
63176         return false;
63177       return entityIDs.some(function(entityID) {
63178         var original = context.graph().base().entities[entityID];
63179         var latest = context.graph().entity(entityID);
63180         return allKeys().some(function(key) {
63181           return original ? latest.tags[key] !== original.tags[key] : latest.tags[key];
63182         });
63183       });
63184     }
63185     function tagsContainFieldKey() {
63186       return allKeys().some(function(key) {
63187         if (field.type === "multiCombo") {
63188           for (var tagKey in _tags) {
63189             if (tagKey.indexOf(key) === 0) {
63190               return true;
63191             }
63192           }
63193           return false;
63194         }
63195         return _tags[key] !== void 0;
63196       });
63197     }
63198     function revert(d3_event, d) {
63199       d3_event.stopPropagation();
63200       d3_event.preventDefault();
63201       if (!entityIDs || _locked)
63202         return;
63203       dispatch10.call("revert", d, allKeys());
63204     }
63205     function remove2(d3_event, d) {
63206       d3_event.stopPropagation();
63207       d3_event.preventDefault();
63208       if (_locked)
63209         return;
63210       var t = {};
63211       allKeys().forEach(function(key) {
63212         t[key] = void 0;
63213       });
63214       dispatch10.call("change", d, t);
63215     }
63216     field.render = function(selection2) {
63217       var container = selection2.selectAll(".form-field").data([field]);
63218       var enter = container.enter().append("div").attr("class", function(d) {
63219         return "form-field form-field-" + d.safeid;
63220       }).classed("nowrap", !options2.wrap);
63221       if (options2.wrap) {
63222         var labelEnter = enter.append("label").attr("class", "field-label").attr("for", function(d) {
63223           return d.domId;
63224         });
63225         var textEnter = labelEnter.append("span").attr("class", "label-text");
63226         textEnter.append("span").attr("class", "label-textvalue").each(function(d) {
63227           d.label()(select_default2(this));
63228         });
63229         textEnter.append("span").attr("class", "label-textannotation");
63230         if (options2.remove) {
63231           labelEnter.append("button").attr("class", "remove-icon").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
63232         }
63233         if (options2.revert) {
63234           labelEnter.append("button").attr("class", "modified-icon").attr("title", _t("icons.undo")).call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo"));
63235         }
63236       }
63237       container = container.merge(enter);
63238       container.select(".field-label > .remove-icon").on("click", remove2);
63239       container.select(".field-label > .modified-icon").on("click", revert);
63240       container.each(function(d) {
63241         var selection3 = select_default2(this);
63242         if (!d.impl) {
63243           createField();
63244         }
63245         var reference, help;
63246         if (options2.wrap && field.type === "restrictions") {
63247           help = uiFieldHelp(context, "restrictions");
63248         }
63249         if (options2.wrap && options2.info) {
63250           var referenceKey = d.key || "";
63251           if (d.type === "multiCombo") {
63252             referenceKey = referenceKey.replace(/:$/, "");
63253           }
63254           reference = uiTagReference(d.reference || { key: referenceKey }, context);
63255           if (_state === "hover") {
63256             reference.showing(false);
63257           }
63258         }
63259         selection3.call(d.impl);
63260         if (help) {
63261           selection3.call(help.body).select(".field-label").call(help.button);
63262         }
63263         if (reference) {
63264           selection3.call(reference.body).select(".field-label").call(reference.button);
63265         }
63266         d.impl.tags(_tags);
63267       });
63268       container.classed("locked", _locked).classed("modified", isModified()).classed("present", tagsContainFieldKey());
63269       var annotation = container.selectAll(".field-label .label-textannotation");
63270       var icon2 = annotation.selectAll(".icon").data(_locked ? [0] : []);
63271       icon2.exit().remove();
63272       icon2.enter().append("svg").attr("class", "icon").append("use").attr("xlink:href", "#fas-lock");
63273       container.call(_locked ? _lockedTip : _lockedTip.destroy);
63274     };
63275     field.state = function(val) {
63276       if (!arguments.length)
63277         return _state;
63278       _state = val;
63279       return field;
63280     };
63281     field.tags = function(val) {
63282       if (!arguments.length)
63283         return _tags;
63284       _tags = val;
63285       if (tagsContainFieldKey() && !_show) {
63286         _show = true;
63287         if (!field.impl) {
63288           createField();
63289         }
63290       }
63291       return field;
63292     };
63293     field.locked = function(val) {
63294       if (!arguments.length)
63295         return _locked;
63296       _locked = val;
63297       return field;
63298     };
63299     field.show = function() {
63300       _show = true;
63301       if (!field.impl) {
63302         createField();
63303       }
63304       if (field.default && field.key && _tags[field.key] !== field.default) {
63305         var t = {};
63306         t[field.key] = field.default;
63307         dispatch10.call("change", this, t);
63308       }
63309     };
63310     field.isShown = function() {
63311       return _show;
63312     };
63313     field.isAllowed = function() {
63314       if (entityIDs && entityIDs.length > 1 && uiFields[field.type].supportsMultiselection === false)
63315         return false;
63316       if (field.geometry && !entityIDs.every(function(entityID) {
63317         return field.matchGeometry(context.graph().geometry(entityID));
63318       }))
63319         return false;
63320       if (entityIDs && _entityExtent && field.locationSetID) {
63321         var validHere = _sharedLocationManager.locationSetsAt(_entityExtent.center());
63322         if (!validHere[field.locationSetID])
63323           return false;
63324       }
63325       var prerequisiteTag = field.prerequisiteTag;
63326       if (entityIDs && !tagsContainFieldKey() && // ignore tagging prerequisites if a value is already present
63327       prerequisiteTag) {
63328         if (!entityIDs.every(function(entityID) {
63329           var entity = context.graph().entity(entityID);
63330           if (prerequisiteTag.key) {
63331             var value = entity.tags[prerequisiteTag.key];
63332             if (!value)
63333               return false;
63334             if (prerequisiteTag.valueNot) {
63335               return prerequisiteTag.valueNot !== value;
63336             }
63337             if (prerequisiteTag.value) {
63338               return prerequisiteTag.value === value;
63339             }
63340           } else if (prerequisiteTag.keyNot) {
63341             if (entity.tags[prerequisiteTag.keyNot])
63342               return false;
63343           }
63344           return true;
63345         }))
63346           return false;
63347       }
63348       return true;
63349     };
63350     field.focus = function() {
63351       if (field.impl) {
63352         field.impl.focus();
63353       }
63354     };
63355     return utilRebind(field, dispatch10, "on");
63356   }
63357
63358   // modules/ui/form_fields.js
63359   function uiFormFields(context) {
63360     var moreCombo = uiCombobox(context, "more-fields").minItems(1);
63361     var _fieldsArr = [];
63362     var _lastPlaceholder = "";
63363     var _state = "";
63364     var _klass = "";
63365     function formFields(selection2) {
63366       var allowedFields = _fieldsArr.filter(function(field) {
63367         return field.isAllowed();
63368       });
63369       var shown = allowedFields.filter(function(field) {
63370         return field.isShown();
63371       });
63372       var notShown = allowedFields.filter(function(field) {
63373         return !field.isShown();
63374       });
63375       var container = selection2.selectAll(".form-fields-container").data([0]);
63376       container = container.enter().append("div").attr("class", "form-fields-container " + (_klass || "")).merge(container);
63377       var fields = container.selectAll(".wrap-form-field").data(shown, function(d) {
63378         return d.id + (d.entityIDs ? d.entityIDs.join() : "");
63379       });
63380       fields.exit().remove();
63381       var enter = fields.enter().append("div").attr("class", function(d) {
63382         return "wrap-form-field wrap-form-field-" + d.safeid;
63383       });
63384       fields = fields.merge(enter);
63385       fields.order().each(function(d) {
63386         select_default2(this).call(d.render);
63387       });
63388       var titles = [];
63389       var moreFields = notShown.map(function(field) {
63390         var title = field.title();
63391         titles.push(title);
63392         var terms = field.terms();
63393         if (field.key)
63394           terms.push(field.key);
63395         if (field.keys)
63396           terms = terms.concat(field.keys);
63397         return {
63398           display: field.label(),
63399           value: title,
63400           title,
63401           field,
63402           terms
63403         };
63404       });
63405       var placeholder = titles.slice(0, 3).join(", ") + (titles.length > 3 ? "\u2026" : "");
63406       var more = selection2.selectAll(".more-fields").data(_state === "hover" || moreFields.length === 0 ? [] : [0]);
63407       more.exit().remove();
63408       var moreEnter = more.enter().append("div").attr("class", "more-fields").append("label");
63409       moreEnter.append("span").call(_t.append("inspector.add_fields"));
63410       more = moreEnter.merge(more);
63411       var input = more.selectAll(".value").data([0]);
63412       input.exit().remove();
63413       input = input.enter().append("input").attr("class", "value").attr("type", "text").attr("placeholder", placeholder).call(utilNoAuto).merge(input);
63414       input.call(utilGetSetValue, "").call(
63415         moreCombo.data(moreFields).on("accept", function(d) {
63416           if (!d)
63417             return;
63418           var field = d.field;
63419           field.show();
63420           selection2.call(formFields);
63421           field.focus();
63422         })
63423       );
63424       if (_lastPlaceholder !== placeholder) {
63425         input.attr("placeholder", placeholder);
63426         _lastPlaceholder = placeholder;
63427       }
63428     }
63429     formFields.fieldsArr = function(val) {
63430       if (!arguments.length)
63431         return _fieldsArr;
63432       _fieldsArr = val || [];
63433       return formFields;
63434     };
63435     formFields.state = function(val) {
63436       if (!arguments.length)
63437         return _state;
63438       _state = val;
63439       return formFields;
63440     };
63441     formFields.klass = function(val) {
63442       if (!arguments.length)
63443         return _klass;
63444       _klass = val;
63445       return formFields;
63446     };
63447     return formFields;
63448   }
63449
63450   // modules/ui/changeset_editor.js
63451   function uiChangesetEditor(context) {
63452     var dispatch10 = dispatch_default("change");
63453     var formFields = uiFormFields(context);
63454     var commentCombo = uiCombobox(context, "comment").caseSensitive(true);
63455     var _fieldsArr;
63456     var _tags;
63457     var _changesetID;
63458     function changesetEditor(selection2) {
63459       render(selection2);
63460     }
63461     function render(selection2) {
63462       var initial = false;
63463       if (!_fieldsArr) {
63464         initial = true;
63465         var presets = _mainPresetIndex;
63466         _fieldsArr = [
63467           uiField(context, presets.field("comment"), null, { show: true, revert: false }),
63468           uiField(context, presets.field("source"), null, { show: false, revert: false }),
63469           uiField(context, presets.field("hashtags"), null, { show: false, revert: false })
63470         ];
63471         _fieldsArr.forEach(function(field) {
63472           field.on("change", function(t, onInput) {
63473             dispatch10.call("change", field, void 0, t, onInput);
63474           });
63475         });
63476       }
63477       _fieldsArr.forEach(function(field) {
63478         field.tags(_tags);
63479       });
63480       selection2.call(formFields.fieldsArr(_fieldsArr));
63481       if (initial) {
63482         var commentField = selection2.select(".form-field-comment textarea");
63483         var commentNode = commentField.node();
63484         if (commentNode) {
63485           commentNode.focus();
63486           commentNode.select();
63487         }
63488         utilTriggerEvent(commentField, "blur");
63489         var osm = context.connection();
63490         if (osm) {
63491           osm.userChangesets(function(err, changesets) {
63492             if (err)
63493               return;
63494             var comments = changesets.map(function(changeset) {
63495               var comment = changeset.tags.comment;
63496               return comment ? { title: comment, value: comment } : null;
63497             }).filter(Boolean);
63498             commentField.call(
63499               commentCombo.data(utilArrayUniqBy(comments, "title"))
63500             );
63501           });
63502         }
63503       }
63504       const warnings = [];
63505       if (_tags.comment.match(/google/i)) {
63506         warnings.push({
63507           id: 'contains "google"',
63508           msg: _t.append("commit.google_warning"),
63509           link: _t("commit.google_warning_link")
63510         });
63511       }
63512       const maxChars = context.maxCharsForTagValue();
63513       const strLen = utilUnicodeCharsCount(utilCleanOsmString(_tags.comment, Number.POSITIVE_INFINITY));
63514       if (strLen > maxChars || false) {
63515         warnings.push({
63516           id: "message too long",
63517           msg: _t.append("commit.changeset_comment_length_warning", { maxChars })
63518         });
63519       }
63520       var commentWarning = selection2.select(".form-field-comment").selectAll(".comment-warning").data(warnings, (d) => d.id);
63521       commentWarning.exit().transition().duration(200).style("opacity", 0).remove();
63522       var commentEnter = commentWarning.enter().insert("div", ".comment-warning").attr("class", "comment-warning field-warning").style("opacity", 0);
63523       commentEnter.call(svgIcon("#iD-icon-alert", "inline")).append("span");
63524       commentEnter.transition().duration(200).style("opacity", 1);
63525       commentWarning.merge(commentEnter).selectAll("div > span").text("").each(function(d) {
63526         let selection3 = select_default2(this);
63527         if (d.link) {
63528           selection3 = selection3.append("a").attr("target", "_blank").attr("href", d.link);
63529         }
63530         selection3.call(d.msg);
63531       });
63532     }
63533     changesetEditor.tags = function(_) {
63534       if (!arguments.length)
63535         return _tags;
63536       _tags = _;
63537       return changesetEditor;
63538     };
63539     changesetEditor.changesetID = function(_) {
63540       if (!arguments.length)
63541         return _changesetID;
63542       if (_changesetID === _)
63543         return changesetEditor;
63544       _changesetID = _;
63545       _fieldsArr = null;
63546       return changesetEditor;
63547     };
63548     return utilRebind(changesetEditor, dispatch10, "on");
63549   }
63550
63551   // modules/ui/commit.js
63552   var import_fast_deep_equal9 = __toESM(require_fast_deep_equal());
63553
63554   // modules/util/jxon.js
63555   var JXON = new function() {
63556     var sValueProp = "keyValue", sAttributesProp = "keyAttributes", sAttrPref = "@", aCache = [], rIsNull = /^\s*$/, rIsBool = /^(?:true|false)$/i;
63557     function parseText(sValue) {
63558       if (rIsNull.test(sValue)) {
63559         return null;
63560       }
63561       if (rIsBool.test(sValue)) {
63562         return sValue.toLowerCase() === "true";
63563       }
63564       if (isFinite(sValue)) {
63565         return parseFloat(sValue);
63566       }
63567       if (isFinite(Date.parse(sValue))) {
63568         return new Date(sValue);
63569       }
63570       return sValue;
63571     }
63572     function EmptyTree() {
63573     }
63574     EmptyTree.prototype.toString = function() {
63575       return "null";
63576     };
63577     EmptyTree.prototype.valueOf = function() {
63578       return null;
63579     };
63580     function objectify(vValue) {
63581       return vValue === null ? new EmptyTree() : vValue instanceof Object ? vValue : new vValue.constructor(vValue);
63582     }
63583     function createObjTree(oParentNode, nVerb, bFreeze, bNesteAttr) {
63584       var nLevelStart = aCache.length, bChildren = oParentNode.hasChildNodes(), bAttributes = oParentNode.hasAttributes(), bHighVerb = Boolean(nVerb & 2);
63585       var sProp, vContent, nLength = 0, sCollectedTxt = "", vResult = bHighVerb ? {} : (
63586         /* put here the default value for empty nodes: */
63587         true
63588       );
63589       if (bChildren) {
63590         for (var oNode, nItem = 0; nItem < oParentNode.childNodes.length; nItem++) {
63591           oNode = oParentNode.childNodes.item(nItem);
63592           if (oNode.nodeType === 4) {
63593             sCollectedTxt += oNode.nodeValue;
63594           } else if (oNode.nodeType === 3) {
63595             sCollectedTxt += oNode.nodeValue.trim();
63596           } else if (oNode.nodeType === 1 && !oNode.prefix) {
63597             aCache.push(oNode);
63598           }
63599         }
63600       }
63601       var nLevelEnd = aCache.length, vBuiltVal = parseText(sCollectedTxt);
63602       if (!bHighVerb && (bChildren || bAttributes)) {
63603         vResult = nVerb === 0 ? objectify(vBuiltVal) : {};
63604       }
63605       for (var nElId = nLevelStart; nElId < nLevelEnd; nElId++) {
63606         sProp = aCache[nElId].nodeName.toLowerCase();
63607         vContent = createObjTree(aCache[nElId], nVerb, bFreeze, bNesteAttr);
63608         if (vResult.hasOwnProperty(sProp)) {
63609           if (vResult[sProp].constructor !== Array) {
63610             vResult[sProp] = [vResult[sProp]];
63611           }
63612           vResult[sProp].push(vContent);
63613         } else {
63614           vResult[sProp] = vContent;
63615           nLength++;
63616         }
63617       }
63618       if (bAttributes) {
63619         var nAttrLen = oParentNode.attributes.length, sAPrefix = bNesteAttr ? "" : sAttrPref, oAttrParent = bNesteAttr ? {} : vResult;
63620         for (var oAttrib, nAttrib = 0; nAttrib < nAttrLen; nLength++, nAttrib++) {
63621           oAttrib = oParentNode.attributes.item(nAttrib);
63622           oAttrParent[sAPrefix + oAttrib.name.toLowerCase()] = parseText(oAttrib.value.trim());
63623         }
63624         if (bNesteAttr) {
63625           if (bFreeze) {
63626             Object.freeze(oAttrParent);
63627           }
63628           vResult[sAttributesProp] = oAttrParent;
63629           nLength -= nAttrLen - 1;
63630         }
63631       }
63632       if (nVerb === 3 || (nVerb === 2 || nVerb === 1 && nLength > 0) && sCollectedTxt) {
63633         vResult[sValueProp] = vBuiltVal;
63634       } else if (!bHighVerb && nLength === 0 && sCollectedTxt) {
63635         vResult = vBuiltVal;
63636       }
63637       if (bFreeze && (bHighVerb || nLength > 0)) {
63638         Object.freeze(vResult);
63639       }
63640       aCache.length = nLevelStart;
63641       return vResult;
63642     }
63643     function loadObjTree(oXMLDoc, oParentEl, oParentObj) {
63644       var vValue, oChild;
63645       if (oParentObj instanceof String || oParentObj instanceof Number || oParentObj instanceof Boolean) {
63646         oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toString()));
63647       } else if (oParentObj.constructor === Date) {
63648         oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toGMTString()));
63649       }
63650       for (var sName in oParentObj) {
63651         vValue = oParentObj[sName];
63652         if (isFinite(sName) || vValue instanceof Function) {
63653           continue;
63654         }
63655         if (sName === sValueProp) {
63656           if (vValue !== null && vValue !== true) {
63657             oParentEl.appendChild(oXMLDoc.createTextNode(vValue.constructor === Date ? vValue.toGMTString() : String(vValue)));
63658           }
63659         } else if (sName === sAttributesProp) {
63660           for (var sAttrib in vValue) {
63661             oParentEl.setAttribute(sAttrib, vValue[sAttrib]);
63662           }
63663         } else if (sName.charAt(0) === sAttrPref) {
63664           oParentEl.setAttribute(sName.slice(1), vValue);
63665         } else if (vValue.constructor === Array) {
63666           for (var nItem = 0; nItem < vValue.length; nItem++) {
63667             oChild = oXMLDoc.createElement(sName);
63668             loadObjTree(oXMLDoc, oChild, vValue[nItem]);
63669             oParentEl.appendChild(oChild);
63670           }
63671         } else {
63672           oChild = oXMLDoc.createElement(sName);
63673           if (vValue instanceof Object) {
63674             loadObjTree(oXMLDoc, oChild, vValue);
63675           } else if (vValue !== null && vValue !== true) {
63676             oChild.appendChild(oXMLDoc.createTextNode(vValue.toString()));
63677           }
63678           oParentEl.appendChild(oChild);
63679         }
63680       }
63681     }
63682     this.build = function(oXMLParent, nVerbosity, bFreeze, bNesteAttributes) {
63683       var _nVerb = arguments.length > 1 && typeof nVerbosity === "number" ? nVerbosity & 3 : (
63684         /* put here the default verbosity level: */
63685         1
63686       );
63687       return createObjTree(oXMLParent, _nVerb, bFreeze || false, arguments.length > 3 ? bNesteAttributes : _nVerb === 3);
63688     };
63689     this.unbuild = function(oObjTree) {
63690       var oNewDoc = document.implementation.createDocument("", "", null);
63691       loadObjTree(oNewDoc, oNewDoc, oObjTree);
63692       return oNewDoc;
63693     };
63694     this.stringify = function(oObjTree) {
63695       return new XMLSerializer().serializeToString(JXON.unbuild(oObjTree));
63696     };
63697   }();
63698
63699   // modules/ui/sections/changes.js
63700   function uiSectionChanges(context) {
63701     var _discardTags = {};
63702     _mainFileFetcher.get("discarded").then(function(d) {
63703       _discardTags = d;
63704     }).catch(function() {
63705     });
63706     var section = uiSection("changes-list", context).label(function() {
63707       var history = context.history();
63708       var summary = history.difference().summary();
63709       return _t.append("inspector.title_count", { title: _t("commit.changes"), count: summary.length });
63710     }).disclosureContent(renderDisclosureContent);
63711     function renderDisclosureContent(selection2) {
63712       var history = context.history();
63713       var summary = history.difference().summary();
63714       var container = selection2.selectAll(".commit-section").data([0]);
63715       var containerEnter = container.enter().append("div").attr("class", "commit-section");
63716       containerEnter.append("ul").attr("class", "changeset-list");
63717       container = containerEnter.merge(container);
63718       var items = container.select("ul").selectAll("li").data(summary);
63719       var itemsEnter = items.enter().append("li").attr("class", "change-item");
63720       var buttons = itemsEnter.append("button").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
63721       buttons.each(function(d) {
63722         select_default2(this).call(svgIcon("#iD-icon-" + d.entity.geometry(d.graph), "pre-text " + d.changeType));
63723       });
63724       buttons.append("span").attr("class", "change-type").html(function(d) {
63725         return _t.html("commit." + d.changeType) + " ";
63726       });
63727       buttons.append("strong").attr("class", "entity-type").text(function(d) {
63728         var matched = _mainPresetIndex.match(d.entity, d.graph);
63729         return matched && matched.name() || utilDisplayType(d.entity.id);
63730       });
63731       buttons.append("span").attr("class", "entity-name").text(function(d) {
63732         var name = utilDisplayName(d.entity) || "", string = "";
63733         if (name !== "") {
63734           string += ":";
63735         }
63736         return string += " " + name;
63737       });
63738       items = itemsEnter.merge(items);
63739       var changeset = new osmChangeset().update({ id: void 0 });
63740       var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
63741       delete changeset.id;
63742       var data = JXON.stringify(changeset.osmChangeJXON(changes));
63743       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
63744       var fileName = "changes.osc";
63745       var linkEnter = container.selectAll(".download-changes").data([0]).enter().append("a").attr("class", "download-changes");
63746       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
63747       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("commit.download_changes"));
63748       function mouseover(d) {
63749         if (d.entity) {
63750           context.surface().selectAll(
63751             utilEntityOrMemberSelector([d.entity.id], context.graph())
63752           ).classed("hover", true);
63753         }
63754       }
63755       function mouseout() {
63756         context.surface().selectAll(".hover").classed("hover", false);
63757       }
63758       function click(d3_event, change) {
63759         if (change.changeType !== "deleted") {
63760           var entity = change.entity;
63761           context.map().zoomToEase(entity);
63762           context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
63763         }
63764       }
63765     }
63766     return section;
63767   }
63768
63769   // modules/ui/commit_warnings.js
63770   function uiCommitWarnings(context) {
63771     function commitWarnings(selection2) {
63772       var issuesBySeverity = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeDisabledRules: true });
63773       for (var severity in issuesBySeverity) {
63774         var issues = issuesBySeverity[severity];
63775         if (severity !== "error") {
63776           issues = issues.filter(function(issue) {
63777             return issue.type !== "help_request";
63778           });
63779         }
63780         var section = severity + "-section";
63781         var issueItem = severity + "-item";
63782         var container = selection2.selectAll("." + section).data(issues.length ? [0] : []);
63783         container.exit().remove();
63784         var containerEnter = container.enter().append("div").attr("class", "modal-section " + section + " fillL2");
63785         containerEnter.append("h3").call(severity === "warning" ? _t.append("commit.warnings") : _t.append("commit.errors"));
63786         containerEnter.append("ul").attr("class", "changeset-list");
63787         container = containerEnter.merge(container);
63788         var items = container.select("ul").selectAll("li").data(issues, function(d) {
63789           return d.key;
63790         });
63791         items.exit().remove();
63792         var itemsEnter = items.enter().append("li").attr("class", issueItem);
63793         var buttons = itemsEnter.append("button").on("mouseover", function(d3_event, d) {
63794           if (d.entityIds) {
63795             context.surface().selectAll(
63796               utilEntityOrMemberSelector(
63797                 d.entityIds,
63798                 context.graph()
63799               )
63800             ).classed("hover", true);
63801           }
63802         }).on("mouseout", function() {
63803           context.surface().selectAll(".hover").classed("hover", false);
63804         }).on("click", function(d3_event, d) {
63805           context.validator().focusIssue(d);
63806         });
63807         buttons.call(svgIcon("#iD-icon-alert", "pre-text"));
63808         buttons.append("strong").attr("class", "issue-message");
63809         buttons.filter(function(d) {
63810           return d.tooltip;
63811         }).call(
63812           uiTooltip().title(function(d) {
63813             return d.tooltip;
63814           }).placement("top")
63815         );
63816         items = itemsEnter.merge(items);
63817         items.selectAll(".issue-message").text("").each(function(d) {
63818           return d.message(context)(select_default2(this));
63819         });
63820       }
63821     }
63822     return commitWarnings;
63823   }
63824
63825   // modules/ui/commit.js
63826   var readOnlyTags = [
63827     /^changesets_count$/,
63828     /^created_by$/,
63829     /^ideditor:/,
63830     /^imagery_used$/,
63831     /^host$/,
63832     /^locale$/,
63833     /^warnings:/,
63834     /^resolved:/,
63835     /^closed:note$/,
63836     /^closed:keepright$/,
63837     /^closed:improveosm:/,
63838     /^closed:osmose:/
63839   ];
63840   var hashtagRegex = /(#[^\u2000-\u206F\u2E00-\u2E7F\s\\'!"#$%()*,.\/:;<=>?@\[\]^`{|}~]+)/g;
63841   function uiCommit(context) {
63842     var dispatch10 = dispatch_default("cancel");
63843     var _userDetails2;
63844     var _selection;
63845     var changesetEditor = uiChangesetEditor(context).on("change", changeTags);
63846     var rawTagEditor = uiSectionRawTagEditor("changeset-tag-editor", context).on("change", changeTags).readOnlyTags(readOnlyTags);
63847     var commitChanges = uiSectionChanges(context);
63848     var commitWarnings = uiCommitWarnings(context);
63849     function commit(selection2) {
63850       _selection = selection2;
63851       if (!context.changeset)
63852         initChangeset();
63853       loadDerivedChangesetTags();
63854       selection2.call(render);
63855     }
63856     function initChangeset() {
63857       var commentDate = +corePreferences("commentDate") || 0;
63858       var currDate = Date.now();
63859       var cutoff = 2 * 86400 * 1e3;
63860       if (commentDate > currDate || currDate - commentDate > cutoff) {
63861         corePreferences("comment", null);
63862         corePreferences("hashtags", null);
63863         corePreferences("source", null);
63864       }
63865       if (context.defaultChangesetComment()) {
63866         corePreferences("comment", context.defaultChangesetComment());
63867         corePreferences("commentDate", Date.now());
63868       }
63869       if (context.defaultChangesetSource()) {
63870         corePreferences("source", context.defaultChangesetSource());
63871         corePreferences("commentDate", Date.now());
63872       }
63873       if (context.defaultChangesetHashtags()) {
63874         corePreferences("hashtags", context.defaultChangesetHashtags());
63875         corePreferences("commentDate", Date.now());
63876       }
63877       var detected = utilDetect();
63878       var tags = {
63879         comment: corePreferences("comment") || "",
63880         created_by: context.cleanTagValue("iD " + context.version),
63881         host: context.cleanTagValue(detected.host),
63882         locale: context.cleanTagValue(_mainLocalizer.localeCode())
63883       };
63884       findHashtags(tags, true);
63885       var hashtags = corePreferences("hashtags");
63886       if (hashtags) {
63887         tags.hashtags = hashtags;
63888       }
63889       var source = corePreferences("source");
63890       if (source) {
63891         tags.source = source;
63892       }
63893       var photoOverlaysUsed = context.history().photoOverlaysUsed();
63894       if (photoOverlaysUsed.length) {
63895         var sources = (tags.source || "").split(";");
63896         if (sources.indexOf("streetlevel imagery") === -1) {
63897           sources.push("streetlevel imagery");
63898         }
63899         photoOverlaysUsed.forEach(function(photoOverlay) {
63900           if (sources.indexOf(photoOverlay) === -1) {
63901             sources.push(photoOverlay);
63902           }
63903         });
63904         tags.source = context.cleanTagValue(sources.join(";"));
63905       }
63906       context.changeset = new osmChangeset({ tags });
63907     }
63908     function loadDerivedChangesetTags() {
63909       var osm = context.connection();
63910       if (!osm)
63911         return;
63912       var tags = Object.assign({}, context.changeset.tags);
63913       var imageryUsed = context.cleanTagValue(context.history().imageryUsed().join(";"));
63914       tags.imagery_used = imageryUsed || "None";
63915       var osmClosed = osm.getClosedIDs();
63916       var itemType;
63917       if (osmClosed.length) {
63918         tags["closed:note"] = context.cleanTagValue(osmClosed.join(";"));
63919       }
63920       if (services.keepRight) {
63921         var krClosed = services.keepRight.getClosedIDs();
63922         if (krClosed.length) {
63923           tags["closed:keepright"] = context.cleanTagValue(krClosed.join(";"));
63924         }
63925       }
63926       if (services.improveOSM) {
63927         var iOsmClosed = services.improveOSM.getClosedCounts();
63928         for (itemType in iOsmClosed) {
63929           tags["closed:improveosm:" + itemType] = context.cleanTagValue(iOsmClosed[itemType].toString());
63930         }
63931       }
63932       if (services.osmose) {
63933         var osmoseClosed = services.osmose.getClosedCounts();
63934         for (itemType in osmoseClosed) {
63935           tags["closed:osmose:" + itemType] = context.cleanTagValue(osmoseClosed[itemType].toString());
63936         }
63937       }
63938       for (var key in tags) {
63939         if (key.match(/(^warnings:)|(^resolved:)/)) {
63940           delete tags[key];
63941         }
63942       }
63943       function addIssueCounts(issues, prefix) {
63944         var issuesByType = utilArrayGroupBy(issues, "type");
63945         for (var issueType in issuesByType) {
63946           var issuesOfType = issuesByType[issueType];
63947           if (issuesOfType[0].subtype) {
63948             var issuesBySubtype = utilArrayGroupBy(issuesOfType, "subtype");
63949             for (var issueSubtype in issuesBySubtype) {
63950               var issuesOfSubtype = issuesBySubtype[issueSubtype];
63951               tags[prefix + ":" + issueType + ":" + issueSubtype] = context.cleanTagValue(issuesOfSubtype.length.toString());
63952             }
63953           } else {
63954             tags[prefix + ":" + issueType] = context.cleanTagValue(issuesOfType.length.toString());
63955           }
63956         }
63957       }
63958       var warnings = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeIgnored: true, includeDisabledRules: true }).warning.filter(function(issue) {
63959         return issue.type !== "help_request";
63960       });
63961       addIssueCounts(warnings, "warnings");
63962       var resolvedIssues = context.validator().getResolvedIssues();
63963       addIssueCounts(resolvedIssues, "resolved");
63964       context.changeset = context.changeset.update({ tags });
63965     }
63966     function render(selection2) {
63967       var osm = context.connection();
63968       if (!osm)
63969         return;
63970       var header = selection2.selectAll(".header").data([0]);
63971       var headerTitle = header.enter().append("div").attr("class", "header fillL");
63972       headerTitle.append("div").append("h2").call(_t.append("commit.title"));
63973       headerTitle.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
63974         dispatch10.call("cancel", this);
63975       }).call(svgIcon("#iD-icon-close"));
63976       var body = selection2.selectAll(".body").data([0]);
63977       body = body.enter().append("div").attr("class", "body").merge(body);
63978       var changesetSection = body.selectAll(".changeset-editor").data([0]);
63979       changesetSection = changesetSection.enter().append("div").attr("class", "modal-section changeset-editor").merge(changesetSection);
63980       changesetSection.call(
63981         changesetEditor.changesetID(context.changeset.id).tags(context.changeset.tags)
63982       );
63983       body.call(commitWarnings);
63984       var saveSection = body.selectAll(".save-section").data([0]);
63985       saveSection = saveSection.enter().append("div").attr("class", "modal-section save-section fillL").merge(saveSection);
63986       var prose = saveSection.selectAll(".commit-info").data([0]);
63987       if (prose.enter().size()) {
63988         _userDetails2 = null;
63989       }
63990       prose = prose.enter().append("p").attr("class", "commit-info").call(_t.append("commit.upload_explanation")).merge(prose);
63991       osm.userDetails(function(err, user) {
63992         if (err)
63993           return;
63994         if (_userDetails2 === user)
63995           return;
63996         _userDetails2 = user;
63997         var userLink = select_default2(document.createElement("div"));
63998         if (user.image_url) {
63999           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
64000         }
64001         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
64002         prose.html(_t.html("commit.upload_explanation_with_user", { user: { html: userLink.html() } }));
64003       });
64004       var requestReview = saveSection.selectAll(".request-review").data([0]);
64005       var requestReviewEnter = requestReview.enter().append("div").attr("class", "request-review");
64006       var requestReviewDomId = utilUniqueDomId("commit-input-request-review");
64007       var labelEnter = requestReviewEnter.append("label").attr("for", requestReviewDomId);
64008       if (!labelEnter.empty()) {
64009         labelEnter.call(uiTooltip().title(() => _t.append("commit.request_review_info")).placement("top"));
64010       }
64011       labelEnter.append("input").attr("type", "checkbox").attr("id", requestReviewDomId);
64012       labelEnter.append("span").call(_t.append("commit.request_review"));
64013       requestReview = requestReview.merge(requestReviewEnter);
64014       var requestReviewInput = requestReview.selectAll("input").property("checked", isReviewRequested(context.changeset.tags)).on("change", toggleRequestReview);
64015       var buttonSection = saveSection.selectAll(".buttons").data([0]);
64016       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons fillL");
64017       buttonEnter.append("button").attr("class", "secondary-action button cancel-button").append("span").attr("class", "label").call(_t.append("commit.cancel"));
64018       var uploadButton = buttonEnter.append("button").attr("class", "action button save-button");
64019       uploadButton.append("span").attr("class", "label").call(_t.append("commit.save"));
64020       var uploadBlockerTooltipText = getUploadBlockerMessage();
64021       buttonSection = buttonSection.merge(buttonEnter);
64022       buttonSection.selectAll(".cancel-button").on("click.cancel", function() {
64023         dispatch10.call("cancel", this);
64024       });
64025       buttonSection.selectAll(".save-button").classed("disabled", uploadBlockerTooltipText !== null).on("click.save", function() {
64026         if (!select_default2(this).classed("disabled")) {
64027           this.blur();
64028           for (var key in context.changeset.tags) {
64029             if (!key)
64030               delete context.changeset.tags[key];
64031           }
64032           context.uploader().save(context.changeset);
64033         }
64034       });
64035       uiTooltip().destroyAny(buttonSection.selectAll(".save-button"));
64036       if (uploadBlockerTooltipText) {
64037         buttonSection.selectAll(".save-button").call(uiTooltip().title(() => uploadBlockerTooltipText).placement("top"));
64038       }
64039       var tagSection = body.selectAll(".tag-section.raw-tag-editor").data([0]);
64040       tagSection = tagSection.enter().append("div").attr("class", "modal-section tag-section raw-tag-editor").merge(tagSection);
64041       tagSection.call(
64042         rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
64043       );
64044       var changesSection = body.selectAll(".commit-changes-section").data([0]);
64045       changesSection = changesSection.enter().append("div").attr("class", "modal-section commit-changes-section").merge(changesSection);
64046       changesSection.call(commitChanges.render);
64047       function toggleRequestReview() {
64048         var rr = requestReviewInput.property("checked");
64049         updateChangeset({ review_requested: rr ? "yes" : void 0 });
64050         tagSection.call(
64051           rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
64052         );
64053       }
64054     }
64055     function getUploadBlockerMessage() {
64056       var errors = context.validator().getIssuesBySeverity({ what: "edited", where: "all" }).error;
64057       if (errors.length) {
64058         return _t.append("commit.outstanding_errors_message", { count: errors.length });
64059       } else {
64060         var hasChangesetComment = context.changeset && context.changeset.tags.comment && context.changeset.tags.comment.trim().length;
64061         if (!hasChangesetComment) {
64062           return _t.append("commit.comment_needed_message");
64063         }
64064       }
64065       return null;
64066     }
64067     function changeTags(_, changed, onInput) {
64068       if (changed.hasOwnProperty("comment")) {
64069         if (changed.comment === void 0) {
64070           changed.comment = "";
64071         }
64072         if (!onInput) {
64073           corePreferences("comment", changed.comment);
64074           corePreferences("commentDate", Date.now());
64075         }
64076       }
64077       if (changed.hasOwnProperty("source")) {
64078         if (changed.source === void 0) {
64079           corePreferences("source", null);
64080         } else if (!onInput) {
64081           corePreferences("source", changed.source);
64082           corePreferences("commentDate", Date.now());
64083         }
64084       }
64085       updateChangeset(changed, onInput);
64086       if (_selection) {
64087         _selection.call(render);
64088       }
64089     }
64090     function findHashtags(tags, commentOnly) {
64091       var detectedHashtags = commentHashtags();
64092       if (detectedHashtags.length) {
64093         corePreferences("hashtags", null);
64094       }
64095       if (!detectedHashtags.length || !commentOnly) {
64096         detectedHashtags = detectedHashtags.concat(hashtagHashtags());
64097       }
64098       var allLowerCase = /* @__PURE__ */ new Set();
64099       return detectedHashtags.filter(function(hashtag) {
64100         var lowerCase = hashtag.toLowerCase();
64101         if (!allLowerCase.has(lowerCase)) {
64102           allLowerCase.add(lowerCase);
64103           return true;
64104         }
64105         return false;
64106       });
64107       function commentHashtags() {
64108         var matches = (tags.comment || "").replace(/http\S*/g, "").match(hashtagRegex);
64109         return matches || [];
64110       }
64111       function hashtagHashtags() {
64112         var matches = (tags.hashtags || "").split(/[,;\s]+/).map(function(s) {
64113           if (s[0] !== "#") {
64114             s = "#" + s;
64115           }
64116           var matched = s.match(hashtagRegex);
64117           return matched && matched[0];
64118         }).filter(Boolean);
64119         return matches || [];
64120       }
64121     }
64122     function isReviewRequested(tags) {
64123       var rr = tags.review_requested;
64124       if (rr === void 0)
64125         return false;
64126       rr = rr.trim().toLowerCase();
64127       return !(rr === "" || rr === "no");
64128     }
64129     function updateChangeset(changed, onInput) {
64130       var tags = Object.assign({}, context.changeset.tags);
64131       Object.keys(changed).forEach(function(k) {
64132         var v = changed[k];
64133         k = context.cleanTagKey(k);
64134         if (readOnlyTags.indexOf(k) !== -1)
64135           return;
64136         if (v === void 0) {
64137           delete tags[k];
64138         } else if (onInput) {
64139           tags[k] = v;
64140         } else {
64141           tags[k] = context.cleanTagValue(v);
64142         }
64143       });
64144       if (!onInput) {
64145         var commentOnly = changed.hasOwnProperty("comment") && changed.comment !== "";
64146         var arr = findHashtags(tags, commentOnly);
64147         if (arr.length) {
64148           tags.hashtags = context.cleanTagValue(arr.join(";"));
64149           corePreferences("hashtags", tags.hashtags);
64150         } else {
64151           delete tags.hashtags;
64152           corePreferences("hashtags", null);
64153         }
64154       }
64155       if (_userDetails2 && _userDetails2.changesets_count !== void 0) {
64156         var changesetsCount = parseInt(_userDetails2.changesets_count, 10) + 1;
64157         tags.changesets_count = String(changesetsCount);
64158         if (changesetsCount <= 100) {
64159           var s;
64160           s = corePreferences("walkthrough_completed");
64161           if (s) {
64162             tags["ideditor:walkthrough_completed"] = s;
64163           }
64164           s = corePreferences("walkthrough_progress");
64165           if (s) {
64166             tags["ideditor:walkthrough_progress"] = s;
64167           }
64168           s = corePreferences("walkthrough_started");
64169           if (s) {
64170             tags["ideditor:walkthrough_started"] = s;
64171           }
64172         }
64173       } else {
64174         delete tags.changesets_count;
64175       }
64176       if (!(0, import_fast_deep_equal9.default)(context.changeset.tags, tags)) {
64177         context.changeset = context.changeset.update({ tags });
64178       }
64179     }
64180     commit.reset = function() {
64181       context.changeset = null;
64182     };
64183     return utilRebind(commit, dispatch10, "on");
64184   }
64185
64186   // modules/ui/confirm.js
64187   function uiConfirm(selection2) {
64188     var modalSelection = uiModal(selection2);
64189     modalSelection.select(".modal").classed("modal-alert", true);
64190     var section = modalSelection.select(".content");
64191     section.append("div").attr("class", "modal-section header");
64192     section.append("div").attr("class", "modal-section message-text");
64193     var buttons = section.append("div").attr("class", "modal-section buttons cf");
64194     modalSelection.okButton = function() {
64195       buttons.append("button").attr("class", "button ok-button action").on("click.confirm", function() {
64196         modalSelection.remove();
64197       }).call(_t.append("confirm.okay")).node().focus();
64198       return modalSelection;
64199     };
64200     return modalSelection;
64201   }
64202
64203   // modules/ui/conflicts.js
64204   function uiConflicts(context) {
64205     var dispatch10 = dispatch_default("cancel", "save");
64206     var keybinding = utilKeybinding("conflicts");
64207     var _origChanges;
64208     var _conflictList;
64209     var _shownConflictIndex;
64210     function keybindingOn() {
64211       select_default2(document).call(keybinding.on("\u238B", cancel, true));
64212     }
64213     function keybindingOff() {
64214       select_default2(document).call(keybinding.unbind);
64215     }
64216     function tryAgain() {
64217       keybindingOff();
64218       dispatch10.call("save");
64219     }
64220     function cancel() {
64221       keybindingOff();
64222       dispatch10.call("cancel");
64223     }
64224     function conflicts(selection2) {
64225       keybindingOn();
64226       var headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
64227       headerEnter.append("button").attr("class", "fr").attr("title", _t("icons.close")).on("click", cancel).call(svgIcon("#iD-icon-close"));
64228       headerEnter.append("h2").call(_t.append("save.conflict.header"));
64229       var bodyEnter = selection2.selectAll(".body").data([0]).enter().append("div").attr("class", "body fillL");
64230       var conflictsHelpEnter = bodyEnter.append("div").attr("class", "conflicts-help").call(_t.append("save.conflict.help"));
64231       var changeset = new osmChangeset();
64232       delete changeset.id;
64233       var data = JXON.stringify(changeset.osmChangeJXON(_origChanges));
64234       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
64235       var fileName = "changes.osc";
64236       var linkEnter = conflictsHelpEnter.selectAll(".download-changes").append("a").attr("class", "download-changes");
64237       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
64238       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("save.conflict.download_changes"));
64239       bodyEnter.append("div").attr("class", "conflict-container fillL3").call(showConflict, 0);
64240       bodyEnter.append("div").attr("class", "conflicts-done").attr("opacity", 0).style("display", "none").call(_t.append("save.conflict.done"));
64241       var buttonsEnter = bodyEnter.append("div").attr("class", "buttons col12 joined conflicts-buttons");
64242       buttonsEnter.append("button").attr("disabled", _conflictList.length > 1).attr("class", "action conflicts-button col6").call(_t.append("save.title")).on("click.try_again", tryAgain);
64243       buttonsEnter.append("button").attr("class", "secondary-action conflicts-button col6").call(_t.append("confirm.cancel")).on("click.cancel", cancel);
64244     }
64245     function showConflict(selection2, index) {
64246       index = utilWrap(index, _conflictList.length);
64247       _shownConflictIndex = index;
64248       var parent = select_default2(selection2.node().parentNode);
64249       if (index === _conflictList.length - 1) {
64250         window.setTimeout(function() {
64251           parent.select(".conflicts-button").attr("disabled", null);
64252           parent.select(".conflicts-done").transition().attr("opacity", 1).style("display", "block");
64253         }, 250);
64254       }
64255       var conflict = selection2.selectAll(".conflict").data([_conflictList[index]]);
64256       conflict.exit().remove();
64257       var conflictEnter = conflict.enter().append("div").attr("class", "conflict");
64258       conflictEnter.append("h4").attr("class", "conflict-count").call(_t.append("save.conflict.count", { num: index + 1, total: _conflictList.length }));
64259       conflictEnter.append("a").attr("class", "conflict-description").attr("href", "#").text(function(d) {
64260         return d.name;
64261       }).on("click", function(d3_event, d) {
64262         d3_event.preventDefault();
64263         zoomToEntity(d.id);
64264       });
64265       var details = conflictEnter.append("div").attr("class", "conflict-detail-container");
64266       details.append("ul").attr("class", "conflict-detail-list").selectAll("li").data(function(d) {
64267         return d.details || [];
64268       }).enter().append("li").attr("class", "conflict-detail-item").html(function(d) {
64269         return d;
64270       });
64271       details.append("div").attr("class", "conflict-choices").call(addChoices);
64272       details.append("div").attr("class", "conflict-nav-buttons joined cf").selectAll("button").data(["previous", "next"]).enter().append("button").attr("class", "conflict-nav-button action col6").attr("disabled", function(d, i2) {
64273         return i2 === 0 && index === 0 || i2 === 1 && index === _conflictList.length - 1 || null;
64274       }).on("click", function(d3_event, d) {
64275         d3_event.preventDefault();
64276         var container = parent.selectAll(".conflict-container");
64277         var sign2 = d === "previous" ? -1 : 1;
64278         container.selectAll(".conflict").remove();
64279         container.call(showConflict, index + sign2);
64280       }).each(function(d) {
64281         _t.append("save.conflict." + d)(select_default2(this));
64282       });
64283     }
64284     function addChoices(selection2) {
64285       var choices = selection2.append("ul").attr("class", "layer-list").selectAll("li").data(function(d) {
64286         return d.choices || [];
64287       });
64288       var choicesEnter = choices.enter().append("li").attr("class", "layer");
64289       var labelEnter = choicesEnter.append("label");
64290       labelEnter.append("input").attr("type", "radio").attr("name", function(d) {
64291         return d.id;
64292       }).on("change", function(d3_event, d) {
64293         var ul = this.parentNode.parentNode.parentNode;
64294         ul.__data__.chosen = d.id;
64295         choose(d3_event, ul, d);
64296       });
64297       labelEnter.append("span").text(function(d) {
64298         return d.text;
64299       });
64300       choicesEnter.merge(choices).each(function(d) {
64301         var ul = this.parentNode;
64302         if (ul.__data__.chosen === d.id) {
64303           choose(null, ul, d);
64304         }
64305       });
64306     }
64307     function choose(d3_event, ul, datum2) {
64308       if (d3_event)
64309         d3_event.preventDefault();
64310       select_default2(ul).selectAll("li").classed("active", function(d) {
64311         return d === datum2;
64312       }).selectAll("input").property("checked", function(d) {
64313         return d === datum2;
64314       });
64315       var extent = geoExtent();
64316       var entity;
64317       entity = context.graph().hasEntity(datum2.id);
64318       if (entity)
64319         extent._extend(entity.extent(context.graph()));
64320       datum2.action();
64321       entity = context.graph().hasEntity(datum2.id);
64322       if (entity)
64323         extent._extend(entity.extent(context.graph()));
64324       zoomToEntity(datum2.id, extent);
64325     }
64326     function zoomToEntity(id2, extent) {
64327       context.surface().selectAll(".hover").classed("hover", false);
64328       var entity = context.graph().hasEntity(id2);
64329       if (entity) {
64330         if (extent) {
64331           context.map().trimmedExtent(extent);
64332         } else {
64333           context.map().zoomToEase(entity);
64334         }
64335         context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
64336       }
64337     }
64338     conflicts.conflictList = function(_) {
64339       if (!arguments.length)
64340         return _conflictList;
64341       _conflictList = _;
64342       return conflicts;
64343     };
64344     conflicts.origChanges = function(_) {
64345       if (!arguments.length)
64346         return _origChanges;
64347       _origChanges = _;
64348       return conflicts;
64349     };
64350     conflicts.shownEntityIds = function() {
64351       if (_conflictList && typeof _shownConflictIndex === "number") {
64352         return [_conflictList[_shownConflictIndex].id];
64353       }
64354       return [];
64355     };
64356     return utilRebind(conflicts, dispatch10, "on");
64357   }
64358
64359   // modules/ui/entity_editor.js
64360   var import_fast_deep_equal10 = __toESM(require_fast_deep_equal());
64361
64362   // modules/ui/sections/entity_issues.js
64363   function uiSectionEntityIssues(context) {
64364     var preference = corePreferences("entity-issues.reference.expanded");
64365     var _expanded = preference === null ? true : preference === "true";
64366     var _entityIDs = [];
64367     var _issues = [];
64368     var _activeIssueID;
64369     var section = uiSection("entity-issues", context).shouldDisplay(function() {
64370       return _issues.length > 0;
64371     }).label(function() {
64372       return _t.append("inspector.title_count", { title: _t("issues.list_title"), count: _issues.length });
64373     }).disclosureContent(renderDisclosureContent);
64374     context.validator().on("validated.entity_issues", function() {
64375       reloadIssues();
64376       section.reRender();
64377     }).on("focusedIssue.entity_issues", function(issue) {
64378       makeActiveIssue(issue.id);
64379     });
64380     function reloadIssues() {
64381       _issues = context.validator().getSharedEntityIssues(_entityIDs, { includeDisabledRules: true });
64382     }
64383     function makeActiveIssue(issueID) {
64384       _activeIssueID = issueID;
64385       section.selection().selectAll(".issue-container").classed("active", function(d) {
64386         return d.id === _activeIssueID;
64387       });
64388     }
64389     function renderDisclosureContent(selection2) {
64390       selection2.classed("grouped-items-area", true);
64391       _activeIssueID = _issues.length > 0 ? _issues[0].id : null;
64392       var containers = selection2.selectAll(".issue-container").data(_issues, function(d) {
64393         return d.key;
64394       });
64395       containers.exit().remove();
64396       var containersEnter = containers.enter().append("div").attr("class", "issue-container");
64397       var itemsEnter = containersEnter.append("div").attr("class", function(d) {
64398         return "issue severity-" + d.severity;
64399       }).on("mouseover.highlight", function(d3_event, d) {
64400         var ids = d.entityIds.filter(function(e) {
64401           return _entityIDs.indexOf(e) === -1;
64402         });
64403         utilHighlightEntities(ids, true, context);
64404       }).on("mouseout.highlight", function(d3_event, d) {
64405         var ids = d.entityIds.filter(function(e) {
64406           return _entityIDs.indexOf(e) === -1;
64407         });
64408         utilHighlightEntities(ids, false, context);
64409       });
64410       var labelsEnter = itemsEnter.append("div").attr("class", "issue-label");
64411       var textEnter = labelsEnter.append("button").attr("class", "issue-text").on("click", function(d3_event, d) {
64412         makeActiveIssue(d.id);
64413         var extent = d.extent(context.graph());
64414         if (extent) {
64415           var setZoom = Math.max(context.map().zoom(), 19);
64416           context.map().unobscuredCenterZoomEase(extent.center(), setZoom);
64417         }
64418       });
64419       textEnter.each(function(d) {
64420         var iconName = "#iD-icon-" + (d.severity === "warning" ? "alert" : "error");
64421         select_default2(this).call(svgIcon(iconName, "issue-icon"));
64422       });
64423       textEnter.append("span").attr("class", "issue-message");
64424       var infoButton = labelsEnter.append("button").attr("class", "issue-info-button").attr("title", _t("icons.information")).call(svgIcon("#iD-icon-inspect"));
64425       infoButton.on("click", function(d3_event) {
64426         d3_event.stopPropagation();
64427         d3_event.preventDefault();
64428         this.blur();
64429         var container = select_default2(this.parentNode.parentNode.parentNode);
64430         var info = container.selectAll(".issue-info");
64431         var isExpanded = info.classed("expanded");
64432         _expanded = !isExpanded;
64433         corePreferences("entity-issues.reference.expanded", _expanded);
64434         if (isExpanded) {
64435           info.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
64436             info.classed("expanded", false);
64437           });
64438         } else {
64439           info.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1").on("end", function() {
64440             info.style("max-height", null);
64441           });
64442         }
64443       });
64444       itemsEnter.append("ul").attr("class", "issue-fix-list");
64445       containersEnter.append("div").attr("class", "issue-info" + (_expanded ? " expanded" : "")).style("max-height", _expanded ? null : "0").style("opacity", _expanded ? "1" : "0").each(function(d) {
64446         if (typeof d.reference === "function") {
64447           select_default2(this).call(d.reference);
64448         } else {
64449           select_default2(this).call(_t.append("inspector.no_documentation_key"));
64450         }
64451       });
64452       containers = containers.merge(containersEnter).classed("active", function(d) {
64453         return d.id === _activeIssueID;
64454       });
64455       containers.selectAll(".issue-message").text("").each(function(d) {
64456         return d.message(context)(select_default2(this));
64457       });
64458       var fixLists = containers.selectAll(".issue-fix-list");
64459       var fixes = fixLists.selectAll(".issue-fix-item").data(function(d) {
64460         return d.fixes ? d.fixes(context) : [];
64461       }, function(fix) {
64462         return fix.id;
64463       });
64464       fixes.exit().remove();
64465       var fixesEnter = fixes.enter().append("li").attr("class", "issue-fix-item");
64466       var buttons = fixesEnter.append("button").on("click", function(d3_event, d) {
64467         if (select_default2(this).attr("disabled") || !d.onClick)
64468           return;
64469         if (d.issue.dateLastRanFix && /* @__PURE__ */ new Date() - d.issue.dateLastRanFix < 1e3)
64470           return;
64471         d.issue.dateLastRanFix = /* @__PURE__ */ new Date();
64472         utilHighlightEntities(d.issue.entityIds.concat(d.entityIds), false, context);
64473         new Promise(function(resolve, reject) {
64474           d.onClick(context, resolve, reject);
64475           if (d.onClick.length <= 1) {
64476             resolve();
64477           }
64478         }).then(function() {
64479           context.validator().validate();
64480         });
64481       }).on("mouseover.highlight", function(d3_event, d) {
64482         utilHighlightEntities(d.entityIds, true, context);
64483       }).on("mouseout.highlight", function(d3_event, d) {
64484         utilHighlightEntities(d.entityIds, false, context);
64485       });
64486       buttons.each(function(d) {
64487         var iconName = d.icon || "iD-icon-wrench";
64488         if (iconName.startsWith("maki")) {
64489           iconName += "-15";
64490         }
64491         select_default2(this).call(svgIcon("#" + iconName, "fix-icon"));
64492       });
64493       buttons.append("span").attr("class", "fix-message").each(function(d) {
64494         return d.title(select_default2(this));
64495       });
64496       fixesEnter.merge(fixes).selectAll("button").classed("actionable", function(d) {
64497         return d.onClick;
64498       }).attr("disabled", function(d) {
64499         return d.onClick ? null : "true";
64500       }).attr("title", function(d) {
64501         if (d.disabledReason) {
64502           return d.disabledReason;
64503         }
64504         return null;
64505       });
64506     }
64507     section.entityIDs = function(val) {
64508       if (!arguments.length)
64509         return _entityIDs;
64510       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
64511         _entityIDs = val;
64512         _activeIssueID = null;
64513         reloadIssues();
64514       }
64515       return section;
64516     };
64517     return section;
64518   }
64519
64520   // modules/ui/preset_icon.js
64521   function uiPresetIcon() {
64522     let _preset;
64523     let _geometry;
64524     function presetIcon(selection2) {
64525       selection2.each(render);
64526     }
64527     function getIcon(p, geom) {
64528       if (p.isFallback && p.isFallback())
64529         return geom === "vertex" ? "" : "iD-icon-" + p.id;
64530       if (p.icon)
64531         return p.icon;
64532       if (geom === "line")
64533         return "iD-other-line";
64534       if (geom === "vertex")
64535         return "temaki-vertex";
64536       return "maki-marker-stroked";
64537     }
64538     function renderPointBorder(container, drawPoint) {
64539       let pointBorder = container.selectAll(".preset-icon-point-border").data(drawPoint ? [0] : []);
64540       pointBorder.exit().remove();
64541       let pointBorderEnter = pointBorder.enter();
64542       const w = 40;
64543       const h = 40;
64544       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");
64545       pointBorder = pointBorderEnter.merge(pointBorder);
64546     }
64547     function renderCategoryBorder(container, category) {
64548       let categoryBorder = container.selectAll(".preset-icon-category-border").data(category ? [0] : []);
64549       categoryBorder.exit().remove();
64550       let categoryBorderEnter = categoryBorder.enter();
64551       const d = 60;
64552       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}`);
64553       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");
64554       categoryBorder = categoryBorderEnter.merge(categoryBorder);
64555       if (category) {
64556         categoryBorder.selectAll("path").attr("class", `area ${category.id}`);
64557       }
64558     }
64559     function renderCircleFill(container, drawVertex) {
64560       let vertexFill = container.selectAll(".preset-icon-fill-vertex").data(drawVertex ? [0] : []);
64561       vertexFill.exit().remove();
64562       let vertexFillEnter = vertexFill.enter();
64563       const w = 60;
64564       const h = 60;
64565       const d = 40;
64566       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);
64567       vertexFill = vertexFillEnter.merge(vertexFill);
64568     }
64569     function renderSquareFill(container, drawArea, tagClasses) {
64570       let fill = container.selectAll(".preset-icon-fill-area").data(drawArea ? [0] : []);
64571       fill.exit().remove();
64572       let fillEnter = fill.enter();
64573       const d = 60;
64574       const w = d;
64575       const h = d;
64576       const l = d * 2 / 3;
64577       const c1 = (w - l) / 2;
64578       const c2 = c1 + l;
64579       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}`);
64580       ["fill", "stroke"].forEach((klass) => {
64581         fillEnter.append("path").attr("d", `M${c1} ${c1} L${c1} ${c2} L${c2} ${c2} L${c2} ${c1} Z`).attr("class", `area ${klass}`);
64582       });
64583       const rVertex = 2.5;
64584       [[c1, c1], [c1, c2], [c2, c2], [c2, c1]].forEach((point2) => {
64585         fillEnter.append("circle").attr("class", "vertex").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", rVertex);
64586       });
64587       const rMidpoint = 1.25;
64588       [[c1, w / 2], [c2, w / 2], [h / 2, c1], [h / 2, c2]].forEach((point2) => {
64589         fillEnter.append("circle").attr("class", "midpoint").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", rMidpoint);
64590       });
64591       fill = fillEnter.merge(fill);
64592       fill.selectAll("path.stroke").attr("class", `area stroke ${tagClasses}`);
64593       fill.selectAll("path.fill").attr("class", `area fill ${tagClasses}`);
64594     }
64595     function renderLine(container, drawLine, tagClasses) {
64596       let line = container.selectAll(".preset-icon-line").data(drawLine ? [0] : []);
64597       line.exit().remove();
64598       let lineEnter = line.enter();
64599       const d = 60;
64600       const w = d;
64601       const h = d;
64602       const y = Math.round(d * 0.72);
64603       const l = Math.round(d * 0.6);
64604       const r = 2.5;
64605       const x12 = (w - l) / 2;
64606       const x2 = x12 + l;
64607       lineEnter = lineEnter.append("svg").attr("class", "preset-icon-line").attr("width", w).attr("height", h).attr("viewBox", `0 0 ${w} ${h}`);
64608       ["casing", "stroke"].forEach((klass) => {
64609         lineEnter.append("path").attr("d", `M${x12} ${y} L${x2} ${y}`).attr("class", `line ${klass}`);
64610       });
64611       [[x12 - 1, y], [x2 + 1, y]].forEach((point2) => {
64612         lineEnter.append("circle").attr("class", "vertex").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", r);
64613       });
64614       line = lineEnter.merge(line);
64615       line.selectAll("path.stroke").attr("class", `line stroke ${tagClasses}`);
64616       line.selectAll("path.casing").attr("class", `line casing ${tagClasses}`);
64617     }
64618     function renderRoute(container, drawRoute, p) {
64619       let route = container.selectAll(".preset-icon-route").data(drawRoute ? [0] : []);
64620       route.exit().remove();
64621       let routeEnter = route.enter();
64622       const d = 60;
64623       const w = d;
64624       const h = d;
64625       const y12 = Math.round(d * 0.8);
64626       const y2 = Math.round(d * 0.68);
64627       const l = Math.round(d * 0.6);
64628       const r = 2;
64629       const x12 = (w - l) / 2;
64630       const x2 = x12 + l / 3;
64631       const x3 = x2 + l / 3;
64632       const x4 = x3 + l / 3;
64633       routeEnter = routeEnter.append("svg").attr("class", "preset-icon-route").attr("width", w).attr("height", h).attr("viewBox", `0 0 ${w} ${h}`);
64634       ["casing", "stroke"].forEach((klass) => {
64635         routeEnter.append("path").attr("d", `M${x12} ${y12} L${x2} ${y2}`).attr("class", `segment0 line ${klass}`);
64636         routeEnter.append("path").attr("d", `M${x2} ${y2} L${x3} ${y12}`).attr("class", `segment1 line ${klass}`);
64637         routeEnter.append("path").attr("d", `M${x3} ${y12} L${x4} ${y2}`).attr("class", `segment2 line ${klass}`);
64638       });
64639       [[x12, y12], [x2, y2], [x3, y12], [x4, y2]].forEach((point2) => {
64640         routeEnter.append("circle").attr("class", "vertex").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", r);
64641       });
64642       route = routeEnter.merge(route);
64643       if (drawRoute) {
64644         let routeType = p.tags.type === "waterway" ? "waterway" : p.tags.route;
64645         const segmentPresetIDs = routeSegments[routeType];
64646         for (let i2 in segmentPresetIDs) {
64647           const segmentPreset = _mainPresetIndex.item(segmentPresetIDs[i2]);
64648           const segmentTagClasses = svgTagClasses().getClassesString(segmentPreset.tags, "");
64649           route.selectAll(`path.stroke.segment${i2}`).attr("class", `segment${i2} line stroke ${segmentTagClasses}`);
64650           route.selectAll(`path.casing.segment${i2}`).attr("class", `segment${i2} line casing ${segmentTagClasses}`);
64651         }
64652       }
64653     }
64654     function renderSvgIcon(container, picon, geom, isFramed, category, tagClasses) {
64655       const isMaki = picon && /^maki-/.test(picon);
64656       const isTemaki = picon && /^temaki-/.test(picon);
64657       const isFa = picon && /^fa[srb]-/.test(picon);
64658       const isR\u00F6ntgen = picon && /^roentgen-/.test(picon);
64659       const isiDIcon = picon && !(isMaki || isTemaki || isFa || isR\u00F6ntgen);
64660       let icon2 = container.selectAll(".preset-icon").data(picon ? [0] : []);
64661       icon2.exit().remove();
64662       icon2 = icon2.enter().append("div").attr("class", "preset-icon").call(svgIcon("")).merge(icon2);
64663       icon2.attr("class", "preset-icon " + (geom ? geom + "-geom" : "")).classed("category", category).classed("framed", isFramed).classed("preset-icon-iD", isiDIcon);
64664       icon2.selectAll("svg").attr("class", "icon " + picon + " " + (!isiDIcon && geom !== "line" ? "" : tagClasses));
64665       icon2.selectAll("use").attr("href", "#" + picon);
64666     }
64667     function renderImageIcon(container, imageURL) {
64668       let imageIcon = container.selectAll("img.image-icon").data(imageURL ? [0] : []);
64669       imageIcon.exit().remove();
64670       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);
64671       imageIcon.attr("src", imageURL);
64672     }
64673     const routeSegments = {
64674       bicycle: ["highway/cycleway", "highway/cycleway", "highway/cycleway"],
64675       bus: ["highway/unclassified", "highway/secondary", "highway/primary"],
64676       trolleybus: ["highway/unclassified", "highway/secondary", "highway/primary"],
64677       detour: ["highway/tertiary", "highway/residential", "highway/unclassified"],
64678       ferry: ["route/ferry", "route/ferry", "route/ferry"],
64679       foot: ["highway/footway", "highway/footway", "highway/footway"],
64680       hiking: ["highway/path", "highway/path", "highway/path"],
64681       horse: ["highway/bridleway", "highway/bridleway", "highway/bridleway"],
64682       light_rail: ["railway/light_rail", "railway/light_rail", "railway/light_rail"],
64683       monorail: ["railway/monorail", "railway/monorail", "railway/monorail"],
64684       mtb: ["highway/path", "highway/track", "highway/bridleway"],
64685       pipeline: ["man_made/pipeline", "man_made/pipeline", "man_made/pipeline"],
64686       piste: ["piste/downhill", "piste/hike", "piste/nordic"],
64687       power: ["power/line", "power/line", "power/line"],
64688       road: ["highway/secondary", "highway/primary", "highway/trunk"],
64689       subway: ["railway/subway", "railway/subway", "railway/subway"],
64690       train: ["railway/rail", "railway/rail", "railway/rail"],
64691       tram: ["railway/tram", "railway/tram", "railway/tram"],
64692       waterway: ["waterway/stream", "waterway/stream", "waterway/stream"]
64693     };
64694     function render() {
64695       let p = _preset.apply(this, arguments);
64696       let geom = _geometry ? _geometry.apply(this, arguments) : null;
64697       if (geom === "relation" && p.tags && (p.tags.type === "route" && p.tags.route && routeSegments[p.tags.route] || p.tags.type === "waterway")) {
64698         geom = "route";
64699       }
64700       const showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
64701       const isFallback = p.isFallback && p.isFallback();
64702       const imageURL = showThirdPartyIcons === "true" && p.imageURL;
64703       const picon = getIcon(p, geom);
64704       const isCategory = !p.setTags;
64705       const drawPoint = false;
64706       const drawVertex = picon !== null && geom === "vertex";
64707       const drawLine = picon && geom === "line" && !isFallback && !isCategory;
64708       const drawArea = picon && geom === "area" && !isFallback && !isCategory;
64709       const drawRoute = picon && geom === "route";
64710       const isFramed = drawVertex || drawArea || drawLine || drawRoute || isCategory;
64711       let tags = !isCategory ? p.setTags({}, geom) : {};
64712       for (let k in tags) {
64713         if (tags[k] === "*") {
64714           tags[k] = "yes";
64715         }
64716       }
64717       let tagClasses = svgTagClasses().getClassesString(tags, "");
64718       let selection2 = select_default2(this);
64719       let container = selection2.selectAll(".preset-icon-container").data([0]);
64720       container = container.enter().append("div").attr("class", "preset-icon-container").merge(container);
64721       container.classed("showing-img", !!imageURL).classed("fallback", isFallback);
64722       renderCategoryBorder(container, isCategory && p);
64723       renderPointBorder(container, drawPoint);
64724       renderCircleFill(container, drawVertex);
64725       renderSquareFill(container, drawArea, tagClasses);
64726       renderLine(container, drawLine, tagClasses);
64727       renderRoute(container, drawRoute, p);
64728       renderSvgIcon(container, picon, geom, isFramed, isCategory, tagClasses);
64729       renderImageIcon(container, imageURL);
64730     }
64731     presetIcon.preset = function(val) {
64732       if (!arguments.length)
64733         return _preset;
64734       _preset = utilFunctor(val);
64735       return presetIcon;
64736     };
64737     presetIcon.geometry = function(val) {
64738       if (!arguments.length)
64739         return _geometry;
64740       _geometry = utilFunctor(val);
64741       return presetIcon;
64742     };
64743     return presetIcon;
64744   }
64745
64746   // modules/ui/sections/feature_type.js
64747   function uiSectionFeatureType(context) {
64748     var dispatch10 = dispatch_default("choose");
64749     var _entityIDs = [];
64750     var _presets = [];
64751     var _tagReference;
64752     var section = uiSection("feature-type", context).label(() => _t.append("inspector.feature_type")).disclosureContent(renderDisclosureContent);
64753     function renderDisclosureContent(selection2) {
64754       selection2.classed("preset-list-item", true);
64755       selection2.classed("mixed-types", _presets.length > 1);
64756       var presetButtonWrap = selection2.selectAll(".preset-list-button-wrap").data([0]).enter().append("div").attr("class", "preset-list-button-wrap");
64757       var presetButton = presetButtonWrap.append("button").attr("class", "preset-list-button preset-reset").call(
64758         uiTooltip().title(() => _t.append("inspector.back_tooltip")).placement("bottom")
64759       );
64760       presetButton.append("div").attr("class", "preset-icon-container");
64761       presetButton.append("div").attr("class", "label").append("div").attr("class", "label-inner");
64762       presetButtonWrap.append("div").attr("class", "accessory-buttons");
64763       var tagReferenceBodyWrap = selection2.selectAll(".tag-reference-body-wrap").data([0]);
64764       tagReferenceBodyWrap = tagReferenceBodyWrap.enter().append("div").attr("class", "tag-reference-body-wrap").merge(tagReferenceBodyWrap);
64765       if (_tagReference) {
64766         selection2.selectAll(".preset-list-button-wrap .accessory-buttons").style("display", _presets.length === 1 ? null : "none").call(_tagReference.button);
64767         tagReferenceBodyWrap.style("display", _presets.length === 1 ? null : "none").call(_tagReference.body);
64768       }
64769       selection2.selectAll(".preset-reset").on("click", function() {
64770         dispatch10.call("choose", this, _presets);
64771       }).on("pointerdown pointerup mousedown mouseup", function(d3_event) {
64772         d3_event.preventDefault();
64773         d3_event.stopPropagation();
64774       });
64775       var geometries = entityGeometries();
64776       selection2.select(".preset-list-item button").call(
64777         uiPresetIcon().geometry(_presets.length === 1 ? geometries.length === 1 && geometries[0] : null).preset(_presets.length === 1 ? _presets[0] : _mainPresetIndex.item("point"))
64778       );
64779       var names = _presets.length === 1 ? [
64780         _presets[0].nameLabel(),
64781         _presets[0].subtitleLabel()
64782       ].filter(Boolean) : [_t.append("inspector.multiple_types")];
64783       var label = selection2.select(".label-inner");
64784       var nameparts = label.selectAll(".namepart").data(names, (d) => d.stringId);
64785       nameparts.exit().remove();
64786       nameparts.enter().append("div").attr("class", "namepart").text("").each(function(d) {
64787         d(select_default2(this));
64788       });
64789     }
64790     section.entityIDs = function(val) {
64791       if (!arguments.length)
64792         return _entityIDs;
64793       _entityIDs = val;
64794       return section;
64795     };
64796     section.presets = function(val) {
64797       if (!arguments.length)
64798         return _presets;
64799       if (!utilArrayIdentical(val, _presets)) {
64800         _presets = val;
64801         if (_presets.length === 1) {
64802           _tagReference = uiTagReference(_presets[0].reference(), context).showing(false);
64803         }
64804       }
64805       return section;
64806     };
64807     function entityGeometries() {
64808       var counts = {};
64809       for (var i2 in _entityIDs) {
64810         var geometry = context.graph().geometry(_entityIDs[i2]);
64811         if (!counts[geometry])
64812           counts[geometry] = 0;
64813         counts[geometry] += 1;
64814       }
64815       return Object.keys(counts).sort(function(geom1, geom2) {
64816         return counts[geom2] - counts[geom1];
64817       });
64818     }
64819     return utilRebind(section, dispatch10, "on");
64820   }
64821
64822   // modules/ui/sections/preset_fields.js
64823   function uiSectionPresetFields(context) {
64824     var section = uiSection("preset-fields", context).label(() => _t.append("inspector.fields")).disclosureContent(renderDisclosureContent);
64825     var dispatch10 = dispatch_default("change", "revert");
64826     var formFields = uiFormFields(context);
64827     var _state;
64828     var _fieldsArr;
64829     var _presets = [];
64830     var _tags;
64831     var _entityIDs;
64832     function renderDisclosureContent(selection2) {
64833       if (!_fieldsArr) {
64834         var graph = context.graph();
64835         var geometries = Object.keys(_entityIDs.reduce(function(geoms, entityID) {
64836           geoms[graph.entity(entityID).geometry(graph)] = true;
64837           return geoms;
64838         }, {}));
64839         const loc = _entityIDs.reduce(function(extent, entityID) {
64840           var entity = context.graph().entity(entityID);
64841           return extent.extend(entity.extent(context.graph()));
64842         }, geoExtent()).center();
64843         var presetsManager = _mainPresetIndex;
64844         var allFields = [];
64845         var allMoreFields = [];
64846         var sharedTotalFields;
64847         _presets.forEach(function(preset) {
64848           var fields = preset.fields(loc);
64849           var moreFields = preset.moreFields(loc);
64850           allFields = utilArrayUnion(allFields, fields);
64851           allMoreFields = utilArrayUnion(allMoreFields, moreFields);
64852           if (!sharedTotalFields) {
64853             sharedTotalFields = utilArrayUnion(fields, moreFields);
64854           } else {
64855             sharedTotalFields = sharedTotalFields.filter(function(field) {
64856               return fields.indexOf(field) !== -1 || moreFields.indexOf(field) !== -1;
64857             });
64858           }
64859         });
64860         var sharedFields = allFields.filter(function(field) {
64861           return sharedTotalFields.indexOf(field) !== -1;
64862         });
64863         var sharedMoreFields = allMoreFields.filter(function(field) {
64864           return sharedTotalFields.indexOf(field) !== -1;
64865         });
64866         _fieldsArr = [];
64867         sharedFields.forEach(function(field) {
64868           if (field.matchAllGeometry(geometries)) {
64869             _fieldsArr.push(
64870               uiField(context, field, _entityIDs)
64871             );
64872           }
64873         });
64874         var singularEntity = _entityIDs.length === 1 && graph.hasEntity(_entityIDs[0]);
64875         if (singularEntity && singularEntity.isHighwayIntersection(graph) && presetsManager.field("restrictions")) {
64876           _fieldsArr.push(
64877             uiField(context, presetsManager.field("restrictions"), _entityIDs)
64878           );
64879         }
64880         var additionalFields = utilArrayUnion(sharedMoreFields, presetsManager.universal());
64881         additionalFields.sort(function(field1, field2) {
64882           return field1.title().localeCompare(field2.title(), _mainLocalizer.localeCode());
64883         });
64884         additionalFields.forEach(function(field) {
64885           if (sharedFields.indexOf(field) === -1 && field.matchAllGeometry(geometries)) {
64886             _fieldsArr.push(
64887               uiField(context, field, _entityIDs, { show: false })
64888             );
64889           }
64890         });
64891         _fieldsArr.forEach(function(field) {
64892           field.on("change", function(t, onInput) {
64893             dispatch10.call("change", field, _entityIDs, t, onInput);
64894           }).on("revert", function(keys2) {
64895             dispatch10.call("revert", field, keys2);
64896           });
64897         });
64898       }
64899       _fieldsArr.forEach(function(field) {
64900         field.state(_state).tags(_tags);
64901       });
64902       selection2.call(
64903         formFields.fieldsArr(_fieldsArr).state(_state).klass("grouped-items-area")
64904       );
64905     }
64906     section.presets = function(val) {
64907       if (!arguments.length)
64908         return _presets;
64909       if (!_presets || !val || !utilArrayIdentical(_presets, val)) {
64910         _presets = val;
64911         _fieldsArr = null;
64912       }
64913       return section;
64914     };
64915     section.state = function(val) {
64916       if (!arguments.length)
64917         return _state;
64918       _state = val;
64919       return section;
64920     };
64921     section.tags = function(val) {
64922       if (!arguments.length)
64923         return _tags;
64924       _tags = val;
64925       return section;
64926     };
64927     section.entityIDs = function(val) {
64928       if (!arguments.length)
64929         return _entityIDs;
64930       if (!val || !_entityIDs || !utilArrayIdentical(_entityIDs, val)) {
64931         _entityIDs = val;
64932         _fieldsArr = null;
64933       }
64934       return section;
64935     };
64936     return utilRebind(section, dispatch10, "on");
64937   }
64938
64939   // modules/ui/sections/raw_member_editor.js
64940   function uiSectionRawMemberEditor(context) {
64941     var section = uiSection("raw-member-editor", context).shouldDisplay(function() {
64942       if (!_entityIDs || _entityIDs.length !== 1)
64943         return false;
64944       var entity = context.hasEntity(_entityIDs[0]);
64945       return entity && entity.type === "relation";
64946     }).label(function() {
64947       var entity = context.hasEntity(_entityIDs[0]);
64948       if (!entity)
64949         return "";
64950       var gt = entity.members.length > _maxMembers ? ">" : "";
64951       var count = gt + entity.members.slice(0, _maxMembers).length;
64952       return _t.append("inspector.title_count", { title: _t("inspector.members"), count });
64953     }).disclosureContent(renderDisclosureContent);
64954     var taginfo = services.taginfo;
64955     var _entityIDs;
64956     var _maxMembers = 1e3;
64957     function downloadMember(d3_event, d) {
64958       d3_event.preventDefault();
64959       select_default2(this.parentNode).classed("tag-reference-loading", true);
64960       context.loadEntity(d.id, function() {
64961         section.reRender();
64962       });
64963     }
64964     function zoomToMember(d3_event, d) {
64965       d3_event.preventDefault();
64966       var entity = context.entity(d.id);
64967       context.map().zoomToEase(entity);
64968       utilHighlightEntities([d.id], true, context);
64969     }
64970     function selectMember(d3_event, d) {
64971       d3_event.preventDefault();
64972       utilHighlightEntities([d.id], false, context);
64973       var entity = context.entity(d.id);
64974       var mapExtent = context.map().extent();
64975       if (!entity.intersects(mapExtent, context.graph())) {
64976         context.map().zoomToEase(entity);
64977       }
64978       context.enter(modeSelect(context, [d.id]));
64979     }
64980     function changeRole(d3_event, d) {
64981       var oldRole = d.role;
64982       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
64983       if (oldRole !== newRole) {
64984         var member = { id: d.id, type: d.type, role: newRole };
64985         context.perform(
64986           actionChangeMember(d.relation.id, member, d.index),
64987           _t("operations.change_role.annotation", {
64988             n: 1
64989           })
64990         );
64991         context.validator().validate();
64992       }
64993     }
64994     function deleteMember(d3_event, d) {
64995       utilHighlightEntities([d.id], false, context);
64996       context.perform(
64997         actionDeleteMember(d.relation.id, d.index),
64998         _t("operations.delete_member.annotation", {
64999           n: 1
65000         })
65001       );
65002       if (!context.hasEntity(d.relation.id)) {
65003         context.enter(modeBrowse(context));
65004       } else {
65005         context.validator().validate();
65006       }
65007     }
65008     function renderDisclosureContent(selection2) {
65009       var entityID = _entityIDs[0];
65010       var memberships = [];
65011       var entity = context.entity(entityID);
65012       entity.members.slice(0, _maxMembers).forEach(function(member, index) {
65013         memberships.push({
65014           index,
65015           id: member.id,
65016           type: member.type,
65017           role: member.role,
65018           relation: entity,
65019           member: context.hasEntity(member.id),
65020           domId: utilUniqueDomId(entityID + "-member-" + index)
65021         });
65022       });
65023       var list = selection2.selectAll(".member-list").data([0]);
65024       list = list.enter().append("ul").attr("class", "member-list").merge(list);
65025       var items = list.selectAll("li").data(memberships, function(d) {
65026         return osmEntity.key(d.relation) + "," + d.index + "," + (d.member ? osmEntity.key(d.member) : "incomplete");
65027       });
65028       items.exit().each(unbind).remove();
65029       var itemsEnter = items.enter().append("li").attr("class", "member-row form-field").classed("member-incomplete", function(d) {
65030         return !d.member;
65031       });
65032       itemsEnter.each(function(d) {
65033         var item = select_default2(this);
65034         var label = item.append("label").attr("class", "field-label").attr("for", d.domId);
65035         if (d.member) {
65036           item.on("mouseover", function() {
65037             utilHighlightEntities([d.id], true, context);
65038           }).on("mouseout", function() {
65039             utilHighlightEntities([d.id], false, context);
65040           });
65041           var labelLink = label.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectMember);
65042           labelLink.append("span").attr("class", "member-entity-type").text(function(d2) {
65043             var matched = _mainPresetIndex.match(d2.member, context.graph());
65044             return matched && matched.name() || utilDisplayType(d2.member.id);
65045           });
65046           labelLink.append("span").attr("class", "member-entity-name").text(function(d2) {
65047             return utilDisplayName(d2.member);
65048           });
65049           label.append("button").attr("title", _t("icons.remove")).attr("class", "remove member-delete").call(svgIcon("#iD-operation-delete"));
65050           label.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToMember);
65051         } else {
65052           var labelText = label.append("span").attr("class", "label-text");
65053           labelText.append("span").attr("class", "member-entity-type").call(_t.append("inspector." + d.type, { id: d.id }));
65054           labelText.append("span").attr("class", "member-entity-name").call(_t.append("inspector.incomplete", { id: d.id }));
65055           label.append("button").attr("class", "member-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMember);
65056         }
65057       });
65058       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
65059       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d) {
65060         return d.domId;
65061       }).property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
65062       if (taginfo) {
65063         wrapEnter.each(bindTypeahead);
65064       }
65065       items = items.merge(itemsEnter).order();
65066       items.select("input.member-role").property("value", function(d) {
65067         return d.role;
65068       }).on("blur", changeRole).on("change", changeRole);
65069       items.select("button.member-delete").on("click", deleteMember);
65070       var dragOrigin, targetIndex;
65071       items.call(
65072         drag_default().on("start", function(d3_event) {
65073           dragOrigin = {
65074             x: d3_event.x,
65075             y: d3_event.y
65076           };
65077           targetIndex = null;
65078         }).on("drag", function(d3_event) {
65079           var x = d3_event.x - dragOrigin.x, y = d3_event.y - dragOrigin.y;
65080           if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
65081           Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) <= 5)
65082             return;
65083           var index = items.nodes().indexOf(this);
65084           select_default2(this).classed("dragging", true);
65085           targetIndex = null;
65086           selection2.selectAll("li.member-row").style("transform", function(d2, index2) {
65087             var node = select_default2(this).node();
65088             if (index === index2) {
65089               return "translate(" + x + "px, " + y + "px)";
65090             } else if (index2 > index && d3_event.y > node.offsetTop) {
65091               if (targetIndex === null || index2 > targetIndex) {
65092                 targetIndex = index2;
65093               }
65094               return "translateY(-100%)";
65095             } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
65096               if (targetIndex === null || index2 < targetIndex) {
65097                 targetIndex = index2;
65098               }
65099               return "translateY(100%)";
65100             }
65101             return null;
65102           });
65103         }).on("end", function(d3_event, d) {
65104           if (!select_default2(this).classed("dragging"))
65105             return;
65106           var index = items.nodes().indexOf(this);
65107           select_default2(this).classed("dragging", false);
65108           selection2.selectAll("li.member-row").style("transform", null);
65109           if (targetIndex !== null) {
65110             context.perform(
65111               actionMoveMember(d.relation.id, index, targetIndex),
65112               _t("operations.reorder_members.annotation")
65113             );
65114             context.validator().validate();
65115           }
65116         })
65117       );
65118       function bindTypeahead(d) {
65119         var row = select_default2(this);
65120         var role = row.selectAll("input.member-role");
65121         var origValue = role.property("value");
65122         function sort(value, data) {
65123           var sameletter = [];
65124           var other = [];
65125           for (var i2 = 0; i2 < data.length; i2++) {
65126             if (data[i2].value.substring(0, value.length) === value) {
65127               sameletter.push(data[i2]);
65128             } else {
65129               other.push(data[i2]);
65130             }
65131           }
65132           return sameletter.concat(other);
65133         }
65134         role.call(
65135           uiCombobox(context, "member-role").fetcher(function(role2, callback) {
65136             var geometry;
65137             if (d.member) {
65138               geometry = context.graph().geometry(d.member.id);
65139             } else if (d.type === "relation") {
65140               geometry = "relation";
65141             } else if (d.type === "way") {
65142               geometry = "line";
65143             } else {
65144               geometry = "point";
65145             }
65146             var rtype = entity.tags.type;
65147             taginfo.roles({
65148               debounce: true,
65149               rtype: rtype || "",
65150               geometry,
65151               query: role2
65152             }, function(err, data) {
65153               if (!err)
65154                 callback(sort(role2, data));
65155             });
65156           }).on("cancel", function() {
65157             role.property("value", origValue);
65158           })
65159         );
65160       }
65161       function unbind() {
65162         var row = select_default2(this);
65163         row.selectAll("input.member-role").call(uiCombobox.off, context);
65164       }
65165     }
65166     section.entityIDs = function(val) {
65167       if (!arguments.length)
65168         return _entityIDs;
65169       _entityIDs = val;
65170       return section;
65171     };
65172     return section;
65173   }
65174
65175   // modules/actions/delete_members.js
65176   function actionDeleteMembers(relationId, memberIndexes) {
65177     return function(graph) {
65178       memberIndexes.sort((a, b) => b - a);
65179       for (var i2 in memberIndexes) {
65180         graph = actionDeleteMember(relationId, memberIndexes[i2])(graph);
65181       }
65182       return graph;
65183     };
65184   }
65185
65186   // modules/ui/sections/raw_membership_editor.js
65187   function uiSectionRawMembershipEditor(context) {
65188     var section = uiSection("raw-membership-editor", context).shouldDisplay(function() {
65189       return _entityIDs && _entityIDs.length;
65190     }).label(function() {
65191       var parents = getSharedParentRelations();
65192       var gt = parents.length > _maxMemberships ? ">" : "";
65193       var count = gt + parents.slice(0, _maxMemberships).length;
65194       return _t.append("inspector.title_count", { title: _t("inspector.relations"), count });
65195     }).disclosureContent(renderDisclosureContent);
65196     var taginfo = services.taginfo;
65197     var nearbyCombo = uiCombobox(context, "parent-relation").minItems(1).fetcher(fetchNearbyRelations).itemsMouseEnter(function(d3_event, d) {
65198       if (d.relation)
65199         utilHighlightEntities([d.relation.id], true, context);
65200     }).itemsMouseLeave(function(d3_event, d) {
65201       if (d.relation)
65202         utilHighlightEntities([d.relation.id], false, context);
65203     });
65204     var _inChange = false;
65205     var _entityIDs = [];
65206     var _showBlank;
65207     var _maxMemberships = 1e3;
65208     function getSharedParentRelations() {
65209       var parents = [];
65210       for (var i2 = 0; i2 < _entityIDs.length; i2++) {
65211         var entity = context.graph().hasEntity(_entityIDs[i2]);
65212         if (!entity)
65213           continue;
65214         if (i2 === 0) {
65215           parents = context.graph().parentRelations(entity);
65216         } else {
65217           parents = utilArrayIntersection(parents, context.graph().parentRelations(entity));
65218         }
65219         if (!parents.length)
65220           break;
65221       }
65222       return parents;
65223     }
65224     function getMemberships() {
65225       var memberships = [];
65226       var relations = getSharedParentRelations().slice(0, _maxMemberships);
65227       var isMultiselect = _entityIDs.length > 1;
65228       var i2, relation, membership, index, member, indexedMember;
65229       for (i2 = 0; i2 < relations.length; i2++) {
65230         relation = relations[i2];
65231         membership = {
65232           relation,
65233           members: [],
65234           hash: osmEntity.key(relation)
65235         };
65236         for (index = 0; index < relation.members.length; index++) {
65237           member = relation.members[index];
65238           if (_entityIDs.indexOf(member.id) !== -1) {
65239             indexedMember = Object.assign({}, member, { index });
65240             membership.members.push(indexedMember);
65241             membership.hash += "," + index.toString();
65242             if (!isMultiselect) {
65243               memberships.push(membership);
65244               membership = {
65245                 relation,
65246                 members: [],
65247                 hash: osmEntity.key(relation)
65248               };
65249             }
65250           }
65251         }
65252         if (membership.members.length)
65253           memberships.push(membership);
65254       }
65255       memberships.forEach(function(membership2) {
65256         membership2.domId = utilUniqueDomId("membership-" + membership2.relation.id);
65257         var roles = [];
65258         membership2.members.forEach(function(member2) {
65259           if (roles.indexOf(member2.role) === -1)
65260             roles.push(member2.role);
65261         });
65262         membership2.role = roles.length === 1 ? roles[0] : roles;
65263       });
65264       return memberships;
65265     }
65266     function selectRelation(d3_event, d) {
65267       d3_event.preventDefault();
65268       utilHighlightEntities([d.relation.id], false, context);
65269       context.enter(modeSelect(context, [d.relation.id]));
65270     }
65271     function zoomToRelation(d3_event, d) {
65272       d3_event.preventDefault();
65273       var entity = context.entity(d.relation.id);
65274       context.map().zoomToEase(entity);
65275       utilHighlightEntities([d.relation.id], true, context);
65276     }
65277     function changeRole(d3_event, d) {
65278       if (d === 0)
65279         return;
65280       if (_inChange)
65281         return;
65282       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
65283       if (!newRole.trim() && typeof d.role !== "string")
65284         return;
65285       var membersToUpdate = d.members.filter(function(member) {
65286         return member.role !== newRole;
65287       });
65288       if (membersToUpdate.length) {
65289         _inChange = true;
65290         context.perform(
65291           function actionChangeMemberRoles(graph) {
65292             membersToUpdate.forEach(function(member) {
65293               var newMember = Object.assign({}, member, { role: newRole });
65294               delete newMember.index;
65295               graph = actionChangeMember(d.relation.id, newMember, member.index)(graph);
65296             });
65297             return graph;
65298           },
65299           _t("operations.change_role.annotation", {
65300             n: membersToUpdate.length
65301           })
65302         );
65303         context.validator().validate();
65304       }
65305       _inChange = false;
65306     }
65307     function addMembership(d, role) {
65308       this.blur();
65309       _showBlank = false;
65310       function actionAddMembers(relationId, ids, role2) {
65311         return function(graph) {
65312           for (var i2 in ids) {
65313             var member = { id: ids[i2], type: graph.entity(ids[i2]).type, role: role2 };
65314             graph = actionAddMember(relationId, member)(graph);
65315           }
65316           return graph;
65317         };
65318       }
65319       if (d.relation) {
65320         context.perform(
65321           actionAddMembers(d.relation.id, _entityIDs, role),
65322           _t("operations.add_member.annotation", {
65323             n: _entityIDs.length
65324           })
65325         );
65326         context.validator().validate();
65327       } else {
65328         var relation = osmRelation();
65329         context.perform(
65330           actionAddEntity(relation),
65331           actionAddMembers(relation.id, _entityIDs, role),
65332           _t("operations.add.annotation.relation")
65333         );
65334         context.enter(modeSelect(context, [relation.id]).newFeature(true));
65335       }
65336     }
65337     function deleteMembership(d3_event, d) {
65338       this.blur();
65339       if (d === 0)
65340         return;
65341       utilHighlightEntities([d.relation.id], false, context);
65342       var indexes = d.members.map(function(member) {
65343         return member.index;
65344       });
65345       context.perform(
65346         actionDeleteMembers(d.relation.id, indexes),
65347         _t("operations.delete_member.annotation", {
65348           n: _entityIDs.length
65349         })
65350       );
65351       context.validator().validate();
65352     }
65353     function fetchNearbyRelations(q, callback) {
65354       var newRelation = {
65355         relation: null,
65356         value: _t("inspector.new_relation"),
65357         display: _t.append("inspector.new_relation")
65358       };
65359       var entityID = _entityIDs[0];
65360       var result = [];
65361       var graph = context.graph();
65362       function baseDisplayLabel(entity) {
65363         var matched = _mainPresetIndex.match(entity, graph);
65364         var presetName = matched && matched.name() || _t("inspector.relation");
65365         var entityName = utilDisplayName(entity) || "";
65366         return presetName + " " + entityName;
65367       }
65368       var explicitRelation = q && context.hasEntity(q.toLowerCase());
65369       if (explicitRelation && explicitRelation.type === "relation" && explicitRelation.id !== entityID) {
65370         result.push({
65371           relation: explicitRelation,
65372           value: baseDisplayLabel(explicitRelation) + " " + explicitRelation.id
65373         });
65374       } else {
65375         context.history().intersects(context.map().extent()).forEach(function(entity) {
65376           if (entity.type !== "relation" || entity.id === entityID)
65377             return;
65378           var value = baseDisplayLabel(entity);
65379           if (q && (value + " " + entity.id).toLowerCase().indexOf(q.toLowerCase()) === -1)
65380             return;
65381           result.push({ relation: entity, value });
65382         });
65383         result.sort(function(a, b) {
65384           return osmRelation.creationOrder(a.relation, b.relation);
65385         });
65386         var dupeGroups = Object.values(utilArrayGroupBy(result, "value")).filter(function(v) {
65387           return v.length > 1;
65388         });
65389         dupeGroups.forEach(function(group) {
65390           group.forEach(function(obj) {
65391             obj.value += " " + obj.relation.id;
65392           });
65393         });
65394       }
65395       result.forEach(function(obj) {
65396         obj.title = obj.value;
65397       });
65398       result.unshift(newRelation);
65399       callback(result);
65400     }
65401     function renderDisclosureContent(selection2) {
65402       var memberships = getMemberships();
65403       var list = selection2.selectAll(".member-list").data([0]);
65404       list = list.enter().append("ul").attr("class", "member-list").merge(list);
65405       var items = list.selectAll("li.member-row-normal").data(memberships, function(d) {
65406         return d.hash;
65407       });
65408       items.exit().each(unbind).remove();
65409       var itemsEnter = items.enter().append("li").attr("class", "member-row member-row-normal form-field");
65410       itemsEnter.on("mouseover", function(d3_event, d) {
65411         utilHighlightEntities([d.relation.id], true, context);
65412       }).on("mouseout", function(d3_event, d) {
65413         utilHighlightEntities([d.relation.id], false, context);
65414       });
65415       var labelEnter = itemsEnter.append("label").attr("class", "field-label").attr("for", function(d) {
65416         return d.domId;
65417       });
65418       var labelLink = labelEnter.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectRelation);
65419       labelLink.append("span").attr("class", "member-entity-type").text(function(d) {
65420         var matched = _mainPresetIndex.match(d.relation, context.graph());
65421         return matched && matched.name() || _t.html("inspector.relation");
65422       });
65423       labelLink.append("span").attr("class", "member-entity-name").text(function(d) {
65424         return utilDisplayName(d.relation);
65425       });
65426       labelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", deleteMembership);
65427       labelEnter.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToRelation);
65428       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
65429       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d) {
65430         return d.domId;
65431       }).property("type", "text").property("value", function(d) {
65432         return typeof d.role === "string" ? d.role : "";
65433       }).attr("title", function(d) {
65434         return Array.isArray(d.role) ? d.role.filter(Boolean).join("\n") : d.role;
65435       }).attr("placeholder", function(d) {
65436         return Array.isArray(d.role) ? _t("inspector.multiple_roles") : _t("inspector.role");
65437       }).classed("mixed", function(d) {
65438         return Array.isArray(d.role);
65439       }).call(utilNoAuto).on("blur", changeRole).on("change", changeRole);
65440       if (taginfo) {
65441         wrapEnter.each(bindTypeahead);
65442       }
65443       var newMembership = list.selectAll(".member-row-new").data(_showBlank ? [0] : []);
65444       newMembership.exit().remove();
65445       var newMembershipEnter = newMembership.enter().append("li").attr("class", "member-row member-row-new form-field");
65446       var newLabelEnter = newMembershipEnter.append("label").attr("class", "field-label");
65447       newLabelEnter.append("input").attr("placeholder", _t("inspector.choose_relation")).attr("type", "text").attr("class", "member-entity-input").call(utilNoAuto);
65448       newLabelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", function() {
65449         list.selectAll(".member-row-new").remove();
65450       });
65451       var newWrapEnter = newMembershipEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
65452       newWrapEnter.append("input").attr("class", "member-role").property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
65453       newMembership = newMembership.merge(newMembershipEnter);
65454       newMembership.selectAll(".member-entity-input").on("blur", cancelEntity).call(
65455         nearbyCombo.on("accept", acceptEntity).on("cancel", cancelEntity)
65456       );
65457       var addRow = selection2.selectAll(".add-row").data([0]);
65458       var addRowEnter = addRow.enter().append("div").attr("class", "add-row");
65459       var addRelationButton = addRowEnter.append("button").attr("class", "add-relation").attr("aria-label", _t("inspector.add_to_relation"));
65460       addRelationButton.call(svgIcon("#iD-icon-plus", "light"));
65461       addRelationButton.call(uiTooltip().title(() => _t.append("inspector.add_to_relation")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left"));
65462       addRowEnter.append("div").attr("class", "space-value");
65463       addRowEnter.append("div").attr("class", "space-buttons");
65464       addRow = addRow.merge(addRowEnter);
65465       addRow.select(".add-relation").on("click", function() {
65466         _showBlank = true;
65467         section.reRender();
65468         list.selectAll(".member-entity-input").node().focus();
65469       });
65470       function acceptEntity(d) {
65471         if (!d) {
65472           cancelEntity();
65473           return;
65474         }
65475         if (d.relation)
65476           utilHighlightEntities([d.relation.id], false, context);
65477         var role = context.cleanRelationRole(list.selectAll(".member-row-new .member-role").property("value"));
65478         addMembership(d, role);
65479       }
65480       function cancelEntity() {
65481         var input = newMembership.selectAll(".member-entity-input");
65482         input.property("value", "");
65483         context.surface().selectAll(".highlighted").classed("highlighted", false);
65484       }
65485       function bindTypeahead(d) {
65486         var row = select_default2(this);
65487         var role = row.selectAll("input.member-role");
65488         var origValue = role.property("value");
65489         function sort(value, data) {
65490           var sameletter = [];
65491           var other = [];
65492           for (var i2 = 0; i2 < data.length; i2++) {
65493             if (data[i2].value.substring(0, value.length) === value) {
65494               sameletter.push(data[i2]);
65495             } else {
65496               other.push(data[i2]);
65497             }
65498           }
65499           return sameletter.concat(other);
65500         }
65501         role.call(
65502           uiCombobox(context, "member-role").fetcher(function(role2, callback) {
65503             var rtype = d.relation.tags.type;
65504             taginfo.roles({
65505               debounce: true,
65506               rtype: rtype || "",
65507               geometry: context.graph().geometry(_entityIDs[0]),
65508               query: role2
65509             }, function(err, data) {
65510               if (!err)
65511                 callback(sort(role2, data));
65512             });
65513           }).on("cancel", function() {
65514             role.property("value", origValue);
65515           })
65516         );
65517       }
65518       function unbind() {
65519         var row = select_default2(this);
65520         row.selectAll("input.member-role").call(uiCombobox.off, context);
65521       }
65522     }
65523     section.entityIDs = function(val) {
65524       if (!arguments.length)
65525         return _entityIDs;
65526       _entityIDs = val;
65527       _showBlank = false;
65528       return section;
65529     };
65530     return section;
65531   }
65532
65533   // modules/ui/sections/selection_list.js
65534   function uiSectionSelectionList(context) {
65535     var _selectedIDs = [];
65536     var section = uiSection("selected-features", context).shouldDisplay(function() {
65537       return _selectedIDs.length > 1;
65538     }).label(function() {
65539       return _t.append("inspector.title_count", { title: _t("inspector.features"), count: _selectedIDs.length });
65540     }).disclosureContent(renderDisclosureContent);
65541     context.history().on("change.selectionList", function(difference) {
65542       if (difference) {
65543         section.reRender();
65544       }
65545     });
65546     section.entityIDs = function(val) {
65547       if (!arguments.length)
65548         return _selectedIDs;
65549       _selectedIDs = val;
65550       return section;
65551     };
65552     function selectEntity(d3_event, entity) {
65553       context.enter(modeSelect(context, [entity.id]));
65554     }
65555     function deselectEntity(d3_event, entity) {
65556       var selectedIDs = _selectedIDs.slice();
65557       var index = selectedIDs.indexOf(entity.id);
65558       if (index > -1) {
65559         selectedIDs.splice(index, 1);
65560         context.enter(modeSelect(context, selectedIDs));
65561       }
65562     }
65563     function renderDisclosureContent(selection2) {
65564       var list = selection2.selectAll(".feature-list").data([0]);
65565       list = list.enter().append("ul").attr("class", "feature-list").merge(list);
65566       var entities = _selectedIDs.map(function(id2) {
65567         return context.hasEntity(id2);
65568       }).filter(Boolean);
65569       var items = list.selectAll(".feature-list-item").data(entities, osmEntity.key);
65570       items.exit().remove();
65571       var enter = items.enter().append("li").attr("class", "feature-list-item").each(function(d) {
65572         select_default2(this).on("mouseover", function() {
65573           utilHighlightEntities([d.id], true, context);
65574         }).on("mouseout", function() {
65575           utilHighlightEntities([d.id], false, context);
65576         });
65577       });
65578       var label = enter.append("button").attr("class", "label").on("click", selectEntity);
65579       label.append("span").attr("class", "entity-geom-icon").call(svgIcon("", "pre-text"));
65580       label.append("span").attr("class", "entity-type");
65581       label.append("span").attr("class", "entity-name");
65582       enter.append("button").attr("class", "close").attr("title", _t("icons.deselect")).on("click", deselectEntity).call(svgIcon("#iD-icon-close"));
65583       items = items.merge(enter);
65584       items.selectAll(".entity-geom-icon use").attr("href", function() {
65585         var entity = this.parentNode.parentNode.__data__;
65586         return "#iD-icon-" + entity.geometry(context.graph());
65587       });
65588       items.selectAll(".entity-type").text(function(entity) {
65589         return _mainPresetIndex.match(entity, context.graph()).name();
65590       });
65591       items.selectAll(".entity-name").text(function(d) {
65592         var entity = context.entity(d.id);
65593         return utilDisplayName(entity);
65594       });
65595     }
65596     return section;
65597   }
65598
65599   // modules/ui/entity_editor.js
65600   function uiEntityEditor(context) {
65601     var dispatch10 = dispatch_default("choose");
65602     var _state = "select";
65603     var _coalesceChanges = false;
65604     var _modified = false;
65605     var _base;
65606     var _entityIDs;
65607     var _activePresets = [];
65608     var _newFeature;
65609     var _sections;
65610     function entityEditor(selection2) {
65611       var combinedTags = utilCombinedTags(_entityIDs, context.graph());
65612       var header = selection2.selectAll(".header").data([0]);
65613       var headerEnter = header.enter().append("div").attr("class", "header fillL");
65614       var direction = _mainLocalizer.textDirection() === "rtl" ? "forward" : "backward";
65615       headerEnter.append("button").attr("class", "preset-reset preset-choose").attr("title", _t("inspector.back_tooltip")).call(svgIcon(`#iD-icon-${direction}`));
65616       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
65617         context.enter(modeBrowse(context));
65618       }).call(svgIcon(_modified ? "#iD-icon-apply" : "#iD-icon-close"));
65619       headerEnter.append("h2");
65620       header = header.merge(headerEnter);
65621       header.selectAll("h2").text("").call(_entityIDs.length === 1 ? _t.append("inspector.edit") : _t.append("inspector.edit_features"));
65622       header.selectAll(".preset-reset").on("click", function() {
65623         dispatch10.call("choose", this, _activePresets);
65624       });
65625       var body = selection2.selectAll(".inspector-body").data([0]);
65626       var bodyEnter = body.enter().append("div").attr("class", "entity-editor inspector-body sep-top");
65627       body = body.merge(bodyEnter);
65628       if (!_sections) {
65629         _sections = [
65630           uiSectionSelectionList(context),
65631           uiSectionFeatureType(context).on("choose", function(presets) {
65632             dispatch10.call("choose", this, presets);
65633           }),
65634           uiSectionEntityIssues(context),
65635           uiSectionPresetFields(context).on("change", changeTags).on("revert", revertTags),
65636           uiSectionRawTagEditor("raw-tag-editor", context).on("change", changeTags),
65637           uiSectionRawMemberEditor(context),
65638           uiSectionRawMembershipEditor(context)
65639         ];
65640       }
65641       _sections.forEach(function(section) {
65642         if (section.entityIDs) {
65643           section.entityIDs(_entityIDs);
65644         }
65645         if (section.presets) {
65646           section.presets(_activePresets);
65647         }
65648         if (section.tags) {
65649           section.tags(combinedTags);
65650         }
65651         if (section.state) {
65652           section.state(_state);
65653         }
65654         body.call(section.render);
65655       });
65656       context.history().on("change.entity-editor", historyChanged);
65657       function historyChanged(difference) {
65658         if (selection2.selectAll(".entity-editor").empty())
65659           return;
65660         if (_state === "hide")
65661           return;
65662         var significant = !difference || difference.didChange.properties || difference.didChange.addition || difference.didChange.deletion;
65663         if (!significant)
65664           return;
65665         _entityIDs = _entityIDs.filter(context.hasEntity);
65666         if (!_entityIDs.length)
65667           return;
65668         var priorActivePreset = _activePresets.length === 1 && _activePresets[0];
65669         loadActivePresets();
65670         var graph = context.graph();
65671         entityEditor.modified(_base !== graph);
65672         entityEditor(selection2);
65673         if (priorActivePreset && _activePresets.length === 1 && priorActivePreset !== _activePresets[0]) {
65674           context.container().selectAll(".entity-editor button.preset-reset .label").style("background-color", "#fff").transition().duration(750).style("background-color", null);
65675         }
65676       }
65677     }
65678     function changeTags(entityIDs, changed, onInput) {
65679       var actions = [];
65680       for (var i2 in entityIDs) {
65681         var entityID = entityIDs[i2];
65682         var entity = context.entity(entityID);
65683         var tags = Object.assign({}, entity.tags);
65684         if (typeof changed === "function") {
65685           tags = changed(tags);
65686         } else {
65687           for (var k in changed) {
65688             if (!k)
65689               continue;
65690             var v = changed[k];
65691             if (typeof v === "object") {
65692               tags[k] = tags[v.oldKey];
65693             } else if (v !== void 0 || tags.hasOwnProperty(k)) {
65694               tags[k] = v;
65695             }
65696           }
65697         }
65698         if (!onInput) {
65699           tags = utilCleanTags(tags);
65700         }
65701         if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
65702           actions.push(actionChangeTags(entityID, tags));
65703         }
65704       }
65705       if (actions.length) {
65706         var combinedAction = function(graph) {
65707           actions.forEach(function(action) {
65708             graph = action(graph);
65709           });
65710           return graph;
65711         };
65712         var annotation = _t("operations.change_tags.annotation");
65713         if (_coalesceChanges) {
65714           context.overwrite(combinedAction, annotation);
65715         } else {
65716           context.perform(combinedAction, annotation);
65717           _coalesceChanges = !!onInput;
65718         }
65719       }
65720       if (!onInput) {
65721         context.validator().validate();
65722       }
65723     }
65724     function revertTags(keys2) {
65725       var actions = [];
65726       for (var i2 in _entityIDs) {
65727         var entityID = _entityIDs[i2];
65728         var original = context.graph().base().entities[entityID];
65729         var changed = {};
65730         for (var j2 in keys2) {
65731           var key = keys2[j2];
65732           changed[key] = original ? original.tags[key] : void 0;
65733         }
65734         var entity = context.entity(entityID);
65735         var tags = Object.assign({}, entity.tags);
65736         for (var k in changed) {
65737           if (!k)
65738             continue;
65739           var v = changed[k];
65740           if (v !== void 0 || tags.hasOwnProperty(k)) {
65741             tags[k] = v;
65742           }
65743         }
65744         tags = utilCleanTags(tags);
65745         if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
65746           actions.push(actionChangeTags(entityID, tags));
65747         }
65748       }
65749       if (actions.length) {
65750         var combinedAction = function(graph) {
65751           actions.forEach(function(action) {
65752             graph = action(graph);
65753           });
65754           return graph;
65755         };
65756         var annotation = _t("operations.change_tags.annotation");
65757         if (_coalesceChanges) {
65758           context.overwrite(combinedAction, annotation);
65759         } else {
65760           context.perform(combinedAction, annotation);
65761           _coalesceChanges = false;
65762         }
65763       }
65764       context.validator().validate();
65765     }
65766     entityEditor.modified = function(val) {
65767       if (!arguments.length)
65768         return _modified;
65769       _modified = val;
65770       return entityEditor;
65771     };
65772     entityEditor.state = function(val) {
65773       if (!arguments.length)
65774         return _state;
65775       _state = val;
65776       return entityEditor;
65777     };
65778     entityEditor.entityIDs = function(val) {
65779       if (!arguments.length)
65780         return _entityIDs;
65781       _base = context.graph();
65782       _coalesceChanges = false;
65783       if (val && _entityIDs && utilArrayIdentical(_entityIDs, val))
65784         return entityEditor;
65785       _entityIDs = val;
65786       loadActivePresets(true);
65787       return entityEditor.modified(false);
65788     };
65789     entityEditor.newFeature = function(val) {
65790       if (!arguments.length)
65791         return _newFeature;
65792       _newFeature = val;
65793       return entityEditor;
65794     };
65795     function loadActivePresets(isForNewSelection) {
65796       var graph = context.graph();
65797       var counts = {};
65798       for (var i2 in _entityIDs) {
65799         var entity = graph.hasEntity(_entityIDs[i2]);
65800         if (!entity)
65801           return;
65802         var match = _mainPresetIndex.match(entity, graph);
65803         if (!counts[match.id])
65804           counts[match.id] = 0;
65805         counts[match.id] += 1;
65806       }
65807       var matches = Object.keys(counts).sort(function(p1, p2) {
65808         return counts[p2] - counts[p1];
65809       }).map(function(pID) {
65810         return _mainPresetIndex.item(pID);
65811       });
65812       if (!isForNewSelection) {
65813         var weakPreset = _activePresets.length === 1 && !_activePresets[0].isFallback() && Object.keys(_activePresets[0].addTags || {}).length === 0;
65814         if (weakPreset && matches.length === 1 && matches[0].isFallback())
65815           return;
65816       }
65817       entityEditor.presets(matches);
65818     }
65819     entityEditor.presets = function(val) {
65820       if (!arguments.length)
65821         return _activePresets;
65822       if (!utilArrayIdentical(val, _activePresets)) {
65823         _activePresets = val;
65824       }
65825       return entityEditor;
65826     };
65827     return utilRebind(entityEditor, dispatch10, "on");
65828   }
65829
65830   // modules/ui/feature_list.js
65831   var sexagesimal = __toESM(require_sexagesimal());
65832   function uiFeatureList(context) {
65833     var _geocodeResults;
65834     function featureList(selection2) {
65835       var header = selection2.append("div").attr("class", "header fillL");
65836       header.append("h2").call(_t.append("inspector.feature_list"));
65837       var searchWrap = selection2.append("div").attr("class", "search-header");
65838       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
65839       var search = searchWrap.append("input").attr("placeholder", _t("inspector.search")).attr("type", "search").call(utilNoAuto).on("keypress", keypress).on("keydown", keydown).on("input", inputevent);
65840       var listWrap = selection2.append("div").attr("class", "inspector-body");
65841       var list = listWrap.append("div").attr("class", "feature-list");
65842       context.on("exit.feature-list", clearSearch);
65843       context.map().on("drawn.feature-list", mapDrawn);
65844       context.keybinding().on(uiCmd("\u2318F"), focusSearch);
65845       function focusSearch(d3_event) {
65846         var mode = context.mode() && context.mode().id;
65847         if (mode !== "browse")
65848           return;
65849         d3_event.preventDefault();
65850         search.node().focus();
65851       }
65852       function keydown(d3_event) {
65853         if (d3_event.keyCode === 27) {
65854           search.node().blur();
65855         }
65856       }
65857       function keypress(d3_event) {
65858         var q = search.property("value"), items = list.selectAll(".feature-list-item");
65859         if (d3_event.keyCode === 13 && // ↩ Return
65860         q.length && items.size()) {
65861           click(d3_event, items.datum());
65862         }
65863       }
65864       function inputevent() {
65865         _geocodeResults = void 0;
65866         drawList();
65867       }
65868       function clearSearch() {
65869         search.property("value", "");
65870         drawList();
65871       }
65872       function mapDrawn(e) {
65873         if (e.full) {
65874           drawList();
65875         }
65876       }
65877       function features() {
65878         var result = [];
65879         var graph = context.graph();
65880         var visibleCenter = context.map().extent().center();
65881         var q = search.property("value").toLowerCase();
65882         if (!q)
65883           return result;
65884         var locationMatch = sexagesimal.pair(q.toUpperCase()) || q.match(/^(-?\d+\.?\d*)\s+(-?\d+\.?\d*)$/);
65885         if (locationMatch) {
65886           var loc = [Number(locationMatch[0]), Number(locationMatch[1])];
65887           result.push({
65888             id: -1,
65889             geometry: "point",
65890             type: _t("inspector.location"),
65891             name: dmsCoordinatePair([loc[1], loc[0]]),
65892             location: loc
65893           });
65894         }
65895         var idMatch = !locationMatch && q.match(/(?:^|\W)(node|way|relation|[nwr])\W{0,2}0*([1-9]\d*)(?:\W|$)/i);
65896         if (idMatch) {
65897           var elemType = idMatch[1].charAt(0);
65898           var elemId = idMatch[2];
65899           result.push({
65900             id: elemType + elemId,
65901             geometry: elemType === "n" ? "point" : elemType === "w" ? "line" : "relation",
65902             type: elemType === "n" ? _t("inspector.node") : elemType === "w" ? _t("inspector.way") : _t("inspector.relation"),
65903             name: elemId
65904           });
65905         }
65906         var allEntities = graph.entities;
65907         var localResults = [];
65908         for (var id2 in allEntities) {
65909           var entity = allEntities[id2];
65910           if (!entity)
65911             continue;
65912           var name = utilDisplayName(entity) || "";
65913           if (name.toLowerCase().indexOf(q) < 0)
65914             continue;
65915           var matched = _mainPresetIndex.match(entity, graph);
65916           var type2 = matched && matched.name() || utilDisplayType(entity.id);
65917           var extent = entity.extent(graph);
65918           var distance = extent ? geoSphericalDistance(visibleCenter, extent.center()) : 0;
65919           localResults.push({
65920             id: entity.id,
65921             entity,
65922             geometry: entity.geometry(graph),
65923             type: type2,
65924             name,
65925             distance
65926           });
65927           if (localResults.length > 100)
65928             break;
65929         }
65930         localResults = localResults.sort(function byDistance(a, b) {
65931           return a.distance - b.distance;
65932         });
65933         result = result.concat(localResults);
65934         (_geocodeResults || []).forEach(function(d) {
65935           if (d.osm_type && d.osm_id) {
65936             var id3 = osmEntity.id.fromOSM(d.osm_type, d.osm_id);
65937             var tags = {};
65938             tags[d.class] = d.type;
65939             var attrs = { id: id3, type: d.osm_type, tags };
65940             if (d.osm_type === "way") {
65941               attrs.nodes = ["a", "a"];
65942             }
65943             var tempEntity = osmEntity(attrs);
65944             var tempGraph = coreGraph([tempEntity]);
65945             var matched2 = _mainPresetIndex.match(tempEntity, tempGraph);
65946             var type3 = matched2 && matched2.name() || utilDisplayType(id3);
65947             result.push({
65948               id: tempEntity.id,
65949               geometry: tempEntity.geometry(tempGraph),
65950               type: type3,
65951               name: d.display_name,
65952               extent: new geoExtent(
65953                 [Number(d.boundingbox[3]), Number(d.boundingbox[0])],
65954                 [Number(d.boundingbox[2]), Number(d.boundingbox[1])]
65955               )
65956             });
65957           }
65958         });
65959         if (q.match(/^[0-9]+$/)) {
65960           result.push({
65961             id: "n" + q,
65962             geometry: "point",
65963             type: _t("inspector.node"),
65964             name: q
65965           });
65966           result.push({
65967             id: "w" + q,
65968             geometry: "line",
65969             type: _t("inspector.way"),
65970             name: q
65971           });
65972           result.push({
65973             id: "r" + q,
65974             geometry: "relation",
65975             type: _t("inspector.relation"),
65976             name: q
65977           });
65978         }
65979         return result;
65980       }
65981       function drawList() {
65982         var value = search.property("value");
65983         var results = features();
65984         list.classed("filtered", value.length);
65985         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"));
65986         resultsIndicator.append("span").attr("class", "entity-name");
65987         list.selectAll(".no-results-item .entity-name").html("").call(_t.append("geocoder.no_results_worldwide"));
65988         if (services.geocoder) {
65989           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"));
65990         }
65991         list.selectAll(".no-results-item").style("display", value.length && !results.length ? "block" : "none");
65992         list.selectAll(".geocode-item").style("display", value && _geocodeResults === void 0 ? "block" : "none");
65993         list.selectAll(".feature-list-item").data([-1]).remove();
65994         var items = list.selectAll(".feature-list-item").data(results, function(d) {
65995           return d.id;
65996         });
65997         var enter = items.enter().insert("button", ".geocode-item").attr("class", "feature-list-item").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
65998         var label = enter.append("div").attr("class", "label");
65999         label.each(function(d) {
66000           select_default2(this).call(svgIcon("#iD-icon-" + d.geometry, "pre-text"));
66001         });
66002         label.append("span").attr("class", "entity-type").text(function(d) {
66003           return d.type;
66004         });
66005         label.append("span").attr("class", "entity-name").text(function(d) {
66006           return d.name;
66007         });
66008         enter.style("opacity", 0).transition().style("opacity", 1);
66009         items.order();
66010         items.exit().remove();
66011       }
66012       function mouseover(d3_event, d) {
66013         if (d.id === -1)
66014           return;
66015         utilHighlightEntities([d.id], true, context);
66016       }
66017       function mouseout(d3_event, d) {
66018         if (d.id === -1)
66019           return;
66020         utilHighlightEntities([d.id], false, context);
66021       }
66022       function click(d3_event, d) {
66023         d3_event.preventDefault();
66024         if (d.location) {
66025           context.map().centerZoomEase([d.location[1], d.location[0]], 19);
66026         } else if (d.entity) {
66027           utilHighlightEntities([d.id], false, context);
66028           context.enter(modeSelect(context, [d.entity.id]));
66029           context.map().zoomToEase(d.entity);
66030         } else {
66031           context.zoomToEntity(d.id);
66032         }
66033       }
66034       function geocoderSearch() {
66035         services.geocoder.search(search.property("value"), function(err, resp) {
66036           _geocodeResults = resp || [];
66037           drawList();
66038         });
66039       }
66040     }
66041     return featureList;
66042   }
66043
66044   // modules/ui/improveOSM_comments.js
66045   function uiImproveOsmComments() {
66046     let _qaItem;
66047     function issueComments(selection2) {
66048       let comments = selection2.selectAll(".comments-container").data([0]);
66049       comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
66050       services.improveOSM.getComments(_qaItem).then((d) => {
66051         if (!d.comments)
66052           return;
66053         const commentEnter = comments.selectAll(".comment").data(d.comments).enter().append("div").attr("class", "comment");
66054         commentEnter.append("div").attr("class", "comment-avatar").call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
66055         const mainEnter = commentEnter.append("div").attr("class", "comment-main");
66056         const metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
66057         metadataEnter.append("div").attr("class", "comment-author").each(function(d2) {
66058           const osm = services.osm;
66059           let selection3 = select_default2(this);
66060           if (osm && d2.username) {
66061             selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d2.username)).attr("target", "_blank");
66062           }
66063           selection3.text((d4) => d4.username);
66064         });
66065         metadataEnter.append("div").attr("class", "comment-date").html((d2) => _t.html("note.status.commented", { when: localeDateString2(d2.timestamp) }));
66066         mainEnter.append("div").attr("class", "comment-text").append("p").text((d2) => d2.text);
66067       }).catch((err) => {
66068         console.log(err);
66069       });
66070     }
66071     function localeDateString2(s) {
66072       if (!s)
66073         return null;
66074       const options2 = { day: "numeric", month: "short", year: "numeric" };
66075       const d = new Date(s * 1e3);
66076       if (isNaN(d.getTime()))
66077         return null;
66078       return d.toLocaleDateString(_mainLocalizer.localeCode(), options2);
66079     }
66080     issueComments.issue = function(val) {
66081       if (!arguments.length)
66082         return _qaItem;
66083       _qaItem = val;
66084       return issueComments;
66085     };
66086     return issueComments;
66087   }
66088
66089   // modules/ui/improveOSM_details.js
66090   function uiImproveOsmDetails(context) {
66091     let _qaItem;
66092     function issueDetail(d) {
66093       if (d.desc)
66094         return d.desc;
66095       const issueKey = d.issueKey;
66096       d.replacements = d.replacements || {};
66097       d.replacements.default = { html: _t.html("inspector.unknown") };
66098       return _t.html(`QA.improveOSM.error_types.${issueKey}.description`, d.replacements);
66099     }
66100     function improveOsmDetails(selection2) {
66101       const details = selection2.selectAll(".error-details").data(
66102         _qaItem ? [_qaItem] : [],
66103         (d) => `${d.id}-${d.status || 0}`
66104       );
66105       details.exit().remove();
66106       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
66107       const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
66108       descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
66109       descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
66110       let relatedEntities = [];
66111       descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
66112         const link2 = select_default2(this);
66113         const isObjectLink = link2.classed("error_object_link");
66114         const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
66115         const entity = context.hasEntity(entityID);
66116         relatedEntities.push(entityID);
66117         link2.on("mouseenter", () => {
66118           utilHighlightEntities([entityID], true, context);
66119         }).on("mouseleave", () => {
66120           utilHighlightEntities([entityID], false, context);
66121         }).on("click", (d3_event) => {
66122           d3_event.preventDefault();
66123           utilHighlightEntities([entityID], false, context);
66124           const osmlayer = context.layers().layer("osm");
66125           if (!osmlayer.enabled()) {
66126             osmlayer.enabled(true);
66127           }
66128           context.map().centerZoom(_qaItem.loc, 20);
66129           if (entity) {
66130             context.enter(modeSelect(context, [entityID]));
66131           } else {
66132             context.loadEntity(entityID, (err, result) => {
66133               if (err)
66134                 return;
66135               const entity2 = result.data.find((e) => e.id === entityID);
66136               if (entity2)
66137                 context.enter(modeSelect(context, [entityID]));
66138             });
66139           }
66140         });
66141         if (entity) {
66142           let name = utilDisplayName(entity);
66143           if (!name && !isObjectLink) {
66144             const preset = _mainPresetIndex.match(entity, context.graph());
66145             name = preset && !preset.isFallback() && preset.name();
66146           }
66147           if (name) {
66148             this.innerText = name;
66149           }
66150         }
66151       });
66152       context.features().forceVisible(relatedEntities);
66153       context.map().pan([0, 0]);
66154     }
66155     improveOsmDetails.issue = function(val) {
66156       if (!arguments.length)
66157         return _qaItem;
66158       _qaItem = val;
66159       return improveOsmDetails;
66160     };
66161     return improveOsmDetails;
66162   }
66163
66164   // modules/ui/improveOSM_header.js
66165   function uiImproveOsmHeader() {
66166     let _qaItem;
66167     function issueTitle(d) {
66168       const issueKey = d.issueKey;
66169       d.replacements = d.replacements || {};
66170       d.replacements.default = { html: _t.html("inspector.unknown") };
66171       return _t.html(`QA.improveOSM.error_types.${issueKey}.title`, d.replacements);
66172     }
66173     function improveOsmHeader(selection2) {
66174       const header = selection2.selectAll(".qa-header").data(
66175         _qaItem ? [_qaItem] : [],
66176         (d) => `${d.id}-${d.status || 0}`
66177       );
66178       header.exit().remove();
66179       const headerEnter = header.enter().append("div").attr("class", "qa-header");
66180       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}`);
66181       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");
66182       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 : "");
66183       headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
66184     }
66185     improveOsmHeader.issue = function(val) {
66186       if (!arguments.length)
66187         return _qaItem;
66188       _qaItem = val;
66189       return improveOsmHeader;
66190     };
66191     return improveOsmHeader;
66192   }
66193
66194   // modules/ui/improveOSM_editor.js
66195   function uiImproveOsmEditor(context) {
66196     const dispatch10 = dispatch_default("change");
66197     const qaDetails = uiImproveOsmDetails(context);
66198     const qaComments = uiImproveOsmComments(context);
66199     const qaHeader = uiImproveOsmHeader(context);
66200     let _qaItem;
66201     function improveOsmEditor(selection2) {
66202       const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
66203       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
66204       headerEnter.append("h2").call(_t.append("QA.improveOSM.title"));
66205       let body = selection2.selectAll(".body").data([0]);
66206       body = body.enter().append("div").attr("class", "body").merge(body);
66207       const editor = body.selectAll(".qa-editor").data([0]);
66208       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);
66209     }
66210     function improveOsmSaveSection(selection2) {
66211       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
66212       const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
66213       let saveSection = selection2.selectAll(".qa-save").data(
66214         isShown ? [_qaItem] : [],
66215         (d) => `${d.id}-${d.status || 0}`
66216       );
66217       saveSection.exit().remove();
66218       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
66219       saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("note.newComment"));
66220       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);
66221       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
66222       function changeInput() {
66223         const input = select_default2(this);
66224         let val = input.property("value").trim();
66225         if (val === "") {
66226           val = void 0;
66227         }
66228         _qaItem = _qaItem.update({ newComment: val });
66229         const qaService = services.improveOSM;
66230         if (qaService) {
66231           qaService.replaceItem(_qaItem);
66232         }
66233         saveSection.call(qaSaveButtons);
66234       }
66235     }
66236     function qaSaveButtons(selection2) {
66237       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
66238       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d) => d.status + d.id);
66239       buttonSection.exit().remove();
66240       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
66241       buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
66242       buttonEnter.append("button").attr("class", "button close-button action");
66243       buttonEnter.append("button").attr("class", "button ignore-button action");
66244       buttonSection = buttonSection.merge(buttonEnter);
66245       buttonSection.select(".comment-button").attr("disabled", (d) => d.newComment ? null : true).on("click.comment", function(d3_event, d) {
66246         this.blur();
66247         const qaService = services.improveOSM;
66248         if (qaService) {
66249           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
66250         }
66251       });
66252       buttonSection.select(".close-button").html((d) => {
66253         const andComment = d.newComment ? "_comment" : "";
66254         return _t.html(`QA.keepRight.close${andComment}`);
66255       }).on("click.close", function(d3_event, d) {
66256         this.blur();
66257         const qaService = services.improveOSM;
66258         if (qaService) {
66259           d.newStatus = "SOLVED";
66260           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
66261         }
66262       });
66263       buttonSection.select(".ignore-button").html((d) => {
66264         const andComment = d.newComment ? "_comment" : "";
66265         return _t.html(`QA.keepRight.ignore${andComment}`);
66266       }).on("click.ignore", function(d3_event, d) {
66267         this.blur();
66268         const qaService = services.improveOSM;
66269         if (qaService) {
66270           d.newStatus = "INVALID";
66271           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
66272         }
66273       });
66274     }
66275     improveOsmEditor.error = function(val) {
66276       if (!arguments.length)
66277         return _qaItem;
66278       _qaItem = val;
66279       return improveOsmEditor;
66280     };
66281     return utilRebind(improveOsmEditor, dispatch10, "on");
66282   }
66283
66284   // modules/ui/preset_list.js
66285   function uiPresetList(context) {
66286     var dispatch10 = dispatch_default("cancel", "choose");
66287     var _entityIDs;
66288     var _currLoc;
66289     var _currentPresets;
66290     var _autofocus = false;
66291     function presetList(selection2) {
66292       if (!_entityIDs)
66293         return;
66294       var presets = _mainPresetIndex.matchAllGeometry(entityGeometries());
66295       selection2.html("");
66296       var messagewrap = selection2.append("div").attr("class", "header fillL");
66297       var message = messagewrap.append("h2").call(_t.append("inspector.choose"));
66298       var direction = _mainLocalizer.textDirection() === "rtl" ? "backward" : "forward";
66299       messagewrap.append("button").attr("class", "preset-choose").attr("title", _entityIDs.length === 1 ? _t("inspector.edit") : _t("inspector.edit_features")).on("click", function() {
66300         dispatch10.call("cancel", this);
66301       }).call(svgIcon(`#iD-icon-${direction}`));
66302       function initialKeydown(d3_event) {
66303         if (search.property("value").length === 0 && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
66304           d3_event.preventDefault();
66305           d3_event.stopPropagation();
66306           operationDelete(context, _entityIDs)();
66307         } else if (search.property("value").length === 0 && (d3_event.ctrlKey || d3_event.metaKey) && d3_event.keyCode === utilKeybinding.keyCodes.z) {
66308           d3_event.preventDefault();
66309           d3_event.stopPropagation();
66310           context.undo();
66311         } else if (!d3_event.ctrlKey && !d3_event.metaKey) {
66312           select_default2(this).on("keydown", keydown);
66313           keydown.call(this, d3_event);
66314         }
66315       }
66316       function keydown(d3_event) {
66317         if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"] && // if insertion point is at the end of the string
66318         search.node().selectionStart === search.property("value").length) {
66319           d3_event.preventDefault();
66320           d3_event.stopPropagation();
66321           var buttons = list.selectAll(".preset-list-button");
66322           if (!buttons.empty())
66323             buttons.nodes()[0].focus();
66324         }
66325       }
66326       function keypress(d3_event) {
66327         var value = search.property("value");
66328         if (d3_event.keyCode === 13 && // ↩ Return
66329         value.length) {
66330           list.selectAll(".preset-list-item:first-child").each(function(d) {
66331             d.choose.call(this);
66332           });
66333         }
66334       }
66335       function inputevent() {
66336         var value = search.property("value");
66337         list.classed("filtered", value.length);
66338         var results, messageText;
66339         if (value.length) {
66340           results = presets.search(value, entityGeometries()[0], _currLoc);
66341           messageText = _t.html("inspector.results", {
66342             n: results.collection.length,
66343             search: value
66344           });
66345         } else {
66346           var entityPresets2 = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
66347           results = _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets2);
66348           messageText = _t.html("inspector.choose");
66349         }
66350         list.call(drawList, results);
66351         message.html(messageText);
66352       }
66353       var searchWrap = selection2.append("div").attr("class", "search-header");
66354       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
66355       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));
66356       if (_autofocus) {
66357         search.node().focus();
66358         setTimeout(function() {
66359           search.node().focus();
66360         }, 0);
66361       }
66362       var listWrap = selection2.append("div").attr("class", "inspector-body");
66363       var entityPresets = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
66364       var list = listWrap.append("div").attr("class", "preset-list").call(drawList, _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets));
66365       context.features().on("change.preset-list", updateForFeatureHiddenState);
66366     }
66367     function drawList(list, presets) {
66368       presets = presets.matchAllGeometry(entityGeometries());
66369       var collection = presets.collection.reduce(function(collection2, preset) {
66370         if (!preset)
66371           return collection2;
66372         if (preset.members) {
66373           if (preset.members.collection.filter(function(preset2) {
66374             return preset2.addable();
66375           }).length > 1) {
66376             collection2.push(CategoryItem(preset));
66377           }
66378         } else if (preset.addable()) {
66379           collection2.push(PresetItem(preset));
66380         }
66381         return collection2;
66382       }, []);
66383       var items = list.selectAll(".preset-list-item").data(collection, function(d) {
66384         return d.preset.id;
66385       });
66386       items.order();
66387       items.exit().remove();
66388       items.enter().append("div").attr("class", function(item) {
66389         return "preset-list-item preset-" + item.preset.id.replace("/", "-");
66390       }).classed("current", function(item) {
66391         return _currentPresets.indexOf(item.preset) !== -1;
66392       }).each(function(item) {
66393         select_default2(this).call(item);
66394       }).style("opacity", 0).transition().style("opacity", 1);
66395       updateForFeatureHiddenState();
66396     }
66397     function itemKeydown(d3_event) {
66398       var item = select_default2(this.closest(".preset-list-item"));
66399       var parentItem = select_default2(item.node().parentNode.closest(".preset-list-item"));
66400       if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"]) {
66401         d3_event.preventDefault();
66402         d3_event.stopPropagation();
66403         var nextItem = select_default2(item.node().nextElementSibling);
66404         if (nextItem.empty()) {
66405           if (!parentItem.empty()) {
66406             nextItem = select_default2(parentItem.node().nextElementSibling);
66407           }
66408         } else if (select_default2(this).classed("expanded")) {
66409           nextItem = item.select(".subgrid .preset-list-item:first-child");
66410         }
66411         if (!nextItem.empty()) {
66412           nextItem.select(".preset-list-button").node().focus();
66413         }
66414       } else if (d3_event.keyCode === utilKeybinding.keyCodes["\u2191"]) {
66415         d3_event.preventDefault();
66416         d3_event.stopPropagation();
66417         var previousItem = select_default2(item.node().previousElementSibling);
66418         if (previousItem.empty()) {
66419           if (!parentItem.empty()) {
66420             previousItem = parentItem;
66421           }
66422         } else if (previousItem.select(".preset-list-button").classed("expanded")) {
66423           previousItem = previousItem.select(".subgrid .preset-list-item:last-child");
66424         }
66425         if (!previousItem.empty()) {
66426           previousItem.select(".preset-list-button").node().focus();
66427         } else {
66428           var search = select_default2(this.closest(".preset-list-pane")).select(".preset-search-input");
66429           search.node().focus();
66430         }
66431       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
66432         d3_event.preventDefault();
66433         d3_event.stopPropagation();
66434         if (!parentItem.empty()) {
66435           parentItem.select(".preset-list-button").node().focus();
66436         }
66437       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
66438         d3_event.preventDefault();
66439         d3_event.stopPropagation();
66440         item.datum().choose.call(select_default2(this).node());
66441       }
66442     }
66443     function CategoryItem(preset) {
66444       var box, sublist, shown = false;
66445       function item(selection2) {
66446         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap category");
66447         function click() {
66448           var isExpanded = select_default2(this).classed("expanded");
66449           var iconName = isExpanded ? _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward" : "#iD-icon-down";
66450           select_default2(this).classed("expanded", !isExpanded).attr("title", !isExpanded ? _t("icons.collapse") : _t("icons.expand"));
66451           select_default2(this).selectAll("div.label-inner svg.icon use").attr("href", iconName);
66452           item.choose();
66453         }
66454         var geometries = entityGeometries();
66455         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) {
66456           if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
66457             d3_event.preventDefault();
66458             d3_event.stopPropagation();
66459             if (!select_default2(this).classed("expanded")) {
66460               click.call(this, d3_event);
66461             }
66462           } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
66463             d3_event.preventDefault();
66464             d3_event.stopPropagation();
66465             if (select_default2(this).classed("expanded")) {
66466               click.call(this, d3_event);
66467             }
66468           } else {
66469             itemKeydown.call(this, d3_event);
66470           }
66471         });
66472         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
66473         label.append("div").attr("class", "namepart").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline")).append("span").call(preset.nameLabel()).append("span").text("\u2026");
66474         box = selection2.append("div").attr("class", "subgrid").style("max-height", "0px").style("opacity", 0);
66475         box.append("div").attr("class", "arrow");
66476         sublist = box.append("div").attr("class", "preset-list fillL3");
66477       }
66478       item.choose = function() {
66479         if (!box || !sublist)
66480           return;
66481         if (shown) {
66482           shown = false;
66483           box.transition().duration(200).style("opacity", "0").style("max-height", "0px").style("padding-bottom", "0px");
66484         } else {
66485           shown = true;
66486           var members = preset.members.matchAllGeometry(entityGeometries());
66487           sublist.call(drawList, members);
66488           box.transition().duration(200).style("opacity", "1").style("max-height", 200 + members.collection.length * 190 + "px").style("padding-bottom", "10px");
66489         }
66490       };
66491       item.preset = preset;
66492       return item;
66493     }
66494     function PresetItem(preset) {
66495       function item(selection2) {
66496         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap");
66497         var geometries = entityGeometries();
66498         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);
66499         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
66500         var nameparts = [
66501           preset.nameLabel(),
66502           preset.subtitleLabel()
66503         ].filter(Boolean);
66504         label.selectAll(".namepart").data(nameparts, (d) => d.stringId).enter().append("div").attr("class", "namepart").text("").each(function(d) {
66505           d(select_default2(this));
66506         });
66507         wrap2.call(item.reference.button);
66508         selection2.call(item.reference.body);
66509       }
66510       item.choose = function() {
66511         if (select_default2(this).classed("disabled"))
66512           return;
66513         if (!context.inIntro()) {
66514           _mainPresetIndex.setMostRecent(preset, entityGeometries()[0]);
66515         }
66516         context.perform(
66517           function(graph) {
66518             for (var i2 in _entityIDs) {
66519               var entityID = _entityIDs[i2];
66520               var oldPreset = _mainPresetIndex.match(graph.entity(entityID), graph);
66521               graph = actionChangePreset(entityID, oldPreset, preset)(graph);
66522             }
66523             return graph;
66524           },
66525           _t("operations.change_tags.annotation")
66526         );
66527         context.validator().validate();
66528         dispatch10.call("choose", this, preset);
66529       };
66530       item.help = function(d3_event) {
66531         d3_event.stopPropagation();
66532         item.reference.toggle();
66533       };
66534       item.preset = preset;
66535       item.reference = uiTagReference(preset.reference(), context);
66536       return item;
66537     }
66538     function updateForFeatureHiddenState() {
66539       if (!_entityIDs.every(context.hasEntity))
66540         return;
66541       var geometries = entityGeometries();
66542       var button = context.container().selectAll(".preset-list .preset-list-button");
66543       button.call(uiTooltip().destroyAny);
66544       button.each(function(item, index) {
66545         var hiddenPresetFeaturesId;
66546         for (var i2 in geometries) {
66547           hiddenPresetFeaturesId = context.features().isHiddenPreset(item.preset, geometries[i2]);
66548           if (hiddenPresetFeaturesId)
66549             break;
66550         }
66551         var isHiddenPreset = !context.inIntro() && !!hiddenPresetFeaturesId && (_currentPresets.length !== 1 || item.preset !== _currentPresets[0]);
66552         select_default2(this).classed("disabled", isHiddenPreset);
66553         if (isHiddenPreset) {
66554           var isAutoHidden = context.features().autoHidden(hiddenPresetFeaturesId);
66555           select_default2(this).call(
66556             uiTooltip().title(() => _t.append("inspector.hidden_preset." + (isAutoHidden ? "zoom" : "manual"), {
66557               features: _t("feature." + hiddenPresetFeaturesId + ".description")
66558             })).placement(index < 2 ? "bottom" : "top")
66559           );
66560         }
66561       });
66562     }
66563     presetList.autofocus = function(val) {
66564       if (!arguments.length)
66565         return _autofocus;
66566       _autofocus = val;
66567       return presetList;
66568     };
66569     presetList.entityIDs = function(val) {
66570       if (!arguments.length)
66571         return _entityIDs;
66572       _entityIDs = val;
66573       _currLoc = null;
66574       if (_entityIDs && _entityIDs.length) {
66575         const extent = _entityIDs.reduce(function(extent2, entityID) {
66576           var entity = context.graph().entity(entityID);
66577           return extent2.extend(entity.extent(context.graph()));
66578         }, geoExtent());
66579         _currLoc = extent.center();
66580         var presets = _entityIDs.map(function(entityID) {
66581           return _mainPresetIndex.match(context.entity(entityID), context.graph());
66582         });
66583         presetList.presets(presets);
66584       }
66585       return presetList;
66586     };
66587     presetList.presets = function(val) {
66588       if (!arguments.length)
66589         return _currentPresets;
66590       _currentPresets = val;
66591       return presetList;
66592     };
66593     function entityGeometries() {
66594       var counts = {};
66595       for (var i2 in _entityIDs) {
66596         var entityID = _entityIDs[i2];
66597         var entity = context.entity(entityID);
66598         var geometry = entity.geometry(context.graph());
66599         if (geometry === "vertex" && entity.isOnAddressLine(context.graph())) {
66600           geometry = "point";
66601         }
66602         if (!counts[geometry])
66603           counts[geometry] = 0;
66604         counts[geometry] += 1;
66605       }
66606       return Object.keys(counts).sort(function(geom1, geom2) {
66607         return counts[geom2] - counts[geom1];
66608       });
66609     }
66610     return utilRebind(presetList, dispatch10, "on");
66611   }
66612
66613   // modules/ui/view_on_osm.js
66614   function uiViewOnOSM(context) {
66615     var _what;
66616     function viewOnOSM(selection2) {
66617       var url;
66618       if (_what instanceof osmEntity) {
66619         url = context.connection().entityURL(_what);
66620       } else if (_what instanceof osmNote) {
66621         url = context.connection().noteURL(_what);
66622       }
66623       var data = !_what || _what.isNew() ? [] : [_what];
66624       var link2 = selection2.selectAll(".view-on-osm").data(data, function(d) {
66625         return d.id;
66626       });
66627       link2.exit().remove();
66628       var linkEnter = link2.enter().append("a").attr("class", "view-on-osm").attr("target", "_blank").attr("href", url).call(svgIcon("#iD-icon-out-link", "inline"));
66629       linkEnter.append("span").call(_t.append("inspector.view_on_osm"));
66630     }
66631     viewOnOSM.what = function(_) {
66632       if (!arguments.length)
66633         return _what;
66634       _what = _;
66635       return viewOnOSM;
66636     };
66637     return viewOnOSM;
66638   }
66639
66640   // modules/ui/inspector.js
66641   function uiInspector(context) {
66642     var presetList = uiPresetList(context);
66643     var entityEditor = uiEntityEditor(context);
66644     var wrap2 = select_default2(null), presetPane = select_default2(null), editorPane = select_default2(null);
66645     var _state = "select";
66646     var _entityIDs;
66647     var _newFeature = false;
66648     function inspector(selection2) {
66649       presetList.entityIDs(_entityIDs).autofocus(_newFeature).on("choose", inspector.setPreset).on("cancel", function() {
66650         inspector.setPreset();
66651       });
66652       entityEditor.state(_state).entityIDs(_entityIDs).on("choose", inspector.showList);
66653       wrap2 = selection2.selectAll(".panewrap").data([0]);
66654       var enter = wrap2.enter().append("div").attr("class", "panewrap");
66655       enter.append("div").attr("class", "preset-list-pane pane");
66656       enter.append("div").attr("class", "entity-editor-pane pane");
66657       wrap2 = wrap2.merge(enter);
66658       presetPane = wrap2.selectAll(".preset-list-pane");
66659       editorPane = wrap2.selectAll(".entity-editor-pane");
66660       function shouldDefaultToPresetList() {
66661         if (_state !== "select")
66662           return false;
66663         if (_entityIDs.length !== 1)
66664           return false;
66665         var entityID = _entityIDs[0];
66666         var entity = context.hasEntity(entityID);
66667         if (!entity)
66668           return false;
66669         if (entity.hasNonGeometryTags())
66670           return false;
66671         if (_newFeature)
66672           return true;
66673         if (entity.geometry(context.graph()) !== "vertex")
66674           return false;
66675         if (context.graph().parentRelations(entity).length)
66676           return false;
66677         if (context.validator().getEntityIssues(entityID).length)
66678           return false;
66679         if (entity.isHighwayIntersection(context.graph()))
66680           return false;
66681         return true;
66682       }
66683       if (shouldDefaultToPresetList()) {
66684         wrap2.style("right", "-100%");
66685         editorPane.classed("hide", true);
66686         presetPane.classed("hide", false).call(presetList);
66687       } else {
66688         wrap2.style("right", "0%");
66689         presetPane.classed("hide", true);
66690         editorPane.classed("hide", false).call(entityEditor);
66691       }
66692       var footer = selection2.selectAll(".footer").data([0]);
66693       footer = footer.enter().append("div").attr("class", "footer").merge(footer);
66694       footer.call(
66695         uiViewOnOSM(context).what(context.hasEntity(_entityIDs.length === 1 && _entityIDs[0]))
66696       );
66697     }
66698     inspector.showList = function(presets) {
66699       presetPane.classed("hide", false);
66700       wrap2.transition().styleTween("right", function() {
66701         return value_default("0%", "-100%");
66702       }).on("end", function() {
66703         editorPane.classed("hide", true);
66704       });
66705       if (presets) {
66706         presetList.presets(presets);
66707       }
66708       presetPane.call(presetList.autofocus(true));
66709     };
66710     inspector.setPreset = function(preset) {
66711       if (preset && preset.id === "type/multipolygon") {
66712         presetPane.call(presetList.autofocus(true));
66713       } else {
66714         editorPane.classed("hide", false);
66715         wrap2.transition().styleTween("right", function() {
66716           return value_default("-100%", "0%");
66717         }).on("end", function() {
66718           presetPane.classed("hide", true);
66719         });
66720         if (preset) {
66721           entityEditor.presets([preset]);
66722         }
66723         editorPane.call(entityEditor);
66724       }
66725     };
66726     inspector.state = function(val) {
66727       if (!arguments.length)
66728         return _state;
66729       _state = val;
66730       entityEditor.state(_state);
66731       context.container().selectAll(".field-help-body").remove();
66732       return inspector;
66733     };
66734     inspector.entityIDs = function(val) {
66735       if (!arguments.length)
66736         return _entityIDs;
66737       _entityIDs = val;
66738       return inspector;
66739     };
66740     inspector.newFeature = function(val) {
66741       if (!arguments.length)
66742         return _newFeature;
66743       _newFeature = val;
66744       return inspector;
66745     };
66746     return inspector;
66747   }
66748
66749   // modules/ui/keepRight_details.js
66750   function uiKeepRightDetails(context) {
66751     let _qaItem;
66752     function issueDetail(d) {
66753       const { itemType, parentIssueType } = d;
66754       const unknown = { html: _t.html("inspector.unknown") };
66755       let replacements = d.replacements || {};
66756       replacements.default = unknown;
66757       if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
66758         return _t.html(`QA.keepRight.errorTypes.${itemType}.description`, replacements);
66759       } else {
66760         return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.description`, replacements);
66761       }
66762     }
66763     function keepRightDetails(selection2) {
66764       const details = selection2.selectAll(".error-details").data(
66765         _qaItem ? [_qaItem] : [],
66766         (d) => `${d.id}-${d.status || 0}`
66767       );
66768       details.exit().remove();
66769       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
66770       const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
66771       descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
66772       descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
66773       let relatedEntities = [];
66774       descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
66775         const link2 = select_default2(this);
66776         const isObjectLink = link2.classed("error_object_link");
66777         const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
66778         const entity = context.hasEntity(entityID);
66779         relatedEntities.push(entityID);
66780         link2.on("mouseenter", () => {
66781           utilHighlightEntities([entityID], true, context);
66782         }).on("mouseleave", () => {
66783           utilHighlightEntities([entityID], false, context);
66784         }).on("click", (d3_event) => {
66785           d3_event.preventDefault();
66786           utilHighlightEntities([entityID], false, context);
66787           const osmlayer = context.layers().layer("osm");
66788           if (!osmlayer.enabled()) {
66789             osmlayer.enabled(true);
66790           }
66791           context.map().centerZoomEase(_qaItem.loc, 20);
66792           if (entity) {
66793             context.enter(modeSelect(context, [entityID]));
66794           } else {
66795             context.loadEntity(entityID, (err, result) => {
66796               if (err)
66797                 return;
66798               const entity2 = result.data.find((e) => e.id === entityID);
66799               if (entity2)
66800                 context.enter(modeSelect(context, [entityID]));
66801             });
66802           }
66803         });
66804         if (entity) {
66805           let name = utilDisplayName(entity);
66806           if (!name && !isObjectLink) {
66807             const preset = _mainPresetIndex.match(entity, context.graph());
66808             name = preset && !preset.isFallback() && preset.name();
66809           }
66810           if (name) {
66811             this.innerText = name;
66812           }
66813         }
66814       });
66815       context.features().forceVisible(relatedEntities);
66816       context.map().pan([0, 0]);
66817     }
66818     keepRightDetails.issue = function(val) {
66819       if (!arguments.length)
66820         return _qaItem;
66821       _qaItem = val;
66822       return keepRightDetails;
66823     };
66824     return keepRightDetails;
66825   }
66826
66827   // modules/ui/keepRight_header.js
66828   function uiKeepRightHeader() {
66829     let _qaItem;
66830     function issueTitle(d) {
66831       const { itemType, parentIssueType } = d;
66832       const unknown = _t.html("inspector.unknown");
66833       let replacements = d.replacements || {};
66834       replacements.default = { html: unknown };
66835       if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
66836         return _t.html(`QA.keepRight.errorTypes.${itemType}.title`, replacements);
66837       } else {
66838         return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.title`, replacements);
66839       }
66840     }
66841     function keepRightHeader(selection2) {
66842       const header = selection2.selectAll(".qa-header").data(
66843         _qaItem ? [_qaItem] : [],
66844         (d) => `${d.id}-${d.status || 0}`
66845       );
66846       header.exit().remove();
66847       const headerEnter = header.enter().append("div").attr("class", "qa-header");
66848       const iconEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d) => d.id < 0);
66849       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"));
66850       headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
66851     }
66852     keepRightHeader.issue = function(val) {
66853       if (!arguments.length)
66854         return _qaItem;
66855       _qaItem = val;
66856       return keepRightHeader;
66857     };
66858     return keepRightHeader;
66859   }
66860
66861   // modules/ui/view_on_keepRight.js
66862   function uiViewOnKeepRight() {
66863     let _qaItem;
66864     function viewOnKeepRight(selection2) {
66865       let url;
66866       if (services.keepRight && _qaItem instanceof QAItem) {
66867         url = services.keepRight.issueURL(_qaItem);
66868       }
66869       const link2 = selection2.selectAll(".view-on-keepRight").data(url ? [url] : []);
66870       link2.exit().remove();
66871       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"));
66872       linkEnter.append("span").call(_t.append("inspector.view_on_keepRight"));
66873     }
66874     viewOnKeepRight.what = function(val) {
66875       if (!arguments.length)
66876         return _qaItem;
66877       _qaItem = val;
66878       return viewOnKeepRight;
66879     };
66880     return viewOnKeepRight;
66881   }
66882
66883   // modules/ui/keepRight_editor.js
66884   function uiKeepRightEditor(context) {
66885     const dispatch10 = dispatch_default("change");
66886     const qaDetails = uiKeepRightDetails(context);
66887     const qaHeader = uiKeepRightHeader(context);
66888     let _qaItem;
66889     function keepRightEditor(selection2) {
66890       const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
66891       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
66892       headerEnter.append("h2").call(_t.append("QA.keepRight.title"));
66893       let body = selection2.selectAll(".body").data([0]);
66894       body = body.enter().append("div").attr("class", "body").merge(body);
66895       const editor = body.selectAll(".qa-editor").data([0]);
66896       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(keepRightSaveSection);
66897       const footer = selection2.selectAll(".footer").data([0]);
66898       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnKeepRight(context).what(_qaItem));
66899     }
66900     function keepRightSaveSection(selection2) {
66901       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
66902       const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
66903       let saveSection = selection2.selectAll(".qa-save").data(
66904         isShown ? [_qaItem] : [],
66905         (d) => `${d.id}-${d.status || 0}`
66906       );
66907       saveSection.exit().remove();
66908       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
66909       saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("QA.keepRight.comment"));
66910       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);
66911       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
66912       function changeInput() {
66913         const input = select_default2(this);
66914         let val = input.property("value").trim();
66915         if (val === _qaItem.comment) {
66916           val = void 0;
66917         }
66918         _qaItem = _qaItem.update({ newComment: val });
66919         const qaService = services.keepRight;
66920         if (qaService) {
66921           qaService.replaceItem(_qaItem);
66922         }
66923         saveSection.call(qaSaveButtons);
66924       }
66925     }
66926     function qaSaveButtons(selection2) {
66927       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
66928       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d) => d.status + d.id);
66929       buttonSection.exit().remove();
66930       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
66931       buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
66932       buttonEnter.append("button").attr("class", "button close-button action");
66933       buttonEnter.append("button").attr("class", "button ignore-button action");
66934       buttonSection = buttonSection.merge(buttonEnter);
66935       buttonSection.select(".comment-button").attr("disabled", (d) => d.newComment ? null : true).on("click.comment", function(d3_event, d) {
66936         this.blur();
66937         const qaService = services.keepRight;
66938         if (qaService) {
66939           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
66940         }
66941       });
66942       buttonSection.select(".close-button").html((d) => {
66943         const andComment = d.newComment ? "_comment" : "";
66944         return _t.html(`QA.keepRight.close${andComment}`);
66945       }).on("click.close", function(d3_event, d) {
66946         this.blur();
66947         const qaService = services.keepRight;
66948         if (qaService) {
66949           d.newStatus = "ignore_t";
66950           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
66951         }
66952       });
66953       buttonSection.select(".ignore-button").html((d) => {
66954         const andComment = d.newComment ? "_comment" : "";
66955         return _t.html(`QA.keepRight.ignore${andComment}`);
66956       }).on("click.ignore", function(d3_event, d) {
66957         this.blur();
66958         const qaService = services.keepRight;
66959         if (qaService) {
66960           d.newStatus = "ignore";
66961           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
66962         }
66963       });
66964     }
66965     keepRightEditor.error = function(val) {
66966       if (!arguments.length)
66967         return _qaItem;
66968       _qaItem = val;
66969       return keepRightEditor;
66970     };
66971     return utilRebind(keepRightEditor, dispatch10, "on");
66972   }
66973
66974   // modules/ui/lasso.js
66975   function uiLasso(context) {
66976     var group, polygon2;
66977     lasso.coordinates = [];
66978     function lasso(selection2) {
66979       context.container().classed("lasso", true);
66980       group = selection2.append("g").attr("class", "lasso hide");
66981       polygon2 = group.append("path").attr("class", "lasso-path");
66982       group.call(uiToggle(true));
66983     }
66984     function draw() {
66985       if (polygon2) {
66986         polygon2.data([lasso.coordinates]).attr("d", function(d) {
66987           return "M" + d.join(" L") + " Z";
66988         });
66989       }
66990     }
66991     lasso.extent = function() {
66992       return lasso.coordinates.reduce(function(extent, point2) {
66993         return extent.extend(geoExtent(point2));
66994       }, geoExtent());
66995     };
66996     lasso.p = function(_) {
66997       if (!arguments.length)
66998         return lasso;
66999       lasso.coordinates.push(_);
67000       draw();
67001       return lasso;
67002     };
67003     lasso.close = function() {
67004       if (group) {
67005         group.call(uiToggle(false, function() {
67006           select_default2(this).remove();
67007         }));
67008       }
67009       context.container().classed("lasso", false);
67010     };
67011     return lasso;
67012   }
67013
67014   // modules/ui/note_comments.js
67015   function uiNoteComments() {
67016     var _note;
67017     function noteComments(selection2) {
67018       if (_note.isNew())
67019         return;
67020       var comments = selection2.selectAll(".comments-container").data([0]);
67021       comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
67022       var commentEnter = comments.selectAll(".comment").data(_note.comments).enter().append("div").attr("class", "comment");
67023       commentEnter.append("div").attr("class", function(d) {
67024         return "comment-avatar user-" + d.uid;
67025       }).call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
67026       var mainEnter = commentEnter.append("div").attr("class", "comment-main");
67027       var metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
67028       metadataEnter.append("div").attr("class", "comment-author").each(function(d) {
67029         var selection3 = select_default2(this);
67030         var osm = services.osm;
67031         if (osm && d.user) {
67032           selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d.user)).attr("target", "_blank");
67033         }
67034         if (d.user) {
67035           selection3.text(d.user);
67036         } else {
67037           selection3.call(_t.append("note.anonymous"));
67038         }
67039       });
67040       metadataEnter.append("div").attr("class", "comment-date").html(function(d) {
67041         return _t.html("note.status." + d.action, { when: localeDateString2(d.date) });
67042       });
67043       mainEnter.append("div").attr("class", "comment-text").html(function(d) {
67044         return d.html;
67045       }).selectAll("a").attr("rel", "noopener nofollow").attr("target", "_blank");
67046       comments.call(replaceAvatars);
67047     }
67048     function replaceAvatars(selection2) {
67049       var showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
67050       var osm = services.osm;
67051       if (showThirdPartyIcons !== "true" || !osm)
67052         return;
67053       var uids = {};
67054       _note.comments.forEach(function(d) {
67055         if (d.uid)
67056           uids[d.uid] = true;
67057       });
67058       Object.keys(uids).forEach(function(uid) {
67059         osm.loadUser(uid, function(err, user) {
67060           if (!user || !user.image_url)
67061             return;
67062           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);
67063         });
67064       });
67065     }
67066     function localeDateString2(s) {
67067       if (!s)
67068         return null;
67069       var options2 = { day: "numeric", month: "short", year: "numeric" };
67070       s = s.replace(/-/g, "/");
67071       var d = new Date(s);
67072       if (isNaN(d.getTime()))
67073         return null;
67074       return d.toLocaleDateString(_mainLocalizer.localeCode(), options2);
67075     }
67076     noteComments.note = function(val) {
67077       if (!arguments.length)
67078         return _note;
67079       _note = val;
67080       return noteComments;
67081     };
67082     return noteComments;
67083   }
67084
67085   // modules/ui/note_header.js
67086   function uiNoteHeader() {
67087     var _note;
67088     function noteHeader(selection2) {
67089       var header = selection2.selectAll(".note-header").data(
67090         _note ? [_note] : [],
67091         function(d) {
67092           return d.status + d.id;
67093         }
67094       );
67095       header.exit().remove();
67096       var headerEnter = header.enter().append("div").attr("class", "note-header");
67097       var iconEnter = headerEnter.append("div").attr("class", function(d) {
67098         return "note-header-icon " + d.status;
67099       }).classed("new", function(d) {
67100         return d.id < 0;
67101       });
67102       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-note", "note-fill"));
67103       iconEnter.each(function(d) {
67104         var statusIcon;
67105         if (d.id < 0) {
67106           statusIcon = "#iD-icon-plus";
67107         } else if (d.status === "open") {
67108           statusIcon = "#iD-icon-close";
67109         } else {
67110           statusIcon = "#iD-icon-apply";
67111         }
67112         iconEnter.append("div").attr("class", "note-icon-annotation").attr("title", _t("icons.close")).call(svgIcon(statusIcon, "icon-annotation"));
67113       });
67114       headerEnter.append("div").attr("class", "note-header-label").html(function(d) {
67115         if (_note.isNew()) {
67116           return _t.html("note.new");
67117         }
67118         return _t.html("note.note") + " " + d.id + " " + (d.status === "closed" ? _t.html("note.closed") : "");
67119       });
67120     }
67121     noteHeader.note = function(val) {
67122       if (!arguments.length)
67123         return _note;
67124       _note = val;
67125       return noteHeader;
67126     };
67127     return noteHeader;
67128   }
67129
67130   // modules/ui/note_report.js
67131   function uiNoteReport() {
67132     var _note;
67133     function noteReport(selection2) {
67134       var url;
67135       if (services.osm && _note instanceof osmNote && !_note.isNew()) {
67136         url = services.osm.noteReportURL(_note);
67137       }
67138       var link2 = selection2.selectAll(".note-report").data(url ? [url] : []);
67139       link2.exit().remove();
67140       var linkEnter = link2.enter().append("a").attr("class", "note-report").attr("target", "_blank").attr("href", function(d) {
67141         return d;
67142       }).call(svgIcon("#iD-icon-out-link", "inline"));
67143       linkEnter.append("span").call(_t.append("note.report"));
67144     }
67145     noteReport.note = function(val) {
67146       if (!arguments.length)
67147         return _note;
67148       _note = val;
67149       return noteReport;
67150     };
67151     return noteReport;
67152   }
67153
67154   // modules/ui/note_editor.js
67155   function uiNoteEditor(context) {
67156     var dispatch10 = dispatch_default("change");
67157     var noteComments = uiNoteComments(context);
67158     var noteHeader = uiNoteHeader();
67159     var _note;
67160     var _newNote;
67161     function noteEditor(selection2) {
67162       var header = selection2.selectAll(".header").data([0]);
67163       var headerEnter = header.enter().append("div").attr("class", "header fillL");
67164       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
67165         context.enter(modeBrowse(context));
67166       }).call(svgIcon("#iD-icon-close"));
67167       headerEnter.append("h2").call(_t.append("note.title"));
67168       var body = selection2.selectAll(".body").data([0]);
67169       body = body.enter().append("div").attr("class", "body").merge(body);
67170       var editor = body.selectAll(".note-editor").data([0]);
67171       editor.enter().append("div").attr("class", "modal-section note-editor").merge(editor).call(noteHeader.note(_note)).call(noteComments.note(_note)).call(noteSaveSection);
67172       var footer = selection2.selectAll(".footer").data([0]);
67173       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOSM(context).what(_note)).call(uiNoteReport(context).note(_note));
67174       var osm = services.osm;
67175       if (osm) {
67176         osm.on("change.note-save", function() {
67177           selection2.call(noteEditor);
67178         });
67179       }
67180     }
67181     function noteSaveSection(selection2) {
67182       var isSelected = _note && _note.id === context.selectedNoteID();
67183       var noteSave = selection2.selectAll(".note-save").data(isSelected ? [_note] : [], function(d) {
67184         return d.status + d.id;
67185       });
67186       noteSave.exit().remove();
67187       var noteSaveEnter = noteSave.enter().append("div").attr("class", "note-save save-section cf");
67188       noteSaveEnter.append("h4").attr("class", ".note-save-header").html(function() {
67189         return _note.isNew() ? _t.html("note.newDescription") : _t.html("note.newComment");
67190       });
67191       var commentTextarea = noteSaveEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("note.inputPlaceholder")).attr("maxlength", 1e3).property("value", function(d) {
67192         return d.newComment;
67193       }).call(utilNoAuto).on("keydown.note-input", keydown).on("input.note-input", changeInput).on("blur.note-input", changeInput);
67194       if (!commentTextarea.empty() && _newNote) {
67195         commentTextarea.node().focus();
67196       }
67197       noteSave = noteSaveEnter.merge(noteSave).call(userDetails).call(noteSaveButtons);
67198       function keydown(d3_event) {
67199         if (!(d3_event.keyCode === 13 && // ↩ Return
67200         d3_event.metaKey))
67201           return;
67202         var osm = services.osm;
67203         if (!osm)
67204           return;
67205         var hasAuth = osm.authenticated();
67206         if (!hasAuth)
67207           return;
67208         if (!_note.newComment)
67209           return;
67210         d3_event.preventDefault();
67211         select_default2(this).on("keydown.note-input", null);
67212         window.setTimeout(function() {
67213           if (_note.isNew()) {
67214             noteSave.selectAll(".save-button").node().focus();
67215             clickSave(_note);
67216           } else {
67217             noteSave.selectAll(".comment-button").node().focus();
67218             clickComment(_note);
67219           }
67220         }, 10);
67221       }
67222       function changeInput() {
67223         var input = select_default2(this);
67224         var val = input.property("value").trim() || void 0;
67225         _note = _note.update({ newComment: val });
67226         var osm = services.osm;
67227         if (osm) {
67228           osm.replaceNote(_note);
67229         }
67230         noteSave.call(noteSaveButtons);
67231       }
67232     }
67233     function userDetails(selection2) {
67234       var detailSection = selection2.selectAll(".detail-section").data([0]);
67235       detailSection = detailSection.enter().append("div").attr("class", "detail-section").merge(detailSection);
67236       var osm = services.osm;
67237       if (!osm)
67238         return;
67239       var hasAuth = osm.authenticated();
67240       var authWarning = detailSection.selectAll(".auth-warning").data(hasAuth ? [] : [0]);
67241       authWarning.exit().transition().duration(200).style("opacity", 0).remove();
67242       var authEnter = authWarning.enter().insert("div", ".tag-reference-body").attr("class", "field-warning auth-warning").style("opacity", 0);
67243       authEnter.call(svgIcon("#iD-icon-alert", "inline"));
67244       authEnter.append("span").call(_t.append("note.login"));
67245       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) {
67246         d3_event.preventDefault();
67247         osm.authenticate();
67248       });
67249       authEnter.transition().duration(200).style("opacity", 1);
67250       var prose = detailSection.selectAll(".note-save-prose").data(hasAuth ? [0] : []);
67251       prose.exit().remove();
67252       prose = prose.enter().append("p").attr("class", "note-save-prose").call(_t.append("note.upload_explanation")).merge(prose);
67253       osm.userDetails(function(err, user) {
67254         if (err)
67255           return;
67256         var userLink = select_default2(document.createElement("div"));
67257         if (user.image_url) {
67258           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
67259         }
67260         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
67261         prose.html(_t.html("note.upload_explanation_with_user", { user: { html: userLink.html() } }));
67262       });
67263     }
67264     function noteSaveButtons(selection2) {
67265       var osm = services.osm;
67266       var hasAuth = osm && osm.authenticated();
67267       var isSelected = _note && _note.id === context.selectedNoteID();
67268       var buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_note] : [], function(d) {
67269         return d.status + d.id;
67270       });
67271       buttonSection.exit().remove();
67272       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
67273       if (_note.isNew()) {
67274         buttonEnter.append("button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
67275         buttonEnter.append("button").attr("class", "button save-button action").call(_t.append("note.save"));
67276       } else {
67277         buttonEnter.append("button").attr("class", "button status-button action");
67278         buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("note.comment"));
67279       }
67280       buttonSection = buttonSection.merge(buttonEnter);
67281       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
67282       buttonSection.select(".save-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
67283       buttonSection.select(".status-button").attr("disabled", hasAuth ? null : true).html(function(d) {
67284         var action = d.status === "open" ? "close" : "open";
67285         var andComment = d.newComment ? "_comment" : "";
67286         return _t.html("note." + action + andComment);
67287       }).on("click.status", clickStatus);
67288       buttonSection.select(".comment-button").attr("disabled", isSaveDisabled).on("click.comment", clickComment);
67289       function isSaveDisabled(d) {
67290         return hasAuth && d.status === "open" && d.newComment ? null : true;
67291       }
67292     }
67293     function clickCancel(d3_event, d) {
67294       this.blur();
67295       var osm = services.osm;
67296       if (osm) {
67297         osm.removeNote(d);
67298       }
67299       context.enter(modeBrowse(context));
67300       dispatch10.call("change");
67301     }
67302     function clickSave(d3_event, d) {
67303       this.blur();
67304       var osm = services.osm;
67305       if (osm) {
67306         osm.postNoteCreate(d, function(err, note) {
67307           dispatch10.call("change", note);
67308         });
67309       }
67310     }
67311     function clickStatus(d3_event, d) {
67312       this.blur();
67313       var osm = services.osm;
67314       if (osm) {
67315         var setStatus = d.status === "open" ? "closed" : "open";
67316         osm.postNoteUpdate(d, setStatus, function(err, note) {
67317           dispatch10.call("change", note);
67318         });
67319       }
67320     }
67321     function clickComment(d3_event, d) {
67322       this.blur();
67323       var osm = services.osm;
67324       if (osm) {
67325         osm.postNoteUpdate(d, d.status, function(err, note) {
67326           dispatch10.call("change", note);
67327         });
67328       }
67329     }
67330     noteEditor.note = function(val) {
67331       if (!arguments.length)
67332         return _note;
67333       _note = val;
67334       return noteEditor;
67335     };
67336     noteEditor.newNote = function(val) {
67337       if (!arguments.length)
67338         return _newNote;
67339       _newNote = val;
67340       return noteEditor;
67341     };
67342     return utilRebind(noteEditor, dispatch10, "on");
67343   }
67344
67345   // modules/ui/source_switch.js
67346   function uiSourceSwitch(context) {
67347     var keys2;
67348     function click(d3_event) {
67349       d3_event.preventDefault();
67350       var osm = context.connection();
67351       if (!osm)
67352         return;
67353       if (context.inIntro())
67354         return;
67355       if (context.history().hasChanges() && !window.confirm(_t("source_switch.lose_changes")))
67356         return;
67357       var isLive = select_default2(this).classed("live");
67358       isLive = !isLive;
67359       context.enter(modeBrowse(context));
67360       context.history().clearSaved();
67361       context.flush();
67362       select_default2(this).html(isLive ? _t.html("source_switch.live") : _t.html("source_switch.dev")).classed("live", isLive).classed("chip", isLive);
67363       osm.switch(isLive ? keys2[0] : keys2[1]);
67364     }
67365     var sourceSwitch = function(selection2) {
67366       selection2.append("a").attr("href", "#").call(_t.append("source_switch.live")).attr("class", "live chip").on("click", click);
67367     };
67368     sourceSwitch.keys = function(_) {
67369       if (!arguments.length)
67370         return keys2;
67371       keys2 = _;
67372       return sourceSwitch;
67373     };
67374     return sourceSwitch;
67375   }
67376
67377   // modules/ui/spinner.js
67378   function uiSpinner(context) {
67379     var osm = context.connection();
67380     return function(selection2) {
67381       var img = selection2.append("img").attr("src", context.imagePath("loader-black.gif")).style("opacity", 0);
67382       if (osm) {
67383         osm.on("loading.spinner", function() {
67384           img.transition().style("opacity", 1);
67385         }).on("loaded.spinner", function() {
67386           img.transition().style("opacity", 0);
67387         });
67388       }
67389     };
67390   }
67391
67392   // modules/ui/sections/privacy.js
67393   function uiSectionPrivacy(context) {
67394     let section = uiSection("preferences-third-party", context).label(() => _t.append("preferences.privacy.title")).disclosureContent(renderDisclosureContent);
67395     function renderDisclosureContent(selection2) {
67396       selection2.selectAll(".privacy-options-list").data([0]).enter().append("ul").attr("class", "layer-list privacy-options-list");
67397       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(
67398         uiTooltip().title(() => _t.append("preferences.privacy.third_party_icons.tooltip")).placement("bottom")
67399       );
67400       thirdPartyIconsEnter.append("input").attr("type", "checkbox").on("change", (d3_event, d) => {
67401         d3_event.preventDefault();
67402         corePreferences("preferences.privacy.thirdpartyicons", d === "true" ? "false" : "true");
67403       });
67404       thirdPartyIconsEnter.append("span").call(_t.append("preferences.privacy.third_party_icons.description"));
67405       selection2.selectAll(".privacy-third-party-icons-item").classed("active", (d) => d === "true").select("input").property("checked", (d) => d === "true");
67406       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"));
67407     }
67408     corePreferences.onChange("preferences.privacy.thirdpartyicons", section.reRender);
67409     return section;
67410   }
67411
67412   // modules/ui/splash.js
67413   function uiSplash(context) {
67414     return (selection2) => {
67415       if (context.history().hasRestorableChanges())
67416         return;
67417       let updateMessage = "";
67418       const sawPrivacyVersion = corePreferences("sawPrivacyVersion");
67419       let showSplash = !corePreferences("sawSplash");
67420       if (sawPrivacyVersion !== context.privacyVersion) {
67421         updateMessage = _t("splash.privacy_update");
67422         showSplash = true;
67423       }
67424       if (!showSplash)
67425         return;
67426       corePreferences("sawSplash", true);
67427       corePreferences("sawPrivacyVersion", context.privacyVersion);
67428       _mainFileFetcher.get("intro_graph");
67429       let modalSelection = uiModal(selection2);
67430       modalSelection.select(".modal").attr("class", "modal-splash modal");
67431       let introModal = modalSelection.select(".content").append("div").attr("class", "fillL");
67432       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("splash.welcome"));
67433       let modalSection = introModal.append("div").attr("class", "modal-section");
67434       modalSection.append("p").html(_t.html("splash.text", {
67435         version: context.version,
67436         website: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/develop/CHANGELOG.md#whats-new">' + _t.html("splash.changelog") + "</a>" },
67437         github: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/issues">github.com</a>' }
67438       }));
67439       modalSection.append("p").html(_t.html("splash.privacy", {
67440         updateMessage,
67441         privacyLink: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/release/PRIVACY.md">' + _t("splash.privacy_policy") + "</a>" }
67442       }));
67443       uiSectionPrivacy(context).label(() => _t.append("splash.privacy_settings")).render(modalSection);
67444       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
67445       let walkthrough = buttonWrap.append("button").attr("class", "walkthrough").on("click", () => {
67446         context.container().call(uiIntro(context));
67447         modalSelection.close();
67448       });
67449       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
67450       walkthrough.append("div").call(_t.append("splash.walkthrough"));
67451       let startEditing = buttonWrap.append("button").attr("class", "start-editing").on("click", modalSelection.close);
67452       startEditing.append("svg").attr("class", "logo logo-features").append("use").attr("xlink:href", "#iD-logo-features");
67453       startEditing.append("div").call(_t.append("splash.start"));
67454       modalSelection.select("button.close").attr("class", "hide");
67455     };
67456   }
67457
67458   // modules/ui/status.js
67459   function uiStatus(context) {
67460     var osm = context.connection();
67461     return function(selection2) {
67462       if (!osm)
67463         return;
67464       function update(err, apiStatus) {
67465         selection2.html("");
67466         if (err) {
67467           if (apiStatus === "connectionSwitched") {
67468             return;
67469           } else if (apiStatus === "rateLimited") {
67470             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) {
67471               d3_event.preventDefault();
67472               osm.authenticate();
67473             });
67474           } else {
67475             var throttledRetry = throttle_default(function() {
67476               context.loadTiles(context.projection);
67477               osm.reloadApiStatus();
67478             }, 2e3);
67479             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) {
67480               d3_event.preventDefault();
67481               throttledRetry();
67482             });
67483           }
67484         } else if (apiStatus === "readonly") {
67485           selection2.call(_t.append("osm_api_status.message.readonly"));
67486         } else if (apiStatus === "offline") {
67487           selection2.call(_t.append("osm_api_status.message.offline"));
67488         }
67489         selection2.attr("class", "api-status " + (err ? "error" : apiStatus));
67490       }
67491       osm.on("apiStatusChange.uiStatus", update);
67492       context.history().on("storage_error", () => {
67493         selection2.selectAll("span.local-storage-full").remove();
67494         selection2.append("span").attr("class", "local-storage-full").call(_t.append("osm_api_status.message.local_storage_full"));
67495         selection2.classed("error", true);
67496       });
67497       window.setInterval(function() {
67498         osm.reloadApiStatus();
67499       }, 9e4);
67500       osm.reloadApiStatus();
67501     };
67502   }
67503
67504   // node_modules/osm-community-index/lib/simplify.js
67505   var import_diacritics2 = __toESM(require_diacritics(), 1);
67506   function simplify(str2) {
67507     if (typeof str2 !== "string")
67508       return "";
67509     return import_diacritics2.default.remove(
67510       str2.replace(/&/g, "and").replace(/(İ|i̇)/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()
67511     );
67512   }
67513
67514   // node_modules/osm-community-index/lib/resolve_strings.js
67515   function resolveStrings(item, defaults2, localizerFn) {
67516     let itemStrings = Object.assign({}, item.strings);
67517     let defaultStrings = Object.assign({}, defaults2[item.type]);
67518     const anyToken = new RegExp(/(\{\w+\})/, "gi");
67519     if (localizerFn) {
67520       if (itemStrings.community) {
67521         const communityID = simplify(itemStrings.community);
67522         itemStrings.community = localizerFn(`_communities.${communityID}`);
67523       }
67524       ["name", "description", "extendedDescription"].forEach((prop) => {
67525         if (defaultStrings[prop])
67526           defaultStrings[prop] = localizerFn(`_defaults.${item.type}.${prop}`);
67527         if (itemStrings[prop])
67528           itemStrings[prop] = localizerFn(`${item.id}.${prop}`);
67529       });
67530     }
67531     let replacements = {
67532       account: item.account,
67533       community: itemStrings.community,
67534       signupUrl: itemStrings.signupUrl,
67535       url: itemStrings.url
67536     };
67537     if (!replacements.signupUrl) {
67538       replacements.signupUrl = resolve(itemStrings.signupUrl || defaultStrings.signupUrl);
67539     }
67540     if (!replacements.url) {
67541       replacements.url = resolve(itemStrings.url || defaultStrings.url);
67542     }
67543     let resolved = {
67544       name: resolve(itemStrings.name || defaultStrings.name),
67545       url: resolve(itemStrings.url || defaultStrings.url),
67546       signupUrl: resolve(itemStrings.signupUrl || defaultStrings.signupUrl),
67547       description: resolve(itemStrings.description || defaultStrings.description),
67548       extendedDescription: resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription)
67549     };
67550     resolved.nameHTML = linkify(resolved.url, resolved.name);
67551     resolved.urlHTML = linkify(resolved.url);
67552     resolved.signupUrlHTML = linkify(resolved.signupUrl);
67553     resolved.descriptionHTML = resolve(itemStrings.description || defaultStrings.description, true);
67554     resolved.extendedDescriptionHTML = resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription, true);
67555     return resolved;
67556     function resolve(s, addLinks) {
67557       if (!s)
67558         return void 0;
67559       let result = s;
67560       for (let key in replacements) {
67561         const token = `{${key}}`;
67562         const regex = new RegExp(token, "g");
67563         if (regex.test(result)) {
67564           let replacement = replacements[key];
67565           if (!replacement) {
67566             throw new Error(`Cannot resolve token: ${token}`);
67567           } else {
67568             if (addLinks && (key === "signupUrl" || key === "url")) {
67569               replacement = linkify(replacement);
67570             }
67571             result = result.replace(regex, replacement);
67572           }
67573         }
67574       }
67575       const leftovers = result.match(anyToken);
67576       if (leftovers) {
67577         throw new Error(`Cannot resolve tokens: ${leftovers}`);
67578       }
67579       if (addLinks && item.type === "reddit") {
67580         result = result.replace(/(\/r\/\w+\/*)/i, (match) => linkify(resolved.url, match));
67581       }
67582       return result;
67583     }
67584     function linkify(url, text2) {
67585       if (!url)
67586         return void 0;
67587       text2 = text2 || url;
67588       return `<a target="_blank" href="${url}">${text2}</a>`;
67589     }
67590   }
67591
67592   // modules/ui/success.js
67593   var _oci = null;
67594   function uiSuccess(context) {
67595     const MAXEVENTS = 2;
67596     const dispatch10 = dispatch_default("cancel");
67597     let _changeset2;
67598     let _location;
67599     ensureOSMCommunityIndex();
67600     function ensureOSMCommunityIndex() {
67601       const data = _mainFileFetcher;
67602       return Promise.all([
67603         data.get("oci_features"),
67604         data.get("oci_resources"),
67605         data.get("oci_defaults")
67606       ]).then((vals) => {
67607         if (_oci)
67608           return _oci;
67609         if (vals[0] && Array.isArray(vals[0].features)) {
67610           _sharedLocationManager.mergeCustomGeoJSON(vals[0]);
67611         }
67612         let ociResources = Object.values(vals[1].resources);
67613         if (ociResources.length) {
67614           return _sharedLocationManager.mergeLocationSets(ociResources).then(() => {
67615             _oci = {
67616               resources: ociResources,
67617               defaults: vals[2].defaults
67618             };
67619             return _oci;
67620           });
67621         } else {
67622           _oci = {
67623             resources: [],
67624             // no resources?
67625             defaults: vals[2].defaults
67626           };
67627           return _oci;
67628         }
67629       });
67630     }
67631     function parseEventDate(when) {
67632       if (!when)
67633         return;
67634       let raw = when.trim();
67635       if (!raw)
67636         return;
67637       if (!/Z$/.test(raw)) {
67638         raw += "Z";
67639       }
67640       const parsed = new Date(raw);
67641       return new Date(parsed.toUTCString().slice(0, 25));
67642     }
67643     function success(selection2) {
67644       let header = selection2.append("div").attr("class", "header fillL");
67645       header.append("h2").call(_t.append("success.just_edited"));
67646       header.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => dispatch10.call("cancel")).call(svgIcon("#iD-icon-close"));
67647       let body = selection2.append("div").attr("class", "body save-success fillL");
67648       let summary = body.append("div").attr("class", "save-summary");
67649       summary.append("h3").call(_t.append("success.thank_you" + (_location ? "_location" : ""), { where: _location }));
67650       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"));
67651       let osm = context.connection();
67652       if (!osm)
67653         return;
67654       let changesetURL = osm.changesetURL(_changeset2.id);
67655       let table = summary.append("table").attr("class", "summary-table");
67656       let row = table.append("tr").attr("class", "summary-row");
67657       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");
67658       let summaryDetail = row.append("td").attr("class", "cell-detail summary-detail");
67659       summaryDetail.append("a").attr("class", "cell-detail summary-view-on-osm").attr("target", "_blank").attr("href", changesetURL).call(_t.append("success.view_on_osm"));
67660       summaryDetail.append("div").html(_t.html("success.changeset_id", {
67661         changeset_id: { html: `<a href="${changesetURL}" target="_blank">${_changeset2.id}</a>` }
67662       }));
67663       ensureOSMCommunityIndex().then((oci) => {
67664         const loc = context.map().center();
67665         const validHere = _sharedLocationManager.locationSetsAt(loc);
67666         let communities = [];
67667         oci.resources.forEach((resource) => {
67668           let area = validHere[resource.locationSetID];
67669           if (!area)
67670             return;
67671           const localizer = (stringID) => _t.html(`community.${stringID}`);
67672           resource.resolved = resolveStrings(resource, oci.defaults, localizer);
67673           communities.push({
67674             area,
67675             order: resource.order || 0,
67676             resource
67677           });
67678         });
67679         communities.sort((a, b) => a.area - b.area || b.order - a.order);
67680         body.call(showCommunityLinks, communities.map((c) => c.resource));
67681       });
67682     }
67683     function showCommunityLinks(selection2, resources) {
67684       let communityLinks = selection2.append("div").attr("class", "save-communityLinks");
67685       communityLinks.append("h3").call(_t.append("success.like_osm"));
67686       let table = communityLinks.append("table").attr("class", "community-table");
67687       let row = table.selectAll(".community-row").data(resources);
67688       let rowEnter = row.enter().append("tr").attr("class", "community-row");
67689       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}`);
67690       let communityDetail = rowEnter.append("td").attr("class", "cell-detail community-detail");
67691       communityDetail.each(showCommunityDetails);
67692       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"));
67693     }
67694     function showCommunityDetails(d) {
67695       let selection2 = select_default2(this);
67696       let communityID = d.id;
67697       selection2.append("div").attr("class", "community-name").html(d.resolved.nameHTML);
67698       selection2.append("div").attr("class", "community-description").html(d.resolved.descriptionHTML);
67699       if (d.resolved.extendedDescriptionHTML || d.languageCodes && d.languageCodes.length) {
67700         selection2.append("div").call(
67701           uiDisclosure(context, `community-more-${d.id}`, false).expanded(false).updatePreference(false).label(() => _t.append("success.more")).content(showMore)
67702         );
67703       }
67704       let nextEvents = (d.events || []).map((event) => {
67705         event.date = parseEventDate(event.when);
67706         return event;
67707       }).filter((event) => {
67708         const t = event.date.getTime();
67709         const now3 = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
67710         return !isNaN(t) && t >= now3;
67711       }).sort((a, b) => {
67712         return a.date < b.date ? -1 : a.date > b.date ? 1 : 0;
67713       }).slice(0, MAXEVENTS);
67714       if (nextEvents.length) {
67715         selection2.append("div").call(
67716           uiDisclosure(context, `community-events-${d.id}`, false).expanded(false).updatePreference(false).label(_t.html("success.events")).content(showNextEvents)
67717         ).select(".hide-toggle").append("span").attr("class", "badge-text").text(nextEvents.length);
67718       }
67719       function showMore(selection3) {
67720         let more = selection3.selectAll(".community-more").data([0]);
67721         let moreEnter = more.enter().append("div").attr("class", "community-more");
67722         if (d.resolved.extendedDescriptionHTML) {
67723           moreEnter.append("div").attr("class", "community-extended-description").html(d.resolved.extendedDescriptionHTML);
67724         }
67725         if (d.languageCodes && d.languageCodes.length) {
67726           const languageList = d.languageCodes.map((code) => _mainLocalizer.languageName(code)).join(", ");
67727           moreEnter.append("div").attr("class", "community-languages").call(_t.append("success.languages", { languages: languageList }));
67728         }
67729       }
67730       function showNextEvents(selection3) {
67731         let events = selection3.append("div").attr("class", "community-events");
67732         let item = events.selectAll(".community-event").data(nextEvents);
67733         let itemEnter = item.enter().append("div").attr("class", "community-event");
67734         itemEnter.append("div").attr("class", "community-event-name").append("a").attr("target", "_blank").attr("href", (d2) => d2.url).text((d2) => {
67735           let name = d2.name;
67736           if (d2.i18n && d2.id) {
67737             name = _t(`community.${communityID}.events.${d2.id}.name`, { default: name });
67738           }
67739           return name;
67740         });
67741         itemEnter.append("div").attr("class", "community-event-when").text((d2) => {
67742           let options2 = { weekday: "short", day: "numeric", month: "short", year: "numeric" };
67743           if (d2.date.getHours() || d2.date.getMinutes()) {
67744             options2.hour = "numeric";
67745             options2.minute = "numeric";
67746           }
67747           return d2.date.toLocaleString(_mainLocalizer.localeCode(), options2);
67748         });
67749         itemEnter.append("div").attr("class", "community-event-where").text((d2) => {
67750           let where = d2.where;
67751           if (d2.i18n && d2.id) {
67752             where = _t(`community.${communityID}.events.${d2.id}.where`, { default: where });
67753           }
67754           return where;
67755         });
67756         itemEnter.append("div").attr("class", "community-event-description").text((d2) => {
67757           let description = d2.description;
67758           if (d2.i18n && d2.id) {
67759             description = _t(`community.${communityID}.events.${d2.id}.description`, { default: description });
67760           }
67761           return description;
67762         });
67763       }
67764     }
67765     success.changeset = function(val) {
67766       if (!arguments.length)
67767         return _changeset2;
67768       _changeset2 = val;
67769       return success;
67770     };
67771     success.location = function(val) {
67772       if (!arguments.length)
67773         return _location;
67774       _location = val;
67775       return success;
67776     };
67777     return utilRebind(success, dispatch10, "on");
67778   }
67779
67780   // modules/ui/version.js
67781   var sawVersion = null;
67782   var isNewVersion = false;
67783   var isNewUser = false;
67784   function uiVersion(context) {
67785     var currVersion = context.version;
67786     var matchedVersion = currVersion.match(/\d+\.\d+\.\d+.*/);
67787     if (sawVersion === null && matchedVersion !== null) {
67788       if (corePreferences("sawVersion")) {
67789         isNewUser = false;
67790         isNewVersion = corePreferences("sawVersion") !== currVersion && currVersion.indexOf("-") === -1;
67791       } else {
67792         isNewUser = true;
67793         isNewVersion = true;
67794       }
67795       corePreferences("sawVersion", currVersion);
67796       sawVersion = currVersion;
67797     }
67798     return function(selection2) {
67799       selection2.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD").text(currVersion);
67800       if (isNewVersion && !isNewUser) {
67801         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")).call(
67802           uiTooltip().title(() => _t.append("version.whats_new", { version: currVersion })).placement("top").scrollContainer(context.container().select(".main-footer-wrap"))
67803         );
67804       }
67805     };
67806   }
67807
67808   // modules/ui/zoom.js
67809   function uiZoom(context) {
67810     var zooms = [{
67811       id: "zoom-in",
67812       icon: "iD-icon-plus",
67813       title: _t.append("zoom.in"),
67814       action: zoomIn,
67815       disabled: function() {
67816         return !context.map().canZoomIn();
67817       },
67818       disabledTitle: _t.append("zoom.disabled.in"),
67819       key: "+"
67820     }, {
67821       id: "zoom-out",
67822       icon: "iD-icon-minus",
67823       title: _t.append("zoom.out"),
67824       action: zoomOut,
67825       disabled: function() {
67826         return !context.map().canZoomOut();
67827       },
67828       disabledTitle: _t.append("zoom.disabled.out"),
67829       key: "-"
67830     }];
67831     function zoomIn(d3_event) {
67832       if (d3_event.shiftKey)
67833         return;
67834       d3_event.preventDefault();
67835       context.map().zoomIn();
67836     }
67837     function zoomOut(d3_event) {
67838       if (d3_event.shiftKey)
67839         return;
67840       d3_event.preventDefault();
67841       context.map().zoomOut();
67842     }
67843     function zoomInFurther(d3_event) {
67844       if (d3_event.shiftKey)
67845         return;
67846       d3_event.preventDefault();
67847       context.map().zoomInFurther();
67848     }
67849     function zoomOutFurther(d3_event) {
67850       if (d3_event.shiftKey)
67851         return;
67852       d3_event.preventDefault();
67853       context.map().zoomOutFurther();
67854     }
67855     return function(selection2) {
67856       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function(d) {
67857         if (d.disabled()) {
67858           return d.disabledTitle;
67859         }
67860         return d.title;
67861       }).keys(function(d) {
67862         return [d.key];
67863       });
67864       var lastPointerUpType;
67865       var buttons = selection2.selectAll("button").data(zooms).enter().append("button").attr("class", function(d) {
67866         return d.id;
67867       }).on("pointerup.editor", function(d3_event) {
67868         lastPointerUpType = d3_event.pointerType;
67869       }).on("click.editor", function(d3_event, d) {
67870         if (!d.disabled()) {
67871           d.action(d3_event);
67872         } else if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
67873           context.ui().flash.duration(2e3).iconName("#" + d.icon).iconClass("disabled").label(d.disabledTitle)();
67874         }
67875         lastPointerUpType = null;
67876       }).call(tooltipBehavior);
67877       buttons.each(function(d) {
67878         select_default2(this).call(svgIcon("#" + d.icon, "light"));
67879       });
67880       utilKeybinding.plusKeys.forEach(function(key) {
67881         context.keybinding().on([key], zoomIn);
67882         context.keybinding().on([uiCmd("\u2325" + key)], zoomInFurther);
67883       });
67884       utilKeybinding.minusKeys.forEach(function(key) {
67885         context.keybinding().on([key], zoomOut);
67886         context.keybinding().on([uiCmd("\u2325" + key)], zoomOutFurther);
67887       });
67888       function updateButtonStates() {
67889         buttons.classed("disabled", function(d) {
67890           return d.disabled();
67891         }).each(function() {
67892           var selection3 = select_default2(this);
67893           if (!selection3.select(".tooltip.in").empty()) {
67894             selection3.call(tooltipBehavior.updateContent);
67895           }
67896         });
67897       }
67898       updateButtonStates();
67899       context.map().on("move.uiZoom", updateButtonStates);
67900     };
67901   }
67902
67903   // modules/ui/sections/raw_tag_editor.js
67904   function uiSectionRawTagEditor(id2, context) {
67905     var section = uiSection(id2, context).classes("raw-tag-editor").label(function() {
67906       var count = Object.keys(_tags).filter(function(d) {
67907         return d;
67908       }).length;
67909       return _t.append("inspector.title_count", { title: _t("inspector.tags"), count });
67910     }).expandedByDefault(false).disclosureContent(renderDisclosureContent);
67911     var taginfo = services.taginfo;
67912     var dispatch10 = dispatch_default("change");
67913     var availableViews = [
67914       { id: "list", icon: "#fas-th-list" },
67915       { id: "text", icon: "#fas-i-cursor" }
67916     ];
67917     var _tagView = corePreferences("raw-tag-editor-view") || "list";
67918     var _readOnlyTags = [];
67919     var _orderedKeys = [];
67920     var _showBlank = false;
67921     var _pendingChange = null;
67922     var _state;
67923     var _presets;
67924     var _tags;
67925     var _entityIDs;
67926     var _didInteract = false;
67927     function interacted() {
67928       _didInteract = true;
67929     }
67930     function renderDisclosureContent(wrap2) {
67931       _orderedKeys = _orderedKeys.filter(function(key) {
67932         return _tags[key] !== void 0;
67933       });
67934       var all = Object.keys(_tags).sort();
67935       var missingKeys = utilArrayDifference(all, _orderedKeys);
67936       for (var i2 in missingKeys) {
67937         _orderedKeys.push(missingKeys[i2]);
67938       }
67939       var rowData = _orderedKeys.map(function(key, i3) {
67940         return { index: i3, key, value: _tags[key] };
67941       });
67942       if (!rowData.length || _showBlank) {
67943         _showBlank = false;
67944         rowData.push({ index: rowData.length, key: "", value: "" });
67945       }
67946       var options2 = wrap2.selectAll(".raw-tag-options").data([0]);
67947       options2.exit().remove();
67948       var optionsEnter = options2.enter().insert("div", ":first-child").attr("class", "raw-tag-options").attr("role", "tablist");
67949       var optionEnter = optionsEnter.selectAll(".raw-tag-option").data(availableViews, function(d) {
67950         return d.id;
67951       }).enter();
67952       optionEnter.append("button").attr("class", function(d) {
67953         return "raw-tag-option raw-tag-option-" + d.id + (_tagView === d.id ? " selected" : "");
67954       }).attr("aria-selected", function(d) {
67955         return _tagView === d.id;
67956       }).attr("role", "tab").attr("title", function(d) {
67957         return _t("icons." + d.id);
67958       }).on("click", function(d3_event, d) {
67959         _tagView = d.id;
67960         corePreferences("raw-tag-editor-view", d.id);
67961         wrap2.selectAll(".raw-tag-option").classed("selected", function(datum2) {
67962           return datum2 === d;
67963         }).attr("aria-selected", function(datum2) {
67964           return datum2 === d;
67965         });
67966         wrap2.selectAll(".tag-text").classed("hide", d.id !== "text").each(setTextareaHeight);
67967         wrap2.selectAll(".tag-list, .add-row").classed("hide", d.id !== "list");
67968       }).each(function(d) {
67969         select_default2(this).call(svgIcon(d.icon));
67970       });
67971       var textData = rowsToText(rowData);
67972       var textarea = wrap2.selectAll(".tag-text").data([0]);
67973       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);
67974       textarea.call(utilGetSetValue, textData).each(setTextareaHeight).on("input", setTextareaHeight).on("focus", interacted).on("blur", textChanged).on("change", textChanged);
67975       var list = wrap2.selectAll(".tag-list").data([0]);
67976       list = list.enter().append("ul").attr("class", "tag-list" + (_tagView !== "list" ? " hide" : "")).merge(list);
67977       var addRowEnter = wrap2.selectAll(".add-row").data([0]).enter().append("div").attr("class", "add-row" + (_tagView !== "list" ? " hide" : ""));
67978       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.append("inspector.add_to_tag")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left")).on("click", addTag);
67979       addRowEnter.append("div").attr("class", "space-value");
67980       addRowEnter.append("div").attr("class", "space-buttons");
67981       var items = list.selectAll(".tag-row").data(rowData, function(d) {
67982         return d.key;
67983       });
67984       items.exit().each(unbind).remove();
67985       var itemsEnter = items.enter().append("li").attr("class", "tag-row").classed("readonly", isReadOnly);
67986       var innerWrap = itemsEnter.append("div").attr("class", "inner-wrap");
67987       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);
67988       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);
67989       innerWrap.append("button").attr("class", "form-field-button remove").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
67990       items = items.merge(itemsEnter).sort(function(a, b) {
67991         return a.index - b.index;
67992       });
67993       items.each(function(d) {
67994         var row = select_default2(this);
67995         var key = row.select("input.key");
67996         var value = row.select("input.value");
67997         if (_entityIDs && taginfo && _state !== "hover") {
67998           bindTypeahead(key, value);
67999         }
68000         var referenceOptions = { key: d.key };
68001         if (typeof d.value === "string") {
68002           referenceOptions.value = d.value;
68003         }
68004         var reference = uiTagReference(referenceOptions, context);
68005         if (_state === "hover") {
68006           reference.showing(false);
68007         }
68008         row.select(".inner-wrap").call(reference.button);
68009         row.call(reference.body);
68010         row.select("button.remove");
68011       });
68012       items.selectAll("input.key").attr("title", function(d) {
68013         return d.key;
68014       }).call(utilGetSetValue, function(d) {
68015         return d.key;
68016       }).attr("readonly", function(d) {
68017         return isReadOnly(d) || null;
68018       });
68019       items.selectAll("input.value").attr("title", function(d) {
68020         return Array.isArray(d.value) ? d.value.filter(Boolean).join("\n") : d.value;
68021       }).classed("mixed", function(d) {
68022         return Array.isArray(d.value);
68023       }).attr("placeholder", function(d) {
68024         return typeof d.value === "string" ? null : _t("inspector.multiple_values");
68025       }).call(utilGetSetValue, function(d) {
68026         return typeof d.value === "string" ? d.value : "";
68027       }).attr("readonly", function(d) {
68028         return isReadOnly(d) || null;
68029       });
68030       items.selectAll("button.remove").on(("PointerEvent" in window ? "pointer" : "mouse") + "down", removeTag);
68031     }
68032     function isReadOnly(d) {
68033       for (var i2 = 0; i2 < _readOnlyTags.length; i2++) {
68034         if (d.key.match(_readOnlyTags[i2]) !== null) {
68035           return true;
68036         }
68037       }
68038       return false;
68039     }
68040     function setTextareaHeight() {
68041       if (_tagView !== "text")
68042         return;
68043       var selection2 = select_default2(this);
68044       var matches = selection2.node().value.match(/\n/g);
68045       var lineCount = 2 + Number(matches && matches.length);
68046       var lineHeight = 20;
68047       selection2.style("height", lineCount * lineHeight + "px");
68048     }
68049     function stringify3(s) {
68050       return JSON.stringify(s).slice(1, -1);
68051     }
68052     function unstringify(s) {
68053       var leading = "";
68054       var trailing = "";
68055       if (s.length < 1 || s.charAt(0) !== '"') {
68056         leading = '"';
68057       }
68058       if (s.length < 2 || s.charAt(s.length - 1) !== '"' || s.charAt(s.length - 1) === '"' && s.charAt(s.length - 2) === "\\") {
68059         trailing = '"';
68060       }
68061       return JSON.parse(leading + s + trailing);
68062     }
68063     function rowsToText(rows) {
68064       var str2 = rows.filter(function(row) {
68065         return row.key && row.key.trim() !== "";
68066       }).map(function(row) {
68067         var rawVal = row.value;
68068         if (typeof rawVal !== "string")
68069           rawVal = "*";
68070         var val = rawVal ? stringify3(rawVal) : "";
68071         return stringify3(row.key) + "=" + val;
68072       }).join("\n");
68073       if (_state !== "hover" && str2.length) {
68074         return str2 + "\n";
68075       }
68076       return str2;
68077     }
68078     function textChanged() {
68079       var newText = this.value.trim();
68080       var newTags = {};
68081       newText.split("\n").forEach(function(row) {
68082         var m = row.match(/^\s*([^=]+)=(.*)$/);
68083         if (m !== null) {
68084           var k = context.cleanTagKey(unstringify(m[1].trim()));
68085           var v = context.cleanTagValue(unstringify(m[2].trim()));
68086           newTags[k] = v;
68087         }
68088       });
68089       var tagDiff = utilTagDiff(_tags, newTags);
68090       if (!tagDiff.length)
68091         return;
68092       _pendingChange = _pendingChange || {};
68093       tagDiff.forEach(function(change) {
68094         if (isReadOnly({ key: change.key }))
68095           return;
68096         if (change.newVal === "*" && typeof change.oldVal !== "string")
68097           return;
68098         if (change.type === "-") {
68099           _pendingChange[change.key] = void 0;
68100         } else if (change.type === "+") {
68101           _pendingChange[change.key] = change.newVal || "";
68102         }
68103       });
68104       if (Object.keys(_pendingChange).length === 0) {
68105         _pendingChange = null;
68106         return;
68107       }
68108       scheduleChange();
68109     }
68110     function pushMore(d3_event) {
68111       if (d3_event.keyCode === 9 && !d3_event.shiftKey && section.selection().selectAll(".tag-list li:last-child input.value").node() === this && utilGetSetValue(select_default2(this))) {
68112         addTag();
68113       }
68114     }
68115     function bindTypeahead(key, value) {
68116       if (isReadOnly(key.datum()))
68117         return;
68118       if (Array.isArray(value.datum().value)) {
68119         value.call(uiCombobox(context, "tag-value").minItems(1).fetcher(function(value2, callback) {
68120           var keyString = utilGetSetValue(key);
68121           if (!_tags[keyString])
68122             return;
68123           var data = _tags[keyString].filter(Boolean).map(function(tagValue) {
68124             return {
68125               value: tagValue,
68126               title: tagValue
68127             };
68128           });
68129           callback(data);
68130         }));
68131         return;
68132       }
68133       var geometry = context.graph().geometry(_entityIDs[0]);
68134       key.call(uiCombobox(context, "tag-key").fetcher(function(value2, callback) {
68135         taginfo.keys({
68136           debounce: true,
68137           geometry,
68138           query: value2
68139         }, function(err, data) {
68140           if (!err) {
68141             const filtered = data.filter((d) => _tags[d.value] === void 0).filter((d) => d.value.toLowerCase().includes(value2.toLowerCase()));
68142             callback(sort(value2, filtered));
68143           }
68144         });
68145       }));
68146       value.call(uiCombobox(context, "tag-value").fetcher(function(value2, callback) {
68147         taginfo.values({
68148           debounce: true,
68149           key: utilGetSetValue(key),
68150           geometry,
68151           query: value2
68152         }, function(err, data) {
68153           if (!err) {
68154             const filtered = data.filter((d) => d.value.toLowerCase().includes(value2.toLowerCase()));
68155             callback(sort(value2, filtered));
68156           }
68157         });
68158       }).caseSensitive(allowUpperCaseTagValues.test(utilGetSetValue(key))));
68159       function sort(value2, data) {
68160         var sameletter = [];
68161         var other = [];
68162         for (var i2 = 0; i2 < data.length; i2++) {
68163           if (data[i2].value.substring(0, value2.length) === value2) {
68164             sameletter.push(data[i2]);
68165           } else {
68166             other.push(data[i2]);
68167           }
68168         }
68169         return sameletter.concat(other);
68170       }
68171     }
68172     function unbind() {
68173       var row = select_default2(this);
68174       row.selectAll("input.key").call(uiCombobox.off, context);
68175       row.selectAll("input.value").call(uiCombobox.off, context);
68176     }
68177     function keyChange(d3_event, d) {
68178       if (select_default2(this).attr("readonly"))
68179         return;
68180       var kOld = d.key;
68181       if (_pendingChange && _pendingChange.hasOwnProperty(kOld) && _pendingChange[kOld] === void 0)
68182         return;
68183       var kNew = context.cleanTagKey(this.value.trim());
68184       if (isReadOnly({ key: kNew })) {
68185         this.value = kOld;
68186         return;
68187       }
68188       if (kNew && kNew !== kOld && _tags[kNew] !== void 0) {
68189         this.value = kOld;
68190         section.selection().selectAll(".tag-list input.value").each(function(d2) {
68191           if (d2.key === kNew) {
68192             var input = select_default2(this).node();
68193             input.focus();
68194             input.select();
68195           }
68196         });
68197         return;
68198       }
68199       _pendingChange = _pendingChange || {};
68200       if (kOld) {
68201         if (kOld === kNew)
68202           return;
68203         _pendingChange[kNew] = _pendingChange[kOld] || { oldKey: kOld };
68204         _pendingChange[kOld] = void 0;
68205       } else {
68206         let row = this.parentNode.parentNode;
68207         let inputVal = select_default2(row).selectAll("input.value");
68208         let vNew = context.cleanTagValue(utilGetSetValue(inputVal));
68209         _pendingChange[kNew] = vNew;
68210         utilGetSetValue(inputVal, vNew);
68211       }
68212       var existingKeyIndex = _orderedKeys.indexOf(kOld);
68213       if (existingKeyIndex !== -1)
68214         _orderedKeys[existingKeyIndex] = kNew;
68215       d.key = kNew;
68216       this.value = kNew;
68217       scheduleChange();
68218     }
68219     function valueChange(d3_event, d) {
68220       if (isReadOnly(d))
68221         return;
68222       if (typeof d.value !== "string" && !this.value)
68223         return;
68224       if (_pendingChange && _pendingChange.hasOwnProperty(d.key) && _pendingChange[d.key] === void 0)
68225         return;
68226       _pendingChange = _pendingChange || {};
68227       _pendingChange[d.key] = context.cleanTagValue(this.value);
68228       scheduleChange();
68229     }
68230     function removeTag(d3_event, d) {
68231       if (isReadOnly(d))
68232         return;
68233       if (d.key === "") {
68234         _showBlank = false;
68235         section.reRender();
68236       } else {
68237         _orderedKeys = _orderedKeys.filter(function(key) {
68238           return key !== d.key;
68239         });
68240         _pendingChange = _pendingChange || {};
68241         _pendingChange[d.key] = void 0;
68242         scheduleChange();
68243       }
68244     }
68245     function addTag() {
68246       window.setTimeout(function() {
68247         _showBlank = true;
68248         section.reRender();
68249         section.selection().selectAll(".tag-list li:last-child input.key").node().focus();
68250       }, 20);
68251     }
68252     function scheduleChange() {
68253       var entityIDs = _entityIDs;
68254       window.setTimeout(function() {
68255         if (!_pendingChange)
68256           return;
68257         dispatch10.call("change", this, entityIDs, _pendingChange);
68258         _pendingChange = null;
68259       }, 10);
68260     }
68261     section.state = function(val) {
68262       if (!arguments.length)
68263         return _state;
68264       if (_state !== val) {
68265         _orderedKeys = [];
68266         _state = val;
68267       }
68268       return section;
68269     };
68270     section.presets = function(val) {
68271       if (!arguments.length)
68272         return _presets;
68273       _presets = val;
68274       if (_presets && _presets.length && _presets[0].isFallback()) {
68275         section.disclosureExpanded(true);
68276       } else if (!_didInteract) {
68277         section.disclosureExpanded(null);
68278       }
68279       return section;
68280     };
68281     section.tags = function(val) {
68282       if (!arguments.length)
68283         return _tags;
68284       _tags = val;
68285       return section;
68286     };
68287     section.entityIDs = function(val) {
68288       if (!arguments.length)
68289         return _entityIDs;
68290       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
68291         _entityIDs = val;
68292         _orderedKeys = [];
68293       }
68294       return section;
68295     };
68296     section.readOnlyTags = function(val) {
68297       if (!arguments.length)
68298         return _readOnlyTags;
68299       _readOnlyTags = val;
68300       return section;
68301     };
68302     return utilRebind(section, dispatch10, "on");
68303   }
68304
68305   // modules/ui/data_editor.js
68306   function uiDataEditor(context) {
68307     var dataHeader = uiDataHeader();
68308     var rawTagEditor = uiSectionRawTagEditor("custom-data-tag-editor", context).expandedByDefault(true).readOnlyTags([/./]);
68309     var _datum;
68310     function dataEditor(selection2) {
68311       var header = selection2.selectAll(".header").data([0]);
68312       var headerEnter = header.enter().append("div").attr("class", "header fillL");
68313       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
68314         context.enter(modeBrowse(context));
68315       }).call(svgIcon("#iD-icon-close"));
68316       headerEnter.append("h2").call(_t.append("map_data.title"));
68317       var body = selection2.selectAll(".body").data([0]);
68318       body = body.enter().append("div").attr("class", "body").merge(body);
68319       var editor = body.selectAll(".data-editor").data([0]);
68320       editor.enter().append("div").attr("class", "modal-section data-editor").merge(editor).call(dataHeader.datum(_datum));
68321       var rte = body.selectAll(".raw-tag-editor").data([0]);
68322       rte.enter().append("div").attr("class", "raw-tag-editor data-editor").merge(rte).call(
68323         rawTagEditor.tags(_datum && _datum.properties || {}).state("hover").render
68324       ).selectAll("textarea.tag-text").attr("readonly", true).classed("readonly", true);
68325     }
68326     dataEditor.datum = function(val) {
68327       if (!arguments.length)
68328         return _datum;
68329       _datum = val;
68330       return this;
68331     };
68332     return dataEditor;
68333   }
68334
68335   // modules/ui/osmose_details.js
68336   function uiOsmoseDetails(context) {
68337     let _qaItem;
68338     function issueString(d, type2) {
68339       if (!d)
68340         return "";
68341       const s = services.osmose.getStrings(d.itemType);
68342       return type2 in s ? s[type2] : "";
68343     }
68344     function osmoseDetails(selection2) {
68345       const details = selection2.selectAll(".error-details").data(
68346         _qaItem ? [_qaItem] : [],
68347         (d) => `${d.id}-${d.status || 0}`
68348       );
68349       details.exit().remove();
68350       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
68351       if (issueString(_qaItem, "detail")) {
68352         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
68353         div.append("h4").call(_t.append("QA.keepRight.detail_description"));
68354         div.append("p").attr("class", "qa-details-description-text").html((d) => issueString(d, "detail")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
68355       }
68356       const detailsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
68357       const elemsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
68358       if (issueString(_qaItem, "fix")) {
68359         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
68360         div.append("h4").call(_t.append("QA.osmose.fix_title"));
68361         div.append("p").html((d) => issueString(d, "fix")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
68362       }
68363       if (issueString(_qaItem, "trap")) {
68364         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
68365         div.append("h4").call(_t.append("QA.osmose.trap_title"));
68366         div.append("p").html((d) => issueString(d, "trap")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
68367       }
68368       const thisItem = _qaItem;
68369       services.osmose.loadIssueDetail(_qaItem).then((d) => {
68370         if (!d.elems || d.elems.length === 0)
68371           return;
68372         if (context.selectedErrorID() !== thisItem.id && context.container().selectAll(`.qaItem.osmose.hover.itemId-${thisItem.id}`).empty())
68373           return;
68374         if (d.detail) {
68375           detailsDiv.append("h4").call(_t.append("QA.osmose.detail_title"));
68376           detailsDiv.append("p").html((d2) => d2.detail).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
68377         }
68378         elemsDiv.append("h4").call(_t.append("QA.osmose.elems_title"));
68379         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() {
68380           const link2 = select_default2(this);
68381           const entityID = this.textContent;
68382           const entity = context.hasEntity(entityID);
68383           link2.on("mouseenter", () => {
68384             utilHighlightEntities([entityID], true, context);
68385           }).on("mouseleave", () => {
68386             utilHighlightEntities([entityID], false, context);
68387           }).on("click", (d3_event) => {
68388             d3_event.preventDefault();
68389             utilHighlightEntities([entityID], false, context);
68390             const osmlayer = context.layers().layer("osm");
68391             if (!osmlayer.enabled()) {
68392               osmlayer.enabled(true);
68393             }
68394             context.map().centerZoom(d.loc, 20);
68395             if (entity) {
68396               context.enter(modeSelect(context, [entityID]));
68397             } else {
68398               context.loadEntity(entityID, (err, result) => {
68399                 if (err)
68400                   return;
68401                 const entity2 = result.data.find((e) => e.id === entityID);
68402                 if (entity2)
68403                   context.enter(modeSelect(context, [entityID]));
68404               });
68405             }
68406           });
68407           if (entity) {
68408             let name = utilDisplayName(entity);
68409             if (!name) {
68410               const preset = _mainPresetIndex.match(entity, context.graph());
68411               name = preset && !preset.isFallback() && preset.name();
68412             }
68413             if (name) {
68414               this.innerText = name;
68415             }
68416           }
68417         });
68418         context.features().forceVisible(d.elems);
68419         context.map().pan([0, 0]);
68420       }).catch((err) => {
68421         console.log(err);
68422       });
68423     }
68424     osmoseDetails.issue = function(val) {
68425       if (!arguments.length)
68426         return _qaItem;
68427       _qaItem = val;
68428       return osmoseDetails;
68429     };
68430     return osmoseDetails;
68431   }
68432
68433   // modules/ui/osmose_header.js
68434   function uiOsmoseHeader() {
68435     let _qaItem;
68436     function issueTitle(d) {
68437       const unknown = _t("inspector.unknown");
68438       if (!d)
68439         return unknown;
68440       const s = services.osmose.getStrings(d.itemType);
68441       return "title" in s ? s.title : unknown;
68442     }
68443     function osmoseHeader(selection2) {
68444       const header = selection2.selectAll(".qa-header").data(
68445         _qaItem ? [_qaItem] : [],
68446         (d) => `${d.id}-${d.status || 0}`
68447       );
68448       header.exit().remove();
68449       const headerEnter = header.enter().append("div").attr("class", "qa-header");
68450       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}`);
68451       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");
68452       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 : "");
68453       headerEnter.append("div").attr("class", "qa-header-label").text(issueTitle);
68454     }
68455     osmoseHeader.issue = function(val) {
68456       if (!arguments.length)
68457         return _qaItem;
68458       _qaItem = val;
68459       return osmoseHeader;
68460     };
68461     return osmoseHeader;
68462   }
68463
68464   // modules/ui/view_on_osmose.js
68465   function uiViewOnOsmose() {
68466     let _qaItem;
68467     function viewOnOsmose(selection2) {
68468       let url;
68469       if (services.osmose && _qaItem instanceof QAItem) {
68470         url = services.osmose.itemURL(_qaItem);
68471       }
68472       const link2 = selection2.selectAll(".view-on-osmose").data(url ? [url] : []);
68473       link2.exit().remove();
68474       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"));
68475       linkEnter.append("span").call(_t.append("inspector.view_on_osmose"));
68476     }
68477     viewOnOsmose.what = function(val) {
68478       if (!arguments.length)
68479         return _qaItem;
68480       _qaItem = val;
68481       return viewOnOsmose;
68482     };
68483     return viewOnOsmose;
68484   }
68485
68486   // modules/ui/osmose_editor.js
68487   function uiOsmoseEditor(context) {
68488     const dispatch10 = dispatch_default("change");
68489     const qaDetails = uiOsmoseDetails(context);
68490     const qaHeader = uiOsmoseHeader(context);
68491     let _qaItem;
68492     function osmoseEditor(selection2) {
68493       const header = selection2.selectAll(".header").data([0]);
68494       const headerEnter = header.enter().append("div").attr("class", "header fillL");
68495       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
68496       headerEnter.append("h2").call(_t.append("QA.osmose.title"));
68497       let body = selection2.selectAll(".body").data([0]);
68498       body = body.enter().append("div").attr("class", "body").merge(body);
68499       let editor = body.selectAll(".qa-editor").data([0]);
68500       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(osmoseSaveSection);
68501       const footer = selection2.selectAll(".footer").data([0]);
68502       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOsmose(context).what(_qaItem));
68503     }
68504     function osmoseSaveSection(selection2) {
68505       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
68506       const isShown = _qaItem && isSelected;
68507       let saveSection = selection2.selectAll(".qa-save").data(
68508         isShown ? [_qaItem] : [],
68509         (d) => `${d.id}-${d.status || 0}`
68510       );
68511       saveSection.exit().remove();
68512       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
68513       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
68514     }
68515     function qaSaveButtons(selection2) {
68516       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
68517       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d) => d.status + d.id);
68518       buttonSection.exit().remove();
68519       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
68520       buttonEnter.append("button").attr("class", "button close-button action");
68521       buttonEnter.append("button").attr("class", "button ignore-button action");
68522       buttonSection = buttonSection.merge(buttonEnter);
68523       buttonSection.select(".close-button").call(_t.append("QA.keepRight.close")).on("click.close", function(d3_event, d) {
68524         this.blur();
68525         const qaService = services.osmose;
68526         if (qaService) {
68527           d.newStatus = "done";
68528           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
68529         }
68530       });
68531       buttonSection.select(".ignore-button").call(_t.append("QA.keepRight.ignore")).on("click.ignore", function(d3_event, d) {
68532         this.blur();
68533         const qaService = services.osmose;
68534         if (qaService) {
68535           d.newStatus = "false";
68536           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
68537         }
68538       });
68539     }
68540     osmoseEditor.error = function(val) {
68541       if (!arguments.length)
68542         return _qaItem;
68543       _qaItem = val;
68544       return osmoseEditor;
68545     };
68546     return utilRebind(osmoseEditor, dispatch10, "on");
68547   }
68548
68549   // modules/ui/sidebar.js
68550   function uiSidebar(context) {
68551     var inspector = uiInspector(context);
68552     var dataEditor = uiDataEditor(context);
68553     var noteEditor = uiNoteEditor(context);
68554     var improveOsmEditor = uiImproveOsmEditor(context);
68555     var keepRightEditor = uiKeepRightEditor(context);
68556     var osmoseEditor = uiOsmoseEditor(context);
68557     var _current;
68558     var _wasData = false;
68559     var _wasNote = false;
68560     var _wasQaItem = false;
68561     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
68562     function sidebar(selection2) {
68563       var container = context.container();
68564       var minWidth = 240;
68565       var sidebarWidth;
68566       var containerWidth;
68567       var dragOffset;
68568       selection2.style("min-width", minWidth + "px").style("max-width", "400px").style("width", "33.3333%");
68569       var resizer = selection2.append("div").attr("class", "sidebar-resizer").on(_pointerPrefix + "down.sidebar-resizer", pointerdown);
68570       var downPointerId, lastClientX, containerLocGetter;
68571       function pointerdown(d3_event) {
68572         if (downPointerId)
68573           return;
68574         if ("button" in d3_event && d3_event.button !== 0)
68575           return;
68576         downPointerId = d3_event.pointerId || "mouse";
68577         lastClientX = d3_event.clientX;
68578         containerLocGetter = utilFastMouse(container.node());
68579         dragOffset = utilFastMouse(resizer.node())(d3_event)[0] - 1;
68580         sidebarWidth = selection2.node().getBoundingClientRect().width;
68581         containerWidth = container.node().getBoundingClientRect().width;
68582         var widthPct = sidebarWidth / containerWidth * 100;
68583         selection2.style("width", widthPct + "%").style("max-width", "85%");
68584         resizer.classed("dragging", true);
68585         select_default2(window).on("touchmove.sidebar-resizer", function(d3_event2) {
68586           d3_event2.preventDefault();
68587         }, { passive: false }).on(_pointerPrefix + "move.sidebar-resizer", pointermove).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", pointerup);
68588       }
68589       function pointermove(d3_event) {
68590         if (downPointerId !== (d3_event.pointerId || "mouse"))
68591           return;
68592         d3_event.preventDefault();
68593         var dx = d3_event.clientX - lastClientX;
68594         lastClientX = d3_event.clientX;
68595         var isRTL = _mainLocalizer.textDirection() === "rtl";
68596         var scaleX = isRTL ? 0 : 1;
68597         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
68598         var x = containerLocGetter(d3_event)[0] - dragOffset;
68599         sidebarWidth = isRTL ? containerWidth - x : x;
68600         var isCollapsed = selection2.classed("collapsed");
68601         var shouldCollapse = sidebarWidth < minWidth;
68602         selection2.classed("collapsed", shouldCollapse);
68603         if (shouldCollapse) {
68604           if (!isCollapsed) {
68605             selection2.style(xMarginProperty, "-400px").style("width", "400px");
68606             context.ui().onResize([(sidebarWidth - dx) * scaleX, 0]);
68607           }
68608         } else {
68609           var widthPct = sidebarWidth / containerWidth * 100;
68610           selection2.style(xMarginProperty, null).style("width", widthPct + "%");
68611           if (isCollapsed) {
68612             context.ui().onResize([-sidebarWidth * scaleX, 0]);
68613           } else {
68614             context.ui().onResize([-dx * scaleX, 0]);
68615           }
68616         }
68617       }
68618       function pointerup(d3_event) {
68619         if (downPointerId !== (d3_event.pointerId || "mouse"))
68620           return;
68621         downPointerId = null;
68622         resizer.classed("dragging", false);
68623         select_default2(window).on("touchmove.sidebar-resizer", null).on(_pointerPrefix + "move.sidebar-resizer", null).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", null);
68624       }
68625       var featureListWrap = selection2.append("div").attr("class", "feature-list-pane").call(uiFeatureList(context));
68626       var inspectorWrap = selection2.append("div").attr("class", "inspector-hidden inspector-wrap");
68627       var hoverModeSelect = function(targets) {
68628         context.container().selectAll(".feature-list-item button").classed("hover", false);
68629         if (context.selectedIDs().length > 1 && targets && targets.length) {
68630           var elements = context.container().selectAll(".feature-list-item button").filter(function(node) {
68631             return targets.indexOf(node) !== -1;
68632           });
68633           if (!elements.empty()) {
68634             elements.classed("hover", true);
68635           }
68636         }
68637       };
68638       sidebar.hoverModeSelect = throttle_default(hoverModeSelect, 200);
68639       function hover(targets) {
68640         var datum2 = targets && targets.length && targets[0];
68641         if (datum2 && datum2.__featurehash__) {
68642           _wasData = true;
68643           sidebar.show(dataEditor.datum(datum2));
68644           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
68645         } else if (datum2 instanceof osmNote) {
68646           if (context.mode().id === "drag-note")
68647             return;
68648           _wasNote = true;
68649           var osm = services.osm;
68650           if (osm) {
68651             datum2 = osm.getNote(datum2.id);
68652           }
68653           sidebar.show(noteEditor.note(datum2));
68654           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
68655         } else if (datum2 instanceof QAItem) {
68656           _wasQaItem = true;
68657           var errService = services[datum2.service];
68658           if (errService) {
68659             datum2 = errService.getError(datum2.id);
68660           }
68661           var errEditor;
68662           if (datum2.service === "keepRight") {
68663             errEditor = keepRightEditor;
68664           } else if (datum2.service === "osmose") {
68665             errEditor = osmoseEditor;
68666           } else {
68667             errEditor = improveOsmEditor;
68668           }
68669           context.container().selectAll(".qaItem." + datum2.service).classed("hover", function(d) {
68670             return d.id === datum2.id;
68671           });
68672           sidebar.show(errEditor.error(datum2));
68673           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
68674         } else if (!_current && datum2 instanceof osmEntity) {
68675           featureListWrap.classed("inspector-hidden", true);
68676           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", true);
68677           if (!inspector.entityIDs() || !utilArrayIdentical(inspector.entityIDs(), [datum2.id]) || inspector.state() !== "hover") {
68678             inspector.state("hover").entityIDs([datum2.id]).newFeature(false);
68679             inspectorWrap.call(inspector);
68680           }
68681         } else if (!_current) {
68682           featureListWrap.classed("inspector-hidden", false);
68683           inspectorWrap.classed("inspector-hidden", true);
68684           inspector.state("hide");
68685         } else if (_wasData || _wasNote || _wasQaItem) {
68686           _wasNote = false;
68687           _wasData = false;
68688           _wasQaItem = false;
68689           context.container().selectAll(".note").classed("hover", false);
68690           context.container().selectAll(".qaItem").classed("hover", false);
68691           sidebar.hide();
68692         }
68693       }
68694       sidebar.hover = throttle_default(hover, 200);
68695       sidebar.intersects = function(extent) {
68696         var rect = selection2.node().getBoundingClientRect();
68697         return extent.intersects([
68698           context.projection.invert([0, rect.height]),
68699           context.projection.invert([rect.width, 0])
68700         ]);
68701       };
68702       sidebar.select = function(ids, newFeature) {
68703         sidebar.hide();
68704         if (ids && ids.length) {
68705           var entity = ids.length === 1 && context.entity(ids[0]);
68706           if (entity && newFeature && selection2.classed("collapsed")) {
68707             var extent = entity.extent(context.graph());
68708             sidebar.expand(sidebar.intersects(extent));
68709           }
68710           featureListWrap.classed("inspector-hidden", true);
68711           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", false);
68712           inspector.state("select").entityIDs(ids).newFeature(newFeature);
68713           inspectorWrap.call(inspector);
68714         } else {
68715           inspector.state("hide");
68716         }
68717       };
68718       sidebar.showPresetList = function() {
68719         inspector.showList();
68720       };
68721       sidebar.show = function(component, element) {
68722         featureListWrap.classed("inspector-hidden", true);
68723         inspectorWrap.classed("inspector-hidden", true);
68724         if (_current)
68725           _current.remove();
68726         _current = selection2.append("div").attr("class", "sidebar-component").call(component, element);
68727       };
68728       sidebar.hide = function() {
68729         featureListWrap.classed("inspector-hidden", false);
68730         inspectorWrap.classed("inspector-hidden", true);
68731         if (_current)
68732           _current.remove();
68733         _current = null;
68734       };
68735       sidebar.expand = function(moveMap) {
68736         if (selection2.classed("collapsed")) {
68737           sidebar.toggle(moveMap);
68738         }
68739       };
68740       sidebar.collapse = function(moveMap) {
68741         if (!selection2.classed("collapsed")) {
68742           sidebar.toggle(moveMap);
68743         }
68744       };
68745       sidebar.toggle = function(moveMap) {
68746         if (context.inIntro())
68747           return;
68748         var isCollapsed = selection2.classed("collapsed");
68749         var isCollapsing = !isCollapsed;
68750         var isRTL = _mainLocalizer.textDirection() === "rtl";
68751         var scaleX = isRTL ? 0 : 1;
68752         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
68753         sidebarWidth = selection2.node().getBoundingClientRect().width;
68754         selection2.style("width", sidebarWidth + "px");
68755         var startMargin, endMargin, lastMargin;
68756         if (isCollapsing) {
68757           startMargin = lastMargin = 0;
68758           endMargin = -sidebarWidth;
68759         } else {
68760           startMargin = lastMargin = -sidebarWidth;
68761           endMargin = 0;
68762         }
68763         if (!isCollapsing) {
68764           selection2.classed("collapsed", isCollapsing);
68765         }
68766         selection2.transition().style(xMarginProperty, endMargin + "px").tween("panner", function() {
68767           var i2 = number_default(startMargin, endMargin);
68768           return function(t) {
68769             var dx = lastMargin - Math.round(i2(t));
68770             lastMargin = lastMargin - dx;
68771             context.ui().onResize(moveMap ? void 0 : [dx * scaleX, 0]);
68772           };
68773         }).on("end", function() {
68774           if (isCollapsing) {
68775             selection2.classed("collapsed", isCollapsing);
68776           }
68777           if (!isCollapsing) {
68778             var containerWidth2 = container.node().getBoundingClientRect().width;
68779             var widthPct = sidebarWidth / containerWidth2 * 100;
68780             selection2.style(xMarginProperty, null).style("width", widthPct + "%");
68781           }
68782         });
68783       };
68784       resizer.on("dblclick", function(d3_event) {
68785         d3_event.preventDefault();
68786         if (d3_event.sourceEvent) {
68787           d3_event.sourceEvent.preventDefault();
68788         }
68789         sidebar.toggle();
68790       });
68791       context.map().on("crossEditableZoom.sidebar", function(within) {
68792         if (!within && !selection2.select(".inspector-hover").empty()) {
68793           hover([]);
68794         }
68795       });
68796     }
68797     sidebar.showPresetList = function() {
68798     };
68799     sidebar.hover = function() {
68800     };
68801     sidebar.hover.cancel = function() {
68802     };
68803     sidebar.intersects = function() {
68804     };
68805     sidebar.select = function() {
68806     };
68807     sidebar.show = function() {
68808     };
68809     sidebar.hide = function() {
68810     };
68811     sidebar.expand = function() {
68812     };
68813     sidebar.collapse = function() {
68814     };
68815     sidebar.toggle = function() {
68816     };
68817     return sidebar;
68818   }
68819
68820   // modules/modes/draw_area.js
68821   function modeDrawArea(context, wayID, startGraph, button) {
68822     var mode = {
68823       button,
68824       id: "draw-area"
68825     };
68826     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawArea", function() {
68827       context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.areas"))();
68828     });
68829     mode.wayID = wayID;
68830     mode.enter = function() {
68831       context.install(behavior);
68832     };
68833     mode.exit = function() {
68834       context.uninstall(behavior);
68835     };
68836     mode.selectedIDs = function() {
68837       return [wayID];
68838     };
68839     mode.activeID = function() {
68840       return behavior && behavior.activeID() || [];
68841     };
68842     return mode;
68843   }
68844
68845   // modules/modes/add_area.js
68846   function modeAddArea(context, mode) {
68847     mode.id = "add-area";
68848     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
68849     function defaultTags(loc) {
68850       var defaultTags2 = { area: "yes" };
68851       if (mode.preset)
68852         defaultTags2 = mode.preset.setTags(defaultTags2, "area", false, loc);
68853       return defaultTags2;
68854     }
68855     function actionClose(wayId) {
68856       return function(graph) {
68857         return graph.replace(graph.entity(wayId).close());
68858       };
68859     }
68860     function start2(loc) {
68861       var startGraph = context.graph();
68862       var node = osmNode({ loc });
68863       var way = osmWay({ tags: defaultTags(loc) });
68864       context.perform(
68865         actionAddEntity(node),
68866         actionAddEntity(way),
68867         actionAddVertex(way.id, node.id),
68868         actionClose(way.id)
68869       );
68870       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
68871     }
68872     function startFromWay(loc, edge) {
68873       var startGraph = context.graph();
68874       var node = osmNode({ loc });
68875       var way = osmWay({ tags: defaultTags(loc) });
68876       context.perform(
68877         actionAddEntity(node),
68878         actionAddEntity(way),
68879         actionAddVertex(way.id, node.id),
68880         actionClose(way.id),
68881         actionAddMidpoint({ loc, edge }, node)
68882       );
68883       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
68884     }
68885     function startFromNode(node) {
68886       var startGraph = context.graph();
68887       var way = osmWay({ tags: defaultTags(node.loc) });
68888       context.perform(
68889         actionAddEntity(way),
68890         actionAddVertex(way.id, node.id),
68891         actionClose(way.id)
68892       );
68893       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
68894     }
68895     mode.enter = function() {
68896       context.install(behavior);
68897     };
68898     mode.exit = function() {
68899       context.uninstall(behavior);
68900     };
68901     return mode;
68902   }
68903
68904   // modules/modes/add_line.js
68905   function modeAddLine(context, mode) {
68906     mode.id = "add-line";
68907     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
68908     function defaultTags(loc) {
68909       var defaultTags2 = {};
68910       if (mode.preset)
68911         defaultTags2 = mode.preset.setTags(defaultTags2, "line", false, loc);
68912       return defaultTags2;
68913     }
68914     function start2(loc) {
68915       var startGraph = context.graph();
68916       var node = osmNode({ loc });
68917       var way = osmWay({ tags: defaultTags(loc) });
68918       context.perform(
68919         actionAddEntity(node),
68920         actionAddEntity(way),
68921         actionAddVertex(way.id, node.id)
68922       );
68923       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
68924     }
68925     function startFromWay(loc, edge) {
68926       var startGraph = context.graph();
68927       var node = osmNode({ loc });
68928       var way = osmWay({ tags: defaultTags(loc) });
68929       context.perform(
68930         actionAddEntity(node),
68931         actionAddEntity(way),
68932         actionAddVertex(way.id, node.id),
68933         actionAddMidpoint({ loc, edge }, node)
68934       );
68935       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
68936     }
68937     function startFromNode(node) {
68938       var startGraph = context.graph();
68939       var way = osmWay({ tags: defaultTags(node.loc) });
68940       context.perform(
68941         actionAddEntity(way),
68942         actionAddVertex(way.id, node.id)
68943       );
68944       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
68945     }
68946     mode.enter = function() {
68947       context.install(behavior);
68948     };
68949     mode.exit = function() {
68950       context.uninstall(behavior);
68951     };
68952     return mode;
68953   }
68954
68955   // modules/modes/add_point.js
68956   function modeAddPoint(context, mode) {
68957     mode.id = "add-point";
68958     var behavior = behaviorDraw(context).on("click", add).on("clickWay", addWay).on("clickNode", addNode).on("cancel", cancel).on("finish", cancel);
68959     function defaultTags(loc) {
68960       var defaultTags2 = {};
68961       if (mode.preset)
68962         defaultTags2 = mode.preset.setTags(defaultTags2, "point", false, loc);
68963       return defaultTags2;
68964     }
68965     function add(loc) {
68966       var node = osmNode({ loc, tags: defaultTags(loc) });
68967       context.perform(
68968         actionAddEntity(node),
68969         _t("operations.add.annotation.point")
68970       );
68971       enterSelectMode(node);
68972     }
68973     function addWay(loc, edge) {
68974       var node = osmNode({ tags: defaultTags(loc) });
68975       context.perform(
68976         actionAddMidpoint({ loc, edge }, node),
68977         _t("operations.add.annotation.vertex")
68978       );
68979       enterSelectMode(node);
68980     }
68981     function enterSelectMode(node) {
68982       context.enter(
68983         modeSelect(context, [node.id]).newFeature(true)
68984       );
68985     }
68986     function addNode(node) {
68987       const _defaultTags = defaultTags(node.loc);
68988       if (Object.keys(_defaultTags).length === 0) {
68989         enterSelectMode(node);
68990         return;
68991       }
68992       var tags = Object.assign({}, node.tags);
68993       for (var key in _defaultTags) {
68994         tags[key] = _defaultTags[key];
68995       }
68996       context.perform(
68997         actionChangeTags(node.id, tags),
68998         _t("operations.add.annotation.point")
68999       );
69000       enterSelectMode(node);
69001     }
69002     function cancel() {
69003       context.enter(modeBrowse(context));
69004     }
69005     mode.enter = function() {
69006       context.install(behavior);
69007     };
69008     mode.exit = function() {
69009       context.uninstall(behavior);
69010     };
69011     return mode;
69012   }
69013
69014   // modules/modes/select_note.js
69015   function modeSelectNote(context, selectedNoteID) {
69016     var mode = {
69017       id: "select-note",
69018       button: "browse"
69019     };
69020     var _keybinding = utilKeybinding("select-note");
69021     var _noteEditor = uiNoteEditor(context).on("change", function() {
69022       context.map().pan([0, 0]);
69023       var note = checkSelectedID();
69024       if (!note)
69025         return;
69026       context.ui().sidebar.show(_noteEditor.note(note));
69027     });
69028     var _behaviors = [
69029       behaviorBreathe(context),
69030       behaviorHover(context),
69031       behaviorSelect(context),
69032       behaviorLasso(context),
69033       modeDragNode(context).behavior,
69034       modeDragNote(context).behavior
69035     ];
69036     var _newFeature = false;
69037     function checkSelectedID() {
69038       if (!services.osm)
69039         return;
69040       var note = services.osm.getNote(selectedNoteID);
69041       if (!note) {
69042         context.enter(modeBrowse(context));
69043       }
69044       return note;
69045     }
69046     function selectNote(d3_event, drawn) {
69047       if (!checkSelectedID())
69048         return;
69049       var selection2 = context.surface().selectAll(".layer-notes .note-" + selectedNoteID);
69050       if (selection2.empty()) {
69051         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
69052         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
69053           context.enter(modeBrowse(context));
69054         }
69055       } else {
69056         selection2.classed("selected", true);
69057         context.selectedNoteID(selectedNoteID);
69058       }
69059     }
69060     function esc() {
69061       if (context.container().select(".combobox").size())
69062         return;
69063       context.enter(modeBrowse(context));
69064     }
69065     mode.zoomToSelected = function() {
69066       if (!services.osm)
69067         return;
69068       var note = services.osm.getNote(selectedNoteID);
69069       if (note) {
69070         context.map().centerZoomEase(note.loc, 20);
69071       }
69072     };
69073     mode.newFeature = function(val) {
69074       if (!arguments.length)
69075         return _newFeature;
69076       _newFeature = val;
69077       return mode;
69078     };
69079     mode.enter = function() {
69080       var note = checkSelectedID();
69081       if (!note)
69082         return;
69083       _behaviors.forEach(context.install);
69084       _keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
69085       select_default2(document).call(_keybinding);
69086       selectNote();
69087       var sidebar = context.ui().sidebar;
69088       sidebar.show(_noteEditor.note(note).newNote(_newFeature));
69089       sidebar.expand(sidebar.intersects(note.extent()));
69090       context.map().on("drawn.select", selectNote);
69091     };
69092     mode.exit = function() {
69093       _behaviors.forEach(context.uninstall);
69094       select_default2(document).call(_keybinding.unbind);
69095       context.surface().selectAll(".layer-notes .selected").classed("selected hover", false);
69096       context.map().on("drawn.select", null);
69097       context.ui().sidebar.hide();
69098       context.selectedNoteID(null);
69099     };
69100     return mode;
69101   }
69102
69103   // modules/modes/add_note.js
69104   function modeAddNote(context) {
69105     var mode = {
69106       id: "add-note",
69107       button: "note",
69108       description: _t.append("modes.add_note.description"),
69109       key: _t("modes.add_note.key")
69110     };
69111     var behavior = behaviorDraw(context).on("click", add).on("cancel", cancel).on("finish", cancel);
69112     function add(loc) {
69113       var osm = services.osm;
69114       if (!osm)
69115         return;
69116       var note = osmNote({ loc, status: "open", comments: [] });
69117       osm.replaceNote(note);
69118       context.map().pan([0, 0]);
69119       context.selectedNoteID(note.id).enter(modeSelectNote(context, note.id).newFeature(true));
69120     }
69121     function cancel() {
69122       context.enter(modeBrowse(context));
69123     }
69124     mode.enter = function() {
69125       context.install(behavior);
69126     };
69127     mode.exit = function() {
69128       context.uninstall(behavior);
69129     };
69130     return mode;
69131   }
69132
69133   // modules/modes/save.js
69134   function modeSave(context) {
69135     var mode = { id: "save" };
69136     var keybinding = utilKeybinding("modeSave");
69137     var commit = uiCommit(context).on("cancel", cancel);
69138     var _conflictsUi;
69139     var _location;
69140     var _success;
69141     var uploader = context.uploader().on("saveStarted.modeSave", function() {
69142       keybindingOff();
69143     }).on("willAttemptUpload.modeSave", prepareForSuccess).on("progressChanged.modeSave", showProgress).on("resultNoChanges.modeSave", function() {
69144       cancel();
69145     }).on("resultErrors.modeSave", showErrors).on("resultConflicts.modeSave", showConflicts).on("resultSuccess.modeSave", showSuccess);
69146     function cancel() {
69147       context.enter(modeBrowse(context));
69148     }
69149     function showProgress(num, total) {
69150       var modal = context.container().select(".loading-modal .modal-section");
69151       var progress = modal.selectAll(".progress").data([0]);
69152       progress.enter().append("div").attr("class", "progress").merge(progress).text(_t("save.conflict_progress", { num, total }));
69153     }
69154     function showConflicts(changeset, conflicts, origChanges) {
69155       var selection2 = context.container().select(".sidebar").append("div").attr("class", "sidebar-component");
69156       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
69157       _conflictsUi = uiConflicts(context).conflictList(conflicts).origChanges(origChanges).on("cancel", function() {
69158         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
69159         selection2.remove();
69160         keybindingOn();
69161         uploader.cancelConflictResolution();
69162       }).on("save", function() {
69163         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
69164         selection2.remove();
69165         uploader.processResolvedConflicts(changeset);
69166       });
69167       selection2.call(_conflictsUi);
69168     }
69169     function showErrors(errors) {
69170       keybindingOn();
69171       var selection2 = uiConfirm(context.container());
69172       selection2.select(".modal-section.header").append("h3").text(_t("save.error"));
69173       addErrors(selection2, errors);
69174       selection2.okButton();
69175     }
69176     function addErrors(selection2, data) {
69177       var message = selection2.select(".modal-section.message-text");
69178       var items = message.selectAll(".error-container").data(data);
69179       var enter = items.enter().append("div").attr("class", "error-container");
69180       enter.append("a").attr("class", "error-description").attr("href", "#").classed("hide-toggle", true).text(function(d) {
69181         return d.msg || _t("save.unknown_error_details");
69182       }).on("click", function(d3_event) {
69183         d3_event.preventDefault();
69184         var error = select_default2(this);
69185         var detail = select_default2(this.nextElementSibling);
69186         var exp2 = error.classed("expanded");
69187         detail.style("display", exp2 ? "none" : "block");
69188         error.classed("expanded", !exp2);
69189       });
69190       var details = enter.append("div").attr("class", "error-detail-container").style("display", "none");
69191       details.append("ul").attr("class", "error-detail-list").selectAll("li").data(function(d) {
69192         return d.details || [];
69193       }).enter().append("li").attr("class", "error-detail-item").text(function(d) {
69194         return d;
69195       });
69196       items.exit().remove();
69197     }
69198     function showSuccess(changeset) {
69199       commit.reset();
69200       var ui = _success.changeset(changeset).location(_location).on("cancel", function() {
69201         context.ui().sidebar.hide();
69202       });
69203       context.enter(modeBrowse(context).sidebar(ui));
69204     }
69205     function keybindingOn() {
69206       select_default2(document).call(keybinding.on("\u238B", cancel, true));
69207     }
69208     function keybindingOff() {
69209       select_default2(document).call(keybinding.unbind);
69210     }
69211     function prepareForSuccess() {
69212       _success = uiSuccess(context);
69213       _location = null;
69214       if (!services.geocoder)
69215         return;
69216       services.geocoder.reverse(context.map().center(), function(err, result) {
69217         if (err || !result || !result.address)
69218           return;
69219         var addr = result.address;
69220         var place = addr && (addr.town || addr.city || addr.county) || "";
69221         var region = addr && (addr.state || addr.country) || "";
69222         var separator = place && region ? _t("success.thank_you_where.separator") : "";
69223         _location = _t(
69224           "success.thank_you_where.format",
69225           { place, separator, region }
69226         );
69227       });
69228     }
69229     mode.selectedIDs = function() {
69230       return _conflictsUi ? _conflictsUi.shownEntityIds() : [];
69231     };
69232     mode.enter = function() {
69233       context.ui().sidebar.expand();
69234       function done() {
69235         context.ui().sidebar.show(commit);
69236       }
69237       keybindingOn();
69238       context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
69239       var osm = context.connection();
69240       if (!osm) {
69241         cancel();
69242         return;
69243       }
69244       if (osm.authenticated()) {
69245         done();
69246       } else {
69247         osm.authenticate(function(err) {
69248           if (err) {
69249             cancel();
69250           } else {
69251             done();
69252           }
69253         });
69254       }
69255     };
69256     mode.exit = function() {
69257       keybindingOff();
69258       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
69259       context.ui().sidebar.hide();
69260     };
69261     return mode;
69262   }
69263
69264   // modules/modes/select_error.js
69265   function modeSelectError(context, selectedErrorID, selectedErrorService) {
69266     var mode = {
69267       id: "select-error",
69268       button: "browse"
69269     };
69270     var keybinding = utilKeybinding("select-error");
69271     var errorService = services[selectedErrorService];
69272     var errorEditor;
69273     switch (selectedErrorService) {
69274       case "improveOSM":
69275         errorEditor = uiImproveOsmEditor(context).on("change", function() {
69276           context.map().pan([0, 0]);
69277           var error = checkSelectedID();
69278           if (!error)
69279             return;
69280           context.ui().sidebar.show(errorEditor.error(error));
69281         });
69282         break;
69283       case "keepRight":
69284         errorEditor = uiKeepRightEditor(context).on("change", function() {
69285           context.map().pan([0, 0]);
69286           var error = checkSelectedID();
69287           if (!error)
69288             return;
69289           context.ui().sidebar.show(errorEditor.error(error));
69290         });
69291         break;
69292       case "osmose":
69293         errorEditor = uiOsmoseEditor(context).on("change", function() {
69294           context.map().pan([0, 0]);
69295           var error = checkSelectedID();
69296           if (!error)
69297             return;
69298           context.ui().sidebar.show(errorEditor.error(error));
69299         });
69300         break;
69301     }
69302     var behaviors = [
69303       behaviorBreathe(context),
69304       behaviorHover(context),
69305       behaviorSelect(context),
69306       behaviorLasso(context),
69307       modeDragNode(context).behavior,
69308       modeDragNote(context).behavior
69309     ];
69310     function checkSelectedID() {
69311       if (!errorService)
69312         return;
69313       var error = errorService.getError(selectedErrorID);
69314       if (!error) {
69315         context.enter(modeBrowse(context));
69316       }
69317       return error;
69318     }
69319     mode.zoomToSelected = function() {
69320       if (!errorService)
69321         return;
69322       var error = errorService.getError(selectedErrorID);
69323       if (error) {
69324         context.map().centerZoomEase(error.loc, 20);
69325       }
69326     };
69327     mode.enter = function() {
69328       var error = checkSelectedID();
69329       if (!error)
69330         return;
69331       behaviors.forEach(context.install);
69332       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
69333       select_default2(document).call(keybinding);
69334       selectError();
69335       var sidebar = context.ui().sidebar;
69336       sidebar.show(errorEditor.error(error));
69337       context.map().on("drawn.select-error", selectError);
69338       function selectError(d3_event, drawn) {
69339         if (!checkSelectedID())
69340           return;
69341         var selection2 = context.surface().selectAll(".itemId-" + selectedErrorID + "." + selectedErrorService);
69342         if (selection2.empty()) {
69343           var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
69344           if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
69345             context.enter(modeBrowse(context));
69346           }
69347         } else {
69348           selection2.classed("selected", true);
69349           context.selectedErrorID(selectedErrorID);
69350         }
69351       }
69352       function esc() {
69353         if (context.container().select(".combobox").size())
69354           return;
69355         context.enter(modeBrowse(context));
69356       }
69357     };
69358     mode.exit = function() {
69359       behaviors.forEach(context.uninstall);
69360       select_default2(document).call(keybinding.unbind);
69361       context.surface().selectAll(".qaItem.selected").classed("selected hover", false);
69362       context.map().on("drawn.select-error", null);
69363       context.ui().sidebar.hide();
69364       context.selectedErrorID(null);
69365       context.features().forceVisible([]);
69366     };
69367     return mode;
69368   }
69369
69370   // modules/ui/tools/modes.js
69371   function uiToolDrawModes(context) {
69372     var tool = {
69373       id: "old_modes",
69374       label: _t.append("toolbar.add_feature")
69375     };
69376     var modes = [
69377       modeAddPoint(context, {
69378         title: _t.append("modes.add_point.title"),
69379         button: "point",
69380         description: _t.append("modes.add_point.description"),
69381         preset: _mainPresetIndex.item("point"),
69382         key: "1"
69383       }),
69384       modeAddLine(context, {
69385         title: _t.append("modes.add_line.title"),
69386         button: "line",
69387         description: _t.append("modes.add_line.description"),
69388         preset: _mainPresetIndex.item("line"),
69389         key: "2"
69390       }),
69391       modeAddArea(context, {
69392         title: _t.append("modes.add_area.title"),
69393         button: "area",
69394         description: _t.append("modes.add_area.description"),
69395         preset: _mainPresetIndex.item("area"),
69396         key: "3"
69397       })
69398     ];
69399     function enabled(_mode) {
69400       return osmEditable();
69401     }
69402     function osmEditable() {
69403       return context.editable();
69404     }
69405     modes.forEach(function(mode) {
69406       context.keybinding().on(mode.key, function() {
69407         if (!enabled(mode))
69408           return;
69409         if (mode.id === context.mode().id) {
69410           context.enter(modeBrowse(context));
69411         } else {
69412           context.enter(mode);
69413         }
69414       });
69415     });
69416     tool.render = function(selection2) {
69417       var wrap2 = selection2.append("div").attr("class", "joined").style("display", "flex");
69418       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
69419       context.map().on("move.modes", debouncedUpdate).on("drawn.modes", debouncedUpdate);
69420       context.on("enter.modes", update);
69421       update();
69422       function update() {
69423         var buttons = wrap2.selectAll("button.add-button").data(modes, function(d) {
69424           return d.id;
69425         });
69426         buttons.exit().remove();
69427         var buttonsEnter = buttons.enter().append("button").attr("class", function(d) {
69428           return d.id + " add-button bar-button";
69429         }).on("click.mode-buttons", function(d3_event, d) {
69430           if (!enabled(d))
69431             return;
69432           var currMode = context.mode().id;
69433           if (/^draw/.test(currMode))
69434             return;
69435           if (d.id === currMode) {
69436             context.enter(modeBrowse(context));
69437           } else {
69438             context.enter(d);
69439           }
69440         }).call(
69441           uiTooltip().placement("bottom").title(function(d) {
69442             return d.description;
69443           }).keys(function(d) {
69444             return [d.key];
69445           }).scrollContainer(context.container().select(".top-toolbar"))
69446         );
69447         buttonsEnter.each(function(d) {
69448           select_default2(this).call(svgIcon("#iD-icon-" + d.button));
69449         });
69450         buttonsEnter.append("span").attr("class", "label").text("").each(function(mode) {
69451           mode.title(select_default2(this));
69452         });
69453         if (buttons.enter().size() || buttons.exit().size()) {
69454           context.ui().checkOverflow(".top-toolbar", true);
69455         }
69456         buttons = buttons.merge(buttonsEnter).attr("aria-disabled", function(d) {
69457           return !enabled(d);
69458         }).classed("disabled", function(d) {
69459           return !enabled(d);
69460         }).attr("aria-pressed", function(d) {
69461           return context.mode() && context.mode().button === d.button;
69462         }).classed("active", function(d) {
69463           return context.mode() && context.mode().button === d.button;
69464         });
69465       }
69466     };
69467     return tool;
69468   }
69469
69470   // modules/ui/tools/notes.js
69471   function uiToolNotes(context) {
69472     var tool = {
69473       id: "notes",
69474       label: _t.append("modes.add_note.label")
69475     };
69476     var mode = modeAddNote(context);
69477     function enabled() {
69478       return notesEnabled() && notesEditable();
69479     }
69480     function notesEnabled() {
69481       var noteLayer = context.layers().layer("notes");
69482       return noteLayer && noteLayer.enabled();
69483     }
69484     function notesEditable() {
69485       var mode2 = context.mode();
69486       return context.map().notesEditable() && mode2 && mode2.id !== "save";
69487     }
69488     context.keybinding().on(mode.key, function() {
69489       if (!enabled())
69490         return;
69491       if (mode.id === context.mode().id) {
69492         context.enter(modeBrowse(context));
69493       } else {
69494         context.enter(mode);
69495       }
69496     });
69497     tool.render = function(selection2) {
69498       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
69499       context.map().on("move.notes", debouncedUpdate).on("drawn.notes", debouncedUpdate);
69500       context.on("enter.notes", update);
69501       update();
69502       function update() {
69503         var showNotes = notesEnabled();
69504         var data = showNotes ? [mode] : [];
69505         var buttons = selection2.selectAll("button.add-button").data(data, function(d) {
69506           return d.id;
69507         });
69508         buttons.exit().remove();
69509         var buttonsEnter = buttons.enter().append("button").attr("class", function(d) {
69510           return d.id + " add-button bar-button";
69511         }).on("click.notes", function(d3_event, d) {
69512           if (!enabled())
69513             return;
69514           var currMode = context.mode().id;
69515           if (/^draw/.test(currMode))
69516             return;
69517           if (d.id === currMode) {
69518             context.enter(modeBrowse(context));
69519           } else {
69520             context.enter(d);
69521           }
69522         }).call(
69523           uiTooltip().placement("bottom").title(function(d) {
69524             return d.description;
69525           }).keys(function(d) {
69526             return [d.key];
69527           }).scrollContainer(context.container().select(".top-toolbar"))
69528         );
69529         buttonsEnter.each(function(d) {
69530           select_default2(this).call(svgIcon(d.icon || "#iD-icon-" + d.button));
69531         });
69532         if (buttons.enter().size() || buttons.exit().size()) {
69533           context.ui().checkOverflow(".top-toolbar", true);
69534         }
69535         buttons = buttons.merge(buttonsEnter).classed("disabled", function() {
69536           return !enabled();
69537         }).attr("aria-disabled", function() {
69538           return !enabled();
69539         }).classed("active", function(d) {
69540           return context.mode() && context.mode().button === d.button;
69541         }).attr("aria-pressed", function(d) {
69542           return context.mode() && context.mode().button === d.button;
69543         });
69544       }
69545     };
69546     tool.uninstall = function() {
69547       context.on("enter.editor.notes", null).on("exit.editor.notes", null).on("enter.notes", null);
69548       context.map().on("move.notes", null).on("drawn.notes", null);
69549     };
69550     return tool;
69551   }
69552
69553   // modules/ui/tools/save.js
69554   function uiToolSave(context) {
69555     var tool = {
69556       id: "save",
69557       label: _t.append("save.title")
69558     };
69559     var button = null;
69560     var tooltipBehavior = null;
69561     var history = context.history();
69562     var key = uiCmd("\u2318S");
69563     var _numChanges = 0;
69564     function isSaving() {
69565       var mode = context.mode();
69566       return mode && mode.id === "save";
69567     }
69568     function isDisabled() {
69569       return _numChanges === 0 || isSaving();
69570     }
69571     function save(d3_event) {
69572       d3_event.preventDefault();
69573       if (!context.inIntro() && !isSaving() && history.hasChanges()) {
69574         context.enter(modeSave(context));
69575       }
69576     }
69577     function bgColor(numChanges) {
69578       var step;
69579       if (numChanges === 0) {
69580         return null;
69581       } else if (numChanges <= 50) {
69582         step = numChanges / 50;
69583         return rgb_default("#fff", "#ff8")(step);
69584       } else {
69585         step = Math.min((numChanges - 50) / 50, 1);
69586         return rgb_default("#ff8", "#f88")(step);
69587       }
69588     }
69589     function updateCount() {
69590       var val = history.difference().summary().length;
69591       if (val === _numChanges)
69592         return;
69593       _numChanges = val;
69594       if (tooltipBehavior) {
69595         tooltipBehavior.title(() => _t.append(_numChanges > 0 ? "save.help" : "save.no_changes")).keys([key]);
69596       }
69597       if (button) {
69598         button.classed("disabled", isDisabled()).style("background", bgColor(_numChanges));
69599         button.select("span.count").text(_numChanges);
69600       }
69601     }
69602     tool.render = function(selection2) {
69603       tooltipBehavior = uiTooltip().placement("bottom").title(() => _t.append("save.no_changes")).keys([key]).scrollContainer(context.container().select(".top-toolbar"));
69604       var lastPointerUpType;
69605       button = selection2.append("button").attr("class", "save disabled bar-button").on("pointerup", function(d3_event) {
69606         lastPointerUpType = d3_event.pointerType;
69607       }).on("click", function(d3_event) {
69608         save(d3_event);
69609         if (_numChanges === 0 && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
69610           context.ui().flash.duration(2e3).iconName("#iD-icon-save").iconClass("disabled").label(_t.append("save.no_changes"))();
69611         }
69612         lastPointerUpType = null;
69613       }).call(tooltipBehavior);
69614       button.call(svgIcon("#iD-icon-save"));
69615       button.append("span").attr("class", "count").attr("aria-hidden", "true").text("0");
69616       updateCount();
69617       context.keybinding().on(key, save, true);
69618       context.history().on("change.save", updateCount);
69619       context.on("enter.save", function() {
69620         if (button) {
69621           button.classed("disabled", isDisabled());
69622           if (isSaving()) {
69623             button.call(tooltipBehavior.hide);
69624           }
69625         }
69626       });
69627     };
69628     tool.uninstall = function() {
69629       context.keybinding().off(key, true);
69630       context.history().on("change.save", null);
69631       context.on("enter.save", null);
69632       button = null;
69633       tooltipBehavior = null;
69634     };
69635     return tool;
69636   }
69637
69638   // modules/ui/tools/sidebar_toggle.js
69639   function uiToolSidebarToggle(context) {
69640     var tool = {
69641       id: "sidebar_toggle",
69642       label: _t.append("toolbar.inspect")
69643     };
69644     tool.render = function(selection2) {
69645       selection2.append("button").attr("class", "bar-button").attr("aria-label", _t("sidebar.tooltip")).on("click", function() {
69646         context.ui().sidebar.toggle();
69647       }).call(
69648         uiTooltip().placement("bottom").title(() => _t.append("sidebar.tooltip")).keys([_t("sidebar.key")]).scrollContainer(context.container().select(".top-toolbar"))
69649       ).call(svgIcon("#iD-icon-sidebar-" + (_mainLocalizer.textDirection() === "rtl" ? "right" : "left")));
69650     };
69651     return tool;
69652   }
69653
69654   // modules/ui/tools/undo_redo.js
69655   function uiToolUndoRedo(context) {
69656     var tool = {
69657       id: "undo_redo",
69658       label: _t.append("toolbar.undo_redo")
69659     };
69660     var commands = [{
69661       id: "undo",
69662       cmd: uiCmd("\u2318Z"),
69663       action: function() {
69664         context.undo();
69665       },
69666       annotation: function() {
69667         return context.history().undoAnnotation();
69668       },
69669       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")
69670     }, {
69671       id: "redo",
69672       cmd: uiCmd("\u2318\u21E7Z"),
69673       action: function() {
69674         context.redo();
69675       },
69676       annotation: function() {
69677         return context.history().redoAnnotation();
69678       },
69679       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "undo" : "redo")
69680     }];
69681     function editable() {
69682       return context.mode() && context.mode().id !== "save" && context.map().editableDataEnabled(
69683         true
69684         /* ignore min zoom */
69685       );
69686     }
69687     tool.render = function(selection2) {
69688       var tooltipBehavior = uiTooltip().placement("bottom").title(function(d) {
69689         return d.annotation() ? _t.append(d.id + ".tooltip", { action: d.annotation() }) : _t.append(d.id + ".nothing");
69690       }).keys(function(d) {
69691         return [d.cmd];
69692       }).scrollContainer(context.container().select(".top-toolbar"));
69693       var lastPointerUpType;
69694       var buttons = selection2.selectAll("button").data(commands).enter().append("button").attr("class", function(d) {
69695         return "disabled " + d.id + "-button bar-button";
69696       }).on("pointerup", function(d3_event) {
69697         lastPointerUpType = d3_event.pointerType;
69698       }).on("click", function(d3_event, d) {
69699         d3_event.preventDefault();
69700         var annotation = d.annotation();
69701         if (editable() && annotation) {
69702           d.action();
69703         }
69704         if (editable() && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
69705           var label = annotation ? _t.append(d.id + ".tooltip", { action: annotation }) : _t.append(d.id + ".nothing");
69706           context.ui().flash.duration(2e3).iconName("#" + d.icon).iconClass(annotation ? "" : "disabled").label(label)();
69707         }
69708         lastPointerUpType = null;
69709       }).call(tooltipBehavior);
69710       buttons.each(function(d) {
69711         select_default2(this).call(svgIcon("#" + d.icon));
69712       });
69713       context.keybinding().on(commands[0].cmd, function(d3_event) {
69714         d3_event.preventDefault();
69715         if (editable())
69716           commands[0].action();
69717       }).on(commands[1].cmd, function(d3_event) {
69718         d3_event.preventDefault();
69719         if (editable())
69720           commands[1].action();
69721       });
69722       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
69723       context.map().on("move.undo_redo", debouncedUpdate).on("drawn.undo_redo", debouncedUpdate);
69724       context.history().on("change.undo_redo", function(difference) {
69725         if (difference)
69726           update();
69727       });
69728       context.on("enter.undo_redo", update);
69729       function update() {
69730         buttons.classed("disabled", function(d) {
69731           return !editable() || !d.annotation();
69732         }).each(function() {
69733           var selection3 = select_default2(this);
69734           if (!selection3.select(".tooltip.in").empty()) {
69735             selection3.call(tooltipBehavior.updateContent);
69736           }
69737         });
69738       }
69739     };
69740     tool.uninstall = function() {
69741       context.keybinding().off(commands[0].cmd).off(commands[1].cmd);
69742       context.map().on("move.undo_redo", null).on("drawn.undo_redo", null);
69743       context.history().on("change.undo_redo", null);
69744       context.on("enter.undo_redo", null);
69745     };
69746     return tool;
69747   }
69748
69749   // modules/ui/top_toolbar.js
69750   function uiTopToolbar(context) {
69751     var sidebarToggle = uiToolSidebarToggle(context), modes = uiToolDrawModes(context), notes = uiToolNotes(context), undoRedo = uiToolUndoRedo(context), save = uiToolSave(context);
69752     function notesEnabled() {
69753       var noteLayer = context.layers().layer("notes");
69754       return noteLayer && noteLayer.enabled();
69755     }
69756     function topToolbar(bar) {
69757       bar.on("wheel.topToolbar", function(d3_event) {
69758         if (!d3_event.deltaX) {
69759           bar.node().scrollLeft += d3_event.deltaY;
69760         }
69761       });
69762       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
69763       context.layers().on("change.topToolbar", debouncedUpdate);
69764       update();
69765       function update() {
69766         var tools = [
69767           sidebarToggle,
69768           "spacer",
69769           modes
69770         ];
69771         tools.push("spacer");
69772         if (notesEnabled()) {
69773           tools = tools.concat([notes, "spacer"]);
69774         }
69775         tools = tools.concat([undoRedo, save]);
69776         var toolbarItems = bar.selectAll(".toolbar-item").data(tools, function(d) {
69777           return d.id || d;
69778         });
69779         toolbarItems.exit().each(function(d) {
69780           if (d.uninstall) {
69781             d.uninstall();
69782           }
69783         }).remove();
69784         var itemsEnter = toolbarItems.enter().append("div").attr("class", function(d) {
69785           var classes = "toolbar-item " + (d.id || d).replace("_", "-");
69786           if (d.klass)
69787             classes += " " + d.klass;
69788           return classes;
69789         });
69790         var actionableItems = itemsEnter.filter(function(d) {
69791           return d !== "spacer";
69792         });
69793         actionableItems.append("div").attr("class", "item-content").each(function(d) {
69794           select_default2(this).call(d.render, bar);
69795         });
69796         actionableItems.append("div").attr("class", "item-label").each(function(d) {
69797           d.label(select_default2(this));
69798         });
69799       }
69800     }
69801     return topToolbar;
69802   }
69803
69804   // modules/ui/zoom_to_selection.js
69805   function uiZoomToSelection(context) {
69806     function isDisabled() {
69807       var mode = context.mode();
69808       return !mode || !mode.zoomToSelected;
69809     }
69810     var _lastPointerUpType;
69811     function pointerup(d3_event) {
69812       _lastPointerUpType = d3_event.pointerType;
69813     }
69814     function click(d3_event) {
69815       d3_event.preventDefault();
69816       if (isDisabled()) {
69817         if (_lastPointerUpType === "touch" || _lastPointerUpType === "pen") {
69818           context.ui().flash.duration(2e3).iconName("#iD-icon-framed-dot").iconClass("disabled").label(_t.append("inspector.zoom_to.no_selection"))();
69819         }
69820       } else {
69821         var mode = context.mode();
69822         if (mode && mode.zoomToSelected) {
69823           mode.zoomToSelected();
69824         }
69825       }
69826       _lastPointerUpType = null;
69827     }
69828     return function(selection2) {
69829       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function() {
69830         if (isDisabled()) {
69831           return _t.append("inspector.zoom_to.no_selection");
69832         }
69833         return _t.append("inspector.zoom_to.title");
69834       }).keys([_t("inspector.zoom_to.key")]);
69835       var button = selection2.append("button").on("pointerup", pointerup).on("click", click).call(svgIcon("#iD-icon-framed-dot", "light")).call(tooltipBehavior);
69836       function setEnabledState() {
69837         button.classed("disabled", isDisabled());
69838         if (!button.select(".tooltip.in").empty()) {
69839           button.call(tooltipBehavior.updateContent);
69840         }
69841       }
69842       context.on("enter.uiZoomToSelection", setEnabledState);
69843       setEnabledState();
69844     };
69845   }
69846
69847   // modules/ui/pane.js
69848   function uiPane(id2, context) {
69849     var _key;
69850     var _label = "";
69851     var _description = "";
69852     var _iconName = "";
69853     var _sections;
69854     var _paneSelection = select_default2(null);
69855     var _paneTooltip;
69856     var pane = {
69857       id: id2
69858     };
69859     pane.label = function(val) {
69860       if (!arguments.length)
69861         return _label;
69862       _label = val;
69863       return pane;
69864     };
69865     pane.key = function(val) {
69866       if (!arguments.length)
69867         return _key;
69868       _key = val;
69869       return pane;
69870     };
69871     pane.description = function(val) {
69872       if (!arguments.length)
69873         return _description;
69874       _description = val;
69875       return pane;
69876     };
69877     pane.iconName = function(val) {
69878       if (!arguments.length)
69879         return _iconName;
69880       _iconName = val;
69881       return pane;
69882     };
69883     pane.sections = function(val) {
69884       if (!arguments.length)
69885         return _sections;
69886       _sections = val;
69887       return pane;
69888     };
69889     pane.selection = function() {
69890       return _paneSelection;
69891     };
69892     function hidePane() {
69893       context.ui().togglePanes();
69894     }
69895     pane.togglePane = function(d3_event) {
69896       if (d3_event)
69897         d3_event.preventDefault();
69898       _paneTooltip.hide();
69899       context.ui().togglePanes(!_paneSelection.classed("shown") ? _paneSelection : void 0);
69900     };
69901     pane.renderToggleButton = function(selection2) {
69902       if (!_paneTooltip) {
69903         _paneTooltip = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _description).keys([_key]);
69904       }
69905       selection2.append("button").on("click", pane.togglePane).call(svgIcon("#" + _iconName, "light")).call(_paneTooltip);
69906     };
69907     pane.renderContent = function(selection2) {
69908       if (_sections) {
69909         _sections.forEach(function(section) {
69910           selection2.call(section.render);
69911         });
69912       }
69913     };
69914     pane.renderPane = function(selection2) {
69915       _paneSelection = selection2.append("div").attr("class", "fillL map-pane hide " + id2 + "-pane").attr("pane", id2);
69916       var heading = _paneSelection.append("div").attr("class", "pane-heading");
69917       heading.append("h2").text("").call(_label);
69918       heading.append("button").attr("title", _t("icons.close")).on("click", hidePane).call(svgIcon("#iD-icon-close"));
69919       _paneSelection.append("div").attr("class", "pane-content").call(pane.renderContent);
69920       if (_key) {
69921         context.keybinding().on(_key, pane.togglePane);
69922       }
69923     };
69924     return pane;
69925   }
69926
69927   // modules/ui/sections/background_display_options.js
69928   function uiSectionBackgroundDisplayOptions(context) {
69929     var section = uiSection("background-display-options", context).label(() => _t.append("background.display_options")).disclosureContent(renderDisclosureContent);
69930     var _storedOpacity = corePreferences("background-opacity");
69931     var _minVal = 0;
69932     var _maxVal = 3;
69933     var _sliders = ["brightness", "contrast", "saturation", "sharpness"];
69934     var _options = {
69935       brightness: _storedOpacity !== null ? +_storedOpacity : 1,
69936       contrast: 1,
69937       saturation: 1,
69938       sharpness: 1
69939     };
69940     function clamp3(x, min3, max3) {
69941       return Math.max(min3, Math.min(x, max3));
69942     }
69943     function updateValue(d, val) {
69944       val = clamp3(val, _minVal, _maxVal);
69945       _options[d] = val;
69946       context.background()[d](val);
69947       if (d === "brightness") {
69948         corePreferences("background-opacity", val);
69949       }
69950       section.reRender();
69951     }
69952     function renderDisclosureContent(selection2) {
69953       var container = selection2.selectAll(".display-options-container").data([0]);
69954       var containerEnter = container.enter().append("div").attr("class", "display-options-container controls-list");
69955       var slidersEnter = containerEnter.selectAll(".display-control").data(_sliders).enter().append("label").attr("class", function(d) {
69956         return "display-control display-control-" + d;
69957       });
69958       slidersEnter.html(function(d) {
69959         return _t.html("background." + d);
69960       }).append("span").attr("class", function(d) {
69961         return "display-option-value display-option-value-" + d;
69962       });
69963       var sildersControlEnter = slidersEnter.append("div").attr("class", "control-wrap");
69964       sildersControlEnter.append("input").attr("class", function(d) {
69965         return "display-option-input display-option-input-" + d;
69966       }).attr("type", "range").attr("min", _minVal).attr("max", _maxVal).attr("step", "0.05").on("input", function(d3_event, d) {
69967         var val = select_default2(this).property("value");
69968         if (!val && d3_event && d3_event.target) {
69969           val = d3_event.target.value;
69970         }
69971         updateValue(d, val);
69972       });
69973       sildersControlEnter.append("button").attr("title", function(d) {
69974         return `${_t("background.reset")} ${_t("background." + d)}`;
69975       }).attr("class", function(d) {
69976         return "display-option-reset display-option-reset-" + d;
69977       }).on("click", function(d3_event, d) {
69978         if (d3_event.button !== 0)
69979           return;
69980         updateValue(d, 1);
69981       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
69982       containerEnter.append("a").attr("class", "display-option-resetlink").attr("role", "button").attr("href", "#").call(_t.append("background.reset_all")).on("click", function(d3_event) {
69983         d3_event.preventDefault();
69984         for (var i2 = 0; i2 < _sliders.length; i2++) {
69985           updateValue(_sliders[i2], 1);
69986         }
69987       });
69988       container = containerEnter.merge(container);
69989       container.selectAll(".display-option-input").property("value", function(d) {
69990         return _options[d];
69991       });
69992       container.selectAll(".display-option-value").text(function(d) {
69993         return Math.floor(_options[d] * 100) + "%";
69994       });
69995       container.selectAll(".display-option-reset").classed("disabled", function(d) {
69996         return _options[d] === 1;
69997       });
69998       if (containerEnter.size() && _options.brightness !== 1) {
69999         context.background().brightness(_options.brightness);
70000       }
70001     }
70002     return section;
70003   }
70004
70005   // modules/ui/settings/custom_background.js
70006   function uiSettingsCustomBackground() {
70007     var dispatch10 = dispatch_default("change");
70008     function render(selection2) {
70009       var _origSettings = {
70010         template: corePreferences("background-custom-template")
70011       };
70012       var _currSettings = {
70013         template: corePreferences("background-custom-template")
70014       };
70015       var example = "https://{switch:a,b,c}.tile.openstreetmap.org/{zoom}/{x}/{y}.png";
70016       var modal = uiConfirm(selection2).okButton();
70017       modal.classed("settings-modal settings-custom-background", true);
70018       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_background.header"));
70019       var textSection = modal.select(".modal-section.message-text");
70020       var instructions = `${_t.html("settings.custom_background.instructions.info")}
70021
70022 #### ${_t.html("settings.custom_background.instructions.wms.tokens_label")}
70023 * ${_t.html("settings.custom_background.instructions.wms.tokens.proj")}
70024 * ${_t.html("settings.custom_background.instructions.wms.tokens.wkid")}
70025 * ${_t.html("settings.custom_background.instructions.wms.tokens.dimensions")}
70026 * ${_t.html("settings.custom_background.instructions.wms.tokens.bbox")}
70027
70028 #### ${_t.html("settings.custom_background.instructions.tms.tokens_label")}
70029 * ${_t.html("settings.custom_background.instructions.tms.tokens.xyz")}
70030 * ${_t.html("settings.custom_background.instructions.tms.tokens.flipped_y")}
70031 * ${_t.html("settings.custom_background.instructions.tms.tokens.switch")}
70032 * ${_t.html("settings.custom_background.instructions.tms.tokens.quadtile")}
70033 * ${_t.html("settings.custom_background.instructions.tms.tokens.scale_factor")}
70034
70035 #### ${_t.html("settings.custom_background.instructions.example")}
70036 \`${example}\``;
70037       textSection.append("div").attr("class", "instructions-template").html(marked(instructions));
70038       textSection.append("textarea").attr("class", "field-template").attr("placeholder", _t("settings.custom_background.template.placeholder")).call(utilNoAuto).property("value", _currSettings.template);
70039       var buttonSection = modal.select(".modal-section.buttons");
70040       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
70041       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
70042       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
70043       function isSaveDisabled() {
70044         return null;
70045       }
70046       function clickCancel() {
70047         textSection.select(".field-template").property("value", _origSettings.template);
70048         corePreferences("background-custom-template", _origSettings.template);
70049         this.blur();
70050         modal.close();
70051       }
70052       function clickSave() {
70053         _currSettings.template = textSection.select(".field-template").property("value");
70054         corePreferences("background-custom-template", _currSettings.template);
70055         this.blur();
70056         modal.close();
70057         dispatch10.call("change", this, _currSettings);
70058       }
70059     }
70060     return utilRebind(render, dispatch10, "on");
70061   }
70062
70063   // modules/ui/sections/background_list.js
70064   function uiSectionBackgroundList(context) {
70065     var _backgroundList = select_default2(null);
70066     var _customSource = context.background().findSource("custom");
70067     var _settingsCustomBackground = uiSettingsCustomBackground(context).on("change", customChanged);
70068     var section = uiSection("background-list", context).label(() => _t.append("background.backgrounds")).disclosureContent(renderDisclosureContent);
70069     function previousBackgroundID() {
70070       return corePreferences("background-last-used-toggle");
70071     }
70072     function renderDisclosureContent(selection2) {
70073       var container = selection2.selectAll(".layer-background-list").data([0]);
70074       _backgroundList = container.enter().append("ul").attr("class", "layer-list layer-background-list").attr("dir", "auto").merge(container);
70075       var bgExtrasListEnter = selection2.selectAll(".bg-extras-list").data([0]).enter().append("ul").attr("class", "layer-list bg-extras-list");
70076       var minimapLabelEnter = bgExtrasListEnter.append("li").attr("class", "minimap-toggle-item").append("label").call(
70077         uiTooltip().title(() => _t.append("background.minimap.tooltip")).keys([_t("background.minimap.key")]).placement("top")
70078       );
70079       minimapLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
70080         d3_event.preventDefault();
70081         uiMapInMap.toggle();
70082       });
70083       minimapLabelEnter.append("span").call(_t.append("background.minimap.description"));
70084       var panelLabelEnter = bgExtrasListEnter.append("li").attr("class", "background-panel-toggle-item").append("label").call(
70085         uiTooltip().title(() => _t.append("background.panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.background.key"))]).placement("top")
70086       );
70087       panelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
70088         d3_event.preventDefault();
70089         context.ui().info.toggle("background");
70090       });
70091       panelLabelEnter.append("span").call(_t.append("background.panel.description"));
70092       var locPanelLabelEnter = bgExtrasListEnter.append("li").attr("class", "location-panel-toggle-item").append("label").call(
70093         uiTooltip().title(() => _t.append("background.location_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.location.key"))]).placement("top")
70094       );
70095       locPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
70096         d3_event.preventDefault();
70097         context.ui().info.toggle("location");
70098       });
70099       locPanelLabelEnter.append("span").call(_t.append("background.location_panel.description"));
70100       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"));
70101       _backgroundList.call(drawListItems, "radio", function(d3_event, d) {
70102         chooseBackground(d);
70103       }, function(d) {
70104         return !d.isHidden() && !d.overlay;
70105       });
70106     }
70107     function setTooltips(selection2) {
70108       selection2.each(function(d, i2, nodes) {
70109         var item = select_default2(this).select("label");
70110         var span = item.select("span");
70111         var placement = i2 < nodes.length / 2 ? "bottom" : "top";
70112         var hasDescription = d.hasDescription();
70113         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
70114         item.call(uiTooltip().destroyAny);
70115         if (d.id === previousBackgroundID()) {
70116           item.call(
70117             uiTooltip().placement(placement).title(() => _t.append("background.switch")).keys([uiCmd("\u2318" + _t("background.key"))])
70118           );
70119         } else if (hasDescription || isOverflowing) {
70120           item.call(
70121             uiTooltip().placement(placement).title(() => hasDescription ? d.description() : d.label())
70122           );
70123         }
70124       });
70125     }
70126     function drawListItems(layerList, type2, change, filter2) {
70127       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2).sort(function(a, b) {
70128         return a.best() && !b.best() ? -1 : b.best() && !a.best() ? 1 : descending(a.area(), b.area()) || ascending(a.name(), b.name()) || 0;
70129       });
70130       var layerLinks = layerList.selectAll("li").data(sources, function(d, i2) {
70131         return d.id + "---" + i2;
70132       });
70133       layerLinks.exit().remove();
70134       var enter = layerLinks.enter().append("li").classed("layer-custom", function(d) {
70135         return d.id === "custom";
70136       }).classed("best", function(d) {
70137         return d.best();
70138       });
70139       var label = enter.append("label");
70140       label.append("input").attr("type", type2).attr("name", "background-layer").attr("value", function(d) {
70141         return d.id;
70142       }).on("change", change);
70143       label.append("span").each(function(d) {
70144         d.label()(select_default2(this));
70145       });
70146       enter.filter(function(d) {
70147         return d.id === "custom";
70148       }).append("button").attr("class", "layer-browse").call(
70149         uiTooltip().title(() => _t.append("settings.custom_background.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
70150       ).on("click", function(d3_event) {
70151         d3_event.preventDefault();
70152         editCustom();
70153       }).call(svgIcon("#iD-icon-more"));
70154       enter.filter(function(d) {
70155         return d.best();
70156       }).append("div").attr("class", "best").call(
70157         uiTooltip().title(() => _t.append("background.best_imagery")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
70158       ).append("span").text("\u2605");
70159       layerList.call(updateLayerSelections);
70160     }
70161     function updateLayerSelections(selection2) {
70162       function active(d) {
70163         return context.background().showsLayer(d);
70164       }
70165       selection2.selectAll("li").classed("active", active).classed("switch", function(d) {
70166         return d.id === previousBackgroundID();
70167       }).call(setTooltips).selectAll("input").property("checked", active);
70168     }
70169     function chooseBackground(d) {
70170       if (d.id === "custom" && !d.template()) {
70171         return editCustom();
70172       }
70173       var previousBackground = context.background().baseLayerSource();
70174       corePreferences("background-last-used-toggle", previousBackground.id);
70175       corePreferences("background-last-used", d.id);
70176       context.background().baseLayerSource(d);
70177     }
70178     function customChanged(d) {
70179       if (d && d.template) {
70180         _customSource.template(d.template);
70181         chooseBackground(_customSource);
70182       } else {
70183         _customSource.template("");
70184         chooseBackground(context.background().findSource("none"));
70185       }
70186     }
70187     function editCustom() {
70188       context.container().call(_settingsCustomBackground);
70189     }
70190     context.background().on("change.background_list", function() {
70191       _backgroundList.call(updateLayerSelections);
70192     });
70193     context.map().on(
70194       "move.background_list",
70195       debounce_default(function() {
70196         window.requestIdleCallback(section.reRender);
70197       }, 1e3)
70198     );
70199     return section;
70200   }
70201
70202   // modules/ui/sections/background_offset.js
70203   function uiSectionBackgroundOffset(context) {
70204     var section = uiSection("background-offset", context).label(() => _t.append("background.fix_misalignment")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
70205     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
70206     var _directions = [
70207       ["top", [0, -0.5]],
70208       ["left", [-0.5, 0]],
70209       ["right", [0.5, 0]],
70210       ["bottom", [0, 0.5]]
70211     ];
70212     function updateValue() {
70213       var meters = geoOffsetToMeters(context.background().offset());
70214       var x = +meters[0].toFixed(2);
70215       var y = +meters[1].toFixed(2);
70216       context.container().selectAll(".nudge-inner-rect").select("input").classed("error", false).property("value", x + ", " + y);
70217       context.container().selectAll(".nudge-reset").classed("disabled", function() {
70218         return x === 0 && y === 0;
70219       });
70220     }
70221     function resetOffset() {
70222       context.background().offset([0, 0]);
70223       updateValue();
70224     }
70225     function nudge(d) {
70226       context.background().nudge(d, context.map().zoom());
70227       updateValue();
70228     }
70229     function inputOffset() {
70230       var input = select_default2(this);
70231       var d = input.node().value;
70232       if (d === "")
70233         return resetOffset();
70234       d = d.replace(/;/g, ",").split(",").map(function(n2) {
70235         return !isNaN(n2) && n2;
70236       });
70237       if (d.length !== 2 || !d[0] || !d[1]) {
70238         input.classed("error", true);
70239         return;
70240       }
70241       context.background().offset(geoMetersToOffset(d));
70242       updateValue();
70243     }
70244     function dragOffset(d3_event) {
70245       if (d3_event.button !== 0)
70246         return;
70247       var origin = [d3_event.clientX, d3_event.clientY];
70248       var pointerId = d3_event.pointerId || "mouse";
70249       context.container().append("div").attr("class", "nudge-surface");
70250       select_default2(window).on(_pointerPrefix + "move.drag-bg-offset", pointermove).on(_pointerPrefix + "up.drag-bg-offset", pointerup);
70251       if (_pointerPrefix === "pointer") {
70252         select_default2(window).on("pointercancel.drag-bg-offset", pointerup);
70253       }
70254       function pointermove(d3_event2) {
70255         if (pointerId !== (d3_event2.pointerId || "mouse"))
70256           return;
70257         var latest = [d3_event2.clientX, d3_event2.clientY];
70258         var d = [
70259           -(origin[0] - latest[0]) / 4,
70260           -(origin[1] - latest[1]) / 4
70261         ];
70262         origin = latest;
70263         nudge(d);
70264       }
70265       function pointerup(d3_event2) {
70266         if (pointerId !== (d3_event2.pointerId || "mouse"))
70267           return;
70268         if (d3_event2.button !== 0)
70269           return;
70270         context.container().selectAll(".nudge-surface").remove();
70271         select_default2(window).on(".drag-bg-offset", null);
70272       }
70273     }
70274     function renderDisclosureContent(selection2) {
70275       var container = selection2.selectAll(".nudge-container").data([0]);
70276       var containerEnter = container.enter().append("div").attr("class", "nudge-container");
70277       containerEnter.append("div").attr("class", "nudge-instructions").call(_t.append("background.offset"));
70278       var nudgeWrapEnter = containerEnter.append("div").attr("class", "nudge-controls-wrap");
70279       var nudgeEnter = nudgeWrapEnter.append("div").attr("class", "nudge-outer-rect").on(_pointerPrefix + "down", dragOffset);
70280       nudgeEnter.append("div").attr("class", "nudge-inner-rect").append("input").attr("type", "text").attr("aria-label", _t("background.offset_label")).on("change", inputOffset);
70281       nudgeWrapEnter.append("div").selectAll("button").data(_directions).enter().append("button").attr("title", function(d) {
70282         return _t(`background.nudge.${d[0]}`);
70283       }).attr("class", function(d) {
70284         return d[0] + " nudge";
70285       }).on("click", function(d3_event, d) {
70286         nudge(d[1]);
70287       });
70288       nudgeWrapEnter.append("button").attr("title", _t("background.reset")).attr("class", "nudge-reset disabled").on("click", function(d3_event) {
70289         d3_event.preventDefault();
70290         resetOffset();
70291       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
70292       updateValue();
70293     }
70294     context.background().on("change.backgroundOffset-update", updateValue);
70295     return section;
70296   }
70297
70298   // modules/ui/sections/overlay_list.js
70299   function uiSectionOverlayList(context) {
70300     var section = uiSection("overlay-list", context).label(() => _t.append("background.overlays")).disclosureContent(renderDisclosureContent);
70301     var _overlayList = select_default2(null);
70302     function setTooltips(selection2) {
70303       selection2.each(function(d, i2, nodes) {
70304         var item = select_default2(this).select("label");
70305         var span = item.select("span");
70306         var placement = i2 < nodes.length / 2 ? "bottom" : "top";
70307         var description = d.description();
70308         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
70309         item.call(uiTooltip().destroyAny);
70310         if (description || isOverflowing) {
70311           item.call(
70312             uiTooltip().placement(placement).title(() => description || d.name())
70313           );
70314         }
70315       });
70316     }
70317     function updateLayerSelections(selection2) {
70318       function active(d) {
70319         return context.background().showsLayer(d);
70320       }
70321       selection2.selectAll("li").classed("active", active).call(setTooltips).selectAll("input").property("checked", active);
70322     }
70323     function chooseOverlay(d3_event, d) {
70324       d3_event.preventDefault();
70325       context.background().toggleOverlayLayer(d);
70326       _overlayList.call(updateLayerSelections);
70327       document.activeElement.blur();
70328     }
70329     function drawListItems(layerList, type2, change, filter2) {
70330       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2);
70331       var layerLinks = layerList.selectAll("li").data(sources, function(d) {
70332         return d.name();
70333       });
70334       layerLinks.exit().remove();
70335       var enter = layerLinks.enter().append("li");
70336       var label = enter.append("label");
70337       label.append("input").attr("type", type2).attr("name", "layers").on("change", change);
70338       label.append("span").each(function(d) {
70339         d.label()(select_default2(this));
70340       });
70341       layerList.selectAll("li").sort(sortSources);
70342       layerList.call(updateLayerSelections);
70343       function sortSources(a, b) {
70344         return a.best() && !b.best() ? -1 : b.best() && !a.best() ? 1 : descending(a.area(), b.area()) || ascending(a.name(), b.name()) || 0;
70345       }
70346     }
70347     function renderDisclosureContent(selection2) {
70348       var container = selection2.selectAll(".layer-overlay-list").data([0]);
70349       _overlayList = container.enter().append("ul").attr("class", "layer-list layer-overlay-list").attr("dir", "auto").merge(container);
70350       _overlayList.call(drawListItems, "checkbox", chooseOverlay, function(d) {
70351         return !d.isHidden() && d.overlay;
70352       });
70353     }
70354     context.map().on(
70355       "move.overlay_list",
70356       debounce_default(function() {
70357         window.requestIdleCallback(section.reRender);
70358       }, 1e3)
70359     );
70360     return section;
70361   }
70362
70363   // modules/ui/panes/background.js
70364   function uiPaneBackground(context) {
70365     var backgroundPane = uiPane("background", context).key(_t("background.key")).label(_t.append("background.title")).description(_t.append("background.description")).iconName("iD-icon-layers").sections([
70366       uiSectionBackgroundList(context),
70367       uiSectionOverlayList(context),
70368       uiSectionBackgroundDisplayOptions(context),
70369       uiSectionBackgroundOffset(context)
70370     ]);
70371     return backgroundPane;
70372   }
70373
70374   // modules/ui/panes/help.js
70375   function uiPaneHelp(context) {
70376     var docKeys = [
70377       ["help", [
70378         "welcome",
70379         "open_data_h",
70380         "open_data",
70381         "before_start_h",
70382         "before_start",
70383         "open_source_h",
70384         "open_source",
70385         "open_source_attribution",
70386         "open_source_help"
70387       ]],
70388       ["overview", [
70389         "navigation_h",
70390         "navigation_drag",
70391         "navigation_zoom",
70392         "features_h",
70393         "features",
70394         "nodes_ways"
70395       ]],
70396       ["editing", [
70397         "select_h",
70398         "select_left_click",
70399         "select_right_click",
70400         "select_space",
70401         "multiselect_h",
70402         "multiselect",
70403         "multiselect_shift_click",
70404         "multiselect_lasso",
70405         "undo_redo_h",
70406         "undo_redo",
70407         "save_h",
70408         "save",
70409         "save_validation",
70410         "upload_h",
70411         "upload",
70412         "backups_h",
70413         "backups",
70414         "keyboard_h",
70415         "keyboard"
70416       ]],
70417       ["feature_editor", [
70418         "intro",
70419         "definitions",
70420         "type_h",
70421         "type",
70422         "type_picker",
70423         "fields_h",
70424         "fields_all_fields",
70425         "fields_example",
70426         "fields_add_field",
70427         "tags_h",
70428         "tags_all_tags",
70429         "tags_resources"
70430       ]],
70431       ["points", [
70432         "intro",
70433         "add_point_h",
70434         "add_point",
70435         "add_point_finish",
70436         "move_point_h",
70437         "move_point",
70438         "delete_point_h",
70439         "delete_point",
70440         "delete_point_command"
70441       ]],
70442       ["lines", [
70443         "intro",
70444         "add_line_h",
70445         "add_line",
70446         "add_line_draw",
70447         "add_line_continue",
70448         "add_line_finish",
70449         "modify_line_h",
70450         "modify_line_dragnode",
70451         "modify_line_addnode",
70452         "connect_line_h",
70453         "connect_line",
70454         "connect_line_display",
70455         "connect_line_drag",
70456         "connect_line_tag",
70457         "disconnect_line_h",
70458         "disconnect_line_command",
70459         "move_line_h",
70460         "move_line_command",
70461         "move_line_connected",
70462         "delete_line_h",
70463         "delete_line",
70464         "delete_line_command"
70465       ]],
70466       ["areas", [
70467         "intro",
70468         "point_or_area_h",
70469         "point_or_area",
70470         "add_area_h",
70471         "add_area_command",
70472         "add_area_draw",
70473         "add_area_continue",
70474         "add_area_finish",
70475         "square_area_h",
70476         "square_area_command",
70477         "modify_area_h",
70478         "modify_area_dragnode",
70479         "modify_area_addnode",
70480         "delete_area_h",
70481         "delete_area",
70482         "delete_area_command"
70483       ]],
70484       ["relations", [
70485         "intro",
70486         "edit_relation_h",
70487         "edit_relation",
70488         "edit_relation_add",
70489         "edit_relation_delete",
70490         "maintain_relation_h",
70491         "maintain_relation",
70492         "relation_types_h",
70493         "multipolygon_h",
70494         "multipolygon",
70495         "multipolygon_create",
70496         "multipolygon_merge",
70497         "turn_restriction_h",
70498         "turn_restriction",
70499         "turn_restriction_field",
70500         "turn_restriction_editing",
70501         "route_h",
70502         "route",
70503         "route_add",
70504         "boundary_h",
70505         "boundary",
70506         "boundary_add"
70507       ]],
70508       ["operations", [
70509         "intro",
70510         "intro_2",
70511         "straighten",
70512         "orthogonalize",
70513         "circularize",
70514         "move",
70515         "rotate",
70516         "reflect",
70517         "continue",
70518         "reverse",
70519         "disconnect",
70520         "split",
70521         "extract",
70522         "merge",
70523         "delete",
70524         "downgrade",
70525         "copy_paste"
70526       ]],
70527       ["notes", [
70528         "intro",
70529         "add_note_h",
70530         "add_note",
70531         "place_note",
70532         "move_note",
70533         "update_note_h",
70534         "update_note",
70535         "save_note_h",
70536         "save_note"
70537       ]],
70538       ["imagery", [
70539         "intro",
70540         "sources_h",
70541         "choosing",
70542         "sources",
70543         "offsets_h",
70544         "offset",
70545         "offset_change"
70546       ]],
70547       ["streetlevel", [
70548         "intro",
70549         "using_h",
70550         "using",
70551         "photos",
70552         "viewer"
70553       ]],
70554       ["gps", [
70555         "intro",
70556         "survey",
70557         "using_h",
70558         "using",
70559         "tracing",
70560         "upload"
70561       ]],
70562       ["qa", [
70563         "intro",
70564         "tools_h",
70565         "tools",
70566         "issues_h",
70567         "issues"
70568       ]]
70569     ];
70570     var headings = {
70571       "help.help.open_data_h": 3,
70572       "help.help.before_start_h": 3,
70573       "help.help.open_source_h": 3,
70574       "help.overview.navigation_h": 3,
70575       "help.overview.features_h": 3,
70576       "help.editing.select_h": 3,
70577       "help.editing.multiselect_h": 3,
70578       "help.editing.undo_redo_h": 3,
70579       "help.editing.save_h": 3,
70580       "help.editing.upload_h": 3,
70581       "help.editing.backups_h": 3,
70582       "help.editing.keyboard_h": 3,
70583       "help.feature_editor.type_h": 3,
70584       "help.feature_editor.fields_h": 3,
70585       "help.feature_editor.tags_h": 3,
70586       "help.points.add_point_h": 3,
70587       "help.points.move_point_h": 3,
70588       "help.points.delete_point_h": 3,
70589       "help.lines.add_line_h": 3,
70590       "help.lines.modify_line_h": 3,
70591       "help.lines.connect_line_h": 3,
70592       "help.lines.disconnect_line_h": 3,
70593       "help.lines.move_line_h": 3,
70594       "help.lines.delete_line_h": 3,
70595       "help.areas.point_or_area_h": 3,
70596       "help.areas.add_area_h": 3,
70597       "help.areas.square_area_h": 3,
70598       "help.areas.modify_area_h": 3,
70599       "help.areas.delete_area_h": 3,
70600       "help.relations.edit_relation_h": 3,
70601       "help.relations.maintain_relation_h": 3,
70602       "help.relations.relation_types_h": 2,
70603       "help.relations.multipolygon_h": 3,
70604       "help.relations.turn_restriction_h": 3,
70605       "help.relations.route_h": 3,
70606       "help.relations.boundary_h": 3,
70607       "help.notes.add_note_h": 3,
70608       "help.notes.update_note_h": 3,
70609       "help.notes.save_note_h": 3,
70610       "help.imagery.sources_h": 3,
70611       "help.imagery.offsets_h": 3,
70612       "help.streetlevel.using_h": 3,
70613       "help.gps.using_h": 3,
70614       "help.qa.tools_h": 3,
70615       "help.qa.issues_h": 3
70616     };
70617     var docs = docKeys.map(function(key) {
70618       var helpkey = "help." + key[0];
70619       var helpPaneReplacements = { version: context.version };
70620       var text2 = key[1].reduce(function(all, part) {
70621         var subkey = helpkey + "." + part;
70622         var depth = headings[subkey];
70623         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
70624         return all + hhh + helpHtml(subkey, helpPaneReplacements) + "\n\n";
70625       }, "");
70626       return {
70627         title: _t.html(helpkey + ".title"),
70628         content: marked(text2.trim()).replace(/<code>/g, "<kbd>").replace(/<\/code>/g, "</kbd>")
70629       };
70630     });
70631     var helpPane = uiPane("help", context).key(_t("help.key")).label(_t.append("help.title")).description(_t.append("help.title")).iconName("iD-icon-help");
70632     helpPane.renderContent = function(content) {
70633       function clickHelp(d, i2) {
70634         var rtl = _mainLocalizer.textDirection() === "rtl";
70635         content.property("scrollTop", 0);
70636         helpPane.selection().select(".pane-heading h2").html(d.title);
70637         body.html(d.content);
70638         body.selectAll("a").attr("target", "_blank");
70639         menuItems.classed("selected", function(m) {
70640           return m.title === d.title;
70641         });
70642         nav.html("");
70643         if (rtl) {
70644           nav.call(drawNext).call(drawPrevious);
70645         } else {
70646           nav.call(drawPrevious).call(drawNext);
70647         }
70648         function drawNext(selection2) {
70649           if (i2 < docs.length - 1) {
70650             var nextLink = selection2.append("a").attr("href", "#").attr("class", "next").on("click", function(d3_event) {
70651               d3_event.preventDefault();
70652               clickHelp(docs[i2 + 1], i2 + 1);
70653             });
70654             nextLink.append("span").html(docs[i2 + 1].title).call(svgIcon(rtl ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
70655           }
70656         }
70657         function drawPrevious(selection2) {
70658           if (i2 > 0) {
70659             var prevLink = selection2.append("a").attr("href", "#").attr("class", "previous").on("click", function(d3_event) {
70660               d3_event.preventDefault();
70661               clickHelp(docs[i2 - 1], i2 - 1);
70662             });
70663             prevLink.call(svgIcon(rtl ? "#iD-icon-forward" : "#iD-icon-backward", "inline")).append("span").html(docs[i2 - 1].title);
70664           }
70665         }
70666       }
70667       function clickWalkthrough(d3_event) {
70668         d3_event.preventDefault();
70669         if (context.inIntro())
70670           return;
70671         context.container().call(uiIntro(context));
70672         context.ui().togglePanes();
70673       }
70674       function clickShortcuts(d3_event) {
70675         d3_event.preventDefault();
70676         context.container().call(context.ui().shortcuts, true);
70677       }
70678       var toc = content.append("ul").attr("class", "toc");
70679       var menuItems = toc.selectAll("li").data(docs).enter().append("li").append("a").attr("role", "button").attr("href", "#").html(function(d) {
70680         return d.title;
70681       }).on("click", function(d3_event, d) {
70682         d3_event.preventDefault();
70683         clickHelp(d, docs.indexOf(d));
70684       });
70685       var shortcuts = toc.append("li").attr("class", "shortcuts").call(
70686         uiTooltip().title(() => _t.append("shortcuts.tooltip")).keys(["?"]).placement("top")
70687       ).append("a").attr("href", "#").on("click", clickShortcuts);
70688       shortcuts.append("div").call(_t.append("shortcuts.title"));
70689       var walkthrough = toc.append("li").attr("class", "walkthrough").append("a").attr("href", "#").on("click", clickWalkthrough);
70690       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
70691       walkthrough.append("div").call(_t.append("splash.walkthrough"));
70692       var helpContent = content.append("div").attr("class", "left-content");
70693       var body = helpContent.append("div").attr("class", "body");
70694       var nav = helpContent.append("div").attr("class", "nav");
70695       clickHelp(docs[0], 0);
70696     };
70697     return helpPane;
70698   }
70699
70700   // modules/ui/sections/validation_issues.js
70701   function uiSectionValidationIssues(id2, severity, context) {
70702     var _issues = [];
70703     var section = uiSection(id2, context).label(function() {
70704       if (!_issues)
70705         return "";
70706       var issueCountText = _issues.length > 1e3 ? "1000+" : String(_issues.length);
70707       return _t.append("inspector.title_count", { title: _t("issues." + severity + "s.list_title"), count: issueCountText });
70708     }).disclosureContent(renderDisclosureContent).shouldDisplay(function() {
70709       return _issues && _issues.length;
70710     });
70711     function getOptions() {
70712       return {
70713         what: corePreferences("validate-what") || "edited",
70714         where: corePreferences("validate-where") || "all"
70715       };
70716     }
70717     function reloadIssues() {
70718       _issues = context.validator().getIssuesBySeverity(getOptions())[severity];
70719     }
70720     function renderDisclosureContent(selection2) {
70721       var center = context.map().center();
70722       var graph = context.graph();
70723       var issues = _issues.map(function withDistance(issue) {
70724         var extent = issue.extent(graph);
70725         var dist = extent ? geoSphericalDistance(center, extent.center()) : 0;
70726         return Object.assign(issue, { dist });
70727       }).sort(function byDistance(a, b) {
70728         return a.dist - b.dist;
70729       });
70730       issues = issues.slice(0, 1e3);
70731       selection2.call(drawIssuesList, issues);
70732     }
70733     function drawIssuesList(selection2, issues) {
70734       var list = selection2.selectAll(".issues-list").data([0]);
70735       list = list.enter().append("ul").attr("class", "layer-list issues-list " + severity + "s-list").merge(list);
70736       var items = list.selectAll("li").data(issues, function(d) {
70737         return d.key;
70738       });
70739       items.exit().remove();
70740       var itemsEnter = items.enter().append("li").attr("class", function(d) {
70741         return "issue severity-" + d.severity;
70742       });
70743       var labelsEnter = itemsEnter.append("button").attr("class", "issue-label").on("click", function(d3_event, d) {
70744         context.validator().focusIssue(d);
70745       }).on("mouseover", function(d3_event, d) {
70746         utilHighlightEntities(d.entityIds, true, context);
70747       }).on("mouseout", function(d3_event, d) {
70748         utilHighlightEntities(d.entityIds, false, context);
70749       });
70750       var textEnter = labelsEnter.append("span").attr("class", "issue-text");
70751       textEnter.append("span").attr("class", "issue-icon").each(function(d) {
70752         var iconName = "#iD-icon-" + (d.severity === "warning" ? "alert" : "error");
70753         select_default2(this).call(svgIcon(iconName));
70754       });
70755       textEnter.append("span").attr("class", "issue-message");
70756       items = items.merge(itemsEnter).order();
70757       items.selectAll(".issue-message").text("").each(function(d) {
70758         return d.message(context)(select_default2(this));
70759       });
70760     }
70761     context.validator().on("validated.uiSectionValidationIssues" + id2, function() {
70762       window.requestIdleCallback(function() {
70763         reloadIssues();
70764         section.reRender();
70765       });
70766     });
70767     context.map().on(
70768       "move.uiSectionValidationIssues" + id2,
70769       debounce_default(function() {
70770         window.requestIdleCallback(function() {
70771           if (getOptions().where === "visible") {
70772             reloadIssues();
70773           }
70774           section.reRender();
70775         });
70776       }, 1e3)
70777     );
70778     return section;
70779   }
70780
70781   // modules/ui/sections/validation_options.js
70782   function uiSectionValidationOptions(context) {
70783     var section = uiSection("issues-options", context).content(renderContent);
70784     function renderContent(selection2) {
70785       var container = selection2.selectAll(".issues-options-container").data([0]);
70786       container = container.enter().append("div").attr("class", "issues-options-container").merge(container);
70787       var data = [
70788         { key: "what", values: ["edited", "all"] },
70789         { key: "where", values: ["visible", "all"] }
70790       ];
70791       var options2 = container.selectAll(".issues-option").data(data, function(d) {
70792         return d.key;
70793       });
70794       var optionsEnter = options2.enter().append("div").attr("class", function(d) {
70795         return "issues-option issues-option-" + d.key;
70796       });
70797       optionsEnter.append("div").attr("class", "issues-option-title").html(function(d) {
70798         return _t.html("issues.options." + d.key + ".title");
70799       });
70800       var valuesEnter = optionsEnter.selectAll("label").data(function(d) {
70801         return d.values.map(function(val) {
70802           return { value: val, key: d.key };
70803         });
70804       }).enter().append("label");
70805       valuesEnter.append("input").attr("type", "radio").attr("name", function(d) {
70806         return "issues-option-" + d.key;
70807       }).attr("value", function(d) {
70808         return d.value;
70809       }).property("checked", function(d) {
70810         return getOptions()[d.key] === d.value;
70811       }).on("change", function(d3_event, d) {
70812         updateOptionValue(d3_event, d.key, d.value);
70813       });
70814       valuesEnter.append("span").html(function(d) {
70815         return _t.html("issues.options." + d.key + "." + d.value);
70816       });
70817     }
70818     function getOptions() {
70819       return {
70820         what: corePreferences("validate-what") || "edited",
70821         // 'all', 'edited'
70822         where: corePreferences("validate-where") || "all"
70823         // 'all', 'visible'
70824       };
70825     }
70826     function updateOptionValue(d3_event, d, val) {
70827       if (!val && d3_event && d3_event.target) {
70828         val = d3_event.target.value;
70829       }
70830       corePreferences("validate-" + d, val);
70831       context.validator().validate();
70832     }
70833     return section;
70834   }
70835
70836   // modules/ui/sections/validation_rules.js
70837   function uiSectionValidationRules(context) {
70838     var MINSQUARE = 0;
70839     var MAXSQUARE = 20;
70840     var DEFAULTSQUARE = 5;
70841     var section = uiSection("issues-rules", context).disclosureContent(renderDisclosureContent).label(() => _t.append("issues.rules.title"));
70842     var _ruleKeys = context.validator().getRuleKeys().filter(function(key) {
70843       return key !== "maprules";
70844     }).sort(function(key1, key2) {
70845       return _t("issues." + key1 + ".title") < _t("issues." + key2 + ".title") ? -1 : 1;
70846     });
70847     function renderDisclosureContent(selection2) {
70848       var container = selection2.selectAll(".issues-rulelist-container").data([0]);
70849       var containerEnter = container.enter().append("div").attr("class", "issues-rulelist-container");
70850       containerEnter.append("ul").attr("class", "layer-list issue-rules-list");
70851       var ruleLinks = containerEnter.append("div").attr("class", "issue-rules-links section-footer");
70852       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
70853         d3_event.preventDefault();
70854         context.validator().disableRules(_ruleKeys);
70855       });
70856       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
70857         d3_event.preventDefault();
70858         context.validator().disableRules([]);
70859       });
70860       container = container.merge(containerEnter);
70861       container.selectAll(".issue-rules-list").call(drawListItems, _ruleKeys, "checkbox", "rule", toggleRule, isRuleEnabled);
70862     }
70863     function drawListItems(selection2, data, type2, name, change, active) {
70864       var items = selection2.selectAll("li").data(data);
70865       items.exit().remove();
70866       var enter = items.enter().append("li");
70867       if (name === "rule") {
70868         enter.call(
70869           uiTooltip().title(function(d) {
70870             return _t.append("issues." + d + ".tip");
70871           }).placement("top")
70872         );
70873       }
70874       var label = enter.append("label");
70875       label.append("input").attr("type", type2).attr("name", name).on("change", change);
70876       label.append("span").html(function(d) {
70877         var params = {};
70878         if (d === "unsquare_way") {
70879           params.val = { html: '<span class="square-degrees"></span>' };
70880         }
70881         return _t.html("issues." + d + ".title", params);
70882       });
70883       items = items.merge(enter);
70884       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
70885       var degStr = corePreferences("validate-square-degrees");
70886       if (degStr === null) {
70887         degStr = DEFAULTSQUARE.toString();
70888       }
70889       var span = items.selectAll(".square-degrees");
70890       var input = span.selectAll(".square-degrees-input").data([0]);
70891       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) {
70892         d3_event.preventDefault();
70893         d3_event.stopPropagation();
70894         this.select();
70895       }).on("keyup", function(d3_event) {
70896         if (d3_event.keyCode === 13) {
70897           this.blur();
70898           this.select();
70899         }
70900       }).on("blur", changeSquare).merge(input).property("value", degStr);
70901     }
70902     function changeSquare() {
70903       var input = select_default2(this);
70904       var degStr = utilGetSetValue(input).trim();
70905       var degNum = Number(degStr);
70906       if (!isFinite(degNum)) {
70907         degNum = DEFAULTSQUARE;
70908       } else if (degNum > MAXSQUARE) {
70909         degNum = MAXSQUARE;
70910       } else if (degNum < MINSQUARE) {
70911         degNum = MINSQUARE;
70912       }
70913       degNum = Math.round(degNum * 10) / 10;
70914       degStr = degNum.toString();
70915       input.property("value", degStr);
70916       corePreferences("validate-square-degrees", degStr);
70917       context.validator().revalidateUnsquare();
70918     }
70919     function isRuleEnabled(d) {
70920       return context.validator().isRuleEnabled(d);
70921     }
70922     function toggleRule(d3_event, d) {
70923       context.validator().toggleRule(d);
70924     }
70925     context.validator().on("validated.uiSectionValidationRules", function() {
70926       window.requestIdleCallback(section.reRender);
70927     });
70928     return section;
70929   }
70930
70931   // modules/ui/sections/validation_status.js
70932   function uiSectionValidationStatus(context) {
70933     var section = uiSection("issues-status", context).content(renderContent).shouldDisplay(function() {
70934       var issues = context.validator().getIssues(getOptions());
70935       return issues.length === 0;
70936     });
70937     function getOptions() {
70938       return {
70939         what: corePreferences("validate-what") || "edited",
70940         where: corePreferences("validate-where") || "all"
70941       };
70942     }
70943     function renderContent(selection2) {
70944       var box = selection2.selectAll(".box").data([0]);
70945       var boxEnter = box.enter().append("div").attr("class", "box");
70946       boxEnter.append("div").call(svgIcon("#iD-icon-apply", "pre-text"));
70947       var noIssuesMessage = boxEnter.append("span");
70948       noIssuesMessage.append("strong").attr("class", "message");
70949       noIssuesMessage.append("br");
70950       noIssuesMessage.append("span").attr("class", "details");
70951       renderIgnoredIssuesReset(selection2);
70952       setNoIssuesText(selection2);
70953     }
70954     function renderIgnoredIssuesReset(selection2) {
70955       var ignoredIssues = context.validator().getIssues({ what: "all", where: "all", includeDisabledRules: true, includeIgnored: "only" });
70956       var resetIgnored = selection2.selectAll(".reset-ignored").data(ignoredIssues.length ? [0] : []);
70957       resetIgnored.exit().remove();
70958       var resetIgnoredEnter = resetIgnored.enter().append("div").attr("class", "reset-ignored section-footer");
70959       resetIgnoredEnter.append("a").attr("href", "#");
70960       resetIgnored = resetIgnored.merge(resetIgnoredEnter);
70961       resetIgnored.select("a").html(_t.html("inspector.title_count", { title: { html: _t.html("issues.reset_ignored") }, count: ignoredIssues.length }));
70962       resetIgnored.on("click", function(d3_event) {
70963         d3_event.preventDefault();
70964         context.validator().resetIgnoredIssues();
70965       });
70966     }
70967     function setNoIssuesText(selection2) {
70968       var opts = getOptions();
70969       function checkForHiddenIssues(cases) {
70970         for (var type2 in cases) {
70971           var hiddenOpts = cases[type2];
70972           var hiddenIssues = context.validator().getIssues(hiddenOpts);
70973           if (hiddenIssues.length) {
70974             selection2.select(".box .details").html("").call(_t.append(
70975               "issues.no_issues.hidden_issues." + type2,
70976               { count: hiddenIssues.length.toString() }
70977             ));
70978             return;
70979           }
70980         }
70981         selection2.select(".box .details").html("").call(_t.append("issues.no_issues.hidden_issues.none"));
70982       }
70983       var messageType;
70984       if (opts.what === "edited" && opts.where === "visible") {
70985         messageType = "edits_in_view";
70986         checkForHiddenIssues({
70987           elsewhere: { what: "edited", where: "all" },
70988           everything_else: { what: "all", where: "visible" },
70989           disabled_rules: { what: "edited", where: "visible", includeDisabledRules: "only" },
70990           everything_else_elsewhere: { what: "all", where: "all" },
70991           disabled_rules_elsewhere: { what: "edited", where: "all", includeDisabledRules: "only" },
70992           ignored_issues: { what: "edited", where: "visible", includeIgnored: "only" },
70993           ignored_issues_elsewhere: { what: "edited", where: "all", includeIgnored: "only" }
70994         });
70995       } else if (opts.what === "edited" && opts.where === "all") {
70996         messageType = "edits";
70997         checkForHiddenIssues({
70998           everything_else: { what: "all", where: "all" },
70999           disabled_rules: { what: "edited", where: "all", includeDisabledRules: "only" },
71000           ignored_issues: { what: "edited", where: "all", includeIgnored: "only" }
71001         });
71002       } else if (opts.what === "all" && opts.where === "visible") {
71003         messageType = "everything_in_view";
71004         checkForHiddenIssues({
71005           elsewhere: { what: "all", where: "all" },
71006           disabled_rules: { what: "all", where: "visible", includeDisabledRules: "only" },
71007           disabled_rules_elsewhere: { what: "all", where: "all", includeDisabledRules: "only" },
71008           ignored_issues: { what: "all", where: "visible", includeIgnored: "only" },
71009           ignored_issues_elsewhere: { what: "all", where: "all", includeIgnored: "only" }
71010         });
71011       } else if (opts.what === "all" && opts.where === "all") {
71012         messageType = "everything";
71013         checkForHiddenIssues({
71014           disabled_rules: { what: "all", where: "all", includeDisabledRules: "only" },
71015           ignored_issues: { what: "all", where: "all", includeIgnored: "only" }
71016         });
71017       }
71018       if (opts.what === "edited" && context.history().difference().summary().length === 0) {
71019         messageType = "no_edits";
71020       }
71021       selection2.select(".box .message").html("").call(_t.append("issues.no_issues.message." + messageType));
71022     }
71023     context.validator().on("validated.uiSectionValidationStatus", function() {
71024       window.requestIdleCallback(section.reRender);
71025     });
71026     context.map().on(
71027       "move.uiSectionValidationStatus",
71028       debounce_default(function() {
71029         window.requestIdleCallback(section.reRender);
71030       }, 1e3)
71031     );
71032     return section;
71033   }
71034
71035   // modules/ui/panes/issues.js
71036   function uiPaneIssues(context) {
71037     var issuesPane = uiPane("issues", context).key(_t("issues.key")).label(_t.append("issues.title")).description(_t.append("issues.title")).iconName("iD-icon-alert").sections([
71038       uiSectionValidationOptions(context),
71039       uiSectionValidationStatus(context),
71040       uiSectionValidationIssues("issues-errors", "error", context),
71041       uiSectionValidationIssues("issues-warnings", "warning", context),
71042       uiSectionValidationRules(context)
71043     ]);
71044     return issuesPane;
71045   }
71046
71047   // modules/ui/settings/custom_data.js
71048   function uiSettingsCustomData(context) {
71049     var dispatch10 = dispatch_default("change");
71050     function render(selection2) {
71051       var dataLayer = context.layers().layer("data");
71052       var _origSettings = {
71053         fileList: dataLayer && dataLayer.fileList() || null,
71054         url: corePreferences("settings-custom-data-url")
71055       };
71056       var _currSettings = {
71057         fileList: dataLayer && dataLayer.fileList() || null,
71058         url: corePreferences("settings-custom-data-url")
71059       };
71060       var modal = uiConfirm(selection2).okButton();
71061       modal.classed("settings-modal settings-custom-data", true);
71062       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_data.header"));
71063       var textSection = modal.select(".modal-section.message-text");
71064       textSection.append("pre").attr("class", "instructions-file").call(_t.append("settings.custom_data.file.instructions"));
71065       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) {
71066         var files = d3_event.target.files;
71067         if (files && files.length) {
71068           _currSettings.url = "";
71069           textSection.select(".field-url").property("value", "");
71070           _currSettings.fileList = files;
71071         } else {
71072           _currSettings.fileList = null;
71073         }
71074       });
71075       textSection.append("h4").call(_t.append("settings.custom_data.or"));
71076       textSection.append("pre").attr("class", "instructions-url").call(_t.append("settings.custom_data.url.instructions"));
71077       textSection.append("textarea").attr("class", "field-url").attr("placeholder", _t("settings.custom_data.url.placeholder")).call(utilNoAuto).property("value", _currSettings.url);
71078       var buttonSection = modal.select(".modal-section.buttons");
71079       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
71080       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
71081       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
71082       function isSaveDisabled() {
71083         return null;
71084       }
71085       function clickCancel() {
71086         textSection.select(".field-url").property("value", _origSettings.url);
71087         corePreferences("settings-custom-data-url", _origSettings.url);
71088         this.blur();
71089         modal.close();
71090       }
71091       function clickSave() {
71092         _currSettings.url = textSection.select(".field-url").property("value").trim();
71093         if (_currSettings.url) {
71094           _currSettings.fileList = null;
71095         }
71096         if (_currSettings.fileList) {
71097           _currSettings.url = "";
71098         }
71099         corePreferences("settings-custom-data-url", _currSettings.url);
71100         this.blur();
71101         modal.close();
71102         dispatch10.call("change", this, _currSettings);
71103       }
71104     }
71105     return utilRebind(render, dispatch10, "on");
71106   }
71107
71108   // modules/ui/sections/data_layers.js
71109   function uiSectionDataLayers(context) {
71110     var settingsCustomData = uiSettingsCustomData(context).on("change", customChanged);
71111     var layers = context.layers();
71112     var section = uiSection("data-layers", context).label(() => _t.append("map_data.data_layers")).disclosureContent(renderDisclosureContent);
71113     function renderDisclosureContent(selection2) {
71114       var container = selection2.selectAll(".data-layer-container").data([0]);
71115       container.enter().append("div").attr("class", "data-layer-container").merge(container).call(drawOsmItems).call(drawQAItems).call(drawCustomDataItems).call(drawVectorItems).call(drawPanelItems);
71116     }
71117     function showsLayer(which) {
71118       var layer = layers.layer(which);
71119       if (layer) {
71120         return layer.enabled();
71121       }
71122       return false;
71123     }
71124     function setLayer(which, enabled) {
71125       var mode = context.mode();
71126       if (mode && /^draw/.test(mode.id))
71127         return;
71128       var layer = layers.layer(which);
71129       if (layer) {
71130         layer.enabled(enabled);
71131         if (!enabled && (which === "osm" || which === "notes")) {
71132           context.enter(modeBrowse(context));
71133         }
71134       }
71135     }
71136     function toggleLayer(which) {
71137       setLayer(which, !showsLayer(which));
71138     }
71139     function drawOsmItems(selection2) {
71140       var osmKeys = ["osm", "notes"];
71141       var osmLayers = layers.all().filter(function(obj) {
71142         return osmKeys.indexOf(obj.id) !== -1;
71143       });
71144       var ul = selection2.selectAll(".layer-list-osm").data([0]);
71145       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-osm").merge(ul);
71146       var li = ul.selectAll(".list-item").data(osmLayers);
71147       li.exit().remove();
71148       var liEnter = li.enter().append("li").attr("class", function(d) {
71149         return "list-item list-item-" + d.id;
71150       });
71151       var labelEnter = liEnter.append("label").each(function(d) {
71152         if (d.id === "osm") {
71153           select_default2(this).call(
71154             uiTooltip().title(() => _t.append("map_data.layers." + d.id + ".tooltip")).keys([uiCmd("\u2325" + _t("area_fill.wireframe.key"))]).placement("bottom")
71155           );
71156         } else {
71157           select_default2(this).call(
71158             uiTooltip().title(() => _t.append("map_data.layers." + d.id + ".tooltip")).placement("bottom")
71159           );
71160         }
71161       });
71162       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
71163         toggleLayer(d.id);
71164       });
71165       labelEnter.append("span").html(function(d) {
71166         return _t.html("map_data.layers." + d.id + ".title");
71167       });
71168       li.merge(liEnter).classed("active", function(d) {
71169         return d.layer.enabled();
71170       }).selectAll("input").property("checked", function(d) {
71171         return d.layer.enabled();
71172       });
71173     }
71174     function drawQAItems(selection2) {
71175       var qaKeys = ["keepRight", "improveOSM", "osmose"];
71176       var qaLayers = layers.all().filter(function(obj) {
71177         return qaKeys.indexOf(obj.id) !== -1;
71178       });
71179       var ul = selection2.selectAll(".layer-list-qa").data([0]);
71180       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-qa").merge(ul);
71181       var li = ul.selectAll(".list-item").data(qaLayers);
71182       li.exit().remove();
71183       var liEnter = li.enter().append("li").attr("class", function(d) {
71184         return "list-item list-item-" + d.id;
71185       });
71186       var labelEnter = liEnter.append("label").each(function(d) {
71187         select_default2(this).call(
71188           uiTooltip().title(() => _t.append("map_data.layers." + d.id + ".tooltip")).placement("bottom")
71189         );
71190       });
71191       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
71192         toggleLayer(d.id);
71193       });
71194       labelEnter.append("span").each(function(d) {
71195         _t.append("map_data.layers." + d.id + ".title")(select_default2(this));
71196       });
71197       li.merge(liEnter).classed("active", function(d) {
71198         return d.layer.enabled();
71199       }).selectAll("input").property("checked", function(d) {
71200         return d.layer.enabled();
71201       });
71202     }
71203     function drawVectorItems(selection2) {
71204       var dataLayer = layers.layer("data");
71205       var vtData = [
71206         {
71207           name: "Detroit Neighborhoods/Parks",
71208           src: "neighborhoods-parks",
71209           tooltip: "Neighborhood boundaries and parks as compiled by City of Detroit in concert with community groups.",
71210           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"
71211         },
71212         {
71213           name: "Detroit Composite POIs",
71214           src: "composite-poi",
71215           tooltip: "Fire Inspections, Business Licenses, and other public location data collated from the City of Detroit.",
71216           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"
71217         },
71218         {
71219           name: "Detroit All-The-Places POIs",
71220           src: "alltheplaces-poi",
71221           tooltip: "Public domain business location data created by web scrapers.",
71222           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"
71223         }
71224       ];
71225       var detroit = geoExtent([-83.5, 42.1], [-82.8, 42.5]);
71226       var showVectorItems = context.map().zoom() > 9 && detroit.contains(context.map().center());
71227       var container = selection2.selectAll(".vectortile-container").data(showVectorItems ? [0] : []);
71228       container.exit().remove();
71229       var containerEnter = container.enter().append("div").attr("class", "vectortile-container");
71230       containerEnter.append("h4").attr("class", "vectortile-header").text("Detroit Vector Tiles (Beta)");
71231       containerEnter.append("ul").attr("class", "layer-list layer-list-vectortile");
71232       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");
71233       container = container.merge(containerEnter);
71234       var ul = container.selectAll(".layer-list-vectortile");
71235       var li = ul.selectAll(".list-item").data(vtData);
71236       li.exit().remove();
71237       var liEnter = li.enter().append("li").attr("class", function(d) {
71238         return "list-item list-item-" + d.src;
71239       });
71240       var labelEnter = liEnter.append("label").each(function(d) {
71241         select_default2(this).call(
71242           uiTooltip().title(d.tooltip).placement("top")
71243         );
71244       });
71245       labelEnter.append("input").attr("type", "radio").attr("name", "vectortile").on("change", selectVTLayer);
71246       labelEnter.append("span").text(function(d) {
71247         return d.name;
71248       });
71249       li.merge(liEnter).classed("active", isVTLayerSelected).selectAll("input").property("checked", isVTLayerSelected);
71250       function isVTLayerSelected(d) {
71251         return dataLayer && dataLayer.template() === d.template;
71252       }
71253       function selectVTLayer(d3_event, d) {
71254         corePreferences("settings-custom-data-url", d.template);
71255         if (dataLayer) {
71256           dataLayer.template(d.template, d.src);
71257           dataLayer.enabled(true);
71258         }
71259       }
71260     }
71261     function drawCustomDataItems(selection2) {
71262       var dataLayer = layers.layer("data");
71263       var hasData = dataLayer && dataLayer.hasData();
71264       var showsData = hasData && dataLayer.enabled();
71265       var ul = selection2.selectAll(".layer-list-data").data(dataLayer ? [0] : []);
71266       ul.exit().remove();
71267       var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-data");
71268       var liEnter = ulEnter.append("li").attr("class", "list-item-data");
71269       var labelEnter = liEnter.append("label").call(
71270         uiTooltip().title(() => _t.append("map_data.layers.custom.tooltip")).placement("top")
71271       );
71272       labelEnter.append("input").attr("type", "checkbox").on("change", function() {
71273         toggleLayer("data");
71274       });
71275       labelEnter.append("span").call(_t.append("map_data.layers.custom.title"));
71276       liEnter.append("button").attr("class", "open-data-options").call(
71277         uiTooltip().title(() => _t.append("settings.custom_data.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
71278       ).on("click", function(d3_event) {
71279         d3_event.preventDefault();
71280         editCustom();
71281       }).call(svgIcon("#iD-icon-more"));
71282       liEnter.append("button").attr("class", "zoom-to-data").call(
71283         uiTooltip().title(() => _t.append("map_data.layers.custom.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
71284       ).on("click", function(d3_event) {
71285         if (select_default2(this).classed("disabled"))
71286           return;
71287         d3_event.preventDefault();
71288         d3_event.stopPropagation();
71289         dataLayer.fitZoom();
71290       }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
71291       ul = ul.merge(ulEnter);
71292       ul.selectAll(".list-item-data").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
71293       ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
71294     }
71295     function editCustom() {
71296       context.container().call(settingsCustomData);
71297     }
71298     function customChanged(d) {
71299       var dataLayer = layers.layer("data");
71300       if (d && d.url) {
71301         dataLayer.url(d.url);
71302       } else if (d && d.fileList) {
71303         dataLayer.fileList(d.fileList);
71304       }
71305     }
71306     function drawPanelItems(selection2) {
71307       var panelsListEnter = selection2.selectAll(".md-extras-list").data([0]).enter().append("ul").attr("class", "layer-list md-extras-list");
71308       var historyPanelLabelEnter = panelsListEnter.append("li").attr("class", "history-panel-toggle-item").append("label").call(
71309         uiTooltip().title(() => _t.append("map_data.history_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.history.key"))]).placement("top")
71310       );
71311       historyPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
71312         d3_event.preventDefault();
71313         context.ui().info.toggle("history");
71314       });
71315       historyPanelLabelEnter.append("span").call(_t.append("map_data.history_panel.title"));
71316       var measurementPanelLabelEnter = panelsListEnter.append("li").attr("class", "measurement-panel-toggle-item").append("label").call(
71317         uiTooltip().title(() => _t.append("map_data.measurement_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.measurement.key"))]).placement("top")
71318       );
71319       measurementPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
71320         d3_event.preventDefault();
71321         context.ui().info.toggle("measurement");
71322       });
71323       measurementPanelLabelEnter.append("span").call(_t.append("map_data.measurement_panel.title"));
71324     }
71325     context.layers().on("change.uiSectionDataLayers", section.reRender);
71326     context.map().on(
71327       "move.uiSectionDataLayers",
71328       debounce_default(function() {
71329         window.requestIdleCallback(section.reRender);
71330       }, 1e3)
71331     );
71332     return section;
71333   }
71334
71335   // modules/ui/sections/map_features.js
71336   function uiSectionMapFeatures(context) {
71337     var _features = context.features().keys();
71338     var section = uiSection("map-features", context).label(() => _t.append("map_data.map_features")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
71339     function renderDisclosureContent(selection2) {
71340       var container = selection2.selectAll(".layer-feature-list-container").data([0]);
71341       var containerEnter = container.enter().append("div").attr("class", "layer-feature-list-container");
71342       containerEnter.append("ul").attr("class", "layer-list layer-feature-list");
71343       var footer = containerEnter.append("div").attr("class", "feature-list-links section-footer");
71344       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
71345         d3_event.preventDefault();
71346         context.features().disableAll();
71347       });
71348       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
71349         d3_event.preventDefault();
71350         context.features().enableAll();
71351       });
71352       container = container.merge(containerEnter);
71353       container.selectAll(".layer-feature-list").call(drawListItems, _features, "checkbox", "feature", clickFeature, showsFeature);
71354     }
71355     function drawListItems(selection2, data, type2, name, change, active) {
71356       var items = selection2.selectAll("li").data(data);
71357       items.exit().remove();
71358       var enter = items.enter().append("li").call(
71359         uiTooltip().title(function(d) {
71360           var tip = _t.append(name + "." + d + ".tooltip");
71361           if (autoHiddenFeature(d)) {
71362             var msg = showsLayer("osm") ? _t.append("map_data.autohidden") : _t.append("map_data.osmhidden");
71363             return (selection3) => {
71364               selection3.call(tip);
71365               selection3.append("div").call(msg);
71366             };
71367           }
71368           return tip;
71369         }).placement("top")
71370       );
71371       var label = enter.append("label");
71372       label.append("input").attr("type", type2).attr("name", name).on("change", change);
71373       label.append("span").html(function(d) {
71374         return _t.html(name + "." + d + ".description");
71375       });
71376       items = items.merge(enter);
71377       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", autoHiddenFeature);
71378     }
71379     function autoHiddenFeature(d) {
71380       return context.features().autoHidden(d);
71381     }
71382     function showsFeature(d) {
71383       return context.features().enabled(d);
71384     }
71385     function clickFeature(d3_event, d) {
71386       context.features().toggle(d);
71387     }
71388     function showsLayer(id2) {
71389       var layer = context.layers().layer(id2);
71390       return layer && layer.enabled();
71391     }
71392     context.features().on("change.map_features", section.reRender);
71393     return section;
71394   }
71395
71396   // modules/ui/sections/map_style_options.js
71397   function uiSectionMapStyleOptions(context) {
71398     var section = uiSection("fill-area", context).label(() => _t.append("map_data.style_options")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
71399     function renderDisclosureContent(selection2) {
71400       var container = selection2.selectAll(".layer-fill-list").data([0]);
71401       container.enter().append("ul").attr("class", "layer-list layer-fill-list").merge(container).call(drawListItems, context.map().areaFillOptions, "radio", "area_fill", setFill, isActiveFill);
71402       var container2 = selection2.selectAll(".layer-visual-diff-list").data([0]);
71403       container2.enter().append("ul").attr("class", "layer-list layer-visual-diff-list").merge(container2).call(drawListItems, ["highlight_edits"], "checkbox", "visual_diff", toggleHighlightEdited, function() {
71404         return context.surface().classed("highlight-edited");
71405       });
71406     }
71407     function drawListItems(selection2, data, type2, name, change, active) {
71408       var items = selection2.selectAll("li").data(data);
71409       items.exit().remove();
71410       var enter = items.enter().append("li").call(
71411         uiTooltip().title(function(d) {
71412           return _t.append(name + "." + d + ".tooltip");
71413         }).keys(function(d) {
71414           var key = d === "wireframe" ? _t("area_fill.wireframe.key") : null;
71415           if (d === "highlight_edits")
71416             key = _t("map_data.highlight_edits.key");
71417           return key ? [key] : null;
71418         }).placement("top")
71419       );
71420       var label = enter.append("label");
71421       label.append("input").attr("type", type2).attr("name", name).on("change", change);
71422       label.append("span").html(function(d) {
71423         return _t.html(name + "." + d + ".description");
71424       });
71425       items = items.merge(enter);
71426       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
71427     }
71428     function isActiveFill(d) {
71429       return context.map().activeAreaFill() === d;
71430     }
71431     function toggleHighlightEdited(d3_event) {
71432       d3_event.preventDefault();
71433       context.map().toggleHighlightEdited();
71434     }
71435     function setFill(d3_event, d) {
71436       context.map().activeAreaFill(d);
71437     }
71438     context.map().on("changeHighlighting.ui_style, changeAreaFill.ui_style", section.reRender);
71439     return section;
71440   }
71441
71442   // modules/ui/sections/photo_overlays.js
71443   function uiSectionPhotoOverlays(context) {
71444     var layers = context.layers();
71445     var section = uiSection("photo-overlays", context).label(() => _t.append("photo_overlays.title")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
71446     function renderDisclosureContent(selection2) {
71447       var container = selection2.selectAll(".photo-overlay-container").data([0]);
71448       container.enter().append("div").attr("class", "photo-overlay-container").merge(container).call(drawPhotoItems).call(drawPhotoTypeItems).call(drawDateFilter).call(drawUsernameFilter);
71449     }
71450     function drawPhotoItems(selection2) {
71451       var photoKeys = context.photos().overlayLayerIDs();
71452       var photoLayers = layers.all().filter(function(obj) {
71453         return photoKeys.indexOf(obj.id) !== -1;
71454       });
71455       var data = photoLayers.filter(function(obj) {
71456         return obj.layer.supported();
71457       });
71458       function layerSupported(d) {
71459         return d.layer && d.layer.supported();
71460       }
71461       function layerEnabled(d) {
71462         return layerSupported(d) && d.layer.enabled();
71463       }
71464       var ul = selection2.selectAll(".layer-list-photos").data([0]);
71465       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photos").merge(ul);
71466       var li = ul.selectAll(".list-item-photos").data(data);
71467       li.exit().remove();
71468       var liEnter = li.enter().append("li").attr("class", function(d) {
71469         var classes = "list-item-photos list-item-" + d.id;
71470         if (d.id === "mapillary-signs" || d.id === "mapillary-map-features") {
71471           classes += " indented";
71472         }
71473         return classes;
71474       });
71475       var labelEnter = liEnter.append("label").each(function(d) {
71476         var titleID;
71477         if (d.id === "mapillary-signs")
71478           titleID = "mapillary.signs.tooltip";
71479         else if (d.id === "mapillary")
71480           titleID = "mapillary_images.tooltip";
71481         else if (d.id === "kartaview")
71482           titleID = "kartaview_images.tooltip";
71483         else
71484           titleID = d.id.replace(/-/g, "_") + ".tooltip";
71485         select_default2(this).call(
71486           uiTooltip().title(() => _t.append(titleID)).placement("top")
71487         );
71488       });
71489       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
71490         toggleLayer(d.id);
71491       });
71492       labelEnter.append("span").html(function(d) {
71493         var id2 = d.id;
71494         if (id2 === "mapillary-signs")
71495           id2 = "photo_overlays.traffic_signs";
71496         return _t.html(id2.replace(/-/g, "_") + ".title");
71497       });
71498       li.merge(liEnter).classed("active", layerEnabled).selectAll("input").property("checked", layerEnabled);
71499     }
71500     function drawPhotoTypeItems(selection2) {
71501       var data = context.photos().allPhotoTypes();
71502       function typeEnabled(d) {
71503         return context.photos().showsPhotoType(d);
71504       }
71505       var ul = selection2.selectAll(".layer-list-photo-types").data([0]);
71506       ul.exit().remove();
71507       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photo-types").merge(ul);
71508       var li = ul.selectAll(".list-item-photo-types").data(context.photos().shouldFilterByPhotoType() ? data : []);
71509       li.exit().remove();
71510       var liEnter = li.enter().append("li").attr("class", function(d) {
71511         return "list-item-photo-types list-item-" + d;
71512       });
71513       var labelEnter = liEnter.append("label").each(function(d) {
71514         select_default2(this).call(
71515           uiTooltip().title(() => _t.append("photo_overlays.photo_type." + d + ".tooltip")).placement("top")
71516         );
71517       });
71518       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
71519         context.photos().togglePhotoType(d);
71520       });
71521       labelEnter.append("span").html(function(d) {
71522         return _t.html("photo_overlays.photo_type." + d + ".title");
71523       });
71524       li.merge(liEnter).classed("active", typeEnabled).selectAll("input").property("checked", typeEnabled);
71525     }
71526     function drawDateFilter(selection2) {
71527       var data = context.photos().dateFilters();
71528       function filterEnabled(d) {
71529         return context.photos().dateFilterValue(d);
71530       }
71531       var ul = selection2.selectAll(".layer-list-date-filter").data([0]);
71532       ul.exit().remove();
71533       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-date-filter").merge(ul);
71534       var li = ul.selectAll(".list-item-date-filter").data(context.photos().shouldFilterByDate() ? data : []);
71535       li.exit().remove();
71536       var liEnter = li.enter().append("li").attr("class", "list-item-date-filter");
71537       var labelEnter = liEnter.append("label").each(function(d) {
71538         select_default2(this).call(
71539           uiTooltip().title(() => _t.append("photo_overlays.date_filter." + d + ".tooltip")).placement("top")
71540         );
71541       });
71542       labelEnter.append("span").each(function(d) {
71543         _t.append("photo_overlays.date_filter." + d + ".title")(select_default2(this));
71544       });
71545       labelEnter.append("input").attr("type", "date").attr("class", "list-item-input").attr("placeholder", _t("units.year_month_day")).call(utilNoAuto).each(function(d) {
71546         utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d) || "");
71547       }).on("change", function(d3_event, d) {
71548         var value = utilGetSetValue(select_default2(this)).trim();
71549         context.photos().setDateFilter(d, value, true);
71550         li.selectAll("input").each(function(d2) {
71551           utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d2) || "");
71552         });
71553       });
71554       li = li.merge(liEnter).classed("active", filterEnabled);
71555     }
71556     function drawUsernameFilter(selection2) {
71557       function filterEnabled() {
71558         return context.photos().usernames();
71559       }
71560       var ul = selection2.selectAll(".layer-list-username-filter").data([0]);
71561       ul.exit().remove();
71562       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-username-filter").merge(ul);
71563       var li = ul.selectAll(".list-item-username-filter").data(context.photos().shouldFilterByUsername() ? ["username-filter"] : []);
71564       li.exit().remove();
71565       var liEnter = li.enter().append("li").attr("class", "list-item-username-filter");
71566       var labelEnter = liEnter.append("label").each(function() {
71567         select_default2(this).call(
71568           uiTooltip().title(() => _t.append("photo_overlays.username_filter.tooltip")).placement("top")
71569         );
71570       });
71571       labelEnter.append("span").call(_t.append("photo_overlays.username_filter.title"));
71572       labelEnter.append("input").attr("type", "text").attr("class", "list-item-input").call(utilNoAuto).property("value", usernameValue).on("change", function() {
71573         var value = select_default2(this).property("value");
71574         context.photos().setUsernameFilter(value, true);
71575         select_default2(this).property("value", usernameValue);
71576       });
71577       li.merge(liEnter).classed("active", filterEnabled);
71578       function usernameValue() {
71579         var usernames = context.photos().usernames();
71580         if (usernames)
71581           return usernames.join("; ");
71582         return usernames;
71583       }
71584     }
71585     function toggleLayer(which) {
71586       setLayer(which, !showsLayer(which));
71587     }
71588     function showsLayer(which) {
71589       var layer = layers.layer(which);
71590       if (layer) {
71591         return layer.enabled();
71592       }
71593       return false;
71594     }
71595     function setLayer(which, enabled) {
71596       var layer = layers.layer(which);
71597       if (layer) {
71598         layer.enabled(enabled);
71599       }
71600     }
71601     context.layers().on("change.uiSectionPhotoOverlays", section.reRender);
71602     context.photos().on("change.uiSectionPhotoOverlays", section.reRender);
71603     return section;
71604   }
71605
71606   // modules/ui/panes/map_data.js
71607   function uiPaneMapData(context) {
71608     var mapDataPane = uiPane("map-data", context).key(_t("map_data.key")).label(_t.append("map_data.title")).description(_t.append("map_data.description")).iconName("iD-icon-data").sections([
71609       uiSectionDataLayers(context),
71610       uiSectionPhotoOverlays(context),
71611       uiSectionMapStyleOptions(context),
71612       uiSectionMapFeatures(context)
71613     ]);
71614     return mapDataPane;
71615   }
71616
71617   // modules/ui/panes/preferences.js
71618   function uiPanePreferences(context) {
71619     let preferencesPane = uiPane("preferences", context).key(_t("preferences.key")).label(_t.append("preferences.title")).description(_t.append("preferences.description")).iconName("fas-user-cog").sections([
71620       uiSectionPrivacy(context)
71621     ]);
71622     return preferencesPane;
71623   }
71624
71625   // modules/ui/init.js
71626   function uiInit(context) {
71627     var _initCounter = 0;
71628     var _needWidth = {};
71629     var _lastPointerType;
71630     function render(container) {
71631       container.on("click.ui", function(d3_event) {
71632         if (d3_event.button !== 0)
71633           return;
71634         if (!d3_event.composedPath)
71635           return;
71636         var isOkayTarget = d3_event.composedPath().some(function(node) {
71637           return node.nodeType === 1 && // clicking <input> focuses it and/or changes a value
71638           (node.nodeName === "INPUT" || // clicking <label> affects its <input> by default
71639           node.nodeName === "LABEL" || // clicking <a> opens a hyperlink by default
71640           node.nodeName === "A");
71641         });
71642         if (isOkayTarget)
71643           return;
71644         d3_event.preventDefault();
71645       });
71646       var detected = utilDetect();
71647       if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
71648       // but we only need to do this on desktop Safari anyway. – #7694
71649       !detected.isMobileWebKit) {
71650         container.on("gesturestart.ui gesturechange.ui gestureend.ui", function(d3_event) {
71651           d3_event.preventDefault();
71652         });
71653       }
71654       if ("PointerEvent" in window) {
71655         select_default2(window).on("pointerdown.ui pointerup.ui", function(d3_event) {
71656           var pointerType = d3_event.pointerType || "mouse";
71657           if (_lastPointerType !== pointerType) {
71658             _lastPointerType = pointerType;
71659             container.attr("pointer", pointerType);
71660           }
71661         }, true);
71662       } else {
71663         _lastPointerType = "mouse";
71664         container.attr("pointer", "mouse");
71665       }
71666       container.attr("lang", _mainLocalizer.localeCode()).attr("dir", _mainLocalizer.textDirection());
71667       container.call(uiFullScreen(context));
71668       var map2 = context.map();
71669       map2.redrawEnable(false);
71670       map2.on("hitMinZoom.ui", function() {
71671         ui.flash.iconName("#iD-icon-no").label(_t.append("cannot_zoom"))();
71672       });
71673       container.append("svg").attr("id", "ideditor-defs").call(ui.svgDefs);
71674       container.append("div").attr("class", "sidebar").call(ui.sidebar);
71675       var content = container.append("div").attr("class", "main-content active");
71676       content.append("div").attr("class", "top-toolbar-wrap").append("div").attr("class", "top-toolbar fillD").call(uiTopToolbar(context));
71677       content.append("div").attr("class", "main-map").attr("dir", "ltr").call(map2);
71678       var overMap = content.append("div").attr("class", "over-map");
71679       overMap.append("div").attr("class", "select-trap").text("t");
71680       overMap.call(uiMapInMap(context)).call(uiNotice(context));
71681       overMap.append("div").attr("class", "spinner").call(uiSpinner(context));
71682       var controlsWrap = overMap.append("div").attr("class", "map-controls-wrap");
71683       var controls = controlsWrap.append("div").attr("class", "map-controls");
71684       controls.append("div").attr("class", "map-control zoombuttons").call(uiZoom(context));
71685       controls.append("div").attr("class", "map-control zoom-to-selection-control").call(uiZoomToSelection(context));
71686       controls.append("div").attr("class", "map-control geolocate-control").call(uiGeolocate(context));
71687       controlsWrap.on("wheel.mapControls", function(d3_event) {
71688         if (!d3_event.deltaX) {
71689           controlsWrap.node().scrollTop += d3_event.deltaY;
71690         }
71691       });
71692       var panes = overMap.append("div").attr("class", "map-panes");
71693       var uiPanes = [
71694         uiPaneBackground(context),
71695         uiPaneMapData(context),
71696         uiPaneIssues(context),
71697         uiPanePreferences(context),
71698         uiPaneHelp(context)
71699       ];
71700       uiPanes.forEach(function(pane) {
71701         controls.append("div").attr("class", "map-control map-pane-control " + pane.id + "-control").call(pane.renderToggleButton);
71702         panes.call(pane.renderPane);
71703       });
71704       ui.info = uiInfo(context);
71705       overMap.call(ui.info);
71706       overMap.append("div").attr("class", "photoviewer").classed("al", true).classed("hide", true).call(ui.photoviewer);
71707       overMap.append("div").attr("class", "attribution-wrap").attr("dir", "ltr").call(uiAttribution(context));
71708       var about = content.append("div").attr("class", "map-footer");
71709       about.append("div").attr("class", "api-status").call(uiStatus(context));
71710       var footer = about.append("div").attr("class", "map-footer-bar fillD");
71711       footer.append("div").attr("class", "flash-wrap footer-hide");
71712       var footerWrap = footer.append("div").attr("class", "main-footer-wrap footer-show");
71713       footerWrap.append("div").attr("class", "scale-block").call(uiScale(context));
71714       var aboutList = footerWrap.append("div").attr("class", "info-block").append("ul").attr("class", "map-footer-list");
71715       aboutList.append("li").attr("class", "user-list").call(uiContributors(context));
71716       var apiConnections = context.connection().apiConnections();
71717       if (apiConnections && apiConnections.length > 1) {
71718         aboutList.append("li").attr("class", "source-switch").call(
71719           uiSourceSwitch(context).keys(apiConnections)
71720         );
71721       }
71722       aboutList.append("li").attr("class", "issues-info").call(uiIssuesInfo(context));
71723       aboutList.append("li").attr("class", "feature-warning").call(uiFeatureInfo(context));
71724       var issueLinks = aboutList.append("li");
71725       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.append("report_a_bug")).placement("top"));
71726       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.append("help_translate")).placement("top"));
71727       aboutList.append("li").attr("class", "version").call(uiVersion(context));
71728       if (!context.embed()) {
71729         aboutList.call(uiAccount(context));
71730       }
71731       ui.onResize();
71732       map2.redrawEnable(true);
71733       ui.hash = behaviorHash(context);
71734       ui.hash();
71735       if (!ui.hash.hadLocation) {
71736         map2.centerZoom([0, 0], 2);
71737       }
71738       window.onbeforeunload = function() {
71739         return context.save();
71740       };
71741       window.onunload = function() {
71742         context.history().unlock();
71743       };
71744       select_default2(window).on("resize.editor", function() {
71745         ui.onResize();
71746       });
71747       var panPixels = 80;
71748       context.keybinding().on("\u232B", function(d3_event) {
71749         d3_event.preventDefault();
71750       }).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) {
71751         if (d3_event) {
71752           d3_event.stopImmediatePropagation();
71753           d3_event.preventDefault();
71754         }
71755         var previousBackground = context.background().findSource(corePreferences("background-last-used-toggle"));
71756         if (previousBackground) {
71757           var currentBackground = context.background().baseLayerSource();
71758           corePreferences("background-last-used-toggle", currentBackground.id);
71759           corePreferences("background-last-used", previousBackground.id);
71760           context.background().baseLayerSource(previousBackground);
71761         }
71762       }).on(_t("area_fill.wireframe.key"), function toggleWireframe(d3_event) {
71763         d3_event.preventDefault();
71764         d3_event.stopPropagation();
71765         context.map().toggleWireframe();
71766       }).on(uiCmd("\u2325" + _t("area_fill.wireframe.key")), function toggleOsmData(d3_event) {
71767         d3_event.preventDefault();
71768         d3_event.stopPropagation();
71769         var mode = context.mode();
71770         if (mode && /^draw/.test(mode.id))
71771           return;
71772         var layer = context.layers().layer("osm");
71773         if (layer) {
71774           layer.enabled(!layer.enabled());
71775           if (!layer.enabled()) {
71776             context.enter(modeBrowse(context));
71777           }
71778         }
71779       }).on(_t("map_data.highlight_edits.key"), function toggleHighlightEdited(d3_event) {
71780         d3_event.preventDefault();
71781         context.map().toggleHighlightEdited();
71782       });
71783       context.on("enter.editor", function(entered) {
71784         container.classed("mode-" + entered.id, true);
71785       }).on("exit.editor", function(exited) {
71786         container.classed("mode-" + exited.id, false);
71787       });
71788       context.enter(modeBrowse(context));
71789       if (!_initCounter++) {
71790         if (!ui.hash.startWalkthrough) {
71791           context.container().call(uiSplash(context)).call(uiRestore(context));
71792         }
71793         context.container().call(ui.shortcuts);
71794       }
71795       var osm = context.connection();
71796       var auth = uiLoading(context).message(_t.html("loading_auth")).blocking(true);
71797       if (osm && auth) {
71798         osm.on("authLoading.ui", function() {
71799           context.container().call(auth);
71800         }).on("authDone.ui", function() {
71801           auth.close();
71802         });
71803       }
71804       _initCounter++;
71805       if (ui.hash.startWalkthrough) {
71806         ui.hash.startWalkthrough = false;
71807         context.container().call(uiIntro(context));
71808       }
71809       function pan(d) {
71810         return function(d3_event) {
71811           if (d3_event.shiftKey)
71812             return;
71813           if (context.container().select(".combobox").size())
71814             return;
71815           d3_event.preventDefault();
71816           context.map().pan(d, 100);
71817         };
71818       }
71819     }
71820     let ui = {};
71821     let _loadPromise;
71822     ui.ensureLoaded = () => {
71823       if (_loadPromise)
71824         return _loadPromise;
71825       return _loadPromise = Promise.all([
71826         // must have strings and presets before loading the UI
71827         _mainLocalizer.ensureLoaded(),
71828         _mainPresetIndex.ensureLoaded()
71829       ]).then(() => {
71830         if (!context.container().empty())
71831           render(context.container());
71832       }).catch((err) => console.error(err));
71833     };
71834     ui.restart = function() {
71835       context.keybinding().clear();
71836       _loadPromise = null;
71837       context.container().selectAll("*").remove();
71838       ui.ensureLoaded();
71839     };
71840     ui.lastPointerType = function() {
71841       return _lastPointerType;
71842     };
71843     ui.svgDefs = svgDefs(context);
71844     ui.flash = uiFlash(context);
71845     ui.sidebar = uiSidebar(context);
71846     ui.photoviewer = uiPhotoviewer(context);
71847     ui.shortcuts = uiShortcuts(context);
71848     ui.onResize = function(withPan) {
71849       var map2 = context.map();
71850       var mapDimensions = utilGetDimensions(context.container().select(".main-content"), true);
71851       utilGetDimensions(context.container().select(".sidebar"), true);
71852       if (withPan !== void 0) {
71853         map2.redrawEnable(false);
71854         map2.pan(withPan);
71855         map2.redrawEnable(true);
71856       }
71857       map2.dimensions(mapDimensions);
71858       ui.photoviewer.onMapResize();
71859       ui.checkOverflow(".top-toolbar");
71860       ui.checkOverflow(".map-footer-bar");
71861       var resizeWindowEvent = document.createEvent("Event");
71862       resizeWindowEvent.initEvent("resizeWindow", true, true);
71863       document.dispatchEvent(resizeWindowEvent);
71864     };
71865     ui.checkOverflow = function(selector, reset) {
71866       if (reset) {
71867         delete _needWidth[selector];
71868       }
71869       var selection2 = context.container().select(selector);
71870       if (selection2.empty())
71871         return;
71872       var scrollWidth = selection2.property("scrollWidth");
71873       var clientWidth = selection2.property("clientWidth");
71874       var needed = _needWidth[selector] || scrollWidth;
71875       if (scrollWidth > clientWidth) {
71876         selection2.classed("narrow", true);
71877         if (!_needWidth[selector]) {
71878           _needWidth[selector] = scrollWidth;
71879         }
71880       } else if (scrollWidth >= needed) {
71881         selection2.classed("narrow", false);
71882       }
71883     };
71884     ui.togglePanes = function(showPane) {
71885       var hidePanes = context.container().selectAll(".map-pane.shown");
71886       var side = _mainLocalizer.textDirection() === "ltr" ? "right" : "left";
71887       hidePanes.classed("shown", false).classed("hide", true);
71888       context.container().selectAll(".map-pane-control button").classed("active", false);
71889       if (showPane) {
71890         hidePanes.classed("shown", false).classed("hide", true).style(side, "-500px");
71891         context.container().selectAll("." + showPane.attr("pane") + "-control button").classed("active", true);
71892         showPane.classed("shown", true).classed("hide", false);
71893         if (hidePanes.empty()) {
71894           showPane.style(side, "-500px").transition().duration(200).style(side, "0px");
71895         } else {
71896           showPane.style(side, "0px");
71897         }
71898       } else {
71899         hidePanes.classed("shown", true).classed("hide", false).style(side, "0px").transition().duration(200).style(side, "-500px").on("end", function() {
71900           select_default2(this).classed("shown", false).classed("hide", true);
71901         });
71902       }
71903     };
71904     var _editMenu = uiEditMenu(context);
71905     ui.editMenu = function() {
71906       return _editMenu;
71907     };
71908     ui.showEditMenu = function(anchorPoint, triggerType, operations) {
71909       ui.closeEditMenu();
71910       if (!operations && context.mode().operations)
71911         operations = context.mode().operations();
71912       if (!operations || !operations.length)
71913         return;
71914       if (!context.map().editableDataEnabled())
71915         return;
71916       var surfaceNode = context.surface().node();
71917       if (surfaceNode.focus) {
71918         surfaceNode.focus();
71919       }
71920       operations.forEach(function(operation) {
71921         if (operation.point)
71922           operation.point(anchorPoint);
71923       });
71924       _editMenu.anchorLoc(anchorPoint).triggerType(triggerType).operations(operations);
71925       context.map().supersurface.call(_editMenu);
71926     };
71927     ui.closeEditMenu = function() {
71928       context.map().supersurface.select(".edit-menu").remove();
71929     };
71930     var _saveLoading = select_default2(null);
71931     context.uploader().on("saveStarted.ui", function() {
71932       _saveLoading = uiLoading(context).message(_t.html("save.uploading")).blocking(true);
71933       context.container().call(_saveLoading);
71934     }).on("saveEnded.ui", function() {
71935       _saveLoading.close();
71936       _saveLoading = select_default2(null);
71937     });
71938     return ui;
71939   }
71940
71941   // modules/core/context.js
71942   function coreContext() {
71943     const dispatch10 = dispatch_default("enter", "exit", "change");
71944     let context = utilRebind({}, dispatch10, "on");
71945     let _deferred2 = /* @__PURE__ */ new Set();
71946     context.version = package_default.version;
71947     context.privacyVersion = "20201202";
71948     context.initialHashParams = window.location.hash ? utilStringQs(window.location.hash) : {};
71949     context.changeset = null;
71950     let _defaultChangesetComment = context.initialHashParams.comment;
71951     let _defaultChangesetSource = context.initialHashParams.source;
71952     let _defaultChangesetHashtags = context.initialHashParams.hashtags;
71953     context.defaultChangesetComment = function(val) {
71954       if (!arguments.length)
71955         return _defaultChangesetComment;
71956       _defaultChangesetComment = val;
71957       return context;
71958     };
71959     context.defaultChangesetSource = function(val) {
71960       if (!arguments.length)
71961         return _defaultChangesetSource;
71962       _defaultChangesetSource = val;
71963       return context;
71964     };
71965     context.defaultChangesetHashtags = function(val) {
71966       if (!arguments.length)
71967         return _defaultChangesetHashtags;
71968       _defaultChangesetHashtags = val;
71969       return context;
71970     };
71971     let _setsDocumentTitle = true;
71972     context.setsDocumentTitle = function(val) {
71973       if (!arguments.length)
71974         return _setsDocumentTitle;
71975       _setsDocumentTitle = val;
71976       return context;
71977     };
71978     let _documentTitleBase = document.title;
71979     context.documentTitleBase = function(val) {
71980       if (!arguments.length)
71981         return _documentTitleBase;
71982       _documentTitleBase = val;
71983       return context;
71984     };
71985     let _ui;
71986     context.ui = () => _ui;
71987     context.lastPointerType = () => _ui.lastPointerType();
71988     let _keybinding = utilKeybinding("context");
71989     context.keybinding = () => _keybinding;
71990     select_default2(document).call(_keybinding);
71991     let _connection = services.osm;
71992     let _history;
71993     let _validator;
71994     let _uploader;
71995     context.connection = () => _connection;
71996     context.history = () => _history;
71997     context.validator = () => _validator;
71998     context.uploader = () => _uploader;
71999     context.preauth = (options2) => {
72000       if (_connection) {
72001         _connection.switch(options2);
72002       }
72003       return context;
72004     };
72005     context.locale = function(locale2) {
72006       if (!arguments.length)
72007         return _mainLocalizer.localeCode();
72008       _mainLocalizer.preferredLocaleCodes(locale2);
72009       return context;
72010     };
72011     function afterLoad(cid, callback) {
72012       return (err, result) => {
72013         if (err) {
72014           if (err.status === 400 || err.status === 401 || err.status === 403) {
72015             if (_connection) {
72016               _connection.logout();
72017             }
72018           }
72019           if (typeof callback === "function") {
72020             callback(err);
72021           }
72022           return;
72023         } else if (_connection && _connection.getConnectionId() !== cid) {
72024           if (typeof callback === "function") {
72025             callback({ message: "Connection Switched", status: -1 });
72026           }
72027           return;
72028         } else {
72029           _history.merge(result.data, result.extent);
72030           if (typeof callback === "function") {
72031             callback(err, result);
72032           }
72033           return;
72034         }
72035       };
72036     }
72037     context.loadTiles = (projection2, callback) => {
72038       const handle = window.requestIdleCallback(() => {
72039         _deferred2.delete(handle);
72040         if (_connection && context.editableDataEnabled()) {
72041           const cid = _connection.getConnectionId();
72042           _connection.loadTiles(projection2, afterLoad(cid, callback));
72043         }
72044       });
72045       _deferred2.add(handle);
72046     };
72047     context.loadTileAtLoc = (loc, callback) => {
72048       const handle = window.requestIdleCallback(() => {
72049         _deferred2.delete(handle);
72050         if (_connection && context.editableDataEnabled()) {
72051           const cid = _connection.getConnectionId();
72052           _connection.loadTileAtLoc(loc, afterLoad(cid, callback));
72053         }
72054       });
72055       _deferred2.add(handle);
72056     };
72057     context.loadEntity = (entityID, callback) => {
72058       if (_connection) {
72059         const cid = _connection.getConnectionId();
72060         _connection.loadEntity(entityID, afterLoad(cid, callback));
72061         _connection.loadEntityRelations(entityID, afterLoad(cid, callback));
72062       }
72063     };
72064     context.zoomToEntity = (entityID, zoomTo) => {
72065       context.loadEntity(entityID, (err, result) => {
72066         if (err)
72067           return;
72068         if (zoomTo !== false) {
72069           const entity = result.data.find((e) => e.id === entityID);
72070           if (entity) {
72071             _map.zoomTo(entity);
72072           }
72073         }
72074       });
72075       _map.on("drawn.zoomToEntity", () => {
72076         if (!context.hasEntity(entityID))
72077           return;
72078         _map.on("drawn.zoomToEntity", null);
72079         context.on("enter.zoomToEntity", null);
72080         context.enter(modeSelect(context, [entityID]));
72081       });
72082       context.on("enter.zoomToEntity", () => {
72083         if (_mode.id !== "browse") {
72084           _map.on("drawn.zoomToEntity", null);
72085           context.on("enter.zoomToEntity", null);
72086         }
72087       });
72088     };
72089     let _minEditableZoom = 16;
72090     context.minEditableZoom = function(val) {
72091       if (!arguments.length)
72092         return _minEditableZoom;
72093       _minEditableZoom = val;
72094       if (_connection) {
72095         _connection.tileZoom(val);
72096       }
72097       return context;
72098     };
72099     context.maxCharsForTagKey = () => 255;
72100     context.maxCharsForTagValue = () => 255;
72101     context.maxCharsForRelationRole = () => 255;
72102     context.cleanTagKey = (val) => utilCleanOsmString(val, context.maxCharsForTagKey());
72103     context.cleanTagValue = (val) => utilCleanOsmString(val, context.maxCharsForTagValue());
72104     context.cleanRelationRole = (val) => utilCleanOsmString(val, context.maxCharsForRelationRole());
72105     let _inIntro = false;
72106     context.inIntro = function(val) {
72107       if (!arguments.length)
72108         return _inIntro;
72109       _inIntro = val;
72110       return context;
72111     };
72112     context.save = () => {
72113       if (_inIntro || context.container().select(".modal").size())
72114         return;
72115       let canSave;
72116       if (_mode && _mode.id === "save") {
72117         canSave = false;
72118         if (services.osm && services.osm.isChangesetInflight()) {
72119           _history.clearSaved();
72120           return;
72121         }
72122       } else {
72123         canSave = context.selectedIDs().every((id2) => {
72124           const entity = context.hasEntity(id2);
72125           return entity && !entity.isDegenerate();
72126         });
72127       }
72128       if (canSave) {
72129         _history.save();
72130       }
72131       if (_history.hasChanges()) {
72132         return _t("save.unsaved_changes");
72133       }
72134     };
72135     context.debouncedSave = debounce_default(context.save, 350);
72136     function withDebouncedSave(fn) {
72137       return function() {
72138         const result = fn.apply(_history, arguments);
72139         context.debouncedSave();
72140         return result;
72141       };
72142     }
72143     context.hasEntity = (id2) => _history.graph().hasEntity(id2);
72144     context.entity = (id2) => _history.graph().entity(id2);
72145     let _mode;
72146     context.mode = () => _mode;
72147     context.enter = (newMode) => {
72148       if (_mode) {
72149         _mode.exit();
72150         dispatch10.call("exit", this, _mode);
72151       }
72152       _mode = newMode;
72153       _mode.enter();
72154       dispatch10.call("enter", this, _mode);
72155     };
72156     context.selectedIDs = () => _mode && _mode.selectedIDs && _mode.selectedIDs() || [];
72157     context.activeID = () => _mode && _mode.activeID && _mode.activeID();
72158     let _selectedNoteID;
72159     context.selectedNoteID = function(noteID) {
72160       if (!arguments.length)
72161         return _selectedNoteID;
72162       _selectedNoteID = noteID;
72163       return context;
72164     };
72165     let _selectedErrorID;
72166     context.selectedErrorID = function(errorID) {
72167       if (!arguments.length)
72168         return _selectedErrorID;
72169       _selectedErrorID = errorID;
72170       return context;
72171     };
72172     context.install = (behavior) => context.surface().call(behavior);
72173     context.uninstall = (behavior) => context.surface().call(behavior.off);
72174     let _copyGraph;
72175     context.copyGraph = () => _copyGraph;
72176     let _copyIDs = [];
72177     context.copyIDs = function(val) {
72178       if (!arguments.length)
72179         return _copyIDs;
72180       _copyIDs = val;
72181       _copyGraph = _history.graph();
72182       return context;
72183     };
72184     let _copyLonLat;
72185     context.copyLonLat = function(val) {
72186       if (!arguments.length)
72187         return _copyLonLat;
72188       _copyLonLat = val;
72189       return context;
72190     };
72191     let _background;
72192     context.background = () => _background;
72193     let _features;
72194     context.features = () => _features;
72195     context.hasHiddenConnections = (id2) => {
72196       const graph = _history.graph();
72197       const entity = graph.entity(id2);
72198       return _features.hasHiddenConnections(entity, graph);
72199     };
72200     let _photos;
72201     context.photos = () => _photos;
72202     let _map;
72203     context.map = () => _map;
72204     context.layers = () => _map.layers();
72205     context.surface = () => _map.surface;
72206     context.editableDataEnabled = () => _map.editableDataEnabled();
72207     context.surfaceRect = () => _map.surface.node().getBoundingClientRect();
72208     context.editable = () => {
72209       const mode = context.mode();
72210       if (!mode || mode.id === "save")
72211         return false;
72212       return _map.editableDataEnabled();
72213     };
72214     let _debugFlags = {
72215       tile: false,
72216       // tile boundaries
72217       collision: false,
72218       // label collision bounding boxes
72219       imagery: false,
72220       // imagery bounding polygons
72221       target: false,
72222       // touch targets
72223       downloaded: false
72224       // downloaded data from osm
72225     };
72226     context.debugFlags = () => _debugFlags;
72227     context.getDebug = (flag) => flag && _debugFlags[flag];
72228     context.setDebug = function(flag, val) {
72229       if (arguments.length === 1)
72230         val = true;
72231       _debugFlags[flag] = val;
72232       dispatch10.call("change");
72233       return context;
72234     };
72235     let _container = select_default2(null);
72236     context.container = function(val) {
72237       if (!arguments.length)
72238         return _container;
72239       _container = val;
72240       _container.classed("ideditor", true);
72241       return context;
72242     };
72243     context.containerNode = function(val) {
72244       if (!arguments.length)
72245         return context.container().node();
72246       context.container(select_default2(val));
72247       return context;
72248     };
72249     let _embed;
72250     context.embed = function(val) {
72251       if (!arguments.length)
72252         return _embed;
72253       _embed = val;
72254       return context;
72255     };
72256     let _assetPath = "";
72257     context.assetPath = function(val) {
72258       if (!arguments.length)
72259         return _assetPath;
72260       _assetPath = val;
72261       _mainFileFetcher.assetPath(val);
72262       return context;
72263     };
72264     let _assetMap = {};
72265     context.assetMap = function(val) {
72266       if (!arguments.length)
72267         return _assetMap;
72268       _assetMap = val;
72269       _mainFileFetcher.assetMap(val);
72270       return context;
72271     };
72272     context.asset = (val) => {
72273       if (/^http(s)?:\/\//i.test(val))
72274         return val;
72275       const filename = _assetPath + val;
72276       return _assetMap[filename] || filename;
72277     };
72278     context.imagePath = (val) => context.asset(`img/${val}`);
72279     context.reset = context.flush = () => {
72280       context.debouncedSave.cancel();
72281       Array.from(_deferred2).forEach((handle) => {
72282         window.cancelIdleCallback(handle);
72283         _deferred2.delete(handle);
72284       });
72285       Object.values(services).forEach((service) => {
72286         if (service && typeof service.reset === "function") {
72287           service.reset(context);
72288         }
72289       });
72290       context.changeset = null;
72291       _validator.reset();
72292       _features.reset();
72293       _history.reset();
72294       _uploader.reset();
72295       context.container().select(".inspector-wrap *").remove();
72296       return context;
72297     };
72298     context.projection = geoRawMercator();
72299     context.curtainProjection = geoRawMercator();
72300     context.init = () => {
72301       instantiateInternal();
72302       initializeDependents();
72303       return context;
72304       function instantiateInternal() {
72305         _history = coreHistory(context);
72306         context.graph = _history.graph;
72307         context.pauseChangeDispatch = _history.pauseChangeDispatch;
72308         context.resumeChangeDispatch = _history.resumeChangeDispatch;
72309         context.perform = withDebouncedSave(_history.perform);
72310         context.replace = withDebouncedSave(_history.replace);
72311         context.pop = withDebouncedSave(_history.pop);
72312         context.overwrite = withDebouncedSave(_history.overwrite);
72313         context.undo = withDebouncedSave(_history.undo);
72314         context.redo = withDebouncedSave(_history.redo);
72315         _validator = coreValidator(context);
72316         _uploader = coreUploader(context);
72317         _background = rendererBackground(context);
72318         _features = rendererFeatures(context);
72319         _map = rendererMap(context);
72320         _photos = rendererPhotos(context);
72321         _ui = uiInit(context);
72322       }
72323       function initializeDependents() {
72324         if (context.initialHashParams.presets) {
72325           _mainPresetIndex.addablePresetIDs(new Set(context.initialHashParams.presets.split(",")));
72326         }
72327         if (context.initialHashParams.locale) {
72328           _mainLocalizer.preferredLocaleCodes(context.initialHashParams.locale);
72329         }
72330         _mainLocalizer.ensureLoaded();
72331         _mainPresetIndex.ensureLoaded();
72332         _background.ensureLoaded();
72333         Object.values(services).forEach((service) => {
72334           if (service && typeof service.init === "function") {
72335             service.init();
72336           }
72337         });
72338         _map.init();
72339         _validator.init();
72340         _features.init();
72341         if (services.maprules && context.initialHashParams.maprules) {
72342           json_default(context.initialHashParams.maprules).then((mapcss) => {
72343             services.maprules.init();
72344             mapcss.forEach((mapcssSelector) => services.maprules.addRule(mapcssSelector));
72345           }).catch(() => {
72346           });
72347         }
72348         if (!context.container().empty()) {
72349           _ui.ensureLoaded().then(() => {
72350             _background.init();
72351             _photos.init();
72352           });
72353         }
72354       }
72355     };
72356     return context;
72357   }
72358
72359   // modules/services/nominatim.js
72360   var apibase = nominatimApiUrl;
72361   var _inflight = {};
72362   var _nominatimCache;
72363   var nominatim_default = {
72364     init: function() {
72365       _inflight = {};
72366       _nominatimCache = new import_rbush7.default();
72367     },
72368     reset: function() {
72369       Object.values(_inflight).forEach(function(controller) {
72370         controller.abort();
72371       });
72372       _inflight = {};
72373       _nominatimCache = new import_rbush7.default();
72374     },
72375     countryCode: function(location, callback) {
72376       this.reverse(location, function(err, result) {
72377         if (err) {
72378           return callback(err);
72379         } else if (result.address) {
72380           return callback(null, result.address.country_code);
72381         } else {
72382           return callback("Unable to geocode", null);
72383         }
72384       });
72385     },
72386     reverse: function(loc, callback) {
72387       var cached = _nominatimCache.search(
72388         { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] }
72389       );
72390       if (cached.length > 0) {
72391         if (callback)
72392           callback(null, cached[0].data);
72393         return;
72394       }
72395       var params = { zoom: 13, format: "json", addressdetails: 1, lat: loc[1], lon: loc[0] };
72396       var url = apibase + "reverse?" + utilQsString(params);
72397       if (_inflight[url])
72398         return;
72399       var controller = new AbortController();
72400       _inflight[url] = controller;
72401       json_default(url, {
72402         signal: controller.signal,
72403         headers: {
72404           "Accept-Language": _mainLocalizer.localeCodes().join(",")
72405         }
72406       }).then(function(result) {
72407         delete _inflight[url];
72408         if (result && result.error) {
72409           throw new Error(result.error);
72410         }
72411         var extent = geoExtent(loc).padByMeters(200);
72412         _nominatimCache.insert(Object.assign(extent.bbox(), { data: result }));
72413         if (callback)
72414           callback(null, result);
72415       }).catch(function(err) {
72416         delete _inflight[url];
72417         if (err.name === "AbortError")
72418           return;
72419         if (callback)
72420           callback(err.message);
72421       });
72422     },
72423     search: function(val, callback) {
72424       var searchVal = encodeURIComponent(val);
72425       var url = apibase + "search/" + searchVal + "?limit=10&format=json";
72426       if (_inflight[url])
72427         return;
72428       var controller = new AbortController();
72429       _inflight[url] = controller;
72430       json_default(url, {
72431         signal: controller.signal,
72432         headers: {
72433           "Accept-Language": _mainLocalizer.localeCodes().join(",")
72434         }
72435       }).then(function(result) {
72436         delete _inflight[url];
72437         if (result && result.error) {
72438           throw new Error(result.error);
72439         }
72440         if (callback)
72441           callback(null, result);
72442       }).catch(function(err) {
72443         delete _inflight[url];
72444         if (err.name === "AbortError")
72445           return;
72446         if (callback)
72447           callback(err.message);
72448       });
72449     }
72450   };
72451
72452   // node_modules/name-suggestion-index/lib/matcher.js
72453   var import_which_polygon4 = __toESM(require_which_polygon(), 1);
72454
72455   // node_modules/name-suggestion-index/lib/simplify.js
72456   var import_diacritics3 = __toESM(require_diacritics(), 1);
72457   function simplify2(str2) {
72458     if (typeof str2 !== "string")
72459       return "";
72460     return import_diacritics3.default.remove(
72461       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()
72462     );
72463   }
72464
72465   // node_modules/name-suggestion-index/config/matchGroups.json
72466   var matchGroups_default = {
72467     matchGroups: {
72468       adult_gaming_centre: [
72469         "amenity/casino",
72470         "amenity/gambling",
72471         "leisure/adult_gaming_centre"
72472       ],
72473       beauty: [
72474         "shop/beauty",
72475         "shop/hairdresser_supply"
72476       ],
72477       bed: [
72478         "shop/bed",
72479         "shop/furniture"
72480       ],
72481       beverages: [
72482         "shop/alcohol",
72483         "shop/beer",
72484         "shop/beverages",
72485         "shop/kiosk",
72486         "shop/wine"
72487       ],
72488       camping: [
72489         "tourism/camp_site",
72490         "tourism/caravan_site"
72491       ],
72492       car_parts: [
72493         "shop/car_parts",
72494         "shop/car_repair",
72495         "shop/tires",
72496         "shop/tyres"
72497       ],
72498       clinic: [
72499         "amenity/clinic",
72500         "amenity/doctors",
72501         "healthcare/clinic",
72502         "healthcare/laboratory",
72503         "healthcare/physiotherapist",
72504         "healthcare/sample_collection",
72505         "healthcare/dialysis"
72506       ],
72507       convenience: [
72508         "shop/beauty",
72509         "shop/chemist",
72510         "shop/convenience",
72511         "shop/cosmetics",
72512         "shop/grocery",
72513         "shop/kiosk",
72514         "shop/newsagent",
72515         "shop/perfumery"
72516       ],
72517       coworking: [
72518         "amenity/coworking_space",
72519         "office/coworking",
72520         "office/coworking_space"
72521       ],
72522       dentist: [
72523         "amenity/dentist",
72524         "amenity/doctors",
72525         "healthcare/dentist"
72526       ],
72527       electronics: [
72528         "office/telecommunication",
72529         "shop/computer",
72530         "shop/electronics",
72531         "shop/hifi",
72532         "shop/kiosk",
72533         "shop/mobile",
72534         "shop/mobile_phone",
72535         "shop/telecommunication"
72536       ],
72537       fabric: [
72538         "shop/fabric",
72539         "shop/haberdashery",
72540         "shop/sewing"
72541       ],
72542       fashion: [
72543         "shop/accessories",
72544         "shop/bag",
72545         "shop/boutique",
72546         "shop/clothes",
72547         "shop/department_store",
72548         "shop/fashion",
72549         "shop/fashion_accessories",
72550         "shop/sports",
72551         "shop/shoes"
72552       ],
72553       financial: [
72554         "amenity/bank",
72555         "office/accountant",
72556         "office/financial",
72557         "office/financial_advisor",
72558         "office/tax_advisor",
72559         "shop/tax"
72560       ],
72561       fitness: [
72562         "leisure/fitness_centre",
72563         "leisure/fitness_center",
72564         "leisure/sports_centre",
72565         "leisure/sports_center"
72566       ],
72567       food: [
72568         "amenity/bar",
72569         "amenity/cafe",
72570         "amenity/fast_food",
72571         "amenity/ice_cream",
72572         "amenity/pub",
72573         "amenity/restaurant",
72574         "shop/bakery",
72575         "shop/candy",
72576         "shop/chocolate",
72577         "shop/coffee",
72578         "shop/confectionary",
72579         "shop/confectionery",
72580         "shop/food",
72581         "shop/kiosk",
72582         "shop/ice_cream",
72583         "shop/pastry",
72584         "shop/tea"
72585       ],
72586       fuel: [
72587         "amenity/fuel",
72588         "shop/gas",
72589         "shop/convenience;gas",
72590         "shop/gas;convenience"
72591       ],
72592       gift: [
72593         "shop/gift",
72594         "shop/card",
72595         "shop/cards",
72596         "shop/kiosk",
72597         "shop/stationery"
72598       ],
72599       hardware: [
72600         "shop/bathroom_furnishing",
72601         "shop/carpet",
72602         "shop/diy",
72603         "shop/doityourself",
72604         "shop/doors",
72605         "shop/electrical",
72606         "shop/flooring",
72607         "shop/hardware",
72608         "shop/hardware_store",
72609         "shop/power_tools",
72610         "shop/tool_hire",
72611         "shop/tools",
72612         "shop/trade"
72613       ],
72614       health_food: [
72615         "shop/health",
72616         "shop/health_food",
72617         "shop/herbalist",
72618         "shop/nutrition_supplements"
72619       ],
72620       hobby: [
72621         "shop/electronics",
72622         "shop/hobby",
72623         "shop/books",
72624         "shop/games",
72625         "shop/collector",
72626         "shop/toys",
72627         "shop/model",
72628         "shop/video_games",
72629         "shop/anime"
72630       ],
72631       hospital: [
72632         "amenity/doctors",
72633         "amenity/hospital",
72634         "healthcare/hospital"
72635       ],
72636       houseware: [
72637         "shop/houseware",
72638         "shop/interior_decoration"
72639       ],
72640       lifeboat_station: [
72641         "amenity/lifeboat_station",
72642         "emergency/lifeboat_station",
72643         "emergency/marine_rescue"
72644       ],
72645       lodging: [
72646         "tourism/hotel",
72647         "tourism/motel"
72648       ],
72649       money_transfer: [
72650         "amenity/money_transfer",
72651         "shop/money_transfer"
72652       ],
72653       office_supplies: [
72654         "shop/office_supplies",
72655         "shop/stationary",
72656         "shop/stationery"
72657       ],
72658       outdoor: [
72659         "shop/clothes",
72660         "shop/outdoor",
72661         "shop/sports"
72662       ],
72663       parcel_locker: [
72664         "amenity/parcel_locker",
72665         "amenity/vending_machine"
72666       ],
72667       pharmacy: [
72668         "amenity/doctors",
72669         "amenity/pharmacy",
72670         "healthcare/pharmacy"
72671       ],
72672       playground: [
72673         "amenity/theme_park",
72674         "leisure/amusement_arcade",
72675         "leisure/playground"
72676       ],
72677       rental: [
72678         "amenity/bicycle_rental",
72679         "amenity/boat_rental",
72680         "amenity/car_rental",
72681         "amenity/truck_rental",
72682         "amenity/vehicle_rental",
72683         "shop/kiosk",
72684         "shop/rental"
72685       ],
72686       school: [
72687         "amenity/childcare",
72688         "amenity/college",
72689         "amenity/kindergarten",
72690         "amenity/language_school",
72691         "amenity/prep_school",
72692         "amenity/school",
72693         "amenity/university"
72694       ],
72695       storage: [
72696         "shop/storage_units",
72697         "shop/storage_rental"
72698       ],
72699       substation: [
72700         "power/station",
72701         "power/substation",
72702         "power/sub_station"
72703       ],
72704       supermarket: [
72705         "shop/food",
72706         "shop/frozen_food",
72707         "shop/greengrocer",
72708         "shop/grocery",
72709         "shop/supermarket",
72710         "shop/wholesale"
72711       ],
72712       variety_store: [
72713         "shop/variety_store",
72714         "shop/discount",
72715         "shop/convenience"
72716       ],
72717       vending: [
72718         "amenity/vending_machine",
72719         "shop/kiosk",
72720         "shop/vending_machine"
72721       ],
72722       weight_loss: [
72723         "amenity/clinic",
72724         "amenity/doctors",
72725         "amenity/weight_clinic",
72726         "healthcare/counselling",
72727         "leisure/fitness_centre",
72728         "office/therapist",
72729         "shop/beauty",
72730         "shop/diet",
72731         "shop/food",
72732         "shop/health_food",
72733         "shop/herbalist",
72734         "shop/nutrition",
72735         "shop/nutrition_supplements",
72736         "shop/weight_loss"
72737       ],
72738       wholesale: [
72739         "shop/wholesale",
72740         "shop/supermarket",
72741         "shop/department_store"
72742       ]
72743     }
72744   };
72745
72746   // node_modules/name-suggestion-index/config/genericWords.json
72747   var genericWords_default = {
72748     genericWords: [
72749       "^(barn|bazaa?r|bench|bou?tique|building|casa|church)$",
72750       "^(baseball|basketball|football|soccer|softball|tennis(halle)?)\\s?(field|court)?$",
72751       "^(club|green|out|ware)\\s?house$",
72752       "^(driveway|el \xE1rbol|fountain|generic|golf|government|graveyard)$",
72753       "^(fixme|n\\s?\\/?\\s?a|name|no\\s?name|none|null|temporary|test|unknown)$",
72754       "^(hofladen|librairie|magazine?|maison)$",
72755       "^(mobile home|skate)?\\s?park$",
72756       "^(obuwie|pond|pool|sale|shops?|sklep|stores?)$",
72757       "^\\?+$",
72758       "^private$",
72759       "^tattoo( studio)?$",
72760       "^windmill$",
72761       "^\u0446\u0435\u0440\u043A\u043E\u0432\u043D\u0430\u044F( \u043B\u0430\u0432\u043A\u0430)?$"
72762     ]
72763   };
72764
72765   // node_modules/name-suggestion-index/config/trees.json
72766   var trees_default = {
72767     trees: {
72768       brands: {
72769         emoji: "\u{1F354}",
72770         mainTag: "brand:wikidata",
72771         sourceTags: ["brand", "name"],
72772         nameTags: {
72773           primary: "^(name|name:\\w+)$",
72774           alternate: "^(brand|brand:\\w+|operator|operator:\\w+|\\w+_name|\\w+_name:\\w+)$"
72775         }
72776       },
72777       flags: {
72778         emoji: "\u{1F6A9}",
72779         mainTag: "flag:wikidata",
72780         nameTags: {
72781           primary: "^(flag:name|flag:name:\\w+)$",
72782           alternate: "^(country|country:\\w+|flag|flag:\\w+|subject|subject:\\w+)$"
72783         }
72784       },
72785       operators: {
72786         emoji: "\u{1F4BC}",
72787         mainTag: "operator:wikidata",
72788         sourceTags: ["operator"],
72789         nameTags: {
72790           primary: "^(name|name:\\w+|operator|operator:\\w+)$",
72791           alternate: "^(brand|brand:\\w+|\\w+_name|\\w+_name:\\w+)$"
72792         }
72793       },
72794       transit: {
72795         emoji: "\u{1F687}",
72796         mainTag: "network:wikidata",
72797         sourceTags: ["network"],
72798         nameTags: {
72799           primary: "^network$",
72800           alternate: "^(operator|operator:\\w+|network:\\w+|\\w+_name|\\w+_name:\\w+)$"
72801         }
72802       }
72803     }
72804   };
72805
72806   // node_modules/name-suggestion-index/lib/matcher.js
72807   var matchGroups = matchGroups_default.matchGroups;
72808   var trees = trees_default.trees;
72809   var Matcher = class {
72810     //
72811     // `constructor`
72812     // initialize the genericWords regexes
72813     constructor() {
72814       this.matchIndex = void 0;
72815       this.genericWords = /* @__PURE__ */ new Map();
72816       (genericWords_default.genericWords || []).forEach((s) => this.genericWords.set(s, new RegExp(s, "i")));
72817       this.itemLocation = void 0;
72818       this.locationSets = void 0;
72819       this.locationIndex = void 0;
72820       this.warnings = [];
72821     }
72822     //
72823     // `buildMatchIndex()`
72824     // Call this to prepare the matcher for use
72825     //
72826     // `data` needs to be an Object indexed on a 'tree/key/value' path.
72827     // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
72828     // {
72829     //    'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
72830     //    'brands/amenity/bar':  { properties: {}, items: [ {}, {}, … ] },
72831     //    …
72832     // }
72833     //
72834     buildMatchIndex(data) {
72835       const that = this;
72836       if (that.matchIndex)
72837         return;
72838       that.matchIndex = /* @__PURE__ */ new Map();
72839       const seenTree = /* @__PURE__ */ new Map();
72840       Object.keys(data).forEach((tkv) => {
72841         const category = data[tkv];
72842         const parts = tkv.split("/", 3);
72843         const t = parts[0];
72844         const k = parts[1];
72845         const v = parts[2];
72846         const thiskv = `${k}/${v}`;
72847         const tree = trees[t];
72848         let branch = that.matchIndex.get(thiskv);
72849         if (!branch) {
72850           branch = {
72851             primary: /* @__PURE__ */ new Map(),
72852             alternate: /* @__PURE__ */ new Map(),
72853             excludeGeneric: /* @__PURE__ */ new Map(),
72854             excludeNamed: /* @__PURE__ */ new Map()
72855           };
72856           that.matchIndex.set(thiskv, branch);
72857         }
72858         const properties = category.properties || {};
72859         const exclude = properties.exclude || {};
72860         (exclude.generic || []).forEach((s) => branch.excludeGeneric.set(s, new RegExp(s, "i")));
72861         (exclude.named || []).forEach((s) => branch.excludeNamed.set(s, new RegExp(s, "i")));
72862         const excludeRegexes = [...branch.excludeGeneric.values(), ...branch.excludeNamed.values()];
72863         let items = category.items;
72864         if (!Array.isArray(items) || !items.length)
72865           return;
72866         const primaryName = new RegExp(tree.nameTags.primary, "i");
72867         const alternateName = new RegExp(tree.nameTags.alternate, "i");
72868         const notName = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
72869         const skipGenericKV = skipGenericKVMatches(t, k, v);
72870         const genericKV = /* @__PURE__ */ new Set([`${k}/yes`, `building/yes`]);
72871         const matchGroupKV = /* @__PURE__ */ new Set();
72872         Object.values(matchGroups).forEach((matchGroup) => {
72873           const inGroup = matchGroup.some((otherkv) => otherkv === thiskv);
72874           if (!inGroup)
72875             return;
72876           matchGroup.forEach((otherkv) => {
72877             if (otherkv === thiskv)
72878               return;
72879             matchGroupKV.add(otherkv);
72880             const otherk = otherkv.split("/", 2)[0];
72881             genericKV.add(`${otherk}/yes`);
72882           });
72883         });
72884         items.forEach((item) => {
72885           if (!item.id)
72886             return;
72887           if (Array.isArray(item.matchTags) && item.matchTags.length) {
72888             item.matchTags = item.matchTags.filter((matchTag) => !matchGroupKV.has(matchTag) && !genericKV.has(matchTag));
72889             if (!item.matchTags.length)
72890               delete item.matchTags;
72891           }
72892           let kvTags = [`${thiskv}`].concat(item.matchTags || []);
72893           if (!skipGenericKV) {
72894             kvTags = kvTags.concat(Array.from(genericKV));
72895           }
72896           Object.keys(item.tags).forEach((osmkey) => {
72897             if (notName.test(osmkey))
72898               return;
72899             const osmvalue = item.tags[osmkey];
72900             if (!osmvalue || excludeRegexes.some((regex) => regex.test(osmvalue)))
72901               return;
72902             if (primaryName.test(osmkey)) {
72903               kvTags.forEach((kv) => insertName("primary", t, kv, simplify2(osmvalue), item.id));
72904             } else if (alternateName.test(osmkey)) {
72905               kvTags.forEach((kv) => insertName("alternate", t, kv, simplify2(osmvalue), item.id));
72906             }
72907           });
72908           let keepMatchNames = /* @__PURE__ */ new Set();
72909           (item.matchNames || []).forEach((matchName) => {
72910             const nsimple = simplify2(matchName);
72911             kvTags.forEach((kv) => {
72912               const branch2 = that.matchIndex.get(kv);
72913               const primaryLeaf = branch2 && branch2.primary.get(nsimple);
72914               const alternateLeaf = branch2 && branch2.alternate.get(nsimple);
72915               const inPrimary = primaryLeaf && primaryLeaf.has(item.id);
72916               const inAlternate = alternateLeaf && alternateLeaf.has(item.id);
72917               if (!inPrimary && !inAlternate) {
72918                 insertName("alternate", t, kv, nsimple, item.id);
72919                 keepMatchNames.add(matchName);
72920               }
72921             });
72922           });
72923           if (keepMatchNames.size) {
72924             item.matchNames = Array.from(keepMatchNames);
72925           } else {
72926             delete item.matchNames;
72927           }
72928         });
72929       });
72930       function insertName(which, t, kv, nsimple, itemID) {
72931         if (!nsimple) {
72932           that.warnings.push(`Warning: skipping empty ${which} name for item ${t}/${kv}: ${itemID}`);
72933           return;
72934         }
72935         let branch = that.matchIndex.get(kv);
72936         if (!branch) {
72937           branch = {
72938             primary: /* @__PURE__ */ new Map(),
72939             alternate: /* @__PURE__ */ new Map(),
72940             excludeGeneric: /* @__PURE__ */ new Map(),
72941             excludeNamed: /* @__PURE__ */ new Map()
72942           };
72943           that.matchIndex.set(kv, branch);
72944         }
72945         let leaf = branch[which].get(nsimple);
72946         if (!leaf) {
72947           leaf = /* @__PURE__ */ new Set();
72948           branch[which].set(nsimple, leaf);
72949         }
72950         leaf.add(itemID);
72951         if (!/yes$/.test(kv)) {
72952           const kvnsimple = `${kv}/${nsimple}`;
72953           const existing = seenTree.get(kvnsimple);
72954           if (existing && existing !== t) {
72955             const items = Array.from(leaf);
72956             that.warnings.push(`Duplicate cache key "${kvnsimple}" in trees "${t}" and "${existing}", check items: ${items}`);
72957             return;
72958           }
72959           seenTree.set(kvnsimple, t);
72960         }
72961       }
72962       function skipGenericKVMatches(t, k, v) {
72963         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";
72964       }
72965     }
72966     //
72967     // `buildLocationIndex()`
72968     // Call this to prepare a which-polygon location index.
72969     // This *resolves* all the locationSets into GeoJSON, which takes some time.
72970     // You can skip this step if you don't care about matching within a location.
72971     //
72972     // `data` needs to be an Object indexed on a 'tree/key/value' path.
72973     // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
72974     // {
72975     //    'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
72976     //    'brands/amenity/bar':  { properties: {}, items: [ {}, {}, … ] },
72977     //    …
72978     // }
72979     //
72980     buildLocationIndex(data, loco) {
72981       const that = this;
72982       if (that.locationIndex)
72983         return;
72984       that.itemLocation = /* @__PURE__ */ new Map();
72985       that.locationSets = /* @__PURE__ */ new Map();
72986       Object.keys(data).forEach((tkv) => {
72987         const items = data[tkv].items;
72988         if (!Array.isArray(items) || !items.length)
72989           return;
72990         items.forEach((item) => {
72991           if (that.itemLocation.has(item.id))
72992             return;
72993           let resolved;
72994           try {
72995             resolved = loco.resolveLocationSet(item.locationSet);
72996           } catch (err) {
72997             console.warn(`buildLocationIndex: ${err.message}`);
72998           }
72999           if (!resolved || !resolved.id)
73000             return;
73001           that.itemLocation.set(item.id, resolved.id);
73002           if (that.locationSets.has(resolved.id))
73003             return;
73004           let feature3 = _cloneDeep2(resolved.feature);
73005           feature3.id = resolved.id;
73006           feature3.properties.id = resolved.id;
73007           if (!feature3.geometry.coordinates.length || !feature3.properties.area) {
73008             console.warn(`buildLocationIndex: locationSet ${resolved.id} for ${item.id} resolves to an empty feature:`);
73009             console.warn(JSON.stringify(feature3));
73010             return;
73011           }
73012           that.locationSets.set(resolved.id, feature3);
73013         });
73014       });
73015       that.locationIndex = (0, import_which_polygon4.default)({ type: "FeatureCollection", features: [...that.locationSets.values()] });
73016       function _cloneDeep2(obj) {
73017         return JSON.parse(JSON.stringify(obj));
73018       }
73019     }
73020     //
73021     // `match()`
73022     // Pass parts and return an Array of matches.
73023     // `k` - key
73024     // `v` - value
73025     // `n` - namelike
73026     // `loc` - optional - [lon,lat] location to search
73027     //
73028     // 1. If the [k,v,n] tuple matches a canonical item…
73029     // Return an Array of match results.
73030     // Each result will include the area in km² that the item is valid.
73031     //
73032     // Order of results:
73033     // Primary ordering will be on the "match" column:
73034     //   "primary" - where the query matches the `name` tag, followed by
73035     //   "alternate" - where the query matches an alternate name tag (e.g. short_name, brand, operator, etc)
73036     // Secondary ordering will be on the "area" column:
73037     //   "area descending" if no location was provided, (worldwide before local)
73038     //   "area ascending" if location was provided (local before worldwide)
73039     //
73040     // [
73041     //   { match: 'primary',   itemID: String,  area: Number,  kv: String,  nsimple: String },
73042     //   { match: 'primary',   itemID: String,  area: Number,  kv: String,  nsimple: String },
73043     //   { match: 'alternate', itemID: String,  area: Number,  kv: String,  nsimple: String },
73044     //   { match: 'alternate', itemID: String,  area: Number,  kv: String,  nsimple: String },
73045     //   …
73046     // ]
73047     //
73048     // -or-
73049     //
73050     // 2. If the [k,v,n] tuple matches an exclude pattern…
73051     // Return an Array with a single exclude result, either
73052     //
73053     // [ { match: 'excludeGeneric', pattern: String,  kv: String } ]  // "generic" e.g. "Food Court"
73054     //   or
73055     // [ { match: 'excludeNamed', pattern: String,  kv: String } ]    // "named", e.g. "Kebabai"
73056     //
73057     // About results
73058     //   "generic" - a generic word that is probably not really a name.
73059     //     For these, iD should warn the user "Hey don't put 'food court' in the name tag".
73060     //   "named" - a real name like "Kebabai" that is just common, but not a brand.
73061     //     For these, iD should just let it be. We don't include these in NSI, but we don't want to nag users about it either.
73062     //
73063     // -or-
73064     //
73065     // 3. If the [k,v,n] tuple matches nothing of any kind, return `null`
73066     //
73067     //
73068     match(k, v, n2, loc) {
73069       const that = this;
73070       if (!that.matchIndex) {
73071         throw new Error("match:  matchIndex not built.");
73072       }
73073       let matchLocations;
73074       if (Array.isArray(loc) && that.locationIndex) {
73075         matchLocations = that.locationIndex([loc[0], loc[1], loc[0], loc[1]], true);
73076       }
73077       const nsimple = simplify2(n2);
73078       let seen = /* @__PURE__ */ new Set();
73079       let results = [];
73080       gatherResults("primary");
73081       gatherResults("alternate");
73082       if (results.length)
73083         return results;
73084       gatherResults("exclude");
73085       return results.length ? results : null;
73086       function gatherResults(which) {
73087         const kv = `${k}/${v}`;
73088         let didMatch = tryMatch(which, kv);
73089         if (didMatch)
73090           return;
73091         for (let mg in matchGroups) {
73092           const matchGroup = matchGroups[mg];
73093           const inGroup = matchGroup.some((otherkv) => otherkv === kv);
73094           if (!inGroup)
73095             continue;
73096           for (let i2 = 0; i2 < matchGroup.length; i2++) {
73097             const otherkv = matchGroup[i2];
73098             if (otherkv === kv)
73099               continue;
73100             didMatch = tryMatch(which, otherkv);
73101             if (didMatch)
73102               return;
73103           }
73104         }
73105         if (which === "exclude") {
73106           const regex = [...that.genericWords.values()].find((regex2) => regex2.test(n2));
73107           if (regex) {
73108             results.push({ match: "excludeGeneric", pattern: String(regex) });
73109             return;
73110           }
73111         }
73112       }
73113       function tryMatch(which, kv) {
73114         const branch = that.matchIndex.get(kv);
73115         if (!branch)
73116           return;
73117         if (which === "exclude") {
73118           let regex = [...branch.excludeNamed.values()].find((regex2) => regex2.test(n2));
73119           if (regex) {
73120             results.push({ match: "excludeNamed", pattern: String(regex), kv });
73121             return;
73122           }
73123           regex = [...branch.excludeGeneric.values()].find((regex2) => regex2.test(n2));
73124           if (regex) {
73125             results.push({ match: "excludeGeneric", pattern: String(regex), kv });
73126             return;
73127           }
73128           return;
73129         }
73130         const leaf = branch[which].get(nsimple);
73131         if (!leaf || !leaf.size)
73132           return;
73133         let hits = Array.from(leaf).map((itemID) => {
73134           let area = Infinity;
73135           if (that.itemLocation && that.locationSets) {
73136             const location = that.locationSets.get(that.itemLocation.get(itemID));
73137             area = location && location.properties.area || Infinity;
73138           }
73139           return { match: which, itemID, area, kv, nsimple };
73140         });
73141         let sortFn = byAreaDescending;
73142         if (matchLocations) {
73143           hits = hits.filter(isValidLocation);
73144           sortFn = byAreaAscending;
73145         }
73146         if (!hits.length)
73147           return;
73148         hits.sort(sortFn).forEach((hit) => {
73149           if (seen.has(hit.itemID))
73150             return;
73151           seen.add(hit.itemID);
73152           results.push(hit);
73153         });
73154         return true;
73155         function isValidLocation(hit) {
73156           if (!that.itemLocation)
73157             return true;
73158           return matchLocations.find((props) => props.id === that.itemLocation.get(hit.itemID));
73159         }
73160         function byAreaAscending(hitA, hitB) {
73161           return hitA.area - hitB.area;
73162         }
73163         function byAreaDescending(hitA, hitB) {
73164           return hitB.area - hitA.area;
73165         }
73166       }
73167     }
73168     //
73169     // `getWarnings()`
73170     // Return any warnings discovered when buiding the index.
73171     // (currently this does nothing)
73172     //
73173     getWarnings() {
73174       return this.warnings;
73175     }
73176   };
73177
73178   // modules/services/nsi.js
73179   var import_vparse2 = __toESM(require_vparse());
73180   var _nsiStatus = "loading";
73181   var _nsi = {};
73182   var buildingPreset = {
73183     "building/commercial": true,
73184     "building/government": true,
73185     "building/hotel": true,
73186     "building/retail": true,
73187     "building/office": true,
73188     "building/supermarket": true,
73189     "building/yes": true
73190   };
73191   var notNames = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
73192   var notBranches = /(coop|express|wireless|factory|outlet)/i;
73193   function setNsiSources() {
73194     const nsiVersion = package_default.dependencies["name-suggestion-index"] || package_default.devDependencies["name-suggestion-index"];
73195     const v = (0, import_vparse2.default)(nsiVersion);
73196     const vMinor = `${v.major}.${v.minor}`;
73197     const cdn = nsiCdnUrl.replace("{version}", vMinor);
73198     const sources = {
73199       "nsi_data": cdn + "dist/nsi.min.json",
73200       "nsi_dissolved": cdn + "dist/dissolved.min.json",
73201       "nsi_features": cdn + "dist/featureCollection.min.json",
73202       "nsi_generics": cdn + "dist/genericWords.min.json",
73203       "nsi_presets": cdn + "dist/presets/nsi-id-presets.min.json",
73204       "nsi_replacements": cdn + "dist/replacements.min.json",
73205       "nsi_trees": cdn + "dist/trees.min.json"
73206     };
73207     let fileMap = _mainFileFetcher.fileMap();
73208     for (const k in sources) {
73209       if (!fileMap[k])
73210         fileMap[k] = sources[k];
73211     }
73212   }
73213   function loadNsiPresets() {
73214     return Promise.all([
73215       _mainFileFetcher.get("nsi_presets"),
73216       _mainFileFetcher.get("nsi_features")
73217     ]).then((vals) => {
73218       Object.values(vals[0].presets).forEach((preset) => preset.suggestion = true);
73219       _mainPresetIndex.merge({
73220         presets: vals[0].presets,
73221         featureCollection: vals[1]
73222       });
73223     });
73224   }
73225   function loadNsiData() {
73226     return Promise.all([
73227       _mainFileFetcher.get("nsi_data"),
73228       _mainFileFetcher.get("nsi_dissolved"),
73229       _mainFileFetcher.get("nsi_replacements"),
73230       _mainFileFetcher.get("nsi_trees")
73231     ]).then((vals) => {
73232       _nsi = {
73233         data: vals[0].nsi,
73234         // the raw name-suggestion-index data
73235         dissolved: vals[1].dissolved,
73236         // list of dissolved items
73237         replacements: vals[2].replacements,
73238         // trivial old->new qid replacements
73239         trees: vals[3].trees,
73240         // metadata about trees, main tags
73241         kvt: /* @__PURE__ */ new Map(),
73242         // Map (k -> Map (v -> t) )
73243         qids: /* @__PURE__ */ new Map(),
73244         // Map (wd/wp tag values -> qids)
73245         ids: /* @__PURE__ */ new Map()
73246         // Map (id -> NSI item)
73247       };
73248       const matcher = _nsi.matcher = new Matcher();
73249       matcher.buildMatchIndex(_nsi.data);
73250       matcher.itemLocation = /* @__PURE__ */ new Map();
73251       matcher.locationSets = /* @__PURE__ */ new Map();
73252       Object.keys(_nsi.data).forEach((tkv) => {
73253         const items = _nsi.data[tkv].items;
73254         if (!Array.isArray(items) || !items.length)
73255           return;
73256         items.forEach((item) => {
73257           if (matcher.itemLocation.has(item.id))
73258             return;
73259           const locationSetID = _sharedLocationManager.locationSetID(item.locationSet);
73260           matcher.itemLocation.set(item.id, locationSetID);
73261           if (matcher.locationSets.has(locationSetID))
73262             return;
73263           const fakeFeature = { id: locationSetID, properties: { id: locationSetID, area: 1 } };
73264           matcher.locationSets.set(locationSetID, fakeFeature);
73265         });
73266       });
73267       matcher.locationIndex = (bbox2) => {
73268         const validHere = _sharedLocationManager.locationSetsAt([bbox2[0], bbox2[1]]);
73269         const results = [];
73270         for (const [locationSetID, area] of Object.entries(validHere)) {
73271           const fakeFeature = matcher.locationSets.get(locationSetID);
73272           if (fakeFeature) {
73273             fakeFeature.properties.area = area;
73274             results.push(fakeFeature);
73275           }
73276         }
73277         return results;
73278       };
73279       Object.keys(_nsi.data).forEach((tkv) => {
73280         const category = _nsi.data[tkv];
73281         const parts = tkv.split("/", 3);
73282         const t = parts[0];
73283         const k = parts[1];
73284         const v = parts[2];
73285         let vmap = _nsi.kvt.get(k);
73286         if (!vmap) {
73287           vmap = /* @__PURE__ */ new Map();
73288           _nsi.kvt.set(k, vmap);
73289         }
73290         vmap.set(v, t);
73291         const tree = _nsi.trees[t];
73292         const mainTag = tree.mainTag;
73293         const items = category.items || [];
73294         items.forEach((item) => {
73295           item.tkv = tkv;
73296           item.mainTag = mainTag;
73297           _nsi.ids.set(item.id, item);
73298           const wd = item.tags[mainTag];
73299           const wp = item.tags[mainTag.replace("wikidata", "wikipedia")];
73300           if (wd)
73301             _nsi.qids.set(wd, wd);
73302           if (wp && wd)
73303             _nsi.qids.set(wp, wd);
73304         });
73305       });
73306     });
73307   }
73308   function gatherKVs(tags) {
73309     let primary = /* @__PURE__ */ new Set();
73310     let alternate = /* @__PURE__ */ new Set();
73311     Object.keys(tags).forEach((osmkey) => {
73312       const osmvalue = tags[osmkey];
73313       if (!osmvalue)
73314         return;
73315       if (osmkey === "route_master")
73316         osmkey = "route";
73317       const vmap = _nsi.kvt.get(osmkey);
73318       if (!vmap)
73319         return;
73320       if (vmap.get(osmvalue)) {
73321         primary.add(`${osmkey}/${osmvalue}`);
73322       } else if (osmvalue === "yes") {
73323         alternate.add(`${osmkey}/${osmvalue}`);
73324       }
73325     });
73326     const preset = _mainPresetIndex.matchTags(tags, "area");
73327     if (buildingPreset[preset.id]) {
73328       alternate.add("building/yes");
73329     }
73330     return { primary, alternate };
73331   }
73332   function identifyTree(tags) {
73333     let unknown;
73334     let t;
73335     Object.keys(tags).forEach((osmkey) => {
73336       if (t)
73337         return;
73338       const osmvalue = tags[osmkey];
73339       if (!osmvalue)
73340         return;
73341       if (osmkey === "route_master")
73342         osmkey = "route";
73343       const vmap = _nsi.kvt.get(osmkey);
73344       if (!vmap)
73345         return;
73346       if (osmvalue === "yes") {
73347         unknown = "unknown";
73348       } else {
73349         t = vmap.get(osmvalue);
73350       }
73351     });
73352     return t || unknown || null;
73353   }
73354   function gatherNames(tags) {
73355     const empty2 = { primary: /* @__PURE__ */ new Set(), alternate: /* @__PURE__ */ new Set() };
73356     let primary = /* @__PURE__ */ new Set();
73357     let alternate = /* @__PURE__ */ new Set();
73358     let foundSemi = false;
73359     let testNameFragments = false;
73360     let patterns2;
73361     let t = identifyTree(tags);
73362     if (!t)
73363       return empty2;
73364     if (t === "transit") {
73365       patterns2 = {
73366         primary: /^network$/i,
73367         alternate: /^(operator|operator:\w+|network:\w+|\w+_name|\w+_name:\w+)$/i
73368       };
73369     } else if (t === "flags") {
73370       patterns2 = {
73371         primary: /^(flag:name|flag:name:\w+)$/i,
73372         alternate: /^(flag|flag:\w+|subject|subject:\w+)$/i
73373         // note: no `country`, we special-case it below
73374       };
73375     } else if (t === "brands") {
73376       testNameFragments = true;
73377       patterns2 = {
73378         primary: /^(name|name:\w+)$/i,
73379         alternate: /^(brand|brand:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
73380       };
73381     } else if (t === "operators") {
73382       testNameFragments = true;
73383       patterns2 = {
73384         primary: /^(name|name:\w+|operator|operator:\w+)$/i,
73385         alternate: /^(brand|brand:\w+|\w+_name|\w+_name:\w+)/i
73386       };
73387     } else {
73388       testNameFragments = true;
73389       patterns2 = {
73390         primary: /^(name|name:\w+)$/i,
73391         alternate: /^(brand|brand:\w+|network|network:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
73392       };
73393     }
73394     if (tags.name && testNameFragments) {
73395       const nameParts = tags.name.split(/[\s\-\/,.]/);
73396       for (let split = nameParts.length; split > 0; split--) {
73397         const name = nameParts.slice(0, split).join(" ");
73398         primary.add(name);
73399       }
73400     }
73401     Object.keys(tags).forEach((osmkey) => {
73402       const osmvalue = tags[osmkey];
73403       if (!osmvalue)
73404         return;
73405       if (isNamelike(osmkey, "primary")) {
73406         if (/;/.test(osmvalue)) {
73407           foundSemi = true;
73408         } else {
73409           primary.add(osmvalue);
73410           alternate.delete(osmvalue);
73411         }
73412       } else if (!primary.has(osmvalue) && isNamelike(osmkey, "alternate")) {
73413         if (/;/.test(osmvalue)) {
73414           foundSemi = true;
73415         } else {
73416           alternate.add(osmvalue);
73417         }
73418       }
73419     });
73420     if (tags.man_made === "flagpole" && !primary.size && !alternate.size && !!tags.country) {
73421       const osmvalue = tags.country;
73422       if (/;/.test(osmvalue)) {
73423         foundSemi = true;
73424       } else {
73425         alternate.add(osmvalue);
73426       }
73427     }
73428     if (foundSemi) {
73429       return empty2;
73430     } else {
73431       return { primary, alternate };
73432     }
73433     function isNamelike(osmkey, which) {
73434       if (osmkey === "old_name")
73435         return false;
73436       return patterns2[which].test(osmkey) && !notNames.test(osmkey);
73437     }
73438   }
73439   function gatherTuples(tryKVs, tryNames) {
73440     let tuples = [];
73441     ["primary", "alternate"].forEach((whichName) => {
73442       const arr = Array.from(tryNames[whichName]).sort((a, b) => b.length - a.length);
73443       arr.forEach((n2) => {
73444         ["primary", "alternate"].forEach((whichKV) => {
73445           tryKVs[whichKV].forEach((kv) => {
73446             const parts = kv.split("/", 2);
73447             const k = parts[0];
73448             const v = parts[1];
73449             tuples.push({ k, v, n: n2 });
73450           });
73451         });
73452       });
73453     });
73454     return tuples;
73455   }
73456   function _upgradeTags(tags, loc) {
73457     let newTags = Object.assign({}, tags);
73458     let changed = false;
73459     Object.keys(newTags).forEach((osmkey) => {
73460       const matchTag = osmkey.match(/^(\w+:)?wikidata$/);
73461       if (matchTag) {
73462         const prefix = matchTag[1] || "";
73463         const wd = newTags[osmkey];
73464         const replace = _nsi.replacements[wd];
73465         if (replace && replace.wikidata !== void 0) {
73466           changed = true;
73467           if (replace.wikidata) {
73468             newTags[osmkey] = replace.wikidata;
73469           } else {
73470             delete newTags[osmkey];
73471           }
73472         }
73473         if (replace && replace.wikipedia !== void 0) {
73474           changed = true;
73475           const wpkey = `${prefix}wikipedia`;
73476           if (replace.wikipedia) {
73477             newTags[wpkey] = replace.wikipedia;
73478           } else {
73479             delete newTags[wpkey];
73480           }
73481         }
73482       }
73483     });
73484     const isRouteMaster = tags.type === "route_master";
73485     const tryKVs = gatherKVs(tags);
73486     if (!tryKVs.primary.size && !tryKVs.alternate.size) {
73487       return changed ? { newTags, matched: null } : null;
73488     }
73489     const tryNames = gatherNames(tags);
73490     const foundQID = _nsi.qids.get(tags.wikidata) || _nsi.qids.get(tags.wikipedia);
73491     if (foundQID)
73492       tryNames.primary.add(foundQID);
73493     if (!tryNames.primary.size && !tryNames.alternate.size) {
73494       return changed ? { newTags, matched: null } : null;
73495     }
73496     const tuples = gatherTuples(tryKVs, tryNames);
73497     for (let i2 = 0; i2 < tuples.length; i2++) {
73498       const tuple = tuples[i2];
73499       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n, loc);
73500       if (!hits || !hits.length)
73501         continue;
73502       if (hits[0].match !== "primary" && hits[0].match !== "alternate")
73503         break;
73504       let itemID, item;
73505       for (let j2 = 0; j2 < hits.length; j2++) {
73506         const hit = hits[j2];
73507         itemID = hit.itemID;
73508         if (_nsi.dissolved[itemID])
73509           continue;
73510         item = _nsi.ids.get(itemID);
73511         if (!item)
73512           continue;
73513         const mainTag = item.mainTag;
73514         const itemQID = item.tags[mainTag];
73515         const notQID = newTags[`not:${mainTag}`];
73516         if (
73517           // Exceptions, skip this hit
73518           !itemQID || itemQID === notQID || // No `*:wikidata` or matched a `not:*:wikidata`
73519           newTags.office && !item.tags.office
73520         ) {
73521           item = null;
73522           continue;
73523         } else {
73524           break;
73525         }
73526       }
73527       if (!item)
73528         continue;
73529       item = JSON.parse(JSON.stringify(item));
73530       const tkv = item.tkv;
73531       const parts = tkv.split("/", 3);
73532       const k = parts[1];
73533       const v = parts[2];
73534       const category = _nsi.data[tkv];
73535       const properties = category.properties || {};
73536       let preserveTags = item.preserveTags || properties.preserveTags || [];
73537       ["building", "emergency", "internet_access", "takeaway"].forEach((osmkey) => {
73538         if (k !== osmkey)
73539           preserveTags.push(`^${osmkey}$`);
73540       });
73541       const regexes = preserveTags.map((s) => new RegExp(s, "i"));
73542       let keepTags = {};
73543       Object.keys(newTags).forEach((osmkey) => {
73544         if (regexes.some((regex) => regex.test(osmkey))) {
73545           keepTags[osmkey] = newTags[osmkey];
73546         }
73547       });
73548       _nsi.kvt.forEach((vmap, k2) => {
73549         if (newTags[k2] === "yes")
73550           delete newTags[k2];
73551       });
73552       if (foundQID) {
73553         delete newTags.wikipedia;
73554         delete newTags.wikidata;
73555       }
73556       Object.assign(newTags, item.tags, keepTags);
73557       if (isRouteMaster) {
73558         newTags.route_master = newTags.route;
73559         delete newTags.route;
73560       }
73561       const origName = tags.name;
73562       const newName = newTags.name;
73563       if (newName && origName && newName !== origName && !newTags.branch) {
73564         const newNames = gatherNames(newTags);
73565         const newSet = /* @__PURE__ */ new Set([...newNames.primary, ...newNames.alternate]);
73566         const isMoved = newSet.has(origName);
73567         if (!isMoved) {
73568           const nameParts = origName.split(/[\s\-\/,.]/);
73569           for (let split = nameParts.length; split > 0; split--) {
73570             const name = nameParts.slice(0, split).join(" ");
73571             const branch = nameParts.slice(split).join(" ");
73572             const nameHits = _nsi.matcher.match(k, v, name, loc);
73573             if (!nameHits || !nameHits.length)
73574               continue;
73575             if (nameHits.some((hit) => hit.itemID === itemID)) {
73576               if (branch) {
73577                 if (notBranches.test(branch)) {
73578                   newTags.name = origName;
73579                 } else {
73580                   const branchHits = _nsi.matcher.match(k, v, branch, loc);
73581                   if (branchHits && branchHits.length) {
73582                     if (branchHits[0].match === "primary" || branchHits[0].match === "alternate") {
73583                       return null;
73584                     }
73585                   } else {
73586                     newTags.branch = branch;
73587                   }
73588                 }
73589               }
73590               break;
73591             }
73592           }
73593         }
73594       }
73595       return { newTags, matched: item };
73596     }
73597     return changed ? { newTags, matched: null } : null;
73598   }
73599   function _isGenericName(tags) {
73600     const n2 = tags.name;
73601     if (!n2)
73602       return false;
73603     const tryNames = { primary: /* @__PURE__ */ new Set([n2]), alternate: /* @__PURE__ */ new Set() };
73604     const tryKVs = gatherKVs(tags);
73605     if (!tryKVs.primary.size && !tryKVs.alternate.size)
73606       return false;
73607     const tuples = gatherTuples(tryKVs, tryNames);
73608     for (let i2 = 0; i2 < tuples.length; i2++) {
73609       const tuple = tuples[i2];
73610       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n);
73611       if (hits && hits.length && hits[0].match === "excludeGeneric")
73612         return true;
73613     }
73614     return false;
73615   }
73616   var nsi_default = {
73617     // `init()`
73618     // On init, start preparing the name-suggestion-index
73619     //
73620     init: () => {
73621       setNsiSources();
73622       _mainPresetIndex.ensureLoaded().then(() => loadNsiPresets()).then(() => loadNsiData()).then(() => _nsiStatus = "ok").catch(() => _nsiStatus = "failed");
73623     },
73624     // `reset()`
73625     // Reset is called when user saves data to OSM (does nothing here)
73626     //
73627     reset: () => {
73628     },
73629     // `status()`
73630     // To let other code know how it's going...
73631     //
73632     // Returns
73633     //   `String`: 'loading', 'ok', 'failed'
73634     //
73635     status: () => _nsiStatus,
73636     // `isGenericName()`
73637     // Is the `name` tag generic?
73638     //
73639     // Arguments
73640     //   `tags`: `Object` containing the feature's OSM tags
73641     // Returns
73642     //   `true` if it is generic, `false` if not
73643     //
73644     isGenericName: (tags) => _isGenericName(tags),
73645     // `upgradeTags()`
73646     // Suggest tag upgrades.
73647     // This function will not modify the input tags, it makes a copy.
73648     //
73649     // Arguments
73650     //   `tags`: `Object` containing the feature's OSM tags
73651     //   `loc`: Location where this feature exists, as a [lon, lat]
73652     // Returns
73653     //   `Object` containing the result, or `null` if no changes needed:
73654     //   {
73655     //     'newTags': `Object` - The tags the the feature should have
73656     //     'matched': `Object` - The matched item
73657     //   }
73658     //
73659     upgradeTags: (tags, loc) => _upgradeTags(tags, loc),
73660     // `cache()`
73661     // Direct access to the NSI cache, useful for testing or breaking things
73662     //
73663     // Returns
73664     //   `Object`: the internal NSI cache
73665     //
73666     cache: () => _nsi
73667   };
73668
73669   // modules/services/kartaview.js
73670   var import_rbush8 = __toESM(require_rbush_min());
73671   var apibase2 = "https://kartaview.org";
73672   var maxResults = 1e3;
73673   var tileZoom = 14;
73674   var tiler4 = utilTiler().zoomExtent([tileZoom, tileZoom]).skipNullIsland(true);
73675   var dispatch6 = dispatch_default("loadedImages");
73676   var imgZoom = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
73677   var _oscCache;
73678   var _oscSelectedImage;
73679   var _loadViewerPromise2;
73680   function abortRequest4(controller) {
73681     controller.abort();
73682   }
73683   function maxPageAtZoom(z) {
73684     if (z < 15)
73685       return 2;
73686     if (z === 15)
73687       return 5;
73688     if (z === 16)
73689       return 10;
73690     if (z === 17)
73691       return 20;
73692     if (z === 18)
73693       return 40;
73694     if (z > 18)
73695       return 80;
73696   }
73697   function loadTiles2(which, url, projection2) {
73698     var currZoom = Math.floor(geoScaleToZoom(projection2.scale()));
73699     var tiles = tiler4.getTiles(projection2);
73700     var cache = _oscCache[which];
73701     Object.keys(cache.inflight).forEach(function(k) {
73702       var wanted = tiles.find(function(tile) {
73703         return k.indexOf(tile.id + ",") === 0;
73704       });
73705       if (!wanted) {
73706         abortRequest4(cache.inflight[k]);
73707         delete cache.inflight[k];
73708       }
73709     });
73710     tiles.forEach(function(tile) {
73711       loadNextTilePage(which, currZoom, url, tile);
73712     });
73713   }
73714   function loadNextTilePage(which, currZoom, url, tile) {
73715     var cache = _oscCache[which];
73716     var bbox2 = tile.extent.bbox();
73717     var maxPages = maxPageAtZoom(currZoom);
73718     var nextPage = cache.nextPage[tile.id] || 1;
73719     var params = utilQsString({
73720       ipp: maxResults,
73721       page: nextPage,
73722       // client_id: clientId,
73723       bbTopLeft: [bbox2.maxY, bbox2.minX].join(","),
73724       bbBottomRight: [bbox2.minY, bbox2.maxX].join(",")
73725     }, true);
73726     if (nextPage > maxPages)
73727       return;
73728     var id2 = tile.id + "," + String(nextPage);
73729     if (cache.loaded[id2] || cache.inflight[id2])
73730       return;
73731     var controller = new AbortController();
73732     cache.inflight[id2] = controller;
73733     var options2 = {
73734       method: "POST",
73735       signal: controller.signal,
73736       body: params,
73737       headers: { "Content-Type": "application/x-www-form-urlencoded" }
73738     };
73739     json_default(url, options2).then(function(data) {
73740       cache.loaded[id2] = true;
73741       delete cache.inflight[id2];
73742       if (!data || !data.currentPageItems || !data.currentPageItems.length) {
73743         throw new Error("No Data");
73744       }
73745       var features = data.currentPageItems.map(function(item) {
73746         var loc = [+item.lng, +item.lat];
73747         var d;
73748         if (which === "images") {
73749           d = {
73750             loc,
73751             key: item.id,
73752             ca: +item.heading,
73753             captured_at: item.shot_date || item.date_added,
73754             captured_by: item.username,
73755             imagePath: item.lth_name,
73756             sequence_id: item.sequence_id,
73757             sequence_index: +item.sequence_index
73758           };
73759           var seq = _oscCache.sequences[d.sequence_id];
73760           if (!seq) {
73761             seq = { rotation: 0, images: [] };
73762             _oscCache.sequences[d.sequence_id] = seq;
73763           }
73764           seq.images[d.sequence_index] = d;
73765           _oscCache.images.forImageKey[d.key] = d;
73766         }
73767         return {
73768           minX: loc[0],
73769           minY: loc[1],
73770           maxX: loc[0],
73771           maxY: loc[1],
73772           data: d
73773         };
73774       });
73775       cache.rtree.load(features);
73776       if (data.currentPageItems.length === maxResults) {
73777         cache.nextPage[tile.id] = nextPage + 1;
73778         loadNextTilePage(which, currZoom, url, tile);
73779       } else {
73780         cache.nextPage[tile.id] = Infinity;
73781       }
73782       if (which === "images") {
73783         dispatch6.call("loadedImages");
73784       }
73785     }).catch(function() {
73786       cache.loaded[id2] = true;
73787       delete cache.inflight[id2];
73788     });
73789   }
73790   function partitionViewport2(projection2) {
73791     var z = geoScaleToZoom(projection2.scale());
73792     var z2 = Math.ceil(z * 2) / 2 + 2.5;
73793     var tiler8 = utilTiler().zoomExtent([z2, z2]);
73794     return tiler8.getTiles(projection2).map(function(tile) {
73795       return tile.extent;
73796     });
73797   }
73798   function searchLimited2(limit, projection2, rtree) {
73799     limit = limit || 5;
73800     return partitionViewport2(projection2).reduce(function(result, extent) {
73801       var found = rtree.search(extent.bbox()).slice(0, limit).map(function(d) {
73802         return d.data;
73803       });
73804       return found.length ? result.concat(found) : result;
73805     }, []);
73806   }
73807   var kartaview_default = {
73808     init: function() {
73809       if (!_oscCache) {
73810         this.reset();
73811       }
73812       this.event = utilRebind(this, dispatch6, "on");
73813     },
73814     reset: function() {
73815       if (_oscCache) {
73816         Object.values(_oscCache.images.inflight).forEach(abortRequest4);
73817       }
73818       _oscCache = {
73819         images: { inflight: {}, loaded: {}, nextPage: {}, rtree: new import_rbush8.default(), forImageKey: {} },
73820         sequences: {}
73821       };
73822       _oscSelectedImage = null;
73823     },
73824     images: function(projection2) {
73825       var limit = 5;
73826       return searchLimited2(limit, projection2, _oscCache.images.rtree);
73827     },
73828     sequences: function(projection2) {
73829       var viewport = projection2.clipExtent();
73830       var min3 = [viewport[0][0], viewport[1][1]];
73831       var max3 = [viewport[1][0], viewport[0][1]];
73832       var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
73833       var sequenceKeys = {};
73834       _oscCache.images.rtree.search(bbox2).forEach(function(d) {
73835         sequenceKeys[d.data.sequence_id] = true;
73836       });
73837       var lineStrings = [];
73838       Object.keys(sequenceKeys).forEach(function(sequenceKey) {
73839         var seq = _oscCache.sequences[sequenceKey];
73840         var images = seq && seq.images;
73841         if (images) {
73842           lineStrings.push({
73843             type: "LineString",
73844             coordinates: images.map(function(d) {
73845               return d.loc;
73846             }).filter(Boolean),
73847             properties: {
73848               captured_at: images[0] ? images[0].captured_at : null,
73849               captured_by: images[0] ? images[0].captured_by : null,
73850               key: sequenceKey
73851             }
73852           });
73853         }
73854       });
73855       return lineStrings;
73856     },
73857     cachedImage: function(imageKey) {
73858       return _oscCache.images.forImageKey[imageKey];
73859     },
73860     loadImages: function(projection2) {
73861       var url = apibase2 + "/1.0/list/nearby-photos/";
73862       loadTiles2("images", url, projection2);
73863     },
73864     ensureViewerLoaded: function(context) {
73865       if (_loadViewerPromise2)
73866         return _loadViewerPromise2;
73867       var wrap2 = context.container().select(".photoviewer").selectAll(".kartaview-wrapper").data([0]);
73868       var that = this;
73869       var wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper kartaview-wrapper").classed("hide", true).call(imgZoom.on("zoom", zoomPan)).on("dblclick.zoom", null);
73870       wrapEnter.append("div").attr("class", "photo-attribution fillD");
73871       var controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
73872       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
73873       controlsEnter.append("button").on("click.rotate-ccw", rotate(-90)).text("\u293F");
73874       controlsEnter.append("button").on("click.rotate-cw", rotate(90)).text("\u293E");
73875       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
73876       wrapEnter.append("div").attr("class", "kartaview-image-wrap");
73877       context.ui().photoviewer.on("resize.kartaview", function(dimensions) {
73878         imgZoom = zoom_default2().extent([[0, 0], dimensions]).translateExtent([[0, 0], dimensions]).scaleExtent([1, 15]).on("zoom", zoomPan);
73879       });
73880       function zoomPan(d3_event) {
73881         var t = d3_event.transform;
73882         context.container().select(".photoviewer .kartaview-image-wrap").call(utilSetTransform, t.x, t.y, t.k);
73883       }
73884       function rotate(deg) {
73885         return function() {
73886           if (!_oscSelectedImage)
73887             return;
73888           var sequenceKey = _oscSelectedImage.sequence_id;
73889           var sequence = _oscCache.sequences[sequenceKey];
73890           if (!sequence)
73891             return;
73892           var r = sequence.rotation || 0;
73893           r += deg;
73894           if (r > 180)
73895             r -= 360;
73896           if (r < -180)
73897             r += 360;
73898           sequence.rotation = r;
73899           var wrap3 = context.container().select(".photoviewer .kartaview-wrapper");
73900           wrap3.transition().duration(100).call(imgZoom.transform, identity2);
73901           wrap3.selectAll(".kartaview-image").transition().duration(100).style("transform", "rotate(" + r + "deg)");
73902         };
73903       }
73904       function step(stepBy) {
73905         return function() {
73906           if (!_oscSelectedImage)
73907             return;
73908           var sequenceKey = _oscSelectedImage.sequence_id;
73909           var sequence = _oscCache.sequences[sequenceKey];
73910           if (!sequence)
73911             return;
73912           var nextIndex = _oscSelectedImage.sequence_index + stepBy;
73913           var nextImage = sequence.images[nextIndex];
73914           if (!nextImage)
73915             return;
73916           context.map().centerEase(nextImage.loc);
73917           that.selectImage(context, nextImage.key);
73918         };
73919       }
73920       _loadViewerPromise2 = Promise.resolve();
73921       return _loadViewerPromise2;
73922     },
73923     showViewer: function(context) {
73924       var viewer = context.container().select(".photoviewer").classed("hide", false);
73925       var isHidden = viewer.selectAll(".photo-wrapper.kartaview-wrapper.hide").size();
73926       if (isHidden) {
73927         viewer.selectAll(".photo-wrapper:not(.kartaview-wrapper)").classed("hide", true);
73928         viewer.selectAll(".photo-wrapper.kartaview-wrapper").classed("hide", false);
73929       }
73930       return this;
73931     },
73932     hideViewer: function(context) {
73933       _oscSelectedImage = null;
73934       this.updateUrlImage(null);
73935       var viewer = context.container().select(".photoviewer");
73936       if (!viewer.empty())
73937         viewer.datum(null);
73938       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
73939       context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
73940       return this.setStyles(context, null, true);
73941     },
73942     selectImage: function(context, imageKey) {
73943       var d = this.cachedImage(imageKey);
73944       _oscSelectedImage = d;
73945       this.updateUrlImage(imageKey);
73946       var viewer = context.container().select(".photoviewer");
73947       if (!viewer.empty())
73948         viewer.datum(d);
73949       this.setStyles(context, null, true);
73950       context.container().selectAll(".icon-sign").classed("currentView", false);
73951       if (!d)
73952         return this;
73953       var wrap2 = context.container().select(".photoviewer .kartaview-wrapper");
73954       var imageWrap = wrap2.selectAll(".kartaview-image-wrap");
73955       var attribution = wrap2.selectAll(".photo-attribution").text("");
73956       wrap2.transition().duration(100).call(imgZoom.transform, identity2);
73957       imageWrap.selectAll(".kartaview-image").remove();
73958       if (d) {
73959         var sequence = _oscCache.sequences[d.sequence_id];
73960         var r = sequence && sequence.rotation || 0;
73961         imageWrap.append("img").attr("class", "kartaview-image").attr("src", apibase2 + "/" + d.imagePath).style("transform", "rotate(" + r + "deg)");
73962         if (d.captured_by) {
73963           attribution.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://kartaview.org/user/" + encodeURIComponent(d.captured_by)).text("@" + d.captured_by);
73964           attribution.append("span").text("|");
73965         }
73966         if (d.captured_at) {
73967           attribution.append("span").attr("class", "captured_at").text(localeDateString2(d.captured_at));
73968           attribution.append("span").text("|");
73969         }
73970         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");
73971       }
73972       return this;
73973       function localeDateString2(s) {
73974         if (!s)
73975           return null;
73976         var options2 = { day: "numeric", month: "short", year: "numeric" };
73977         var d2 = new Date(s);
73978         if (isNaN(d2.getTime()))
73979           return null;
73980         return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
73981       }
73982     },
73983     getSelectedImage: function() {
73984       return _oscSelectedImage;
73985     },
73986     getSequenceKeyForImage: function(d) {
73987       return d && d.sequence_id;
73988     },
73989     // Updates the currently highlighted sequence and selected bubble.
73990     // Reset is only necessary when interacting with the viewport because
73991     // this implicitly changes the currently selected bubble/sequence
73992     setStyles: function(context, hovered, reset) {
73993       if (reset) {
73994         context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
73995         context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
73996       }
73997       var hoveredImageKey = hovered && hovered.key;
73998       var hoveredSequenceKey = this.getSequenceKeyForImage(hovered);
73999       var hoveredSequence = hoveredSequenceKey && _oscCache.sequences[hoveredSequenceKey];
74000       var hoveredImageKeys = hoveredSequence && hoveredSequence.images.map(function(d) {
74001         return d.key;
74002       }) || [];
74003       var viewer = context.container().select(".photoviewer");
74004       var selected = viewer.empty() ? void 0 : viewer.datum();
74005       var selectedImageKey = selected && selected.key;
74006       var selectedSequenceKey = this.getSequenceKeyForImage(selected);
74007       var selectedSequence = selectedSequenceKey && _oscCache.sequences[selectedSequenceKey];
74008       var selectedImageKeys = selectedSequence && selectedSequence.images.map(function(d) {
74009         return d.key;
74010       }) || [];
74011       var highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
74012       context.container().selectAll(".layer-kartaview .viewfield-group").classed("highlighted", function(d) {
74013         return highlightedImageKeys.indexOf(d.key) !== -1;
74014       }).classed("hovered", function(d) {
74015         return d.key === hoveredImageKey;
74016       }).classed("currentView", function(d) {
74017         return d.key === selectedImageKey;
74018       });
74019       context.container().selectAll(".layer-kartaview .sequence").classed("highlighted", function(d) {
74020         return d.properties.key === hoveredSequenceKey;
74021       }).classed("currentView", function(d) {
74022         return d.properties.key === selectedSequenceKey;
74023       });
74024       context.container().selectAll(".layer-kartaview .viewfield-group .viewfield").attr("d", viewfieldPath);
74025       function viewfieldPath() {
74026         var d = this.parentNode.__data__;
74027         if (d.pano && d.key !== selectedImageKey) {
74028           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
74029         } else {
74030           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
74031         }
74032       }
74033       return this;
74034     },
74035     updateUrlImage: function(imageKey) {
74036       if (!window.mocha) {
74037         var hash = utilStringQs(window.location.hash);
74038         if (imageKey) {
74039           hash.photo = "kartaview/" + imageKey;
74040         } else {
74041           delete hash.photo;
74042         }
74043         window.location.replace("#" + utilQsString(hash, true));
74044       }
74045     },
74046     cache: function() {
74047       return _oscCache;
74048     }
74049   };
74050
74051   // node_modules/osm-auth/src/osm-auth.mjs
74052   var import_store = __toESM(require_store_legacy(), 1);
74053   function osmAuth(o) {
74054     var oauth2 = {};
74055     oauth2.authenticated = function() {
74056       return !!token("oauth2_access_token");
74057     };
74058     oauth2.logout = function() {
74059       token("oauth2_access_token", "");
74060       token("oauth_token", "");
74061       token("oauth_token_secret", "");
74062       token("oauth_request_token_secret", "");
74063       return oauth2;
74064     };
74065     oauth2.authenticate = function(callback) {
74066       if (oauth2.authenticated()) {
74067         callback(null, oauth2);
74068         return;
74069       }
74070       oauth2.logout();
74071       var url = o.url + "/oauth2/authorize?" + utilQsString2({
74072         client_id: o.client_id,
74073         redirect_uri: o.redirect_uri,
74074         response_type: "code",
74075         scope: o.scope
74076       });
74077       if (o.singlepage) {
74078         var params = utilStringQs2(window.location.search.slice(1));
74079         if (params.code) {
74080           getAccessToken(params.code);
74081         } else {
74082           window.location = url;
74083         }
74084       } else {
74085         var w = 600;
74086         var h = 550;
74087         var settings = [
74088           ["width", w],
74089           ["height", h],
74090           ["left", window.screen.width / 2 - w / 2],
74091           ["top", window.screen.height / 2 - h / 2]
74092         ].map(function(x) {
74093           return x.join("=");
74094         }).join(",");
74095         var popup = window.open("about:blank", "oauth_window", settings);
74096         oauth2.popupWindow = popup;
74097         popup.location = url;
74098         if (!popup) {
74099           var error = new Error("Popup was blocked");
74100           error.status = "popup-blocked";
74101           throw error;
74102         }
74103       }
74104       window.authComplete = function(url2) {
74105         var params2 = utilStringQs2(url2.split("?")[1]);
74106         getAccessToken(params2.code);
74107         delete window.authComplete;
74108       };
74109       function getAccessToken(auth_code) {
74110         var url2 = o.url + "/oauth2/token?" + utilQsString2({
74111           client_id: o.client_id,
74112           grant_type: "authorization_code",
74113           code: auth_code,
74114           redirect_uri: o.redirect_uri,
74115           client_secret: o.client_secret
74116         });
74117         oauth2.rawxhr("POST", url2, null, null, null, accessTokenDone);
74118         o.loading();
74119       }
74120       function accessTokenDone(err, xhr) {
74121         o.done();
74122         if (err) {
74123           callback(err);
74124           return;
74125         }
74126         var access_token = JSON.parse(xhr.response);
74127         token("oauth2_access_token", access_token.access_token);
74128         callback(null, oauth2);
74129       }
74130     };
74131     oauth2.bringPopupWindowToFront = function() {
74132       var broughtPopupToFront = false;
74133       try {
74134         if (oauth2.popupWindow && !oauth2.popupWindow.closed) {
74135           oauth2.popupWindow.focus();
74136           broughtPopupToFront = true;
74137         }
74138       } catch (err) {
74139       }
74140       return broughtPopupToFront;
74141     };
74142     oauth2.bootstrapToken = function(auth_code, callback) {
74143       function getAccessToken(auth_code2) {
74144         var url = o.url + "/oauth2/token?" + utilQsString2({
74145           client_id: o.client_id,
74146           grant_type: "authorization_code",
74147           code: auth_code2,
74148           redirect_uri: o.redirect_uri,
74149           client_secret: o.client_secret
74150         });
74151         oauth2.rawxhr("POST", url, null, null, null, accessTokenDone);
74152         o.loading();
74153       }
74154       function accessTokenDone(err, xhr) {
74155         o.done();
74156         if (err) {
74157           callback(err);
74158           return;
74159         }
74160         var access_token = JSON.parse(xhr.response);
74161         token("oauth2_access_token", access_token.access_token);
74162         callback(null, oauth2);
74163       }
74164       getAccessToken(auth_code);
74165     };
74166     oauth2.fetch = function(path, options2, callback) {
74167       if (oauth2.authenticated()) {
74168         return run();
74169       } else {
74170         if (o.auto) {
74171           oauth2.authenticate(run);
74172           return;
74173         } else {
74174           callback("not authenticated", null);
74175           return;
74176         }
74177       }
74178       function run() {
74179         var url = options2.prefix !== false ? o.url + path : path;
74180         var headers = options2.headers || { "Content-Type": "application/x-www-form-urlencoded" };
74181         headers.Authorization = "Bearer " + token("oauth2_access_token");
74182         return fetch(url, {
74183           method: options2.method,
74184           body: options2.body,
74185           headers
74186         }).then((resp) => {
74187           var contentType = resp.headers.get("content-type").split(";")[0];
74188           switch (contentType) {
74189             case "text/html":
74190             case "text/xml":
74191               return resp.text().then(
74192                 (txt) => new window.DOMParser().parseFromString(txt, contentType)
74193               );
74194             case "application/html":
74195               return resp.json();
74196             default:
74197               return resp.text();
74198           }
74199         });
74200       }
74201     };
74202     oauth2.xhr = function(options2, callback) {
74203       if (oauth2.authenticated()) {
74204         return run();
74205       } else {
74206         if (o.auto) {
74207           oauth2.authenticate(run);
74208           return;
74209         } else {
74210           callback("not authenticated", null);
74211           return;
74212         }
74213       }
74214       function run() {
74215         var url = options2.prefix !== false ? o.url + options2.path : options2.path;
74216         return oauth2.rawxhr(
74217           options2.method,
74218           url,
74219           token("oauth2_access_token"),
74220           options2.content,
74221           options2.headers,
74222           done
74223         );
74224       }
74225       function done(err, xhr) {
74226         if (err) {
74227           callback(err);
74228         } else if (xhr.responseXML) {
74229           callback(err, xhr.responseXML);
74230         } else {
74231           callback(err, xhr.response);
74232         }
74233       }
74234     };
74235     oauth2.rawxhr = function(method, url, access_token, data, headers, callback) {
74236       headers = headers || { "Content-Type": "application/x-www-form-urlencoded" };
74237       if (access_token) {
74238         headers.Authorization = "Bearer " + access_token;
74239       }
74240       var xhr = new XMLHttpRequest();
74241       xhr.onreadystatechange = function() {
74242         if (4 === xhr.readyState && 0 !== xhr.status) {
74243           if (/^20\d$/.test(xhr.status)) {
74244             callback(null, xhr);
74245           } else {
74246             callback(xhr, null);
74247           }
74248         }
74249       };
74250       xhr.onerror = function(e) {
74251         callback(e, null);
74252       };
74253       xhr.open(method, url, true);
74254       for (var h in headers)
74255         xhr.setRequestHeader(h, headers[h]);
74256       xhr.send(data);
74257       return xhr;
74258     };
74259     oauth2.preauth = function(val) {
74260       if (val && val.access_token) {
74261         token("oauth2_access_token", val.access_token);
74262       }
74263       return oauth2;
74264     };
74265     oauth2.options = function(val) {
74266       if (!arguments.length)
74267         return o;
74268       o = val;
74269       o.url = o.url || "https://www.openstreetmap.org";
74270       o.auto = o.auto || false;
74271       o.singlepage = o.singlepage || false;
74272       o.loading = o.loading || function() {
74273       };
74274       o.done = o.done || function() {
74275       };
74276       return oauth2.preauth(o);
74277     };
74278     var token;
74279     if (import_store.default.enabled) {
74280       token = function(x, y) {
74281         if (arguments.length === 1)
74282           return import_store.default.get(o.url + x);
74283         else if (arguments.length === 2)
74284           return import_store.default.set(o.url + x, y);
74285       };
74286     } else {
74287       var storage = {};
74288       token = function(x, y) {
74289         if (arguments.length === 1)
74290           return storage[o.url + x];
74291         else if (arguments.length === 2)
74292           return storage[o.url + x] = y;
74293       };
74294     }
74295     oauth2.options(o);
74296     return oauth2;
74297   }
74298   function utilQsString2(obj) {
74299     return Object.keys(obj).sort().map(function(key) {
74300       return encodeURIComponent(key) + "=" + encodeURIComponent(obj[key]);
74301     }).join("&");
74302   }
74303   function utilStringQs2(str2) {
74304     var i2 = 0;
74305     while (i2 < str2.length && (str2[i2] === "?" || str2[i2] === "#"))
74306       i2++;
74307     str2 = str2.slice(i2);
74308     return str2.split("&").reduce(function(obj, pair2) {
74309       var parts = pair2.split("=");
74310       if (parts.length === 2) {
74311         obj[parts[0]] = decodeURIComponent(parts[1]);
74312       }
74313       return obj;
74314     }, {});
74315   }
74316
74317   // modules/services/osm.js
74318   var import_rbush9 = __toESM(require_rbush_min());
74319   var tiler5 = utilTiler();
74320   var dispatch7 = dispatch_default("apiStatusChange", "authLoading", "authDone", "change", "loading", "loaded", "loadedNotes");
74321   var urlroot = osmApiConnections[0].url;
74322   var redirectPath = window.location.origin + window.location.pathname;
74323   var oauth = osmAuth({
74324     url: urlroot,
74325     client_id: osmApiConnections[0].client_id,
74326     client_secret: osmApiConnections[0].client_secret,
74327     scope: "read_prefs write_prefs write_api read_gpx write_notes",
74328     redirect_uri: redirectPath + "land.html",
74329     loading: authLoading,
74330     done: authDone
74331   });
74332   var _apiConnections = osmApiConnections;
74333   var _imageryBlocklists = [/.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/];
74334   var _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new import_rbush9.default() };
74335   var _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new import_rbush9.default() };
74336   var _userCache = { toLoad: {}, user: {} };
74337   var _cachedApiStatus;
74338   var _changeset = {};
74339   var _deferred = /* @__PURE__ */ new Set();
74340   var _connectionID = 1;
74341   var _tileZoom4 = 16;
74342   var _noteZoom = 12;
74343   var _rateLimitError;
74344   var _userChangesets;
74345   var _userDetails;
74346   var _off;
74347   var _maxWayNodes = 2e3;
74348   function authLoading() {
74349     dispatch7.call("authLoading");
74350   }
74351   function authDone() {
74352     dispatch7.call("authDone");
74353   }
74354   function abortRequest5(controllerOrXHR) {
74355     if (controllerOrXHR) {
74356       controllerOrXHR.abort();
74357     }
74358   }
74359   function hasInflightRequests(cache) {
74360     return Object.keys(cache.inflight).length;
74361   }
74362   function abortUnwantedRequests4(cache, visibleTiles) {
74363     Object.keys(cache.inflight).forEach(function(k) {
74364       if (cache.toLoad[k])
74365         return;
74366       if (visibleTiles.find(function(tile) {
74367         return k === tile.id;
74368       }))
74369         return;
74370       abortRequest5(cache.inflight[k]);
74371       delete cache.inflight[k];
74372     });
74373   }
74374   function getLoc(attrs) {
74375     var lon = attrs.lon && attrs.lon.value;
74376     var lat = attrs.lat && attrs.lat.value;
74377     return [Number(lon), Number(lat)];
74378   }
74379   function getNodes(obj) {
74380     var elems = obj.getElementsByTagName("nd");
74381     var nodes = new Array(elems.length);
74382     for (var i2 = 0, l = elems.length; i2 < l; i2++) {
74383       nodes[i2] = "n" + elems[i2].attributes.ref.value;
74384     }
74385     return nodes;
74386   }
74387   function getNodesJSON(obj) {
74388     var elems = obj.nodes;
74389     var nodes = new Array(elems.length);
74390     for (var i2 = 0, l = elems.length; i2 < l; i2++) {
74391       nodes[i2] = "n" + elems[i2];
74392     }
74393     return nodes;
74394   }
74395   function getTags(obj) {
74396     var elems = obj.getElementsByTagName("tag");
74397     var tags = {};
74398     for (var i2 = 0, l = elems.length; i2 < l; i2++) {
74399       var attrs = elems[i2].attributes;
74400       tags[attrs.k.value] = attrs.v.value;
74401     }
74402     return tags;
74403   }
74404   function getMembers(obj) {
74405     var elems = obj.getElementsByTagName("member");
74406     var members = new Array(elems.length);
74407     for (var i2 = 0, l = elems.length; i2 < l; i2++) {
74408       var attrs = elems[i2].attributes;
74409       members[i2] = {
74410         id: attrs.type.value[0] + attrs.ref.value,
74411         type: attrs.type.value,
74412         role: attrs.role.value
74413       };
74414     }
74415     return members;
74416   }
74417   function getMembersJSON(obj) {
74418     var elems = obj.members;
74419     var members = new Array(elems.length);
74420     for (var i2 = 0, l = elems.length; i2 < l; i2++) {
74421       var attrs = elems[i2];
74422       members[i2] = {
74423         id: attrs.type[0] + attrs.ref,
74424         type: attrs.type,
74425         role: attrs.role
74426       };
74427     }
74428     return members;
74429   }
74430   function getVisible(attrs) {
74431     return !attrs.visible || attrs.visible.value !== "false";
74432   }
74433   function parseComments(comments) {
74434     var parsedComments = [];
74435     for (var i2 = 0; i2 < comments.length; i2++) {
74436       var comment = comments[i2];
74437       if (comment.nodeName === "comment") {
74438         var childNodes = comment.childNodes;
74439         var parsedComment = {};
74440         for (var j2 = 0; j2 < childNodes.length; j2++) {
74441           var node = childNodes[j2];
74442           var nodeName = node.nodeName;
74443           if (nodeName === "#text")
74444             continue;
74445           parsedComment[nodeName] = node.textContent;
74446           if (nodeName === "uid") {
74447             var uid = node.textContent;
74448             if (uid && !_userCache.user[uid]) {
74449               _userCache.toLoad[uid] = true;
74450             }
74451           }
74452         }
74453         if (parsedComment) {
74454           parsedComments.push(parsedComment);
74455         }
74456       }
74457     }
74458     return parsedComments;
74459   }
74460   function encodeNoteRtree(note) {
74461     return {
74462       minX: note.loc[0],
74463       minY: note.loc[1],
74464       maxX: note.loc[0],
74465       maxY: note.loc[1],
74466       data: note
74467     };
74468   }
74469   var jsonparsers = {
74470     node: function nodeData(obj, uid) {
74471       return new osmNode({
74472         id: uid,
74473         visible: typeof obj.visible === "boolean" ? obj.visible : true,
74474         version: obj.version && obj.version.toString(),
74475         changeset: obj.changeset && obj.changeset.toString(),
74476         timestamp: obj.timestamp,
74477         user: obj.user,
74478         uid: obj.uid && obj.uid.toString(),
74479         loc: [Number(obj.lon), Number(obj.lat)],
74480         tags: obj.tags
74481       });
74482     },
74483     way: function wayData(obj, uid) {
74484       return new osmWay({
74485         id: uid,
74486         visible: typeof obj.visible === "boolean" ? obj.visible : true,
74487         version: obj.version && obj.version.toString(),
74488         changeset: obj.changeset && obj.changeset.toString(),
74489         timestamp: obj.timestamp,
74490         user: obj.user,
74491         uid: obj.uid && obj.uid.toString(),
74492         tags: obj.tags,
74493         nodes: getNodesJSON(obj)
74494       });
74495     },
74496     relation: function relationData(obj, uid) {
74497       return new osmRelation({
74498         id: uid,
74499         visible: typeof obj.visible === "boolean" ? obj.visible : true,
74500         version: obj.version && obj.version.toString(),
74501         changeset: obj.changeset && obj.changeset.toString(),
74502         timestamp: obj.timestamp,
74503         user: obj.user,
74504         uid: obj.uid && obj.uid.toString(),
74505         tags: obj.tags,
74506         members: getMembersJSON(obj)
74507       });
74508     },
74509     user: function parseUser(obj, uid) {
74510       return {
74511         id: uid,
74512         display_name: obj.display_name,
74513         account_created: obj.account_created,
74514         image_url: obj.img && obj.img.href,
74515         changesets_count: obj.changesets && obj.changesets.count && obj.changesets.count.toString() || "0",
74516         active_blocks: obj.blocks && obj.blocks.received && obj.blocks.received.active && obj.blocks.received.active.toString() || "0"
74517       };
74518     }
74519   };
74520   function parseJSON(payload, callback, options2) {
74521     options2 = Object.assign({ skipSeen: true }, options2);
74522     if (!payload) {
74523       return callback({ message: "No JSON", status: -1 });
74524     }
74525     var json = payload;
74526     if (typeof json !== "object")
74527       json = JSON.parse(payload);
74528     if (!json.elements)
74529       return callback({ message: "No JSON", status: -1 });
74530     var children2 = json.elements;
74531     var handle = window.requestIdleCallback(function() {
74532       _deferred.delete(handle);
74533       var results = [];
74534       var result;
74535       for (var i2 = 0; i2 < children2.length; i2++) {
74536         result = parseChild(children2[i2]);
74537         if (result)
74538           results.push(result);
74539       }
74540       callback(null, results);
74541     });
74542     _deferred.add(handle);
74543     function parseChild(child) {
74544       var parser3 = jsonparsers[child.type];
74545       if (!parser3)
74546         return null;
74547       var uid;
74548       uid = osmEntity.id.fromOSM(child.type, child.id);
74549       if (options2.skipSeen) {
74550         if (_tileCache.seen[uid])
74551           return null;
74552         _tileCache.seen[uid] = true;
74553       }
74554       return parser3(child, uid);
74555     }
74556   }
74557   function parseUserJSON(payload, callback, options2) {
74558     options2 = Object.assign({ skipSeen: true }, options2);
74559     if (!payload) {
74560       return callback({ message: "No JSON", status: -1 });
74561     }
74562     var json = payload;
74563     if (typeof json !== "object")
74564       json = JSON.parse(payload);
74565     if (!json.users && !json.user)
74566       return callback({ message: "No JSON", status: -1 });
74567     var objs = json.users || [json];
74568     var handle = window.requestIdleCallback(function() {
74569       _deferred.delete(handle);
74570       var results = [];
74571       var result;
74572       for (var i2 = 0; i2 < objs.length; i2++) {
74573         result = parseObj(objs[i2]);
74574         if (result)
74575           results.push(result);
74576       }
74577       callback(null, results);
74578     });
74579     _deferred.add(handle);
74580     function parseObj(obj) {
74581       var uid = obj.user.id && obj.user.id.toString();
74582       if (options2.skipSeen && _userCache.user[uid]) {
74583         delete _userCache.toLoad[uid];
74584         return null;
74585       }
74586       var user = jsonparsers.user(obj.user, uid);
74587       _userCache.user[uid] = user;
74588       delete _userCache.toLoad[uid];
74589       return user;
74590     }
74591   }
74592   var parsers = {
74593     node: function nodeData2(obj, uid) {
74594       var attrs = obj.attributes;
74595       return new osmNode({
74596         id: uid,
74597         visible: getVisible(attrs),
74598         version: attrs.version.value,
74599         changeset: attrs.changeset && attrs.changeset.value,
74600         timestamp: attrs.timestamp && attrs.timestamp.value,
74601         user: attrs.user && attrs.user.value,
74602         uid: attrs.uid && attrs.uid.value,
74603         loc: getLoc(attrs),
74604         tags: getTags(obj)
74605       });
74606     },
74607     way: function wayData2(obj, uid) {
74608       var attrs = obj.attributes;
74609       return new osmWay({
74610         id: uid,
74611         visible: getVisible(attrs),
74612         version: attrs.version.value,
74613         changeset: attrs.changeset && attrs.changeset.value,
74614         timestamp: attrs.timestamp && attrs.timestamp.value,
74615         user: attrs.user && attrs.user.value,
74616         uid: attrs.uid && attrs.uid.value,
74617         tags: getTags(obj),
74618         nodes: getNodes(obj)
74619       });
74620     },
74621     relation: function relationData2(obj, uid) {
74622       var attrs = obj.attributes;
74623       return new osmRelation({
74624         id: uid,
74625         visible: getVisible(attrs),
74626         version: attrs.version.value,
74627         changeset: attrs.changeset && attrs.changeset.value,
74628         timestamp: attrs.timestamp && attrs.timestamp.value,
74629         user: attrs.user && attrs.user.value,
74630         uid: attrs.uid && attrs.uid.value,
74631         tags: getTags(obj),
74632         members: getMembers(obj)
74633       });
74634     },
74635     note: function parseNote(obj, uid) {
74636       var attrs = obj.attributes;
74637       var childNodes = obj.childNodes;
74638       var props = {};
74639       props.id = uid;
74640       props.loc = getLoc(attrs);
74641       var coincident = false;
74642       var epsilon3 = 1e-5;
74643       do {
74644         if (coincident) {
74645           props.loc = geoVecAdd(props.loc, [epsilon3, epsilon3]);
74646         }
74647         var bbox2 = geoExtent(props.loc).bbox();
74648         coincident = _noteCache.rtree.search(bbox2).length;
74649       } while (coincident);
74650       for (var i2 = 0; i2 < childNodes.length; i2++) {
74651         var node = childNodes[i2];
74652         var nodeName = node.nodeName;
74653         if (nodeName === "#text")
74654           continue;
74655         if (nodeName === "comments") {
74656           props[nodeName] = parseComments(node.childNodes);
74657         } else {
74658           props[nodeName] = node.textContent;
74659         }
74660       }
74661       var note = new osmNote(props);
74662       var item = encodeNoteRtree(note);
74663       _noteCache.note[note.id] = note;
74664       _noteCache.rtree.insert(item);
74665       return note;
74666     },
74667     user: function parseUser2(obj, uid) {
74668       var attrs = obj.attributes;
74669       var user = {
74670         id: uid,
74671         display_name: attrs.display_name && attrs.display_name.value,
74672         account_created: attrs.account_created && attrs.account_created.value,
74673         changesets_count: "0",
74674         active_blocks: "0"
74675       };
74676       var img = obj.getElementsByTagName("img");
74677       if (img && img[0] && img[0].getAttribute("href")) {
74678         user.image_url = img[0].getAttribute("href");
74679       }
74680       var changesets = obj.getElementsByTagName("changesets");
74681       if (changesets && changesets[0] && changesets[0].getAttribute("count")) {
74682         user.changesets_count = changesets[0].getAttribute("count");
74683       }
74684       var blocks = obj.getElementsByTagName("blocks");
74685       if (blocks && blocks[0]) {
74686         var received = blocks[0].getElementsByTagName("received");
74687         if (received && received[0] && received[0].getAttribute("active")) {
74688           user.active_blocks = received[0].getAttribute("active");
74689         }
74690       }
74691       _userCache.user[uid] = user;
74692       delete _userCache.toLoad[uid];
74693       return user;
74694     }
74695   };
74696   function parseXML(xml, callback, options2) {
74697     options2 = Object.assign({ skipSeen: true }, options2);
74698     if (!xml || !xml.childNodes) {
74699       return callback({ message: "No XML", status: -1 });
74700     }
74701     var root3 = xml.childNodes[0];
74702     var children2 = root3.childNodes;
74703     var handle = window.requestIdleCallback(function() {
74704       _deferred.delete(handle);
74705       var results = [];
74706       var result;
74707       for (var i2 = 0; i2 < children2.length; i2++) {
74708         result = parseChild(children2[i2]);
74709         if (result)
74710           results.push(result);
74711       }
74712       callback(null, results);
74713     });
74714     _deferred.add(handle);
74715     function parseChild(child) {
74716       var parser3 = parsers[child.nodeName];
74717       if (!parser3)
74718         return null;
74719       var uid;
74720       if (child.nodeName === "user") {
74721         uid = child.attributes.id.value;
74722         if (options2.skipSeen && _userCache.user[uid]) {
74723           delete _userCache.toLoad[uid];
74724           return null;
74725         }
74726       } else if (child.nodeName === "note") {
74727         uid = child.getElementsByTagName("id")[0].textContent;
74728       } else {
74729         uid = osmEntity.id.fromOSM(child.nodeName, child.attributes.id.value);
74730         if (options2.skipSeen) {
74731           if (_tileCache.seen[uid])
74732             return null;
74733           _tileCache.seen[uid] = true;
74734         }
74735       }
74736       return parser3(child, uid);
74737     }
74738   }
74739   function updateRtree4(item, replace) {
74740     _noteCache.rtree.remove(item, function isEql(a, b) {
74741       return a.data.id === b.data.id;
74742     });
74743     if (replace) {
74744       _noteCache.rtree.insert(item);
74745     }
74746   }
74747   function wrapcb(thisArg, callback, cid) {
74748     return function(err, result) {
74749       if (err) {
74750         if (err.status === 400 || err.status === 401 || err.status === 403) {
74751           thisArg.logout();
74752         }
74753         return callback.call(thisArg, err);
74754       } else if (thisArg.getConnectionId() !== cid) {
74755         return callback.call(thisArg, { message: "Connection Switched", status: -1 });
74756       } else {
74757         return callback.call(thisArg, err, result);
74758       }
74759     };
74760   }
74761   var osm_default = {
74762     init: function() {
74763       utilRebind(this, dispatch7, "on");
74764     },
74765     reset: function() {
74766       Array.from(_deferred).forEach(function(handle) {
74767         window.cancelIdleCallback(handle);
74768         _deferred.delete(handle);
74769       });
74770       _connectionID++;
74771       _userChangesets = void 0;
74772       _userDetails = void 0;
74773       _rateLimitError = void 0;
74774       Object.values(_tileCache.inflight).forEach(abortRequest5);
74775       Object.values(_noteCache.inflight).forEach(abortRequest5);
74776       Object.values(_noteCache.inflightPost).forEach(abortRequest5);
74777       if (_changeset.inflight)
74778         abortRequest5(_changeset.inflight);
74779       _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new import_rbush9.default() };
74780       _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new import_rbush9.default() };
74781       _userCache = { toLoad: {}, user: {} };
74782       _cachedApiStatus = void 0;
74783       _changeset = {};
74784       return this;
74785     },
74786     getConnectionId: function() {
74787       return _connectionID;
74788     },
74789     getUrlRoot: function() {
74790       return urlroot;
74791     },
74792     changesetURL: function(changesetID) {
74793       return urlroot + "/changeset/" + changesetID;
74794     },
74795     changesetsURL: function(center, zoom) {
74796       var precision2 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
74797       return urlroot + "/history#map=" + Math.floor(zoom) + "/" + center[1].toFixed(precision2) + "/" + center[0].toFixed(precision2);
74798     },
74799     entityURL: function(entity) {
74800       return urlroot + "/" + entity.type + "/" + entity.osmId();
74801     },
74802     historyURL: function(entity) {
74803       return urlroot + "/" + entity.type + "/" + entity.osmId() + "/history";
74804     },
74805     userURL: function(username) {
74806       return urlroot + "/user/" + encodeURIComponent(username);
74807     },
74808     noteURL: function(note) {
74809       return urlroot + "/note/" + note.id;
74810     },
74811     noteReportURL: function(note) {
74812       return urlroot + "/reports/new?reportable_type=Note&reportable_id=" + note.id;
74813     },
74814     // Generic method to load data from the OSM API
74815     // Can handle either auth or unauth calls.
74816     loadFromAPI: function(path, callback, options2) {
74817       options2 = Object.assign({ skipSeen: true }, options2);
74818       var that = this;
74819       var cid = _connectionID;
74820       function done(err, payload) {
74821         if (that.getConnectionId() !== cid) {
74822           if (callback)
74823             callback({ message: "Connection Switched", status: -1 });
74824           return;
74825         }
74826         var isAuthenticated = that.authenticated();
74827         if (isAuthenticated && err && err.status && (err.status === 400 || err.status === 401 || err.status === 403)) {
74828           that.logout();
74829           that.loadFromAPI(path, callback, options2);
74830         } else {
74831           if (!isAuthenticated && !_rateLimitError && err && err.status && (err.status === 509 || err.status === 429)) {
74832             _rateLimitError = err;
74833             dispatch7.call("change");
74834             that.reloadApiStatus();
74835           } else if (err && _cachedApiStatus === "online" || !err && _cachedApiStatus !== "online") {
74836             that.reloadApiStatus();
74837           }
74838           if (callback) {
74839             if (err) {
74840               return callback(err);
74841             } else {
74842               if (path.indexOf(".json") !== -1) {
74843                 return parseJSON(payload, callback, options2);
74844               } else {
74845                 return parseXML(payload, callback, options2);
74846               }
74847             }
74848           }
74849         }
74850       }
74851       if (this.authenticated()) {
74852         return oauth.xhr({ method: "GET", path }, done);
74853       } else {
74854         var url = urlroot + path;
74855         var controller = new AbortController();
74856         var fn;
74857         if (path.indexOf(".json") !== -1) {
74858           fn = json_default;
74859         } else {
74860           fn = xml_default;
74861         }
74862         fn(url, { signal: controller.signal }).then(function(data) {
74863           done(null, data);
74864         }).catch(function(err) {
74865           if (err.name === "AbortError")
74866             return;
74867           var match = err.message.match(/^\d{3}/);
74868           if (match) {
74869             done({ status: +match[0], statusText: err.message });
74870           } else {
74871             done(err.message);
74872           }
74873         });
74874         return controller;
74875       }
74876     },
74877     // Load a single entity by id (ways and relations use the `/full` call to include
74878     // nodes and members). Parent relations are not included, see `loadEntityRelations`.
74879     // GET /api/0.6/node/#id
74880     // GET /api/0.6/[way|relation]/#id/full
74881     loadEntity: function(id2, callback) {
74882       var type2 = osmEntity.id.type(id2);
74883       var osmID = osmEntity.id.toOSM(id2);
74884       var options2 = { skipSeen: false };
74885       this.loadFromAPI(
74886         "/api/0.6/" + type2 + "/" + osmID + (type2 !== "node" ? "/full" : "") + ".json",
74887         function(err, entities) {
74888           if (callback)
74889             callback(err, { data: entities });
74890         },
74891         options2
74892       );
74893     },
74894     // Load a single entity with a specific version
74895     // GET /api/0.6/[node|way|relation]/#id/#version
74896     loadEntityVersion: function(id2, version, callback) {
74897       var type2 = osmEntity.id.type(id2);
74898       var osmID = osmEntity.id.toOSM(id2);
74899       var options2 = { skipSeen: false };
74900       this.loadFromAPI(
74901         "/api/0.6/" + type2 + "/" + osmID + "/" + version + ".json",
74902         function(err, entities) {
74903           if (callback)
74904             callback(err, { data: entities });
74905         },
74906         options2
74907       );
74908     },
74909     // Load the relations of a single entity with the given.
74910     // GET /api/0.6/[node|way|relation]/#id/relations
74911     loadEntityRelations: function(id2, callback) {
74912       var type2 = osmEntity.id.type(id2);
74913       var osmID = osmEntity.id.toOSM(id2);
74914       var options2 = { skipSeen: false };
74915       this.loadFromAPI(
74916         "/api/0.6/" + type2 + "/" + osmID + "/relations.json",
74917         function(err, entities) {
74918           if (callback)
74919             callback(err, { data: entities });
74920         },
74921         options2
74922       );
74923     },
74924     // Load multiple entities in chunks
74925     // (note: callback may be called multiple times)
74926     // Unlike `loadEntity`, child nodes and members are not fetched
74927     // GET /api/0.6/[nodes|ways|relations]?#parameters
74928     loadMultiple: function(ids, callback) {
74929       var that = this;
74930       var groups = utilArrayGroupBy(utilArrayUniq(ids), osmEntity.id.type);
74931       Object.keys(groups).forEach(function(k) {
74932         var type2 = k + "s";
74933         var osmIDs = groups[k].map(function(id2) {
74934           return osmEntity.id.toOSM(id2);
74935         });
74936         var options2 = { skipSeen: false };
74937         utilArrayChunk(osmIDs, 150).forEach(function(arr) {
74938           that.loadFromAPI(
74939             "/api/0.6/" + type2 + ".json?" + type2 + "=" + arr.join(),
74940             function(err, entities) {
74941               if (callback)
74942                 callback(err, { data: entities });
74943             },
74944             options2
74945           );
74946         });
74947       });
74948     },
74949     // Create, upload, and close a changeset
74950     // PUT /api/0.6/changeset/create
74951     // POST /api/0.6/changeset/#id/upload
74952     // PUT /api/0.6/changeset/#id/close
74953     putChangeset: function(changeset, changes, callback) {
74954       var cid = _connectionID;
74955       if (_changeset.inflight) {
74956         return callback({ message: "Changeset already inflight", status: -2 }, changeset);
74957       } else if (_changeset.open) {
74958         return createdChangeset.call(this, null, _changeset.open);
74959       } else {
74960         var options2 = {
74961           method: "PUT",
74962           path: "/api/0.6/changeset/create",
74963           headers: { "Content-Type": "text/xml" },
74964           content: JXON.stringify(changeset.asJXON())
74965         };
74966         _changeset.inflight = oauth.xhr(
74967           options2,
74968           wrapcb(this, createdChangeset, cid)
74969         );
74970       }
74971       function createdChangeset(err, changesetID) {
74972         _changeset.inflight = null;
74973         if (err) {
74974           return callback(err, changeset);
74975         }
74976         _changeset.open = changesetID;
74977         changeset = changeset.update({ id: changesetID });
74978         var options3 = {
74979           method: "POST",
74980           path: "/api/0.6/changeset/" + changesetID + "/upload",
74981           headers: { "Content-Type": "text/xml" },
74982           content: JXON.stringify(changeset.osmChangeJXON(changes))
74983         };
74984         _changeset.inflight = oauth.xhr(
74985           options3,
74986           wrapcb(this, uploadedChangeset, cid)
74987         );
74988       }
74989       function uploadedChangeset(err) {
74990         _changeset.inflight = null;
74991         if (err)
74992           return callback(err, changeset);
74993         window.setTimeout(function() {
74994           callback(null, changeset);
74995         }, 2500);
74996         _changeset.open = null;
74997         if (this.getConnectionId() === cid) {
74998           oauth.xhr({
74999             method: "PUT",
75000             path: "/api/0.6/changeset/" + changeset.id + "/close",
75001             headers: { "Content-Type": "text/xml" }
75002           }, function() {
75003             return true;
75004           });
75005         }
75006       }
75007     },
75008     // Load multiple users in chunks
75009     // (note: callback may be called multiple times)
75010     // GET /api/0.6/users?users=#id1,#id2,...,#idn
75011     loadUsers: function(uids, callback) {
75012       var toLoad = [];
75013       var cached = [];
75014       utilArrayUniq(uids).forEach(function(uid) {
75015         if (_userCache.user[uid]) {
75016           delete _userCache.toLoad[uid];
75017           cached.push(_userCache.user[uid]);
75018         } else {
75019           toLoad.push(uid);
75020         }
75021       });
75022       if (cached.length || !this.authenticated()) {
75023         callback(void 0, cached);
75024         if (!this.authenticated())
75025           return;
75026       }
75027       utilArrayChunk(toLoad, 150).forEach(function(arr) {
75028         oauth.xhr(
75029           { method: "GET", path: "/api/0.6/users.json?users=" + arr.join() },
75030           wrapcb(this, done, _connectionID)
75031         );
75032       }.bind(this));
75033       function done(err, payload) {
75034         if (err)
75035           return callback(err);
75036         var options2 = { skipSeen: true };
75037         return parseUserJSON(payload, function(err2, results) {
75038           if (err2)
75039             return callback(err2);
75040           return callback(void 0, results);
75041         }, options2);
75042       }
75043     },
75044     // Load a given user by id
75045     // GET /api/0.6/user/#id
75046     loadUser: function(uid, callback) {
75047       if (_userCache.user[uid] || !this.authenticated()) {
75048         delete _userCache.toLoad[uid];
75049         return callback(void 0, _userCache.user[uid]);
75050       }
75051       oauth.xhr(
75052         { method: "GET", path: "/api/0.6/user/" + uid + ".json" },
75053         wrapcb(this, done, _connectionID)
75054       );
75055       function done(err, payload) {
75056         if (err)
75057           return callback(err);
75058         var options2 = { skipSeen: true };
75059         return parseUserJSON(payload, function(err2, results) {
75060           if (err2)
75061             return callback(err2);
75062           return callback(void 0, results[0]);
75063         }, options2);
75064       }
75065     },
75066     // Load the details of the logged-in user
75067     // GET /api/0.6/user/details
75068     userDetails: function(callback) {
75069       if (_userDetails) {
75070         return callback(void 0, _userDetails);
75071       }
75072       oauth.xhr(
75073         { method: "GET", path: "/api/0.6/user/details.json" },
75074         wrapcb(this, done, _connectionID)
75075       );
75076       function done(err, payload) {
75077         if (err)
75078           return callback(err);
75079         var options2 = { skipSeen: false };
75080         return parseUserJSON(payload, function(err2, results) {
75081           if (err2)
75082             return callback(err2);
75083           _userDetails = results[0];
75084           return callback(void 0, _userDetails);
75085         }, options2);
75086       }
75087     },
75088     // Load previous changesets for the logged in user
75089     // GET /api/0.6/changesets?user=#id
75090     userChangesets: function(callback) {
75091       if (_userChangesets) {
75092         return callback(void 0, _userChangesets);
75093       }
75094       this.userDetails(
75095         wrapcb(this, gotDetails, _connectionID)
75096       );
75097       function gotDetails(err, user) {
75098         if (err) {
75099           return callback(err);
75100         }
75101         oauth.xhr(
75102           { method: "GET", path: "/api/0.6/changesets?user=" + user.id },
75103           wrapcb(this, done, _connectionID)
75104         );
75105       }
75106       function done(err, xml) {
75107         if (err) {
75108           return callback(err);
75109         }
75110         _userChangesets = Array.prototype.map.call(
75111           xml.getElementsByTagName("changeset"),
75112           function(changeset) {
75113             return { tags: getTags(changeset) };
75114           }
75115         ).filter(function(changeset) {
75116           var comment = changeset.tags.comment;
75117           return comment && comment !== "";
75118         });
75119         return callback(void 0, _userChangesets);
75120       }
75121     },
75122     // Fetch the status of the OSM API
75123     // GET /api/capabilities
75124     status: function(callback) {
75125       var url = urlroot + "/api/capabilities";
75126       var errback = wrapcb(this, done, _connectionID);
75127       xml_default(url).then(function(data) {
75128         errback(null, data);
75129       }).catch(function(err) {
75130         errback(err.message);
75131       });
75132       function done(err, xml) {
75133         if (err) {
75134           return callback(err, null);
75135         }
75136         var elements = xml.getElementsByTagName("blacklist");
75137         var regexes = [];
75138         for (var i2 = 0; i2 < elements.length; i2++) {
75139           var regexString = elements[i2].getAttribute("regex");
75140           if (regexString) {
75141             try {
75142               var regex = new RegExp(regexString);
75143               regexes.push(regex);
75144             } catch (e) {
75145             }
75146           }
75147         }
75148         if (regexes.length) {
75149           _imageryBlocklists = regexes;
75150         }
75151         if (_rateLimitError) {
75152           return callback(_rateLimitError, "rateLimited");
75153         } else {
75154           var waynodes = xml.getElementsByTagName("waynodes");
75155           var maxWayNodes = waynodes.length && parseInt(waynodes[0].getAttribute("maximum"), 10);
75156           if (maxWayNodes && isFinite(maxWayNodes))
75157             _maxWayNodes = maxWayNodes;
75158           var apiStatus = xml.getElementsByTagName("status");
75159           var val = apiStatus[0].getAttribute("api");
75160           return callback(void 0, val);
75161         }
75162       }
75163     },
75164     // Calls `status` and dispatches an `apiStatusChange` event if the returned
75165     // status differs from the cached status.
75166     reloadApiStatus: function() {
75167       if (!this.throttledReloadApiStatus) {
75168         var that = this;
75169         this.throttledReloadApiStatus = throttle_default(function() {
75170           that.status(function(err, status) {
75171             if (status !== _cachedApiStatus) {
75172               _cachedApiStatus = status;
75173               dispatch7.call("apiStatusChange", that, err, status);
75174             }
75175           });
75176         }, 500);
75177       }
75178       this.throttledReloadApiStatus();
75179     },
75180     // Returns the maximum number of nodes a single way can have
75181     maxWayNodes: function() {
75182       return _maxWayNodes;
75183     },
75184     // Load data (entities) from the API in tiles
75185     // GET /api/0.6/map?bbox=
75186     loadTiles: function(projection2, callback) {
75187       if (_off)
75188         return;
75189       var tiles = tiler5.zoomExtent([_tileZoom4, _tileZoom4]).getTiles(projection2);
75190       var hadRequests = hasInflightRequests(_tileCache);
75191       abortUnwantedRequests4(_tileCache, tiles);
75192       if (hadRequests && !hasInflightRequests(_tileCache)) {
75193         dispatch7.call("loaded");
75194       }
75195       tiles.forEach(function(tile) {
75196         this.loadTile(tile, callback);
75197       }, this);
75198     },
75199     // Load a single data tile
75200     // GET /api/0.6/map?bbox=
75201     loadTile: function(tile, callback) {
75202       if (_off)
75203         return;
75204       if (_tileCache.loaded[tile.id] || _tileCache.inflight[tile.id])
75205         return;
75206       if (!hasInflightRequests(_tileCache)) {
75207         dispatch7.call("loading");
75208       }
75209       var path = "/api/0.6/map.json?bbox=";
75210       var options2 = { skipSeen: true };
75211       _tileCache.inflight[tile.id] = this.loadFromAPI(
75212         path + tile.extent.toParam(),
75213         tileCallback,
75214         options2
75215       );
75216       function tileCallback(err, parsed) {
75217         delete _tileCache.inflight[tile.id];
75218         if (!err) {
75219           delete _tileCache.toLoad[tile.id];
75220           _tileCache.loaded[tile.id] = true;
75221           var bbox2 = tile.extent.bbox();
75222           bbox2.id = tile.id;
75223           _tileCache.rtree.insert(bbox2);
75224         }
75225         if (callback) {
75226           callback(err, Object.assign({ data: parsed }, tile));
75227         }
75228         if (!hasInflightRequests(_tileCache)) {
75229           dispatch7.call("loaded");
75230         }
75231       }
75232     },
75233     isDataLoaded: function(loc) {
75234       var bbox2 = { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] };
75235       return _tileCache.rtree.collides(bbox2);
75236     },
75237     // load the tile that covers the given `loc`
75238     loadTileAtLoc: function(loc, callback) {
75239       if (Object.keys(_tileCache.toLoad).length > 50)
75240         return;
75241       var k = geoZoomToScale(_tileZoom4 + 1);
75242       var offset = geoRawMercator().scale(k)(loc);
75243       var projection2 = geoRawMercator().transform({ k, x: -offset[0], y: -offset[1] });
75244       var tiles = tiler5.zoomExtent([_tileZoom4, _tileZoom4]).getTiles(projection2);
75245       tiles.forEach(function(tile) {
75246         if (_tileCache.toLoad[tile.id] || _tileCache.loaded[tile.id] || _tileCache.inflight[tile.id])
75247           return;
75248         _tileCache.toLoad[tile.id] = true;
75249         this.loadTile(tile, callback);
75250       }, this);
75251     },
75252     // Load notes from the API in tiles
75253     // GET /api/0.6/notes?bbox=
75254     loadNotes: function(projection2, noteOptions) {
75255       noteOptions = Object.assign({ limit: 1e4, closed: 7 }, noteOptions);
75256       if (_off)
75257         return;
75258       var that = this;
75259       var path = "/api/0.6/notes?limit=" + noteOptions.limit + "&closed=" + noteOptions.closed + "&bbox=";
75260       var throttleLoadUsers = throttle_default(function() {
75261         var uids = Object.keys(_userCache.toLoad);
75262         if (!uids.length)
75263           return;
75264         that.loadUsers(uids, function() {
75265         });
75266       }, 750);
75267       var tiles = tiler5.zoomExtent([_noteZoom, _noteZoom]).getTiles(projection2);
75268       abortUnwantedRequests4(_noteCache, tiles);
75269       tiles.forEach(function(tile) {
75270         if (_noteCache.loaded[tile.id] || _noteCache.inflight[tile.id])
75271           return;
75272         var options2 = { skipSeen: false };
75273         _noteCache.inflight[tile.id] = that.loadFromAPI(
75274           path + tile.extent.toParam(),
75275           function(err) {
75276             delete _noteCache.inflight[tile.id];
75277             if (!err) {
75278               _noteCache.loaded[tile.id] = true;
75279             }
75280             throttleLoadUsers();
75281             dispatch7.call("loadedNotes");
75282           },
75283           options2
75284         );
75285       });
75286     },
75287     // Create a note
75288     // POST /api/0.6/notes?params
75289     postNoteCreate: function(note, callback) {
75290       if (!this.authenticated()) {
75291         return callback({ message: "Not Authenticated", status: -3 }, note);
75292       }
75293       if (_noteCache.inflightPost[note.id]) {
75294         return callback({ message: "Note update already inflight", status: -2 }, note);
75295       }
75296       if (!note.loc[0] || !note.loc[1] || !note.newComment)
75297         return;
75298       var comment = note.newComment;
75299       if (note.newCategory && note.newCategory !== "None") {
75300         comment += " #" + note.newCategory;
75301       }
75302       var path = "/api/0.6/notes?" + utilQsString({ lon: note.loc[0], lat: note.loc[1], text: comment });
75303       _noteCache.inflightPost[note.id] = oauth.xhr(
75304         { method: "POST", path },
75305         wrapcb(this, done, _connectionID)
75306       );
75307       function done(err, xml) {
75308         delete _noteCache.inflightPost[note.id];
75309         if (err) {
75310           return callback(err);
75311         }
75312         this.removeNote(note);
75313         var options2 = { skipSeen: false };
75314         return parseXML(xml, function(err2, results) {
75315           if (err2) {
75316             return callback(err2);
75317           } else {
75318             return callback(void 0, results[0]);
75319           }
75320         }, options2);
75321       }
75322     },
75323     // Update a note
75324     // POST /api/0.6/notes/#id/comment?text=comment
75325     // POST /api/0.6/notes/#id/close?text=comment
75326     // POST /api/0.6/notes/#id/reopen?text=comment
75327     postNoteUpdate: function(note, newStatus, callback) {
75328       if (!this.authenticated()) {
75329         return callback({ message: "Not Authenticated", status: -3 }, note);
75330       }
75331       if (_noteCache.inflightPost[note.id]) {
75332         return callback({ message: "Note update already inflight", status: -2 }, note);
75333       }
75334       var action;
75335       if (note.status !== "closed" && newStatus === "closed") {
75336         action = "close";
75337       } else if (note.status !== "open" && newStatus === "open") {
75338         action = "reopen";
75339       } else {
75340         action = "comment";
75341         if (!note.newComment)
75342           return;
75343       }
75344       var path = "/api/0.6/notes/" + note.id + "/" + action;
75345       if (note.newComment) {
75346         path += "?" + utilQsString({ text: note.newComment });
75347       }
75348       _noteCache.inflightPost[note.id] = oauth.xhr(
75349         { method: "POST", path },
75350         wrapcb(this, done, _connectionID)
75351       );
75352       function done(err, xml) {
75353         delete _noteCache.inflightPost[note.id];
75354         if (err) {
75355           return callback(err);
75356         }
75357         this.removeNote(note);
75358         if (action === "close") {
75359           _noteCache.closed[note.id] = true;
75360         } else if (action === "reopen") {
75361           delete _noteCache.closed[note.id];
75362         }
75363         var options2 = { skipSeen: false };
75364         return parseXML(xml, function(err2, results) {
75365           if (err2) {
75366             return callback(err2);
75367           } else {
75368             return callback(void 0, results[0]);
75369           }
75370         }, options2);
75371       }
75372     },
75373     /* connection options for source switcher (optional) */
75374     apiConnections: function(val) {
75375       if (!arguments.length)
75376         return _apiConnections;
75377       _apiConnections = val;
75378       return this;
75379     },
75380     switch: function(newOptions) {
75381       urlroot = newOptions.url;
75382       var oldOptions = utilObjectOmit(oauth.options(), "access_token");
75383       oauth.options(Object.assign(oldOptions, newOptions));
75384       this.reset();
75385       this.userChangesets(function() {
75386       });
75387       dispatch7.call("change");
75388       return this;
75389     },
75390     toggle: function(val) {
75391       _off = !val;
75392       return this;
75393     },
75394     isChangesetInflight: function() {
75395       return !!_changeset.inflight;
75396     },
75397     // get/set cached data
75398     // This is used to save/restore the state when entering/exiting the walkthrough
75399     // Also used for testing purposes.
75400     caches: function(obj) {
75401       function cloneCache(source) {
75402         var target = {};
75403         Object.keys(source).forEach(function(k) {
75404           if (k === "rtree") {
75405             target.rtree = new import_rbush9.default().fromJSON(source.rtree.toJSON());
75406           } else if (k === "note") {
75407             target.note = {};
75408             Object.keys(source.note).forEach(function(id2) {
75409               target.note[id2] = osmNote(source.note[id2]);
75410             });
75411           } else {
75412             target[k] = JSON.parse(JSON.stringify(source[k]));
75413           }
75414         });
75415         return target;
75416       }
75417       if (!arguments.length) {
75418         return {
75419           tile: cloneCache(_tileCache),
75420           note: cloneCache(_noteCache),
75421           user: cloneCache(_userCache)
75422         };
75423       }
75424       if (obj === "get") {
75425         return {
75426           tile: _tileCache,
75427           note: _noteCache,
75428           user: _userCache
75429         };
75430       }
75431       if (obj.tile) {
75432         _tileCache = obj.tile;
75433         _tileCache.inflight = {};
75434       }
75435       if (obj.note) {
75436         _noteCache = obj.note;
75437         _noteCache.inflight = {};
75438         _noteCache.inflightPost = {};
75439       }
75440       if (obj.user) {
75441         _userCache = obj.user;
75442       }
75443       return this;
75444     },
75445     logout: function() {
75446       _userChangesets = void 0;
75447       _userDetails = void 0;
75448       oauth.logout();
75449       dispatch7.call("change");
75450       return this;
75451     },
75452     authenticated: function() {
75453       return oauth.authenticated();
75454     },
75455     authenticate: function(callback) {
75456       var that = this;
75457       var cid = _connectionID;
75458       _userChangesets = void 0;
75459       _userDetails = void 0;
75460       function done(err, res) {
75461         if (err) {
75462           if (callback)
75463             callback(err);
75464           return;
75465         }
75466         if (that.getConnectionId() !== cid) {
75467           if (callback)
75468             callback({ message: "Connection Switched", status: -1 });
75469           return;
75470         }
75471         _rateLimitError = void 0;
75472         dispatch7.call("change");
75473         if (callback)
75474           callback(err, res);
75475         that.userChangesets(function() {
75476         });
75477       }
75478       oauth.authenticate(done);
75479     },
75480     imageryBlocklists: function() {
75481       return _imageryBlocklists;
75482     },
75483     tileZoom: function(val) {
75484       if (!arguments.length)
75485         return _tileZoom4;
75486       _tileZoom4 = val;
75487       return this;
75488     },
75489     // get all cached notes covering the viewport
75490     notes: function(projection2) {
75491       var viewport = projection2.clipExtent();
75492       var min3 = [viewport[0][0], viewport[1][1]];
75493       var max3 = [viewport[1][0], viewport[0][1]];
75494       var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
75495       return _noteCache.rtree.search(bbox2).map(function(d) {
75496         return d.data;
75497       });
75498     },
75499     // get a single note from the cache
75500     getNote: function(id2) {
75501       return _noteCache.note[id2];
75502     },
75503     // remove a single note from the cache
75504     removeNote: function(note) {
75505       if (!(note instanceof osmNote) || !note.id)
75506         return;
75507       delete _noteCache.note[note.id];
75508       updateRtree4(encodeNoteRtree(note), false);
75509     },
75510     // replace a single note in the cache
75511     replaceNote: function(note) {
75512       if (!(note instanceof osmNote) || !note.id)
75513         return;
75514       _noteCache.note[note.id] = note;
75515       updateRtree4(encodeNoteRtree(note), true);
75516       return note;
75517     },
75518     // Get an array of note IDs closed during this session.
75519     // Used to populate `closed:note` changeset tag
75520     getClosedIDs: function() {
75521       return Object.keys(_noteCache.closed).sort();
75522     }
75523   };
75524
75525   // modules/services/osm_wikibase.js
75526   var apibase3 = "https://wiki.openstreetmap.org/w/api.php";
75527   var _inflight2 = {};
75528   var _wikibaseCache = {};
75529   var _localeIDs = { en: false };
75530   var debouncedRequest = debounce_default(request, 500, { leading: false });
75531   function request(url, callback) {
75532     if (_inflight2[url])
75533       return;
75534     var controller = new AbortController();
75535     _inflight2[url] = controller;
75536     json_default(url, { signal: controller.signal }).then(function(result) {
75537       delete _inflight2[url];
75538       if (callback)
75539         callback(null, result);
75540     }).catch(function(err) {
75541       delete _inflight2[url];
75542       if (err.name === "AbortError")
75543         return;
75544       if (callback)
75545         callback(err.message);
75546     });
75547   }
75548   var osm_wikibase_default = {
75549     init: function() {
75550       _inflight2 = {};
75551       _wikibaseCache = {};
75552       _localeIDs = {};
75553     },
75554     reset: function() {
75555       Object.values(_inflight2).forEach(function(controller) {
75556         controller.abort();
75557       });
75558       _inflight2 = {};
75559     },
75560     /**
75561      * Get the best value for the property, or undefined if not found
75562      * @param entity object from wikibase
75563      * @param property string e.g. 'P4' for image
75564      * @param langCode string e.g. 'fr' for French
75565      */
75566     claimToValue: function(entity, property, langCode) {
75567       if (!entity.claims[property])
75568         return void 0;
75569       var locale2 = _localeIDs[langCode];
75570       var preferredPick, localePick;
75571       entity.claims[property].forEach(function(stmt) {
75572         if (!preferredPick && stmt.rank === "preferred") {
75573           preferredPick = stmt;
75574         }
75575         if (locale2 && stmt.qualifiers && stmt.qualifiers.P26 && stmt.qualifiers.P26[0].datavalue.value.id === locale2) {
75576           localePick = stmt;
75577         }
75578       });
75579       var result = localePick || preferredPick;
75580       if (result) {
75581         var datavalue = result.mainsnak.datavalue;
75582         return datavalue.type === "wikibase-entityid" ? datavalue.value.id : datavalue.value;
75583       } else {
75584         return void 0;
75585       }
75586     },
75587     /**
75588      * Convert monolingual property into a key-value object (language -> value)
75589      * @param entity object from wikibase
75590      * @param property string e.g. 'P31' for monolingual wiki page title
75591      */
75592     monolingualClaimToValueObj: function(entity, property) {
75593       if (!entity || !entity.claims[property])
75594         return void 0;
75595       return entity.claims[property].reduce(function(acc, obj) {
75596         var value = obj.mainsnak.datavalue.value;
75597         acc[value.language] = value.text;
75598         return acc;
75599       }, {});
75600     },
75601     toSitelink: function(key, value) {
75602       var result = value ? "Tag:" + key + "=" + value : "Key:" + key;
75603       return result.replace(/_/g, " ").trim();
75604     },
75605     //
75606     // Pass params object of the form:
75607     // {
75608     //   key: 'string',
75609     //   value: 'string',
75610     //   langCode: 'string'
75611     // }
75612     //
75613     getEntity: function(params, callback) {
75614       var doRequest = params.debounce ? debouncedRequest : request;
75615       var that = this;
75616       var titles = [];
75617       var result = {};
75618       var rtypeSitelink = params.key === "type" && params.value ? ("Relation:" + params.value).replace(/_/g, " ").trim() : false;
75619       var keySitelink = params.key ? this.toSitelink(params.key) : false;
75620       var tagSitelink = params.key && params.value ? this.toSitelink(params.key, params.value) : false;
75621       var localeSitelink;
75622       if (params.langCodes) {
75623         params.langCodes.forEach(function(langCode) {
75624           if (_localeIDs[langCode] === void 0) {
75625             localeSitelink = ("Locale:" + langCode).replace(/_/g, " ").trim();
75626             titles.push(localeSitelink);
75627           }
75628         });
75629       }
75630       if (rtypeSitelink) {
75631         if (_wikibaseCache[rtypeSitelink]) {
75632           result.rtype = _wikibaseCache[rtypeSitelink];
75633         } else {
75634           titles.push(rtypeSitelink);
75635         }
75636       }
75637       if (keySitelink) {
75638         if (_wikibaseCache[keySitelink]) {
75639           result.key = _wikibaseCache[keySitelink];
75640         } else {
75641           titles.push(keySitelink);
75642         }
75643       }
75644       if (tagSitelink) {
75645         if (_wikibaseCache[tagSitelink]) {
75646           result.tag = _wikibaseCache[tagSitelink];
75647         } else {
75648           titles.push(tagSitelink);
75649         }
75650       }
75651       if (!titles.length) {
75652         return callback(null, result);
75653       }
75654       var obj = {
75655         action: "wbgetentities",
75656         sites: "wiki",
75657         titles: titles.join("|"),
75658         languages: params.langCodes.join("|"),
75659         languagefallback: 1,
75660         origin: "*",
75661         format: "json"
75662         // There is an MW Wikibase API bug https://phabricator.wikimedia.org/T212069
75663         // We shouldn't use v1 until it gets fixed, but should switch to it afterwards
75664         // formatversion: 2,
75665       };
75666       var url = apibase3 + "?" + utilQsString(obj);
75667       doRequest(url, function(err, d) {
75668         if (err) {
75669           callback(err);
75670         } else if (!d.success || d.error) {
75671           callback(d.error.messages.map(function(v) {
75672             return v.html["*"];
75673           }).join("<br>"));
75674         } else {
75675           var localeID = false;
75676           Object.values(d.entities).forEach(function(res) {
75677             if (res.missing !== "") {
75678               var title = res.sitelinks.wiki.title;
75679               if (title === rtypeSitelink) {
75680                 _wikibaseCache[rtypeSitelink] = res;
75681                 result.rtype = res;
75682               } else if (title === keySitelink) {
75683                 _wikibaseCache[keySitelink] = res;
75684                 result.key = res;
75685               } else if (title === tagSitelink) {
75686                 _wikibaseCache[tagSitelink] = res;
75687                 result.tag = res;
75688               } else if (title === localeSitelink) {
75689                 localeID = res.id;
75690               } else {
75691                 console.log("Unexpected title " + title);
75692               }
75693             }
75694           });
75695           if (localeSitelink) {
75696             that.addLocale(params.langCodes[0], localeID);
75697           }
75698           callback(null, result);
75699         }
75700       });
75701     },
75702     //
75703     // Pass params object of the form:
75704     // {
75705     //   key: 'string',     // required
75706     //   value: 'string'    // optional
75707     // }
75708     //
75709     // Get an result object used to display tag documentation
75710     // {
75711     //   title:        'string',
75712     //   description:  'string',
75713     //   editURL:      'string',
75714     //   imageURL:     'string',
75715     //   wiki:         { title: 'string', text: 'string', url: 'string' }
75716     // }
75717     //
75718     getDocs: function(params, callback) {
75719       var that = this;
75720       var langCodes = _mainLocalizer.localeCodes().map(function(code) {
75721         return code.toLowerCase();
75722       });
75723       params.langCodes = langCodes;
75724       this.getEntity(params, function(err, data) {
75725         if (err) {
75726           callback(err);
75727           return;
75728         }
75729         var entity = data.rtype || data.tag || data.key;
75730         if (!entity) {
75731           callback("No entity");
75732           return;
75733         }
75734         var i2;
75735         var description;
75736         for (i2 in langCodes) {
75737           let code2 = langCodes[i2];
75738           if (entity.descriptions[code2] && entity.descriptions[code2].language === code2) {
75739             description = entity.descriptions[code2];
75740             break;
75741           }
75742         }
75743         if (!description && Object.values(entity.descriptions).length)
75744           description = Object.values(entity.descriptions)[0];
75745         var result = {
75746           title: entity.title,
75747           description: description ? description.value : "",
75748           descriptionLocaleCode: description ? description.language : "",
75749           editURL: "https://wiki.openstreetmap.org/wiki/" + entity.title
75750         };
75751         if (entity.claims) {
75752           var imageroot;
75753           var image = that.claimToValue(entity, "P4", langCodes[0]);
75754           if (image) {
75755             imageroot = "https://commons.wikimedia.org/w/index.php";
75756           } else {
75757             image = that.claimToValue(entity, "P28", langCodes[0]);
75758             if (image) {
75759               imageroot = "https://wiki.openstreetmap.org/w/index.php";
75760             }
75761           }
75762           if (imageroot && image) {
75763             result.imageURL = imageroot + "?" + utilQsString({
75764               title: "Special:Redirect/file/" + image,
75765               width: 400
75766             });
75767           }
75768         }
75769         var rtypeWiki = that.monolingualClaimToValueObj(data.rtype, "P31");
75770         var tagWiki = that.monolingualClaimToValueObj(data.tag, "P31");
75771         var keyWiki = that.monolingualClaimToValueObj(data.key, "P31");
75772         var wikis = [rtypeWiki, tagWiki, keyWiki];
75773         for (i2 in wikis) {
75774           var wiki = wikis[i2];
75775           for (var j2 in langCodes) {
75776             var code = langCodes[j2];
75777             var referenceId = langCodes[0].split("-")[0] !== "en" && code.split("-")[0] === "en" ? "inspector.wiki_en_reference" : "inspector.wiki_reference";
75778             var info = getWikiInfo(wiki, code, referenceId);
75779             if (info) {
75780               result.wiki = info;
75781               break;
75782             }
75783           }
75784           if (result.wiki)
75785             break;
75786         }
75787         callback(null, result);
75788         function getWikiInfo(wiki2, langCode, tKey) {
75789           if (wiki2 && wiki2[langCode]) {
75790             return {
75791               title: wiki2[langCode],
75792               text: tKey,
75793               url: "https://wiki.openstreetmap.org/wiki/" + wiki2[langCode]
75794             };
75795           }
75796         }
75797       });
75798     },
75799     addLocale: function(langCode, qid) {
75800       _localeIDs[langCode] = qid;
75801     },
75802     apibase: function(val) {
75803       if (!arguments.length)
75804         return apibase3;
75805       apibase3 = val;
75806       return this;
75807     }
75808   };
75809
75810   // modules/services/streetside.js
75811   var import_rbush10 = __toESM(require_rbush_min());
75812
75813   // modules/util/jsonp_request.js
75814   var jsonpCache = {};
75815   window.jsonpCache = jsonpCache;
75816   function jsonpRequest(url, callback) {
75817     var request3 = {
75818       abort: function() {
75819       }
75820     };
75821     if (window.JSONP_FIX) {
75822       if (window.JSONP_DELAY === 0) {
75823         callback(window.JSONP_FIX);
75824       } else {
75825         var t = window.setTimeout(function() {
75826           callback(window.JSONP_FIX);
75827         }, window.JSONP_DELAY || 0);
75828         request3.abort = function() {
75829           window.clearTimeout(t);
75830         };
75831       }
75832       return request3;
75833     }
75834     function rand() {
75835       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
75836       var c = "";
75837       var i2 = -1;
75838       while (++i2 < 15)
75839         c += chars.charAt(Math.floor(Math.random() * 52));
75840       return c;
75841     }
75842     function create2(url2) {
75843       var e = url2.match(/callback=(\w+)/);
75844       var c = e ? e[1] : rand();
75845       jsonpCache[c] = function(data) {
75846         if (jsonpCache[c]) {
75847           callback(data);
75848         }
75849         finalize();
75850       };
75851       function finalize() {
75852         delete jsonpCache[c];
75853         script.remove();
75854       }
75855       request3.abort = finalize;
75856       return "jsonpCache." + c;
75857     }
75858     var cb = create2(url);
75859     var script = select_default2("head").append("script").attr("type", "text/javascript").attr("src", url.replace(/(\{|%7B)callback(\}|%7D)/, cb));
75860     return request3;
75861   }
75862
75863   // modules/services/streetside.js
75864   var bubbleApi = "https://dev.virtualearth.net/mapcontrol/HumanScaleServices/GetBubbles.ashx?";
75865   var streetsideImagesApi = "https://t.ssl.ak.tiles.virtualearth.net/tiles/";
75866   var bubbleAppKey = "AuftgJsO0Xs8Ts4M1xZUQJQXJNsvmh3IV8DkNieCiy3tCwCUMq76-WpkrBtNAuEm";
75867   var pannellumViewerCSS = "pannellum-streetside/pannellum.css";
75868   var pannellumViewerJS = "pannellum-streetside/pannellum.js";
75869   var maxResults2 = 2e3;
75870   var tileZoom2 = 16.5;
75871   var tiler6 = utilTiler().zoomExtent([tileZoom2, tileZoom2]).skipNullIsland(true);
75872   var dispatch8 = dispatch_default("loadedImages", "viewerChanged");
75873   var minHfov = 10;
75874   var maxHfov = 90;
75875   var defaultHfov = 45;
75876   var _hires = false;
75877   var _resolution = 512;
75878   var _currScene = 0;
75879   var _ssCache;
75880   var _pannellumViewer;
75881   var _sceneOptions = {
75882     showFullscreenCtrl: false,
75883     autoLoad: true,
75884     compass: true,
75885     yaw: 0,
75886     minHfov,
75887     maxHfov,
75888     hfov: defaultHfov,
75889     type: "cubemap",
75890     cubeMap: []
75891   };
75892   var _loadViewerPromise3;
75893   function abortRequest6(i2) {
75894     i2.abort();
75895   }
75896   function localeTimestamp(s) {
75897     if (!s)
75898       return null;
75899     const options2 = { day: "numeric", month: "short", year: "numeric" };
75900     const d = new Date(s);
75901     if (isNaN(d.getTime()))
75902       return null;
75903     return d.toLocaleString(_mainLocalizer.localeCode(), options2);
75904   }
75905   function loadTiles3(which, url, projection2, margin) {
75906     const tiles = tiler6.margin(margin).getTiles(projection2);
75907     const cache = _ssCache[which];
75908     Object.keys(cache.inflight).forEach((k) => {
75909       const wanted = tiles.find((tile) => k.indexOf(tile.id + ",") === 0);
75910       if (!wanted) {
75911         abortRequest6(cache.inflight[k]);
75912         delete cache.inflight[k];
75913       }
75914     });
75915     tiles.forEach((tile) => loadNextTilePage2(which, url, tile));
75916   }
75917   function loadNextTilePage2(which, url, tile) {
75918     const cache = _ssCache[which];
75919     const nextPage = cache.nextPage[tile.id] || 0;
75920     const id2 = tile.id + "," + String(nextPage);
75921     if (cache.loaded[id2] || cache.inflight[id2])
75922       return;
75923     cache.inflight[id2] = getBubbles(url, tile, (bubbles) => {
75924       cache.loaded[id2] = true;
75925       delete cache.inflight[id2];
75926       if (!bubbles)
75927         return;
75928       bubbles.shift();
75929       const features = bubbles.map((bubble) => {
75930         if (cache.points[bubble.id])
75931           return null;
75932         const loc = [bubble.lo, bubble.la];
75933         const d = {
75934           loc,
75935           key: bubble.id,
75936           ca: bubble.he,
75937           captured_at: bubble.cd,
75938           captured_by: "microsoft",
75939           // nbn: bubble.nbn,
75940           // pbn: bubble.pbn,
75941           // ad: bubble.ad,
75942           // rn: bubble.rn,
75943           pr: bubble.pr,
75944           // previous
75945           ne: bubble.ne,
75946           // next
75947           pano: true,
75948           sequenceKey: null
75949         };
75950         cache.points[bubble.id] = d;
75951         if (bubble.pr === void 0) {
75952           cache.leaders.push(bubble.id);
75953         }
75954         return {
75955           minX: loc[0],
75956           minY: loc[1],
75957           maxX: loc[0],
75958           maxY: loc[1],
75959           data: d
75960         };
75961       }).filter(Boolean);
75962       cache.rtree.load(features);
75963       connectSequences();
75964       if (which === "bubbles") {
75965         dispatch8.call("loadedImages");
75966       }
75967     });
75968   }
75969   function connectSequences() {
75970     let cache = _ssCache.bubbles;
75971     let keepLeaders = [];
75972     for (let i2 = 0; i2 < cache.leaders.length; i2++) {
75973       let bubble = cache.points[cache.leaders[i2]];
75974       let seen = {};
75975       let sequence = { key: bubble.key, bubbles: [] };
75976       let complete = false;
75977       do {
75978         sequence.bubbles.push(bubble);
75979         seen[bubble.key] = true;
75980         if (bubble.ne === void 0) {
75981           complete = true;
75982         } else {
75983           bubble = cache.points[bubble.ne];
75984         }
75985       } while (bubble && !seen[bubble.key] && !complete);
75986       if (complete) {
75987         _ssCache.sequences[sequence.key] = sequence;
75988         for (let j2 = 0; j2 < sequence.bubbles.length; j2++) {
75989           sequence.bubbles[j2].sequenceKey = sequence.key;
75990         }
75991         sequence.geojson = {
75992           type: "LineString",
75993           properties: {
75994             captured_at: sequence.bubbles[0] ? sequence.bubbles[0].captured_at : null,
75995             captured_by: sequence.bubbles[0] ? sequence.bubbles[0].captured_by : null,
75996             key: sequence.key
75997           },
75998           coordinates: sequence.bubbles.map((d) => d.loc)
75999         };
76000       } else {
76001         keepLeaders.push(cache.leaders[i2]);
76002       }
76003     }
76004     cache.leaders = keepLeaders;
76005   }
76006   function getBubbles(url, tile, callback) {
76007     let rect = tile.extent.rectangle();
76008     let urlForRequest = url + utilQsString({
76009       n: rect[3],
76010       s: rect[1],
76011       e: rect[2],
76012       w: rect[0],
76013       c: maxResults2,
76014       appkey: bubbleAppKey,
76015       jsCallback: "{callback}"
76016     });
76017     return jsonpRequest(urlForRequest, (data) => {
76018       if (!data || data.error) {
76019         callback(null);
76020       } else {
76021         callback(data);
76022       }
76023     });
76024   }
76025   function partitionViewport3(projection2) {
76026     let z = geoScaleToZoom(projection2.scale());
76027     let z2 = Math.ceil(z * 2) / 2 + 2.5;
76028     let tiler8 = utilTiler().zoomExtent([z2, z2]);
76029     return tiler8.getTiles(projection2).map((tile) => tile.extent);
76030   }
76031   function searchLimited3(limit, projection2, rtree) {
76032     limit = limit || 5;
76033     return partitionViewport3(projection2).reduce((result, extent) => {
76034       let found = rtree.search(extent.bbox()).slice(0, limit).map((d) => d.data);
76035       return found.length ? result.concat(found) : result;
76036     }, []);
76037   }
76038   function loadImage(imgInfo) {
76039     return new Promise((resolve) => {
76040       let img = new Image();
76041       img.onload = () => {
76042         let canvas = document.getElementById("ideditor-canvas" + imgInfo.face);
76043         let ctx = canvas.getContext("2d");
76044         ctx.drawImage(img, imgInfo.x, imgInfo.y);
76045         resolve({ imgInfo, status: "ok" });
76046       };
76047       img.onerror = () => {
76048         resolve({ data: imgInfo, status: "error" });
76049       };
76050       img.setAttribute("crossorigin", "");
76051       img.src = imgInfo.url;
76052     });
76053   }
76054   function loadCanvas(imageGroup) {
76055     return Promise.all(imageGroup.map(loadImage)).then((data) => {
76056       let canvas = document.getElementById("ideditor-canvas" + data[0].imgInfo.face);
76057       const which = { "01": 0, "02": 1, "03": 2, "10": 3, "11": 4, "12": 5 };
76058       let face = data[0].imgInfo.face;
76059       _sceneOptions.cubeMap[which[face]] = canvas.toDataURL("image/jpeg", 1);
76060       return { status: "loadCanvas for face " + data[0].imgInfo.face + "ok" };
76061     });
76062   }
76063   function loadFaces(faceGroup) {
76064     return Promise.all(faceGroup.map(loadCanvas)).then(() => {
76065       return { status: "loadFaces done" };
76066     });
76067   }
76068   function setupCanvas(selection2, reset) {
76069     if (reset) {
76070       selection2.selectAll("#ideditor-stitcher-canvases").remove();
76071     }
76072     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);
76073   }
76074   function qkToXY(qk) {
76075     let x = 0;
76076     let y = 0;
76077     let scale = 256;
76078     for (let i2 = qk.length; i2 > 0; i2--) {
76079       const key = qk[i2 - 1];
76080       x += +(key === "1" || key === "3") * scale;
76081       y += +(key === "2" || key === "3") * scale;
76082       scale *= 2;
76083     }
76084     return [x, y];
76085   }
76086   function getQuadKeys() {
76087     let dim = _resolution / 256;
76088     let quadKeys;
76089     if (dim === 16) {
76090       quadKeys = [
76091         "0000",
76092         "0001",
76093         "0010",
76094         "0011",
76095         "0100",
76096         "0101",
76097         "0110",
76098         "0111",
76099         "1000",
76100         "1001",
76101         "1010",
76102         "1011",
76103         "1100",
76104         "1101",
76105         "1110",
76106         "1111",
76107         "0002",
76108         "0003",
76109         "0012",
76110         "0013",
76111         "0102",
76112         "0103",
76113         "0112",
76114         "0113",
76115         "1002",
76116         "1003",
76117         "1012",
76118         "1013",
76119         "1102",
76120         "1103",
76121         "1112",
76122         "1113",
76123         "0020",
76124         "0021",
76125         "0030",
76126         "0031",
76127         "0120",
76128         "0121",
76129         "0130",
76130         "0131",
76131         "1020",
76132         "1021",
76133         "1030",
76134         "1031",
76135         "1120",
76136         "1121",
76137         "1130",
76138         "1131",
76139         "0022",
76140         "0023",
76141         "0032",
76142         "0033",
76143         "0122",
76144         "0123",
76145         "0132",
76146         "0133",
76147         "1022",
76148         "1023",
76149         "1032",
76150         "1033",
76151         "1122",
76152         "1123",
76153         "1132",
76154         "1133",
76155         "0200",
76156         "0201",
76157         "0210",
76158         "0211",
76159         "0300",
76160         "0301",
76161         "0310",
76162         "0311",
76163         "1200",
76164         "1201",
76165         "1210",
76166         "1211",
76167         "1300",
76168         "1301",
76169         "1310",
76170         "1311",
76171         "0202",
76172         "0203",
76173         "0212",
76174         "0213",
76175         "0302",
76176         "0303",
76177         "0312",
76178         "0313",
76179         "1202",
76180         "1203",
76181         "1212",
76182         "1213",
76183         "1302",
76184         "1303",
76185         "1312",
76186         "1313",
76187         "0220",
76188         "0221",
76189         "0230",
76190         "0231",
76191         "0320",
76192         "0321",
76193         "0330",
76194         "0331",
76195         "1220",
76196         "1221",
76197         "1230",
76198         "1231",
76199         "1320",
76200         "1321",
76201         "1330",
76202         "1331",
76203         "0222",
76204         "0223",
76205         "0232",
76206         "0233",
76207         "0322",
76208         "0323",
76209         "0332",
76210         "0333",
76211         "1222",
76212         "1223",
76213         "1232",
76214         "1233",
76215         "1322",
76216         "1323",
76217         "1332",
76218         "1333",
76219         "2000",
76220         "2001",
76221         "2010",
76222         "2011",
76223         "2100",
76224         "2101",
76225         "2110",
76226         "2111",
76227         "3000",
76228         "3001",
76229         "3010",
76230         "3011",
76231         "3100",
76232         "3101",
76233         "3110",
76234         "3111",
76235         "2002",
76236         "2003",
76237         "2012",
76238         "2013",
76239         "2102",
76240         "2103",
76241         "2112",
76242         "2113",
76243         "3002",
76244         "3003",
76245         "3012",
76246         "3013",
76247         "3102",
76248         "3103",
76249         "3112",
76250         "3113",
76251         "2020",
76252         "2021",
76253         "2030",
76254         "2031",
76255         "2120",
76256         "2121",
76257         "2130",
76258         "2131",
76259         "3020",
76260         "3021",
76261         "3030",
76262         "3031",
76263         "3120",
76264         "3121",
76265         "3130",
76266         "3131",
76267         "2022",
76268         "2023",
76269         "2032",
76270         "2033",
76271         "2122",
76272         "2123",
76273         "2132",
76274         "2133",
76275         "3022",
76276         "3023",
76277         "3032",
76278         "3033",
76279         "3122",
76280         "3123",
76281         "3132",
76282         "3133",
76283         "2200",
76284         "2201",
76285         "2210",
76286         "2211",
76287         "2300",
76288         "2301",
76289         "2310",
76290         "2311",
76291         "3200",
76292         "3201",
76293         "3210",
76294         "3211",
76295         "3300",
76296         "3301",
76297         "3310",
76298         "3311",
76299         "2202",
76300         "2203",
76301         "2212",
76302         "2213",
76303         "2302",
76304         "2303",
76305         "2312",
76306         "2313",
76307         "3202",
76308         "3203",
76309         "3212",
76310         "3213",
76311         "3302",
76312         "3303",
76313         "3312",
76314         "3313",
76315         "2220",
76316         "2221",
76317         "2230",
76318         "2231",
76319         "2320",
76320         "2321",
76321         "2330",
76322         "2331",
76323         "3220",
76324         "3221",
76325         "3230",
76326         "3231",
76327         "3320",
76328         "3321",
76329         "3330",
76330         "3331",
76331         "2222",
76332         "2223",
76333         "2232",
76334         "2233",
76335         "2322",
76336         "2323",
76337         "2332",
76338         "2333",
76339         "3222",
76340         "3223",
76341         "3232",
76342         "3233",
76343         "3322",
76344         "3323",
76345         "3332",
76346         "3333"
76347       ];
76348     } else if (dim === 8) {
76349       quadKeys = [
76350         "000",
76351         "001",
76352         "010",
76353         "011",
76354         "100",
76355         "101",
76356         "110",
76357         "111",
76358         "002",
76359         "003",
76360         "012",
76361         "013",
76362         "102",
76363         "103",
76364         "112",
76365         "113",
76366         "020",
76367         "021",
76368         "030",
76369         "031",
76370         "120",
76371         "121",
76372         "130",
76373         "131",
76374         "022",
76375         "023",
76376         "032",
76377         "033",
76378         "122",
76379         "123",
76380         "132",
76381         "133",
76382         "200",
76383         "201",
76384         "210",
76385         "211",
76386         "300",
76387         "301",
76388         "310",
76389         "311",
76390         "202",
76391         "203",
76392         "212",
76393         "213",
76394         "302",
76395         "303",
76396         "312",
76397         "313",
76398         "220",
76399         "221",
76400         "230",
76401         "231",
76402         "320",
76403         "321",
76404         "330",
76405         "331",
76406         "222",
76407         "223",
76408         "232",
76409         "233",
76410         "322",
76411         "323",
76412         "332",
76413         "333"
76414       ];
76415     } else if (dim === 4) {
76416       quadKeys = [
76417         "00",
76418         "01",
76419         "10",
76420         "11",
76421         "02",
76422         "03",
76423         "12",
76424         "13",
76425         "20",
76426         "21",
76427         "30",
76428         "31",
76429         "22",
76430         "23",
76431         "32",
76432         "33"
76433       ];
76434     } else {
76435       quadKeys = [
76436         "0",
76437         "1",
76438         "2",
76439         "3"
76440       ];
76441     }
76442     return quadKeys;
76443   }
76444   var streetside_default = {
76445     /**
76446      * init() initialize streetside.
76447      */
76448     init: function() {
76449       if (!_ssCache) {
76450         this.reset();
76451       }
76452       this.event = utilRebind(this, dispatch8, "on");
76453     },
76454     /**
76455      * reset() reset the cache.
76456      */
76457     reset: function() {
76458       if (_ssCache) {
76459         Object.values(_ssCache.bubbles.inflight).forEach(abortRequest6);
76460       }
76461       _ssCache = {
76462         bubbles: { inflight: {}, loaded: {}, nextPage: {}, rtree: new import_rbush10.default(), points: {}, leaders: [] },
76463         sequences: {}
76464       };
76465     },
76466     /**
76467      * bubbles()
76468      */
76469     bubbles: function(projection2) {
76470       const limit = 5;
76471       return searchLimited3(limit, projection2, _ssCache.bubbles.rtree);
76472     },
76473     cachedImage: function(imageKey) {
76474       return _ssCache.bubbles.points[imageKey];
76475     },
76476     sequences: function(projection2) {
76477       const viewport = projection2.clipExtent();
76478       const min3 = [viewport[0][0], viewport[1][1]];
76479       const max3 = [viewport[1][0], viewport[0][1]];
76480       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
76481       let seen = {};
76482       let results = [];
76483       _ssCache.bubbles.rtree.search(bbox2).forEach((d) => {
76484         const key = d.data.sequenceKey;
76485         if (key && !seen[key]) {
76486           seen[key] = true;
76487           results.push(_ssCache.sequences[key].geojson);
76488         }
76489       });
76490       return results;
76491     },
76492     /**
76493      * loadBubbles()
76494      */
76495     loadBubbles: function(projection2, margin) {
76496       if (margin === void 0)
76497         margin = 2;
76498       loadTiles3("bubbles", bubbleApi, projection2, margin);
76499     },
76500     viewer: function() {
76501       return _pannellumViewer;
76502     },
76503     initViewer: function() {
76504       if (!window.pannellum)
76505         return;
76506       if (_pannellumViewer)
76507         return;
76508       _currScene += 1;
76509       const sceneID = _currScene.toString();
76510       const options2 = {
76511         "default": { firstScene: sceneID },
76512         scenes: {}
76513       };
76514       options2.scenes[sceneID] = _sceneOptions;
76515       _pannellumViewer = window.pannellum.viewer("ideditor-viewer-streetside", options2);
76516     },
76517     ensureViewerLoaded: function(context) {
76518       if (_loadViewerPromise3)
76519         return _loadViewerPromise3;
76520       let wrap2 = context.container().select(".photoviewer").selectAll(".ms-wrapper").data([0]);
76521       let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper ms-wrapper").classed("hide", true);
76522       let that = this;
76523       let pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
76524       wrapEnter.append("div").attr("id", "ideditor-viewer-streetside").on(pointerPrefix + "down.streetside", () => {
76525         select_default2(window).on(pointerPrefix + "move.streetside", () => {
76526           dispatch8.call("viewerChanged");
76527         }, true);
76528       }).on(pointerPrefix + "up.streetside pointercancel.streetside", () => {
76529         select_default2(window).on(pointerPrefix + "move.streetside", null);
76530         let t = timer((elapsed) => {
76531           dispatch8.call("viewerChanged");
76532           if (elapsed > 2e3) {
76533             t.stop();
76534           }
76535         });
76536       }).append("div").attr("class", "photo-attribution fillD");
76537       let controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
76538       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
76539       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
76540       wrap2 = wrap2.merge(wrapEnter).call(setupCanvas, true);
76541       context.ui().photoviewer.on("resize.streetside", () => {
76542         if (_pannellumViewer) {
76543           _pannellumViewer.resize();
76544         }
76545       });
76546       _loadViewerPromise3 = new Promise((resolve, reject) => {
76547         let loadedCount = 0;
76548         function loaded() {
76549           loadedCount += 1;
76550           if (loadedCount === 2)
76551             resolve();
76552         }
76553         const head = select_default2("head");
76554         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() {
76555           reject();
76556         });
76557         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() {
76558           reject();
76559         });
76560       }).catch(function() {
76561         _loadViewerPromise3 = null;
76562       });
76563       return _loadViewerPromise3;
76564       function step(stepBy) {
76565         return () => {
76566           let viewer = context.container().select(".photoviewer");
76567           let selected = viewer.empty() ? void 0 : viewer.datum();
76568           if (!selected)
76569             return;
76570           let nextID = stepBy === 1 ? selected.ne : selected.pr;
76571           let yaw = _pannellumViewer.getYaw();
76572           let ca = selected.ca + yaw;
76573           let origin = selected.loc;
76574           const meters = 35;
76575           let p1 = [
76576             origin[0] + geoMetersToLon(meters / 5, origin[1]),
76577             origin[1]
76578           ];
76579           let p2 = [
76580             origin[0] + geoMetersToLon(meters / 2, origin[1]),
76581             origin[1] + geoMetersToLat(meters)
76582           ];
76583           let p3 = [
76584             origin[0] - geoMetersToLon(meters / 2, origin[1]),
76585             origin[1] + geoMetersToLat(meters)
76586           ];
76587           let p4 = [
76588             origin[0] - geoMetersToLon(meters / 5, origin[1]),
76589             origin[1]
76590           ];
76591           let poly = [p1, p2, p3, p4, p1];
76592           let angle2 = (stepBy === 1 ? ca : ca + 180) * (Math.PI / 180);
76593           poly = geoRotate(poly, -angle2, origin);
76594           let extent = poly.reduce((extent2, point2) => {
76595             return extent2.extend(geoExtent(point2));
76596           }, geoExtent());
76597           let minDist = Infinity;
76598           _ssCache.bubbles.rtree.search(extent.bbox()).forEach((d) => {
76599             if (d.data.key === selected.key)
76600               return;
76601             if (!geoPointInPolygon(d.data.loc, poly))
76602               return;
76603             let dist = geoVecLength(d.data.loc, selected.loc);
76604             let theta = selected.ca - d.data.ca;
76605             let minTheta = Math.min(Math.abs(theta), 360 - Math.abs(theta));
76606             if (minTheta > 20) {
76607               dist += 5;
76608             }
76609             if (dist < minDist) {
76610               nextID = d.data.key;
76611               minDist = dist;
76612             }
76613           });
76614           let nextBubble = nextID && that.cachedImage(nextID);
76615           if (!nextBubble)
76616             return;
76617           context.map().centerEase(nextBubble.loc);
76618           that.selectImage(context, nextBubble.key).yaw(yaw).showViewer(context);
76619         };
76620       }
76621     },
76622     yaw: function(yaw) {
76623       if (typeof yaw !== "number")
76624         return yaw;
76625       _sceneOptions.yaw = yaw;
76626       return this;
76627     },
76628     /**
76629      * showViewer()
76630      */
76631     showViewer: function(context) {
76632       let wrap2 = context.container().select(".photoviewer").classed("hide", false);
76633       let isHidden = wrap2.selectAll(".photo-wrapper.ms-wrapper.hide").size();
76634       if (isHidden) {
76635         wrap2.selectAll(".photo-wrapper:not(.ms-wrapper)").classed("hide", true);
76636         wrap2.selectAll(".photo-wrapper.ms-wrapper").classed("hide", false);
76637       }
76638       return this;
76639     },
76640     /**
76641      * hideViewer()
76642      */
76643     hideViewer: function(context) {
76644       let viewer = context.container().select(".photoviewer");
76645       if (!viewer.empty())
76646         viewer.datum(null);
76647       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
76648       context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
76649       this.updateUrlImage(null);
76650       return this.setStyles(context, null, true);
76651     },
76652     /**
76653      * selectImage().
76654      */
76655     selectImage: function(context, key) {
76656       let that = this;
76657       let d = this.cachedImage(key);
76658       let viewer = context.container().select(".photoviewer");
76659       if (!viewer.empty())
76660         viewer.datum(d);
76661       this.setStyles(context, null, true);
76662       let wrap2 = context.container().select(".photoviewer .ms-wrapper");
76663       let attribution = wrap2.selectAll(".photo-attribution").html("");
76664       wrap2.selectAll(".pnlm-load-box").style("display", "block");
76665       if (!d)
76666         return this;
76667       this.updateUrlImage(key);
76668       _sceneOptions.northOffset = d.ca;
76669       let line1 = attribution.append("div").attr("class", "attribution-row");
76670       const hiresDomId = utilUniqueDomId("streetside-hires");
76671       let label = line1.append("label").attr("for", hiresDomId).attr("class", "streetside-hires");
76672       label.append("input").attr("type", "checkbox").attr("id", hiresDomId).property("checked", _hires).on("click", (d3_event) => {
76673         d3_event.stopPropagation();
76674         _hires = !_hires;
76675         _resolution = _hires ? 1024 : 512;
76676         wrap2.call(setupCanvas, true);
76677         let viewstate = {
76678           yaw: _pannellumViewer.getYaw(),
76679           pitch: _pannellumViewer.getPitch(),
76680           hfov: _pannellumViewer.getHfov()
76681         };
76682         _sceneOptions = Object.assign(_sceneOptions, viewstate);
76683         that.selectImage(context, d.key).showViewer(context);
76684       });
76685       label.append("span").call(_t.append("streetside.hires"));
76686       let captureInfo = line1.append("div").attr("class", "attribution-capture-info");
76687       if (d.captured_by) {
76688         const yyyy = (/* @__PURE__ */ new Date()).getFullYear();
76689         captureInfo.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://www.microsoft.com/en-us/maps/streetside").text("\xA9" + yyyy + " Microsoft");
76690         captureInfo.append("span").text("|");
76691       }
76692       if (d.captured_at) {
76693         captureInfo.append("span").attr("class", "captured_at").text(localeTimestamp(d.captured_at));
76694       }
76695       let line2 = attribution.append("div").attr("class", "attribution-row");
76696       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"));
76697       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"));
76698       let bubbleIdQuadKey = d.key.toString(4);
76699       const paddingNeeded = 16 - bubbleIdQuadKey.length;
76700       for (let i2 = 0; i2 < paddingNeeded; i2++) {
76701         bubbleIdQuadKey = "0" + bubbleIdQuadKey;
76702       }
76703       const imgUrlPrefix = streetsideImagesApi + "hs" + bubbleIdQuadKey;
76704       const imgUrlSuffix = ".jpg?g=13515&n=z";
76705       const faceKeys = ["01", "02", "03", "10", "11", "12"];
76706       let quadKeys = getQuadKeys();
76707       let faces = faceKeys.map((faceKey) => {
76708         return quadKeys.map((quadKey) => {
76709           const xy = qkToXY(quadKey);
76710           return {
76711             face: faceKey,
76712             url: imgUrlPrefix + faceKey + quadKey + imgUrlSuffix,
76713             x: xy[0],
76714             y: xy[1]
76715           };
76716         });
76717       });
76718       loadFaces(faces).then(function() {
76719         if (!_pannellumViewer) {
76720           that.initViewer();
76721         } else {
76722           _currScene += 1;
76723           let sceneID = _currScene.toString();
76724           _pannellumViewer.addScene(sceneID, _sceneOptions).loadScene(sceneID);
76725           if (_currScene > 2) {
76726             sceneID = (_currScene - 1).toString();
76727             _pannellumViewer.removeScene(sceneID);
76728           }
76729         }
76730       });
76731       return this;
76732     },
76733     getSequenceKeyForBubble: function(d) {
76734       return d && d.sequenceKey;
76735     },
76736     // Updates the currently highlighted sequence and selected bubble.
76737     // Reset is only necessary when interacting with the viewport because
76738     // this implicitly changes the currently selected bubble/sequence
76739     setStyles: function(context, hovered, reset) {
76740       if (reset) {
76741         context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
76742         context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
76743       }
76744       let hoveredBubbleKey = hovered && hovered.key;
76745       let hoveredSequenceKey = this.getSequenceKeyForBubble(hovered);
76746       let hoveredSequence = hoveredSequenceKey && _ssCache.sequences[hoveredSequenceKey];
76747       let hoveredBubbleKeys = hoveredSequence && hoveredSequence.bubbles.map((d) => d.key) || [];
76748       let viewer = context.container().select(".photoviewer");
76749       let selected = viewer.empty() ? void 0 : viewer.datum();
76750       let selectedBubbleKey = selected && selected.key;
76751       let selectedSequenceKey = this.getSequenceKeyForBubble(selected);
76752       let selectedSequence = selectedSequenceKey && _ssCache.sequences[selectedSequenceKey];
76753       let selectedBubbleKeys = selectedSequence && selectedSequence.bubbles.map((d) => d.key) || [];
76754       let highlightedBubbleKeys = utilArrayUnion(hoveredBubbleKeys, selectedBubbleKeys);
76755       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);
76756       context.container().selectAll(".layer-streetside-images .sequence").classed("highlighted", (d) => d.properties.key === hoveredSequenceKey).classed("currentView", (d) => d.properties.key === selectedSequenceKey);
76757       context.container().selectAll(".layer-streetside-images .viewfield-group .viewfield").attr("d", viewfieldPath);
76758       function viewfieldPath() {
76759         let d = this.parentNode.__data__;
76760         if (d.pano && d.key !== selectedBubbleKey) {
76761           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
76762         } else {
76763           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
76764         }
76765       }
76766       return this;
76767     },
76768     updateUrlImage: function(imageKey) {
76769       if (!window.mocha) {
76770         var hash = utilStringQs(window.location.hash);
76771         if (imageKey) {
76772           hash.photo = "streetside/" + imageKey;
76773         } else {
76774           delete hash.photo;
76775         }
76776         window.location.replace("#" + utilQsString(hash, true));
76777       }
76778     },
76779     /**
76780      * cache().
76781      */
76782     cache: function() {
76783       return _ssCache;
76784     }
76785   };
76786
76787   // modules/services/taginfo.js
76788   var apibase4 = taginfoApiUrl;
76789   var _inflight3 = {};
76790   var _popularKeys = {};
76791   var _taginfoCache = {};
76792   var tag_sorts = {
76793     point: "count_nodes",
76794     vertex: "count_nodes",
76795     area: "count_ways",
76796     line: "count_ways"
76797   };
76798   var tag_sort_members = {
76799     point: "count_node_members",
76800     vertex: "count_node_members",
76801     area: "count_way_members",
76802     line: "count_way_members",
76803     relation: "count_relation_members"
76804   };
76805   var tag_filters = {
76806     point: "nodes",
76807     vertex: "nodes",
76808     area: "ways",
76809     line: "ways"
76810   };
76811   var tag_members_fractions = {
76812     point: "count_node_members_fraction",
76813     vertex: "count_node_members_fraction",
76814     area: "count_way_members_fraction",
76815     line: "count_way_members_fraction",
76816     relation: "count_relation_members_fraction"
76817   };
76818   function sets(params, n2, o) {
76819     if (params.geometry && o[params.geometry]) {
76820       params[n2] = o[params.geometry];
76821     }
76822     return params;
76823   }
76824   function setFilter(params) {
76825     return sets(params, "filter", tag_filters);
76826   }
76827   function setSort(params) {
76828     return sets(params, "sortname", tag_sorts);
76829   }
76830   function setSortMembers(params) {
76831     return sets(params, "sortname", tag_sort_members);
76832   }
76833   function clean(params) {
76834     return utilObjectOmit(params, ["geometry", "debounce"]);
76835   }
76836   function filterKeys(type2) {
76837     var count_type = type2 ? "count_" + type2 : "count_all";
76838     return function(d) {
76839       return Number(d[count_type]) > 2500 || d.in_wiki;
76840     };
76841   }
76842   function filterMultikeys(prefix) {
76843     return function(d) {
76844       var re2 = new RegExp("^" + prefix + "(.*)$", "i");
76845       var matches = d.key.match(re2) || [];
76846       return matches.length === 2 && matches[1].indexOf(":") === -1;
76847     };
76848   }
76849   function filterValues(allowUpperCase) {
76850     return function(d) {
76851       if (d.value.match(/[;,]/) !== null)
76852         return false;
76853       if (!allowUpperCase && d.value.match(/[A-Z*]/) !== null)
76854         return false;
76855       return d.count > 100 || d.in_wiki;
76856     };
76857   }
76858   function filterRoles(geometry) {
76859     return function(d) {
76860       if (d.role === "")
76861         return false;
76862       if (d.role.match(/[A-Z*;,]/) !== null)
76863         return false;
76864       return Number(d[tag_members_fractions[geometry]]) > 0;
76865     };
76866   }
76867   function valKey(d) {
76868     return {
76869       value: d.key,
76870       title: d.key
76871     };
76872   }
76873   function valKeyDescription(d) {
76874     var obj = {
76875       value: d.value,
76876       title: d.description || d.value
76877     };
76878     return obj;
76879   }
76880   function roleKey(d) {
76881     return {
76882       value: d.role,
76883       title: d.role
76884     };
76885   }
76886   function sortKeys(a, b) {
76887     return a.key.indexOf(":") === -1 && b.key.indexOf(":") !== -1 ? -1 : a.key.indexOf(":") !== -1 && b.key.indexOf(":") === -1 ? 1 : 0;
76888   }
76889   var debouncedRequest2 = debounce_default(request2, 300, { leading: false });
76890   function request2(url, params, exactMatch, callback, loaded) {
76891     if (_inflight3[url])
76892       return;
76893     if (checkCache(url, params, exactMatch, callback))
76894       return;
76895     var controller = new AbortController();
76896     _inflight3[url] = controller;
76897     json_default(url, { signal: controller.signal }).then(function(result) {
76898       delete _inflight3[url];
76899       if (loaded)
76900         loaded(null, result);
76901     }).catch(function(err) {
76902       delete _inflight3[url];
76903       if (err.name === "AbortError")
76904         return;
76905       if (loaded)
76906         loaded(err.message);
76907     });
76908   }
76909   function checkCache(url, params, exactMatch, callback) {
76910     var rp = params.rp || 25;
76911     var testQuery = params.query || "";
76912     var testUrl = url;
76913     do {
76914       var hit = _taginfoCache[testUrl];
76915       if (hit && (url === testUrl || hit.length < rp)) {
76916         callback(null, hit);
76917         return true;
76918       }
76919       if (exactMatch || !testQuery.length)
76920         return false;
76921       testQuery = testQuery.slice(0, -1);
76922       testUrl = url.replace(/&query=(.*?)&/, "&query=" + testQuery + "&");
76923     } while (testQuery.length >= 0);
76924     return false;
76925   }
76926   var taginfo_default = {
76927     init: function() {
76928       _inflight3 = {};
76929       _taginfoCache = {};
76930       _popularKeys = {
76931         // manually exclude some keys – #5377, #7485
76932         postal_code: true,
76933         full_name: true,
76934         loc_name: true,
76935         reg_name: true,
76936         short_name: true,
76937         sorting_name: true,
76938         artist_name: true,
76939         nat_name: true,
76940         long_name: true,
76941         via: true,
76942         "bridge:name": true
76943       };
76944       var params = {
76945         rp: 100,
76946         sortname: "values_all",
76947         sortorder: "desc",
76948         page: 1,
76949         debounce: false,
76950         lang: _mainLocalizer.languageCode()
76951       };
76952       this.keys(params, function(err, data) {
76953         if (err)
76954           return;
76955         data.forEach(function(d) {
76956           if (d.value === "opening_hours")
76957             return;
76958           _popularKeys[d.value] = true;
76959         });
76960       });
76961     },
76962     reset: function() {
76963       Object.values(_inflight3).forEach(function(controller) {
76964         controller.abort();
76965       });
76966       _inflight3 = {};
76967     },
76968     keys: function(params, callback) {
76969       var doRequest = params.debounce ? debouncedRequest2 : request2;
76970       params = clean(setSort(params));
76971       params = Object.assign({
76972         rp: 10,
76973         sortname: "count_all",
76974         sortorder: "desc",
76975         page: 1,
76976         lang: _mainLocalizer.languageCode()
76977       }, params);
76978       var url = apibase4 + "keys/all?" + utilQsString(params);
76979       doRequest(url, params, false, callback, function(err, d) {
76980         if (err) {
76981           callback(err);
76982         } else {
76983           var f2 = filterKeys(params.filter);
76984           var result = d.data.filter(f2).sort(sortKeys).map(valKey);
76985           _taginfoCache[url] = result;
76986           callback(null, result);
76987         }
76988       });
76989     },
76990     multikeys: function(params, callback) {
76991       var doRequest = params.debounce ? debouncedRequest2 : request2;
76992       params = clean(setSort(params));
76993       params = Object.assign({
76994         rp: 25,
76995         sortname: "count_all",
76996         sortorder: "desc",
76997         page: 1,
76998         lang: _mainLocalizer.languageCode()
76999       }, params);
77000       var prefix = params.query;
77001       var url = apibase4 + "keys/all?" + utilQsString(params);
77002       doRequest(url, params, true, callback, function(err, d) {
77003         if (err) {
77004           callback(err);
77005         } else {
77006           var f2 = filterMultikeys(prefix);
77007           var result = d.data.filter(f2).map(valKey);
77008           _taginfoCache[url] = result;
77009           callback(null, result);
77010         }
77011       });
77012     },
77013     values: function(params, callback) {
77014       var key = params.key;
77015       if (key && _popularKeys[key]) {
77016         callback(null, []);
77017         return;
77018       }
77019       var doRequest = params.debounce ? debouncedRequest2 : request2;
77020       params = clean(setSort(setFilter(params)));
77021       params = Object.assign({
77022         rp: 25,
77023         sortname: "count_all",
77024         sortorder: "desc",
77025         page: 1,
77026         lang: _mainLocalizer.languageCode()
77027       }, params);
77028       var url = apibase4 + "key/values?" + utilQsString(params);
77029       doRequest(url, params, false, callback, function(err, d) {
77030         if (err) {
77031           callback(err);
77032         } else {
77033           var allowUpperCase = allowUpperCaseTagValues.test(params.key);
77034           var f2 = filterValues(allowUpperCase);
77035           var result = d.data.filter(f2).map(valKeyDescription);
77036           _taginfoCache[url] = result;
77037           callback(null, result);
77038         }
77039       });
77040     },
77041     roles: function(params, callback) {
77042       var doRequest = params.debounce ? debouncedRequest2 : request2;
77043       var geometry = params.geometry;
77044       params = clean(setSortMembers(params));
77045       params = Object.assign({
77046         rp: 25,
77047         sortname: "count_all_members",
77048         sortorder: "desc",
77049         page: 1,
77050         lang: _mainLocalizer.languageCode()
77051       }, params);
77052       var url = apibase4 + "relation/roles?" + utilQsString(params);
77053       doRequest(url, params, true, callback, function(err, d) {
77054         if (err) {
77055           callback(err);
77056         } else {
77057           var f2 = filterRoles(geometry);
77058           var result = d.data.filter(f2).map(roleKey);
77059           _taginfoCache[url] = result;
77060           callback(null, result);
77061         }
77062       });
77063     },
77064     docs: function(params, callback) {
77065       var doRequest = params.debounce ? debouncedRequest2 : request2;
77066       params = clean(setSort(params));
77067       var path = "key/wiki_pages?";
77068       if (params.value) {
77069         path = "tag/wiki_pages?";
77070       } else if (params.rtype) {
77071         path = "relation/wiki_pages?";
77072       }
77073       var url = apibase4 + path + utilQsString(params);
77074       doRequest(url, params, true, callback, function(err, d) {
77075         if (err) {
77076           callback(err);
77077         } else {
77078           _taginfoCache[url] = d.data;
77079           callback(null, d.data);
77080         }
77081       });
77082     },
77083     apibase: function(_) {
77084       if (!arguments.length)
77085         return apibase4;
77086       apibase4 = _;
77087       return this;
77088     }
77089   };
77090
77091   // modules/services/vector_tile.js
77092   var import_fast_deep_equal11 = __toESM(require_fast_deep_equal());
77093   var import_fast_json_stable_stringify2 = __toESM(require_fast_json_stable_stringify());
77094   var import_polygon_clipping2 = __toESM(require_polygon_clipping_umd());
77095   var import_pbf2 = __toESM(require_pbf());
77096   var import_vector_tile2 = __toESM(require_vector_tile());
77097   var tiler7 = utilTiler().tileSize(512).margin(1);
77098   var dispatch9 = dispatch_default("loadedData");
77099   var _vtCache;
77100   function abortRequest7(controller) {
77101     controller.abort();
77102   }
77103   function vtToGeoJSON(data, tile, mergeCache) {
77104     var vectorTile = new import_vector_tile2.default.VectorTile(new import_pbf2.default(data));
77105     var layers = Object.keys(vectorTile.layers);
77106     if (!Array.isArray(layers)) {
77107       layers = [layers];
77108     }
77109     var features = [];
77110     layers.forEach(function(layerID) {
77111       var layer = vectorTile.layers[layerID];
77112       if (layer) {
77113         for (var i2 = 0; i2 < layer.length; i2++) {
77114           var feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
77115           var geometry = feature3.geometry;
77116           if (geometry.type === "Polygon") {
77117             geometry.type = "MultiPolygon";
77118             geometry.coordinates = [geometry.coordinates];
77119           }
77120           var isClipped = false;
77121           if (geometry.type === "MultiPolygon") {
77122             var featureClip = bboxClip(feature3, tile.extent.rectangle());
77123             if (!(0, import_fast_deep_equal11.default)(feature3.geometry, featureClip.geometry)) {
77124               isClipped = true;
77125             }
77126             if (!feature3.geometry.coordinates.length)
77127               continue;
77128             if (!feature3.geometry.coordinates[0].length)
77129               continue;
77130           }
77131           var featurehash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3));
77132           var propertyhash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3.properties || {}));
77133           feature3.__layerID__ = layerID.replace(/[^_a-zA-Z0-9\-]/g, "_");
77134           feature3.__featurehash__ = featurehash;
77135           feature3.__propertyhash__ = propertyhash;
77136           features.push(feature3);
77137           if (isClipped && geometry.type === "MultiPolygon") {
77138             var merged = mergeCache[propertyhash];
77139             if (merged && merged.length) {
77140               var other = merged[0];
77141               var coords = import_polygon_clipping2.default.union(
77142                 feature3.geometry.coordinates,
77143                 other.geometry.coordinates
77144               );
77145               if (!coords || !coords.length) {
77146                 continue;
77147               }
77148               merged.push(feature3);
77149               for (var j2 = 0; j2 < merged.length; j2++) {
77150                 merged[j2].geometry.coordinates = coords;
77151                 merged[j2].__featurehash__ = featurehash;
77152               }
77153             } else {
77154               mergeCache[propertyhash] = [feature3];
77155             }
77156           }
77157         }
77158       }
77159     });
77160     return features;
77161   }
77162   function loadTile2(source, tile) {
77163     if (source.loaded[tile.id] || source.inflight[tile.id])
77164       return;
77165     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) {
77166       var subdomains = r.split(",");
77167       return subdomains[(tile.xyz[0] + tile.xyz[1]) % subdomains.length];
77168     });
77169     var controller = new AbortController();
77170     source.inflight[tile.id] = controller;
77171     fetch(url, { signal: controller.signal }).then(function(response) {
77172       if (!response.ok) {
77173         throw new Error(response.status + " " + response.statusText);
77174       }
77175       source.loaded[tile.id] = [];
77176       delete source.inflight[tile.id];
77177       return response.arrayBuffer();
77178     }).then(function(data) {
77179       if (!data) {
77180         throw new Error("No Data");
77181       }
77182       var z = tile.xyz[2];
77183       if (!source.canMerge[z]) {
77184         source.canMerge[z] = {};
77185       }
77186       source.loaded[tile.id] = vtToGeoJSON(data, tile, source.canMerge[z]);
77187       dispatch9.call("loadedData");
77188     }).catch(function() {
77189       source.loaded[tile.id] = [];
77190       delete source.inflight[tile.id];
77191     });
77192   }
77193   var vector_tile_default = {
77194     init: function() {
77195       if (!_vtCache) {
77196         this.reset();
77197       }
77198       this.event = utilRebind(this, dispatch9, "on");
77199     },
77200     reset: function() {
77201       for (var sourceID in _vtCache) {
77202         var source = _vtCache[sourceID];
77203         if (source && source.inflight) {
77204           Object.values(source.inflight).forEach(abortRequest7);
77205         }
77206       }
77207       _vtCache = {};
77208     },
77209     addSource: function(sourceID, template) {
77210       _vtCache[sourceID] = { template, inflight: {}, loaded: {}, canMerge: {} };
77211       return _vtCache[sourceID];
77212     },
77213     data: function(sourceID, projection2) {
77214       var source = _vtCache[sourceID];
77215       if (!source)
77216         return [];
77217       var tiles = tiler7.getTiles(projection2);
77218       var seen = {};
77219       var results = [];
77220       for (var i2 = 0; i2 < tiles.length; i2++) {
77221         var features = source.loaded[tiles[i2].id];
77222         if (!features || !features.length)
77223           continue;
77224         for (var j2 = 0; j2 < features.length; j2++) {
77225           var feature3 = features[j2];
77226           var hash = feature3.__featurehash__;
77227           if (seen[hash])
77228             continue;
77229           seen[hash] = true;
77230           results.push(Object.assign({}, feature3));
77231         }
77232       }
77233       return results;
77234     },
77235     loadTiles: function(sourceID, template, projection2) {
77236       var source = _vtCache[sourceID];
77237       if (!source) {
77238         source = this.addSource(sourceID, template);
77239       }
77240       var tiles = tiler7.getTiles(projection2);
77241       Object.keys(source.inflight).forEach(function(k) {
77242         var wanted = tiles.find(function(tile) {
77243           return k === tile.id;
77244         });
77245         if (!wanted) {
77246           abortRequest7(source.inflight[k]);
77247           delete source.inflight[k];
77248         }
77249       });
77250       tiles.forEach(function(tile) {
77251         loadTile2(source, tile);
77252       });
77253     },
77254     cache: function() {
77255       return _vtCache;
77256     }
77257   };
77258
77259   // modules/services/wikidata.js
77260   var apibase5 = "https://www.wikidata.org/w/api.php?";
77261   var _wikidataCache = {};
77262   var wikidata_default = {
77263     init: function() {
77264     },
77265     reset: function() {
77266       _wikidataCache = {};
77267     },
77268     // Search for Wikidata items matching the query
77269     itemsForSearchQuery: function(query, callback, language) {
77270       if (!query) {
77271         if (callback)
77272           callback("No query", {});
77273         return;
77274       }
77275       var lang = this.languagesToQuery()[0];
77276       var url = apibase5 + utilQsString({
77277         action: "wbsearchentities",
77278         format: "json",
77279         formatversion: 2,
77280         search: query,
77281         type: "item",
77282         // the language to search
77283         language: language || lang,
77284         // the language for the label and description in the result
77285         uselang: lang,
77286         limit: 10,
77287         origin: "*"
77288       });
77289       json_default(url).then((result) => {
77290         if (result && result.error) {
77291           if (result.error.code === "badvalue" && result.error.info.includes(lang) && !language && lang.includes("-")) {
77292             this.itemsForSearchQuery(query, callback, lang.split("-")[0]);
77293             return;
77294           } else {
77295             throw new Error(result.error);
77296           }
77297         }
77298         if (callback)
77299           callback(null, result.search || {});
77300       }).catch(function(err) {
77301         if (callback)
77302           callback(err.message, {});
77303       });
77304     },
77305     // Given a Wikipedia language and article title,
77306     // return an array of corresponding Wikidata entities.
77307     itemsByTitle: function(lang, title, callback) {
77308       if (!title) {
77309         if (callback)
77310           callback("No title", {});
77311         return;
77312       }
77313       lang = lang || "en";
77314       var url = apibase5 + utilQsString({
77315         action: "wbgetentities",
77316         format: "json",
77317         formatversion: 2,
77318         sites: lang.replace(/-/g, "_") + "wiki",
77319         titles: title,
77320         languages: "en",
77321         // shrink response by filtering to one language
77322         origin: "*"
77323       });
77324       json_default(url).then(function(result) {
77325         if (result && result.error) {
77326           throw new Error(result.error);
77327         }
77328         if (callback)
77329           callback(null, result.entities || {});
77330       }).catch(function(err) {
77331         if (callback)
77332           callback(err.message, {});
77333       });
77334     },
77335     languagesToQuery: function() {
77336       return _mainLocalizer.localeCodes().map(function(code) {
77337         return code.toLowerCase();
77338       }).filter(function(code) {
77339         return code !== "en-us";
77340       });
77341     },
77342     entityByQID: function(qid, callback) {
77343       if (!qid) {
77344         callback("No qid", {});
77345         return;
77346       }
77347       if (_wikidataCache[qid]) {
77348         if (callback)
77349           callback(null, _wikidataCache[qid]);
77350         return;
77351       }
77352       var langs = this.languagesToQuery();
77353       var url = apibase5 + utilQsString({
77354         action: "wbgetentities",
77355         format: "json",
77356         formatversion: 2,
77357         ids: qid,
77358         props: "labels|descriptions|claims|sitelinks",
77359         sitefilter: langs.map(function(d) {
77360           return d + "wiki";
77361         }).join("|"),
77362         languages: langs.join("|"),
77363         languagefallback: 1,
77364         origin: "*"
77365       });
77366       json_default(url).then(function(result) {
77367         if (result && result.error) {
77368           throw new Error(result.error);
77369         }
77370         if (callback)
77371           callback(null, result.entities[qid] || {});
77372       }).catch(function(err) {
77373         if (callback)
77374           callback(err.message, {});
77375       });
77376     },
77377     // Pass `params` object of the form:
77378     // {
77379     //   qid: 'string'      // brand wikidata  (e.g. 'Q37158')
77380     // }
77381     //
77382     // Get an result object used to display tag documentation
77383     // {
77384     //   title:        'string',
77385     //   description:  'string',
77386     //   editURL:      'string',
77387     //   imageURL:     'string',
77388     //   wiki:         { title: 'string', text: 'string', url: 'string' }
77389     // }
77390     //
77391     getDocs: function(params, callback) {
77392       var langs = this.languagesToQuery();
77393       this.entityByQID(params.qid, function(err, entity) {
77394         if (err || !entity) {
77395           callback(err || "No entity");
77396           return;
77397         }
77398         var i2;
77399         var description;
77400         for (i2 in langs) {
77401           let code = langs[i2];
77402           if (entity.descriptions[code] && entity.descriptions[code].language === code) {
77403             description = entity.descriptions[code];
77404             break;
77405           }
77406         }
77407         if (!description && Object.values(entity.descriptions).length)
77408           description = Object.values(entity.descriptions)[0];
77409         var result = {
77410           title: entity.id,
77411           description: description ? description.value : "",
77412           descriptionLocaleCode: description ? description.language : "",
77413           editURL: "https://www.wikidata.org/wiki/" + entity.id
77414         };
77415         if (entity.claims) {
77416           var imageroot = "https://commons.wikimedia.org/w/index.php";
77417           var props = ["P154", "P18"];
77418           var prop, image;
77419           for (i2 = 0; i2 < props.length; i2++) {
77420             prop = entity.claims[props[i2]];
77421             if (prop && Object.keys(prop).length > 0) {
77422               image = prop[Object.keys(prop)[0]].mainsnak.datavalue.value;
77423               if (image) {
77424                 result.imageURL = imageroot + "?" + utilQsString({
77425                   title: "Special:Redirect/file/" + image,
77426                   width: 400
77427                 });
77428                 break;
77429               }
77430             }
77431           }
77432         }
77433         if (entity.sitelinks) {
77434           var englishLocale = _mainLocalizer.languageCode().toLowerCase() === "en";
77435           for (i2 = 0; i2 < langs.length; i2++) {
77436             var w = langs[i2] + "wiki";
77437             if (entity.sitelinks[w]) {
77438               var title = entity.sitelinks[w].title;
77439               var tKey = "inspector.wiki_reference";
77440               if (!englishLocale && langs[i2] === "en") {
77441                 tKey = "inspector.wiki_en_reference";
77442               }
77443               result.wiki = {
77444                 title,
77445                 text: tKey,
77446                 url: "https://" + langs[i2] + ".wikipedia.org/wiki/" + title.replace(/ /g, "_")
77447               };
77448               break;
77449             }
77450           }
77451         }
77452         callback(null, result);
77453       });
77454     }
77455   };
77456
77457   // modules/services/wikipedia.js
77458   var endpoint = "https://en.wikipedia.org/w/api.php?";
77459   var wikipedia_default = {
77460     init: function() {
77461     },
77462     reset: function() {
77463     },
77464     search: function(lang, query, callback) {
77465       if (!query) {
77466         if (callback)
77467           callback("No Query", []);
77468         return;
77469       }
77470       lang = lang || "en";
77471       var url = endpoint.replace("en", lang) + utilQsString({
77472         action: "query",
77473         list: "search",
77474         srlimit: "10",
77475         srinfo: "suggestion",
77476         format: "json",
77477         origin: "*",
77478         srsearch: query
77479       });
77480       json_default(url).then(function(result) {
77481         if (result && result.error) {
77482           throw new Error(result.error);
77483         } else if (!result || !result.query || !result.query.search) {
77484           throw new Error("No Results");
77485         }
77486         if (callback) {
77487           var titles = result.query.search.map(function(d) {
77488             return d.title;
77489           });
77490           callback(null, titles);
77491         }
77492       }).catch(function(err) {
77493         if (callback)
77494           callback(err, []);
77495       });
77496     },
77497     suggestions: function(lang, query, callback) {
77498       if (!query) {
77499         if (callback)
77500           callback("", []);
77501         return;
77502       }
77503       lang = lang || "en";
77504       var url = endpoint.replace("en", lang) + utilQsString({
77505         action: "opensearch",
77506         namespace: 0,
77507         suggest: "",
77508         format: "json",
77509         origin: "*",
77510         search: query
77511       });
77512       json_default(url).then(function(result) {
77513         if (result && result.error) {
77514           throw new Error(result.error);
77515         } else if (!result || result.length < 2) {
77516           throw new Error("No Results");
77517         }
77518         if (callback)
77519           callback(null, result[1] || []);
77520       }).catch(function(err) {
77521         if (callback)
77522           callback(err.message, []);
77523       });
77524     },
77525     translations: function(lang, title, callback) {
77526       if (!title) {
77527         if (callback)
77528           callback("No Title");
77529         return;
77530       }
77531       var url = endpoint.replace("en", lang) + utilQsString({
77532         action: "query",
77533         prop: "langlinks",
77534         format: "json",
77535         origin: "*",
77536         lllimit: 500,
77537         titles: title
77538       });
77539       json_default(url).then(function(result) {
77540         if (result && result.error) {
77541           throw new Error(result.error);
77542         } else if (!result || !result.query || !result.query.pages) {
77543           throw new Error("No Results");
77544         }
77545         if (callback) {
77546           var list = result.query.pages[Object.keys(result.query.pages)[0]];
77547           var translations = {};
77548           if (list && list.langlinks) {
77549             list.langlinks.forEach(function(d) {
77550               translations[d.lang] = d["*"];
77551             });
77552           }
77553           callback(null, translations);
77554         }
77555       }).catch(function(err) {
77556         if (callback)
77557           callback(err.message);
77558       });
77559     }
77560   };
77561
77562   // modules/services/index.js
77563   var services = {
77564     geocoder: nominatim_default,
77565     keepRight: keepRight_default,
77566     improveOSM: improveOSM_default,
77567     osmose: osmose_default,
77568     mapillary: mapillary_default,
77569     nsi: nsi_default,
77570     kartaview: kartaview_default,
77571     osm: osm_default,
77572     osmWikibase: osm_wikibase_default,
77573     maprules: maprules_default,
77574     streetside: streetside_default,
77575     taginfo: taginfo_default,
77576     vectorTile: vector_tile_default,
77577     wikidata: wikidata_default,
77578     wikipedia: wikipedia_default
77579   };
77580
77581   // modules/modes/drag_note.js
77582   function modeDragNote(context) {
77583     var mode = {
77584       id: "drag-note",
77585       button: "browse"
77586     };
77587     var edit2 = behaviorEdit(context);
77588     var _nudgeInterval;
77589     var _lastLoc;
77590     var _note;
77591     function startNudge(d3_event, nudge) {
77592       if (_nudgeInterval)
77593         window.clearInterval(_nudgeInterval);
77594       _nudgeInterval = window.setInterval(function() {
77595         context.map().pan(nudge);
77596         doMove(d3_event, nudge);
77597       }, 50);
77598     }
77599     function stopNudge() {
77600       if (_nudgeInterval) {
77601         window.clearInterval(_nudgeInterval);
77602         _nudgeInterval = null;
77603       }
77604     }
77605     function origin(note) {
77606       return context.projection(note.loc);
77607     }
77608     function start2(d3_event, note) {
77609       _note = note;
77610       var osm = services.osm;
77611       if (osm) {
77612         _note = osm.getNote(_note.id);
77613       }
77614       context.surface().selectAll(".note-" + _note.id).classed("active", true);
77615       context.perform(actionNoop());
77616       context.enter(mode);
77617       context.selectedNoteID(_note.id);
77618     }
77619     function move(d3_event, entity, point2) {
77620       d3_event.stopPropagation();
77621       _lastLoc = context.projection.invert(point2);
77622       doMove(d3_event);
77623       var nudge = geoViewportEdge(point2, context.map().dimensions());
77624       if (nudge) {
77625         startNudge(d3_event, nudge);
77626       } else {
77627         stopNudge();
77628       }
77629     }
77630     function doMove(d3_event, nudge) {
77631       nudge = nudge || [0, 0];
77632       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
77633       var currMouse = geoVecSubtract(currPoint, nudge);
77634       var loc = context.projection.invert(currMouse);
77635       _note = _note.move(loc);
77636       var osm = services.osm;
77637       if (osm) {
77638         osm.replaceNote(_note);
77639       }
77640       context.replace(actionNoop());
77641     }
77642     function end() {
77643       context.replace(actionNoop());
77644       context.selectedNoteID(_note.id).enter(modeSelectNote(context, _note.id));
77645     }
77646     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);
77647     mode.enter = function() {
77648       context.install(edit2);
77649     };
77650     mode.exit = function() {
77651       context.ui().sidebar.hover.cancel();
77652       context.uninstall(edit2);
77653       context.surface().selectAll(".active").classed("active", false);
77654       stopNudge();
77655     };
77656     mode.behavior = drag;
77657     return mode;
77658   }
77659
77660   // modules/modes/select_data.js
77661   function modeSelectData(context, selectedDatum) {
77662     var mode = {
77663       id: "select-data",
77664       button: "browse"
77665     };
77666     var keybinding = utilKeybinding("select-data");
77667     var dataEditor = uiDataEditor(context);
77668     var behaviors = [
77669       behaviorBreathe(context),
77670       behaviorHover(context),
77671       behaviorSelect(context),
77672       behaviorLasso(context),
77673       modeDragNode(context).behavior,
77674       modeDragNote(context).behavior
77675     ];
77676     function selectData(d3_event, drawn) {
77677       var selection2 = context.surface().selectAll(".layer-mapdata .data" + selectedDatum.__featurehash__);
77678       if (selection2.empty()) {
77679         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
77680         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
77681           context.enter(modeBrowse(context));
77682         }
77683       } else {
77684         selection2.classed("selected", true);
77685       }
77686     }
77687     function esc() {
77688       if (context.container().select(".combobox").size())
77689         return;
77690       context.enter(modeBrowse(context));
77691     }
77692     mode.zoomToSelected = function() {
77693       var extent = geoExtent(bounds_default(selectedDatum));
77694       context.map().centerZoomEase(extent.center(), context.map().trimmedExtentZoom(extent));
77695     };
77696     mode.enter = function() {
77697       behaviors.forEach(context.install);
77698       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
77699       select_default2(document).call(keybinding);
77700       selectData();
77701       var sidebar = context.ui().sidebar;
77702       sidebar.show(dataEditor.datum(selectedDatum));
77703       var extent = geoExtent(bounds_default(selectedDatum));
77704       sidebar.expand(sidebar.intersects(extent));
77705       context.map().on("drawn.select-data", selectData);
77706     };
77707     mode.exit = function() {
77708       behaviors.forEach(context.uninstall);
77709       select_default2(document).call(keybinding.unbind);
77710       context.surface().selectAll(".layer-mapdata .selected").classed("selected hover", false);
77711       context.map().on("drawn.select-data", null);
77712       context.ui().sidebar.hide();
77713     };
77714     return mode;
77715   }
77716
77717   // modules/behavior/select.js
77718   function behaviorSelect(context) {
77719     var _tolerancePx = 4;
77720     var _lastMouseEvent = null;
77721     var _showMenu = false;
77722     var _downPointers = {};
77723     var _longPressTimeout = null;
77724     var _lastInteractionType = null;
77725     var _multiselectionPointerId = null;
77726     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
77727     function keydown(d3_event) {
77728       if (d3_event.keyCode === 32) {
77729         var activeNode = document.activeElement;
77730         if (activeNode && (/* @__PURE__ */ new Set(["INPUT", "TEXTAREA"])).has(activeNode.nodeName))
77731           return;
77732       }
77733       if (d3_event.keyCode === 93 || // context menu key
77734       d3_event.keyCode === 32) {
77735         d3_event.preventDefault();
77736       }
77737       if (d3_event.repeat)
77738         return;
77739       cancelLongPress();
77740       if (d3_event.shiftKey) {
77741         context.surface().classed("behavior-multiselect", true);
77742       }
77743       if (d3_event.keyCode === 32) {
77744         if (!_downPointers.spacebar && _lastMouseEvent) {
77745           cancelLongPress();
77746           _longPressTimeout = window.setTimeout(didLongPress, 500, "spacebar", "spacebar");
77747           _downPointers.spacebar = {
77748             firstEvent: _lastMouseEvent,
77749             lastEvent: _lastMouseEvent
77750           };
77751         }
77752       }
77753     }
77754     function keyup(d3_event) {
77755       cancelLongPress();
77756       if (!d3_event.shiftKey) {
77757         context.surface().classed("behavior-multiselect", false);
77758       }
77759       if (d3_event.keyCode === 93) {
77760         d3_event.preventDefault();
77761         _lastInteractionType = "menukey";
77762         contextmenu(d3_event);
77763       } else if (d3_event.keyCode === 32) {
77764         var pointer = _downPointers.spacebar;
77765         if (pointer) {
77766           delete _downPointers.spacebar;
77767           if (pointer.done)
77768             return;
77769           d3_event.preventDefault();
77770           _lastInteractionType = "spacebar";
77771           click(pointer.firstEvent, pointer.lastEvent, "spacebar");
77772         }
77773       }
77774     }
77775     function pointerdown(d3_event) {
77776       var id2 = (d3_event.pointerId || "mouse").toString();
77777       cancelLongPress();
77778       if (d3_event.buttons && d3_event.buttons !== 1)
77779         return;
77780       context.ui().closeEditMenu();
77781       if (d3_event.pointerType !== "mouse") {
77782         _longPressTimeout = window.setTimeout(didLongPress, 500, id2, "longdown-" + (d3_event.pointerType || "mouse"));
77783       }
77784       _downPointers[id2] = {
77785         firstEvent: d3_event,
77786         lastEvent: d3_event
77787       };
77788     }
77789     function didLongPress(id2, interactionType) {
77790       var pointer = _downPointers[id2];
77791       if (!pointer)
77792         return;
77793       for (var i2 in _downPointers) {
77794         _downPointers[i2].done = true;
77795       }
77796       _longPressTimeout = null;
77797       _lastInteractionType = interactionType;
77798       _showMenu = true;
77799       click(pointer.firstEvent, pointer.lastEvent, id2);
77800     }
77801     function pointermove(d3_event) {
77802       var id2 = (d3_event.pointerId || "mouse").toString();
77803       if (_downPointers[id2]) {
77804         _downPointers[id2].lastEvent = d3_event;
77805       }
77806       if (!d3_event.pointerType || d3_event.pointerType === "mouse") {
77807         _lastMouseEvent = d3_event;
77808         if (_downPointers.spacebar) {
77809           _downPointers.spacebar.lastEvent = d3_event;
77810         }
77811       }
77812     }
77813     function pointerup(d3_event) {
77814       var id2 = (d3_event.pointerId || "mouse").toString();
77815       var pointer = _downPointers[id2];
77816       if (!pointer)
77817         return;
77818       delete _downPointers[id2];
77819       if (_multiselectionPointerId === id2) {
77820         _multiselectionPointerId = null;
77821       }
77822       if (pointer.done)
77823         return;
77824       click(pointer.firstEvent, d3_event, id2);
77825     }
77826     function pointercancel(d3_event) {
77827       var id2 = (d3_event.pointerId || "mouse").toString();
77828       if (!_downPointers[id2])
77829         return;
77830       delete _downPointers[id2];
77831       if (_multiselectionPointerId === id2) {
77832         _multiselectionPointerId = null;
77833       }
77834     }
77835     function contextmenu(d3_event) {
77836       d3_event.preventDefault();
77837       if (!+d3_event.clientX && !+d3_event.clientY) {
77838         if (_lastMouseEvent) {
77839           d3_event = _lastMouseEvent;
77840         } else {
77841           return;
77842         }
77843       } else {
77844         _lastMouseEvent = d3_event;
77845         if (d3_event.pointerType === "touch" || d3_event.pointerType === "pen" || d3_event.mozInputSource && // firefox doesn't give a pointerType on contextmenu events
77846         (d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_TOUCH || d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_PEN)) {
77847           _lastInteractionType = "touch";
77848         } else {
77849           _lastInteractionType = "rightclick";
77850         }
77851       }
77852       _showMenu = true;
77853       click(d3_event, d3_event);
77854     }
77855     function click(firstEvent, lastEvent, pointerId) {
77856       cancelLongPress();
77857       var mapNode = context.container().select(".main-map").node();
77858       var pointGetter = utilFastMouse(mapNode);
77859       var p1 = pointGetter(firstEvent);
77860       var p2 = pointGetter(lastEvent);
77861       var dist = geoVecLength(p1, p2);
77862       if (dist > _tolerancePx || !mapContains(lastEvent)) {
77863         resetProperties();
77864         return;
77865       }
77866       var targetDatum = lastEvent.target.__data__;
77867       var multiselectEntityId;
77868       if (!_multiselectionPointerId) {
77869         var selectPointerInfo = pointerDownOnSelection(pointerId);
77870         if (selectPointerInfo) {
77871           _multiselectionPointerId = selectPointerInfo.pointerId;
77872           multiselectEntityId = !selectPointerInfo.selected && selectPointerInfo.entityId;
77873           _downPointers[selectPointerInfo.pointerId].done = true;
77874         }
77875       }
77876       var isMultiselect = context.mode().id === "select" && // and shift key is down
77877       (lastEvent && lastEvent.shiftKey || // or we're lasso-selecting
77878       context.surface().select(".lasso").node() || // or a pointer is down over a selected feature
77879       _multiselectionPointerId && !multiselectEntityId);
77880       processClick(targetDatum, isMultiselect, p2, multiselectEntityId);
77881       function mapContains(event) {
77882         var rect = mapNode.getBoundingClientRect();
77883         return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
77884       }
77885       function pointerDownOnSelection(skipPointerId) {
77886         var mode = context.mode();
77887         var selectedIDs = mode.id === "select" ? mode.selectedIDs() : [];
77888         for (var pointerId2 in _downPointers) {
77889           if (pointerId2 === "spacebar" || pointerId2 === skipPointerId)
77890             continue;
77891           var pointerInfo = _downPointers[pointerId2];
77892           var p12 = pointGetter(pointerInfo.firstEvent);
77893           var p22 = pointGetter(pointerInfo.lastEvent);
77894           if (geoVecLength(p12, p22) > _tolerancePx)
77895             continue;
77896           var datum2 = pointerInfo.firstEvent.target.__data__;
77897           var entity = datum2 && datum2.properties && datum2.properties.entity || datum2;
77898           if (context.graph().hasEntity(entity.id)) {
77899             return {
77900               pointerId: pointerId2,
77901               entityId: entity.id,
77902               selected: selectedIDs.indexOf(entity.id) !== -1
77903             };
77904           }
77905         }
77906         return null;
77907       }
77908     }
77909     function processClick(datum2, isMultiselect, point2, alsoSelectId) {
77910       var mode = context.mode();
77911       var showMenu = _showMenu;
77912       var interactionType = _lastInteractionType;
77913       var entity = datum2 && datum2.properties && datum2.properties.entity;
77914       if (entity)
77915         datum2 = entity;
77916       if (datum2 && datum2.type === "midpoint") {
77917         datum2 = datum2.parents[0];
77918       }
77919       var newMode;
77920       if (datum2 instanceof osmEntity) {
77921         var selectedIDs = context.selectedIDs();
77922         context.selectedNoteID(null);
77923         context.selectedErrorID(null);
77924         if (!isMultiselect) {
77925           if (!showMenu || selectedIDs.length <= 1 || selectedIDs.indexOf(datum2.id) === -1) {
77926             if (alsoSelectId === datum2.id)
77927               alsoSelectId = null;
77928             selectedIDs = (alsoSelectId ? [alsoSelectId] : []).concat([datum2.id]);
77929             newMode = mode.id === "select" ? mode.selectedIDs(selectedIDs) : modeSelect(context, selectedIDs).selectBehavior(behavior);
77930             context.enter(newMode);
77931           }
77932         } else {
77933           if (selectedIDs.indexOf(datum2.id) !== -1) {
77934             if (!showMenu) {
77935               selectedIDs = selectedIDs.filter(function(id2) {
77936                 return id2 !== datum2.id;
77937               });
77938               newMode = selectedIDs.length ? mode.selectedIDs(selectedIDs) : modeBrowse(context).selectBehavior(behavior);
77939               context.enter(newMode);
77940             }
77941           } else {
77942             selectedIDs = selectedIDs.concat([datum2.id]);
77943             newMode = mode.selectedIDs(selectedIDs);
77944             context.enter(newMode);
77945           }
77946         }
77947       } else if (datum2 && datum2.__featurehash__ && !isMultiselect) {
77948         context.selectedNoteID(null).enter(modeSelectData(context, datum2));
77949       } else if (datum2 instanceof osmNote && !isMultiselect) {
77950         context.selectedNoteID(datum2.id).enter(modeSelectNote(context, datum2.id));
77951       } else if (datum2 instanceof QAItem && !isMultiselect) {
77952         context.selectedErrorID(datum2.id).enter(modeSelectError(context, datum2.id, datum2.service));
77953       } else {
77954         context.selectedNoteID(null);
77955         context.selectedErrorID(null);
77956         if (!isMultiselect && mode.id !== "browse") {
77957           context.enter(modeBrowse(context));
77958         }
77959       }
77960       context.ui().closeEditMenu();
77961       if (showMenu)
77962         context.ui().showEditMenu(point2, interactionType);
77963       resetProperties();
77964     }
77965     function cancelLongPress() {
77966       if (_longPressTimeout)
77967         window.clearTimeout(_longPressTimeout);
77968       _longPressTimeout = null;
77969     }
77970     function resetProperties() {
77971       cancelLongPress();
77972       _showMenu = false;
77973       _lastInteractionType = null;
77974     }
77975     function behavior(selection2) {
77976       resetProperties();
77977       _lastMouseEvent = context.map().lastPointerEvent();
77978       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) {
77979         var e = d3_event;
77980         if (+e.clientX === 0 && +e.clientY === 0) {
77981           d3_event.preventDefault();
77982         }
77983       });
77984       selection2.on(_pointerPrefix + "down.select", pointerdown).on("contextmenu.select", contextmenu);
77985     }
77986     behavior.off = function(selection2) {
77987       cancelLongPress();
77988       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);
77989       selection2.on(_pointerPrefix + "down.select", null).on("contextmenu.select", null);
77990       context.surface().classed("behavior-multiselect", false);
77991     };
77992     return behavior;
77993   }
77994
77995   // modules/operations/index.js
77996   var operations_exports = {};
77997   __export(operations_exports, {
77998     operationCircularize: () => operationCircularize,
77999     operationContinue: () => operationContinue,
78000     operationCopy: () => operationCopy,
78001     operationDelete: () => operationDelete,
78002     operationDisconnect: () => operationDisconnect,
78003     operationDowngrade: () => operationDowngrade,
78004     operationExtract: () => operationExtract,
78005     operationMerge: () => operationMerge,
78006     operationMove: () => operationMove,
78007     operationOrthogonalize: () => operationOrthogonalize,
78008     operationPaste: () => operationPaste,
78009     operationReflectLong: () => operationReflectLong,
78010     operationReflectShort: () => operationReflectShort,
78011     operationReverse: () => operationReverse,
78012     operationRotate: () => operationRotate,
78013     operationSplit: () => operationSplit,
78014     operationStraighten: () => operationStraighten
78015   });
78016
78017   // modules/operations/continue.js
78018   function operationContinue(context, selectedIDs) {
78019     var _entities = selectedIDs.map(function(id2) {
78020       return context.graph().entity(id2);
78021     });
78022     var _geometries = Object.assign(
78023       { line: [], vertex: [] },
78024       utilArrayGroupBy(_entities, function(entity) {
78025         return entity.geometry(context.graph());
78026       })
78027     );
78028     var _vertex = _geometries.vertex.length && _geometries.vertex[0];
78029     function candidateWays() {
78030       return _vertex ? context.graph().parentWays(_vertex).filter(function(parent) {
78031         return parent.geometry(context.graph()) === "line" && !parent.isClosed() && parent.affix(_vertex.id) && (_geometries.line.length === 0 || _geometries.line[0] === parent);
78032       }) : [];
78033     }
78034     var _candidates = candidateWays();
78035     var operation = function() {
78036       var candidate = _candidates[0];
78037       context.enter(
78038         modeDrawLine(context, candidate.id, context.graph(), "line", candidate.affix(_vertex.id), true)
78039       );
78040     };
78041     operation.relatedEntityIds = function() {
78042       return _candidates.length ? [_candidates[0].id] : [];
78043     };
78044     operation.available = function() {
78045       return _geometries.vertex.length === 1 && _geometries.line.length <= 1 && !context.features().hasHiddenConnections(_vertex, context.graph());
78046     };
78047     operation.disabled = function() {
78048       if (_candidates.length === 0) {
78049         return "not_eligible";
78050       } else if (_candidates.length > 1) {
78051         return "multiple";
78052       }
78053       return false;
78054     };
78055     operation.tooltip = function() {
78056       var disable = operation.disabled();
78057       return disable ? _t.append("operations.continue." + disable) : _t.append("operations.continue.description");
78058     };
78059     operation.annotation = function() {
78060       return _t("operations.continue.annotation.line");
78061     };
78062     operation.id = "continue";
78063     operation.keys = [_t("operations.continue.key")];
78064     operation.title = _t.append("operations.continue.title");
78065     operation.behavior = behaviorOperation(context).which(operation);
78066     return operation;
78067   }
78068
78069   // modules/operations/copy.js
78070   function operationCopy(context, selectedIDs) {
78071     function getFilteredIdsToCopy() {
78072       return selectedIDs.filter(function(selectedID) {
78073         var entity = context.graph().hasEntity(selectedID);
78074         return entity.hasInterestingTags() || entity.geometry(context.graph()) !== "vertex";
78075       });
78076     }
78077     var operation = function() {
78078       var graph = context.graph();
78079       var selected = groupEntities(getFilteredIdsToCopy(), graph);
78080       var canCopy = [];
78081       var skip = {};
78082       var entity;
78083       var i2;
78084       for (i2 = 0; i2 < selected.relation.length; i2++) {
78085         entity = selected.relation[i2];
78086         if (!skip[entity.id] && entity.isComplete(graph)) {
78087           canCopy.push(entity.id);
78088           skip = getDescendants(entity.id, graph, skip);
78089         }
78090       }
78091       for (i2 = 0; i2 < selected.way.length; i2++) {
78092         entity = selected.way[i2];
78093         if (!skip[entity.id]) {
78094           canCopy.push(entity.id);
78095           skip = getDescendants(entity.id, graph, skip);
78096         }
78097       }
78098       for (i2 = 0; i2 < selected.node.length; i2++) {
78099         entity = selected.node[i2];
78100         if (!skip[entity.id]) {
78101           canCopy.push(entity.id);
78102         }
78103       }
78104       context.copyIDs(canCopy);
78105       if (_point && (canCopy.length !== 1 || graph.entity(canCopy[0]).type !== "node")) {
78106         context.copyLonLat(context.projection.invert(_point));
78107       } else {
78108         context.copyLonLat(null);
78109       }
78110     };
78111     function groupEntities(ids, graph) {
78112       var entities = ids.map(function(id2) {
78113         return graph.entity(id2);
78114       });
78115       return Object.assign(
78116         { relation: [], way: [], node: [] },
78117         utilArrayGroupBy(entities, "type")
78118       );
78119     }
78120     function getDescendants(id2, graph, descendants) {
78121       var entity = graph.entity(id2);
78122       var children2;
78123       descendants = descendants || {};
78124       if (entity.type === "relation") {
78125         children2 = entity.members.map(function(m) {
78126           return m.id;
78127         });
78128       } else if (entity.type === "way") {
78129         children2 = entity.nodes;
78130       } else {
78131         children2 = [];
78132       }
78133       for (var i2 = 0; i2 < children2.length; i2++) {
78134         if (!descendants[children2[i2]]) {
78135           descendants[children2[i2]] = true;
78136           descendants = getDescendants(children2[i2], graph, descendants);
78137         }
78138       }
78139       return descendants;
78140     }
78141     operation.available = function() {
78142       return getFilteredIdsToCopy().length > 0;
78143     };
78144     operation.disabled = function() {
78145       var extent = utilTotalExtent(getFilteredIdsToCopy(), context.graph());
78146       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
78147         return "too_large";
78148       }
78149       return false;
78150     };
78151     operation.availableForKeypress = function() {
78152       var selection2 = window.getSelection && window.getSelection();
78153       return !selection2 || !selection2.toString();
78154     };
78155     operation.tooltip = function() {
78156       var disable = operation.disabled();
78157       return disable ? _t.append("operations.copy." + disable, { n: selectedIDs.length }) : _t.append("operations.copy.description", { n: selectedIDs.length });
78158     };
78159     operation.annotation = function() {
78160       return _t("operations.copy.annotation", { n: selectedIDs.length });
78161     };
78162     var _point;
78163     operation.point = function(val) {
78164       _point = val;
78165       return operation;
78166     };
78167     operation.id = "copy";
78168     operation.keys = [uiCmd("\u2318C")];
78169     operation.title = _t.append("operations.copy.title");
78170     operation.behavior = behaviorOperation(context).which(operation);
78171     return operation;
78172   }
78173
78174   // modules/operations/disconnect.js
78175   function operationDisconnect(context, selectedIDs) {
78176     var _vertexIDs = [];
78177     var _wayIDs = [];
78178     var _otherIDs = [];
78179     var _actions = [];
78180     selectedIDs.forEach(function(id2) {
78181       var entity = context.entity(id2);
78182       if (entity.type === "way") {
78183         _wayIDs.push(id2);
78184       } else if (entity.geometry(context.graph()) === "vertex") {
78185         _vertexIDs.push(id2);
78186       } else {
78187         _otherIDs.push(id2);
78188       }
78189     });
78190     var _coords, _descriptionID = "", _annotationID = "features";
78191     var _disconnectingVertexIds = [];
78192     var _disconnectingWayIds = [];
78193     if (_vertexIDs.length > 0) {
78194       _disconnectingVertexIds = _vertexIDs;
78195       _vertexIDs.forEach(function(vertexID) {
78196         var action = actionDisconnect(vertexID);
78197         if (_wayIDs.length > 0) {
78198           var waysIDsForVertex = _wayIDs.filter(function(wayID) {
78199             var way = context.entity(wayID);
78200             return way.nodes.indexOf(vertexID) !== -1;
78201           });
78202           action.limitWays(waysIDsForVertex);
78203         }
78204         _actions.push(action);
78205         _disconnectingWayIds = _disconnectingWayIds.concat(context.graph().parentWays(context.graph().entity(vertexID)).map((d) => d.id));
78206       });
78207       _disconnectingWayIds = utilArrayUniq(_disconnectingWayIds).filter(function(id2) {
78208         return _wayIDs.indexOf(id2) === -1;
78209       });
78210       _descriptionID += _actions.length === 1 ? "single_point." : "multiple_points.";
78211       if (_wayIDs.length === 1) {
78212         _descriptionID += "single_way." + context.graph().geometry(_wayIDs[0]);
78213       } else {
78214         _descriptionID += _wayIDs.length === 0 ? "no_ways" : "multiple_ways";
78215       }
78216     } else if (_wayIDs.length > 0) {
78217       var ways = _wayIDs.map(function(id2) {
78218         return context.entity(id2);
78219       });
78220       var nodes = utilGetAllNodes(_wayIDs, context.graph());
78221       _coords = nodes.map(function(n2) {
78222         return n2.loc;
78223       });
78224       var sharedActions = [];
78225       var sharedNodes = [];
78226       var unsharedActions = [];
78227       var unsharedNodes = [];
78228       nodes.forEach(function(node) {
78229         var action = actionDisconnect(node.id).limitWays(_wayIDs);
78230         if (action.disabled(context.graph()) !== "not_connected") {
78231           var count = 0;
78232           for (var i2 in ways) {
78233             var way = ways[i2];
78234             if (way.nodes.indexOf(node.id) !== -1) {
78235               count += 1;
78236             }
78237             if (count > 1)
78238               break;
78239           }
78240           if (count > 1) {
78241             sharedActions.push(action);
78242             sharedNodes.push(node);
78243           } else {
78244             unsharedActions.push(action);
78245             unsharedNodes.push(node);
78246           }
78247         }
78248       });
78249       _descriptionID += "no_points.";
78250       _descriptionID += _wayIDs.length === 1 ? "single_way." : "multiple_ways.";
78251       if (sharedActions.length) {
78252         _actions = sharedActions;
78253         _disconnectingVertexIds = sharedNodes.map((node) => node.id);
78254         _descriptionID += "conjoined";
78255         _annotationID = "from_each_other";
78256       } else {
78257         _actions = unsharedActions;
78258         _disconnectingVertexIds = unsharedNodes.map((node) => node.id);
78259         if (_wayIDs.length === 1) {
78260           _descriptionID += context.graph().geometry(_wayIDs[0]);
78261         } else {
78262           _descriptionID += "separate";
78263         }
78264       }
78265     }
78266     var _extent = utilTotalExtent(_disconnectingVertexIds, context.graph());
78267     var operation = function() {
78268       context.perform(function(graph) {
78269         return _actions.reduce(function(graph2, action) {
78270           return action(graph2);
78271         }, graph);
78272       }, operation.annotation());
78273       context.validator().validate();
78274     };
78275     operation.relatedEntityIds = function() {
78276       if (_vertexIDs.length) {
78277         return _disconnectingWayIds;
78278       }
78279       return _disconnectingVertexIds;
78280     };
78281     operation.available = function() {
78282       if (_actions.length === 0)
78283         return false;
78284       if (_otherIDs.length !== 0)
78285         return false;
78286       if (_vertexIDs.length !== 0 && _wayIDs.length !== 0 && !_wayIDs.every(function(wayID) {
78287         return _vertexIDs.some(function(vertexID) {
78288           var way = context.entity(wayID);
78289           return way.nodes.indexOf(vertexID) !== -1;
78290         });
78291       }))
78292         return false;
78293       return true;
78294     };
78295     operation.disabled = function() {
78296       var reason;
78297       for (var actionIndex in _actions) {
78298         reason = _actions[actionIndex].disabled(context.graph());
78299         if (reason)
78300           return reason;
78301       }
78302       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
78303         return "too_large." + ((_vertexIDs.length ? _vertexIDs : _wayIDs).length === 1 ? "single" : "multiple");
78304       } else if (_coords && someMissing()) {
78305         return "not_downloaded";
78306       } else if (selectedIDs.some(context.hasHiddenConnections)) {
78307         return "connected_to_hidden";
78308       }
78309       return false;
78310       function someMissing() {
78311         if (context.inIntro())
78312           return false;
78313         var osm = context.connection();
78314         if (osm) {
78315           var missing = _coords.filter(function(loc) {
78316             return !osm.isDataLoaded(loc);
78317           });
78318           if (missing.length) {
78319             missing.forEach(function(loc) {
78320               context.loadTileAtLoc(loc);
78321             });
78322             return true;
78323           }
78324         }
78325         return false;
78326       }
78327     };
78328     operation.tooltip = function() {
78329       var disable = operation.disabled();
78330       return disable ? _t.append("operations.disconnect." + disable) : _t.append("operations.disconnect.description." + _descriptionID);
78331     };
78332     operation.annotation = function() {
78333       return _t("operations.disconnect.annotation." + _annotationID);
78334     };
78335     operation.id = "disconnect";
78336     operation.keys = [_t("operations.disconnect.key")];
78337     operation.title = _t.append("operations.disconnect.title");
78338     operation.behavior = behaviorOperation(context).which(operation);
78339     return operation;
78340   }
78341
78342   // modules/operations/downgrade.js
78343   function operationDowngrade(context, selectedIDs) {
78344     var _affectedFeatureCount = 0;
78345     var _downgradeType = downgradeTypeForEntityIDs(selectedIDs);
78346     var _multi = _affectedFeatureCount === 1 ? "single" : "multiple";
78347     function downgradeTypeForEntityIDs(entityIds) {
78348       var downgradeType;
78349       _affectedFeatureCount = 0;
78350       for (var i2 in entityIds) {
78351         var entityID = entityIds[i2];
78352         var type2 = downgradeTypeForEntityID(entityID);
78353         if (type2) {
78354           _affectedFeatureCount += 1;
78355           if (downgradeType && type2 !== downgradeType) {
78356             if (downgradeType !== "generic" && type2 !== "generic") {
78357               downgradeType = "building_address";
78358             } else {
78359               downgradeType = "generic";
78360             }
78361           } else {
78362             downgradeType = type2;
78363           }
78364         }
78365       }
78366       return downgradeType;
78367     }
78368     function downgradeTypeForEntityID(entityID) {
78369       var graph = context.graph();
78370       var entity = graph.entity(entityID);
78371       var preset = _mainPresetIndex.match(entity, graph);
78372       if (!preset || preset.isFallback())
78373         return null;
78374       if (entity.type === "node" && preset.id !== "address" && Object.keys(entity.tags).some(function(key) {
78375         return key.match(/^addr:.{1,}/);
78376       })) {
78377         return "address";
78378       }
78379       var geometry = entity.geometry(graph);
78380       if (geometry === "area" && entity.tags.building && !preset.tags.building) {
78381         return "building";
78382       }
78383       if (geometry === "vertex" && Object.keys(entity.tags).length) {
78384         return "generic";
78385       }
78386       return null;
78387     }
78388     var buildingKeysToKeep = ["architect", "building", "height", "layer", "source", "type", "wheelchair"];
78389     var addressKeysToKeep = ["source"];
78390     var operation = function() {
78391       context.perform(function(graph) {
78392         for (var i2 in selectedIDs) {
78393           var entityID = selectedIDs[i2];
78394           var type2 = downgradeTypeForEntityID(entityID);
78395           if (!type2)
78396             continue;
78397           var tags = Object.assign({}, graph.entity(entityID).tags);
78398           for (var key in tags) {
78399             if (type2 === "address" && addressKeysToKeep.indexOf(key) !== -1)
78400               continue;
78401             if (type2 === "building") {
78402               if (buildingKeysToKeep.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/))
78403                 continue;
78404             }
78405             if (type2 !== "generic") {
78406               if (key.match(/^addr:.{1,}/) || key.match(/^source:.{1,}/))
78407                 continue;
78408             }
78409             delete tags[key];
78410           }
78411           graph = actionChangeTags(entityID, tags)(graph);
78412         }
78413         return graph;
78414       }, operation.annotation());
78415       context.validator().validate();
78416       context.enter(modeSelect(context, selectedIDs));
78417     };
78418     operation.available = function() {
78419       return _downgradeType;
78420     };
78421     operation.disabled = function() {
78422       if (selectedIDs.some(hasWikidataTag)) {
78423         return "has_wikidata_tag";
78424       }
78425       return false;
78426       function hasWikidataTag(id2) {
78427         var entity = context.entity(id2);
78428         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
78429       }
78430     };
78431     operation.tooltip = function() {
78432       var disable = operation.disabled();
78433       return disable ? _t.append("operations.downgrade." + disable + "." + _multi) : _t.append("operations.downgrade.description." + _downgradeType);
78434     };
78435     operation.annotation = function() {
78436       var suffix;
78437       if (_downgradeType === "building_address") {
78438         suffix = "generic";
78439       } else {
78440         suffix = _downgradeType;
78441       }
78442       return _t("operations.downgrade.annotation." + suffix, { n: _affectedFeatureCount });
78443     };
78444     operation.id = "downgrade";
78445     operation.keys = [uiCmd("\u232B")];
78446     operation.title = _t.append("operations.downgrade.title");
78447     operation.behavior = behaviorOperation(context).which(operation);
78448     return operation;
78449   }
78450
78451   // modules/operations/extract.js
78452   function operationExtract(context, selectedIDs) {
78453     var _amount = selectedIDs.length === 1 ? "single" : "multiple";
78454     var _geometries = utilArrayUniq(selectedIDs.map(function(entityID) {
78455       return context.graph().hasEntity(entityID) && context.graph().geometry(entityID);
78456     }).filter(Boolean));
78457     var _geometryID = _geometries.length === 1 ? _geometries[0] : "feature";
78458     var _extent;
78459     var _actions = selectedIDs.map(function(entityID) {
78460       var graph = context.graph();
78461       var entity = graph.hasEntity(entityID);
78462       if (!entity || !entity.hasInterestingTags())
78463         return null;
78464       if (entity.type === "node" && graph.parentWays(entity).length === 0)
78465         return null;
78466       if (entity.type !== "node") {
78467         var preset = _mainPresetIndex.match(entity, graph);
78468         if (preset.geometry.indexOf("point") === -1)
78469           return null;
78470       }
78471       _extent = _extent ? _extent.extend(entity.extent(graph)) : entity.extent(graph);
78472       return actionExtract(entityID, context.projection);
78473     }).filter(Boolean);
78474     var operation = function() {
78475       var combinedAction = function(graph) {
78476         _actions.forEach(function(action) {
78477           graph = action(graph);
78478         });
78479         return graph;
78480       };
78481       context.perform(combinedAction, operation.annotation());
78482       var extractedNodeIDs = _actions.map(function(action) {
78483         return action.getExtractedNodeID();
78484       });
78485       context.enter(modeSelect(context, extractedNodeIDs));
78486     };
78487     operation.available = function() {
78488       return _actions.length && selectedIDs.length === _actions.length;
78489     };
78490     operation.disabled = function() {
78491       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
78492         return "too_large";
78493       } else if (selectedIDs.some(function(entityID) {
78494         return context.graph().geometry(entityID) === "vertex" && context.hasHiddenConnections(entityID);
78495       })) {
78496         return "connected_to_hidden";
78497       }
78498       return false;
78499     };
78500     operation.tooltip = function() {
78501       var disableReason = operation.disabled();
78502       if (disableReason) {
78503         return _t.append("operations.extract." + disableReason + "." + _amount);
78504       } else {
78505         return _t.append("operations.extract.description." + _geometryID + "." + _amount);
78506       }
78507     };
78508     operation.annotation = function() {
78509       return _t("operations.extract.annotation", { n: selectedIDs.length });
78510     };
78511     operation.id = "extract";
78512     operation.keys = [_t("operations.extract.key")];
78513     operation.title = _t.append("operations.extract.title");
78514     operation.behavior = behaviorOperation(context).which(operation);
78515     return operation;
78516   }
78517
78518   // modules/operations/merge.js
78519   function operationMerge(context, selectedIDs) {
78520     var _action = getAction();
78521     function getAction() {
78522       var join = actionJoin(selectedIDs);
78523       if (!join.disabled(context.graph()))
78524         return join;
78525       var merge2 = actionMerge(selectedIDs);
78526       if (!merge2.disabled(context.graph()))
78527         return merge2;
78528       var mergePolygon = actionMergePolygon(selectedIDs);
78529       if (!mergePolygon.disabled(context.graph()))
78530         return mergePolygon;
78531       var mergeNodes = actionMergeNodes(selectedIDs);
78532       if (!mergeNodes.disabled(context.graph()))
78533         return mergeNodes;
78534       if (join.disabled(context.graph()) !== "not_eligible")
78535         return join;
78536       if (merge2.disabled(context.graph()) !== "not_eligible")
78537         return merge2;
78538       if (mergePolygon.disabled(context.graph()) !== "not_eligible")
78539         return mergePolygon;
78540       return mergeNodes;
78541     }
78542     var operation = function() {
78543       if (operation.disabled())
78544         return;
78545       context.perform(_action, operation.annotation());
78546       context.validator().validate();
78547       var resultIDs = selectedIDs.filter(context.hasEntity);
78548       if (resultIDs.length > 1) {
78549         var interestingIDs = resultIDs.filter(function(id2) {
78550           return context.entity(id2).hasInterestingTags();
78551         });
78552         if (interestingIDs.length)
78553           resultIDs = interestingIDs;
78554       }
78555       context.enter(modeSelect(context, resultIDs));
78556     };
78557     operation.available = function() {
78558       return selectedIDs.length >= 2;
78559     };
78560     operation.disabled = function() {
78561       var actionDisabled = _action.disabled(context.graph());
78562       if (actionDisabled)
78563         return actionDisabled;
78564       var osm = context.connection();
78565       if (osm && _action.resultingWayNodesLength && _action.resultingWayNodesLength(context.graph()) > osm.maxWayNodes()) {
78566         return "too_many_vertices";
78567       }
78568       return false;
78569     };
78570     operation.tooltip = function() {
78571       var disabled = operation.disabled();
78572       if (disabled) {
78573         if (disabled === "conflicting_relations") {
78574           return _t.append("operations.merge.conflicting_relations");
78575         }
78576         if (disabled === "restriction" || disabled === "connectivity") {
78577           return _t.append(
78578             "operations.merge.damage_relation",
78579             { relation: _mainPresetIndex.item("type/" + disabled).name() }
78580           );
78581         }
78582         return _t.append("operations.merge." + disabled);
78583       }
78584       return _t.append("operations.merge.description");
78585     };
78586     operation.annotation = function() {
78587       return _t("operations.merge.annotation", { n: selectedIDs.length });
78588     };
78589     operation.id = "merge";
78590     operation.keys = [_t("operations.merge.key")];
78591     operation.title = _t.append("operations.merge.title");
78592     operation.behavior = behaviorOperation(context).which(operation);
78593     return operation;
78594   }
78595
78596   // modules/operations/paste.js
78597   function operationPaste(context) {
78598     var _pastePoint;
78599     var operation = function() {
78600       if (!_pastePoint)
78601         return;
78602       var oldIDs = context.copyIDs();
78603       if (!oldIDs.length)
78604         return;
78605       var projection2 = context.projection;
78606       var extent = geoExtent();
78607       var oldGraph = context.copyGraph();
78608       var newIDs = [];
78609       var action = actionCopyEntities(oldIDs, oldGraph);
78610       context.perform(action);
78611       var copies = action.copies();
78612       var originals = /* @__PURE__ */ new Set();
78613       Object.values(copies).forEach(function(entity) {
78614         originals.add(entity.id);
78615       });
78616       for (var id2 in copies) {
78617         var oldEntity = oldGraph.entity(id2);
78618         var newEntity = copies[id2];
78619         extent._extend(oldEntity.extent(oldGraph));
78620         var parents = context.graph().parentWays(newEntity);
78621         var parentCopied = parents.some(function(parent) {
78622           return originals.has(parent.id);
78623         });
78624         if (!parentCopied) {
78625           newIDs.push(newEntity.id);
78626         }
78627       }
78628       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
78629       var delta = geoVecSubtract(_pastePoint, copyPoint);
78630       context.replace(actionMove(newIDs, delta, projection2), operation.annotation());
78631       context.enter(modeSelect(context, newIDs));
78632     };
78633     operation.point = function(val) {
78634       _pastePoint = val;
78635       return operation;
78636     };
78637     operation.available = function() {
78638       return context.mode().id === "browse";
78639     };
78640     operation.disabled = function() {
78641       return !context.copyIDs().length;
78642     };
78643     operation.tooltip = function() {
78644       var oldGraph = context.copyGraph();
78645       var ids = context.copyIDs();
78646       if (!ids.length) {
78647         return _t.append("operations.paste.nothing_copied");
78648       }
78649       return _t.append("operations.paste.description", { feature: utilDisplayLabel(oldGraph.entity(ids[0]), oldGraph), n: ids.length });
78650     };
78651     operation.annotation = function() {
78652       var ids = context.copyIDs();
78653       return _t("operations.paste.annotation", { n: ids.length });
78654     };
78655     operation.id = "paste";
78656     operation.keys = [uiCmd("\u2318V")];
78657     operation.title = _t.append("operations.paste.title");
78658     return operation;
78659   }
78660
78661   // modules/operations/reverse.js
78662   function operationReverse(context, selectedIDs) {
78663     var operation = function() {
78664       context.perform(function combinedReverseAction(graph) {
78665         actions().forEach(function(action) {
78666           graph = action(graph);
78667         });
78668         return graph;
78669       }, operation.annotation());
78670       context.validator().validate();
78671     };
78672     function actions(situation) {
78673       return selectedIDs.map(function(entityID) {
78674         var entity = context.hasEntity(entityID);
78675         if (!entity)
78676           return null;
78677         if (situation === "toolbar") {
78678           if (entity.type === "way" && (!entity.isOneWay() && !entity.isSided()))
78679             return null;
78680         }
78681         var geometry = entity.geometry(context.graph());
78682         if (entity.type !== "node" && geometry !== "line")
78683           return null;
78684         var action = actionReverse(entityID);
78685         if (action.disabled(context.graph()))
78686           return null;
78687         return action;
78688       }).filter(Boolean);
78689     }
78690     function reverseTypeID() {
78691       var acts = actions();
78692       var nodeActionCount = acts.filter(function(act) {
78693         var entity = context.hasEntity(act.entityID());
78694         return entity && entity.type === "node";
78695       }).length;
78696       if (nodeActionCount === 0)
78697         return "line";
78698       if (nodeActionCount === acts.length)
78699         return "point";
78700       return "feature";
78701     }
78702     operation.available = function(situation) {
78703       return actions(situation).length > 0;
78704     };
78705     operation.disabled = function() {
78706       return false;
78707     };
78708     operation.tooltip = function() {
78709       return _t.append("operations.reverse.description." + reverseTypeID());
78710     };
78711     operation.annotation = function() {
78712       var acts = actions();
78713       return _t("operations.reverse.annotation." + reverseTypeID(), { n: acts.length });
78714     };
78715     operation.id = "reverse";
78716     operation.keys = [_t("operations.reverse.key")];
78717     operation.title = _t.append("operations.reverse.title");
78718     operation.behavior = behaviorOperation(context).which(operation);
78719     return operation;
78720   }
78721
78722   // modules/operations/split.js
78723   function operationSplit(context, selectedIDs) {
78724     var _vertexIds = selectedIDs.filter(function(id2) {
78725       return context.graph().geometry(id2) === "vertex";
78726     });
78727     var _selectedWayIds = selectedIDs.filter(function(id2) {
78728       var entity = context.graph().hasEntity(id2);
78729       return entity && entity.type === "way";
78730     });
78731     var _isAvailable = _vertexIds.length > 0 && _vertexIds.length + _selectedWayIds.length === selectedIDs.length;
78732     var _action = actionSplit(_vertexIds);
78733     var _ways = [];
78734     var _geometry = "feature";
78735     var _waysAmount = "single";
78736     var _nodesAmount = _vertexIds.length === 1 ? "single" : "multiple";
78737     if (_isAvailable) {
78738       if (_selectedWayIds.length)
78739         _action.limitWays(_selectedWayIds);
78740       _ways = _action.ways(context.graph());
78741       var geometries = {};
78742       _ways.forEach(function(way) {
78743         geometries[way.geometry(context.graph())] = true;
78744       });
78745       if (Object.keys(geometries).length === 1) {
78746         _geometry = Object.keys(geometries)[0];
78747       }
78748       _waysAmount = _ways.length === 1 ? "single" : "multiple";
78749     }
78750     var operation = function() {
78751       var difference = context.perform(_action, operation.annotation());
78752       var idsToSelect = _vertexIds.concat(difference.extantIDs().filter(function(id2) {
78753         return context.entity(id2).type === "way";
78754       }));
78755       context.enter(modeSelect(context, idsToSelect));
78756     };
78757     operation.relatedEntityIds = function() {
78758       return _selectedWayIds.length ? [] : _ways.map((way) => way.id);
78759     };
78760     operation.available = function() {
78761       return _isAvailable;
78762     };
78763     operation.disabled = function() {
78764       var reason = _action.disabled(context.graph());
78765       if (reason) {
78766         return reason;
78767       } else if (selectedIDs.some(context.hasHiddenConnections)) {
78768         return "connected_to_hidden";
78769       }
78770       return false;
78771     };
78772     operation.tooltip = function() {
78773       var disable = operation.disabled();
78774       return disable ? _t.append("operations.split." + disable) : _t.append("operations.split.description." + _geometry + "." + _waysAmount + "." + _nodesAmount + "_node");
78775     };
78776     operation.annotation = function() {
78777       return _t("operations.split.annotation." + _geometry, { n: _ways.length });
78778     };
78779     operation.icon = function() {
78780       if (_waysAmount === "multiple") {
78781         return "#iD-operation-split-multiple";
78782       } else {
78783         return "#iD-operation-split";
78784       }
78785     };
78786     operation.id = "split";
78787     operation.keys = [_t("operations.split.key")];
78788     operation.title = _t.append("operations.split.title");
78789     operation.behavior = behaviorOperation(context).which(operation);
78790     return operation;
78791   }
78792
78793   // modules/operations/straighten.js
78794   function operationStraighten(context, selectedIDs) {
78795     var _wayIDs = selectedIDs.filter(function(id2) {
78796       return id2.charAt(0) === "w";
78797     });
78798     var _nodeIDs = selectedIDs.filter(function(id2) {
78799       return id2.charAt(0) === "n";
78800     });
78801     var _amount = (_wayIDs.length ? _wayIDs : _nodeIDs).length === 1 ? "single" : "multiple";
78802     var _nodes = utilGetAllNodes(selectedIDs, context.graph());
78803     var _coords = _nodes.map(function(n2) {
78804       return n2.loc;
78805     });
78806     var _extent = utilTotalExtent(selectedIDs, context.graph());
78807     var _action = chooseAction();
78808     var _geometry;
78809     function chooseAction() {
78810       if (_wayIDs.length === 0 && _nodeIDs.length > 2) {
78811         _geometry = "point";
78812         return actionStraightenNodes(_nodeIDs, context.projection);
78813       } else if (_wayIDs.length > 0 && (_nodeIDs.length === 0 || _nodeIDs.length === 2)) {
78814         var startNodeIDs = [];
78815         var endNodeIDs = [];
78816         for (var i2 = 0; i2 < selectedIDs.length; i2++) {
78817           var entity = context.entity(selectedIDs[i2]);
78818           if (entity.type === "node") {
78819             continue;
78820           } else if (entity.type !== "way" || entity.isClosed()) {
78821             return null;
78822           }
78823           startNodeIDs.push(entity.first());
78824           endNodeIDs.push(entity.last());
78825         }
78826         startNodeIDs = startNodeIDs.filter(function(n2) {
78827           return startNodeIDs.indexOf(n2) === startNodeIDs.lastIndexOf(n2);
78828         });
78829         endNodeIDs = endNodeIDs.filter(function(n2) {
78830           return endNodeIDs.indexOf(n2) === endNodeIDs.lastIndexOf(n2);
78831         });
78832         if (utilArrayDifference(startNodeIDs, endNodeIDs).length + utilArrayDifference(endNodeIDs, startNodeIDs).length !== 2)
78833           return null;
78834         var wayNodeIDs = utilGetAllNodes(_wayIDs, context.graph()).map(function(node) {
78835           return node.id;
78836         });
78837         if (wayNodeIDs.length <= 2)
78838           return null;
78839         if (_nodeIDs.length === 2 && (wayNodeIDs.indexOf(_nodeIDs[0]) === -1 || wayNodeIDs.indexOf(_nodeIDs[1]) === -1))
78840           return null;
78841         if (_nodeIDs.length) {
78842           _extent = utilTotalExtent(_nodeIDs, context.graph());
78843         }
78844         _geometry = "line";
78845         return actionStraightenWay(selectedIDs, context.projection);
78846       }
78847       return null;
78848     }
78849     function operation() {
78850       if (!_action)
78851         return;
78852       context.perform(_action, operation.annotation());
78853       window.setTimeout(function() {
78854         context.validator().validate();
78855       }, 300);
78856     }
78857     operation.available = function() {
78858       return Boolean(_action);
78859     };
78860     operation.disabled = function() {
78861       var reason = _action.disabled(context.graph());
78862       if (reason) {
78863         return reason;
78864       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
78865         return "too_large";
78866       } else if (someMissing()) {
78867         return "not_downloaded";
78868       } else if (selectedIDs.some(context.hasHiddenConnections)) {
78869         return "connected_to_hidden";
78870       }
78871       return false;
78872       function someMissing() {
78873         if (context.inIntro())
78874           return false;
78875         var osm = context.connection();
78876         if (osm) {
78877           var missing = _coords.filter(function(loc) {
78878             return !osm.isDataLoaded(loc);
78879           });
78880           if (missing.length) {
78881             missing.forEach(function(loc) {
78882               context.loadTileAtLoc(loc);
78883             });
78884             return true;
78885           }
78886         }
78887         return false;
78888       }
78889     };
78890     operation.tooltip = function() {
78891       var disable = operation.disabled();
78892       return disable ? _t.append("operations.straighten." + disable + "." + _amount) : _t.append("operations.straighten.description." + _geometry + (_wayIDs.length === 1 ? "" : "s"));
78893     };
78894     operation.annotation = function() {
78895       return _t("operations.straighten.annotation." + _geometry, { n: _wayIDs.length ? _wayIDs.length : _nodeIDs.length });
78896     };
78897     operation.id = "straighten";
78898     operation.keys = [_t("operations.straighten.key")];
78899     operation.title = _t.append("operations.straighten.title");
78900     operation.behavior = behaviorOperation(context).which(operation);
78901     return operation;
78902   }
78903
78904   // modules/modes/select.js
78905   function modeSelect(context, selectedIDs) {
78906     var mode = {
78907       id: "select",
78908       button: "browse"
78909     };
78910     var keybinding = utilKeybinding("select");
78911     var _breatheBehavior = behaviorBreathe(context);
78912     var _modeDragNode = modeDragNode(context);
78913     var _selectBehavior;
78914     var _behaviors = [];
78915     var _operations = [];
78916     var _newFeature = false;
78917     var _follow = false;
78918     var _focusedParentWayId;
78919     var _focusedVertexIds;
78920     function singular() {
78921       if (selectedIDs && selectedIDs.length === 1) {
78922         return context.hasEntity(selectedIDs[0]);
78923       }
78924     }
78925     function selectedEntities() {
78926       return selectedIDs.map(function(id2) {
78927         return context.hasEntity(id2);
78928       }).filter(Boolean);
78929     }
78930     function checkSelectedIDs() {
78931       var ids = [];
78932       if (Array.isArray(selectedIDs)) {
78933         ids = selectedIDs.filter(function(id2) {
78934           return context.hasEntity(id2);
78935         });
78936       }
78937       if (!ids.length) {
78938         context.enter(modeBrowse(context));
78939         return false;
78940       } else if (selectedIDs.length > 1 && ids.length === 1 || selectedIDs.length === 1 && ids.length > 1) {
78941         context.enter(modeSelect(context, ids));
78942         return false;
78943       }
78944       selectedIDs = ids;
78945       return true;
78946     }
78947     function parentWaysIdsOfSelection(onlyCommonParents) {
78948       var graph = context.graph();
78949       var parents = [];
78950       for (var i2 = 0; i2 < selectedIDs.length; i2++) {
78951         var entity = context.hasEntity(selectedIDs[i2]);
78952         if (!entity || entity.geometry(graph) !== "vertex") {
78953           return [];
78954         }
78955         var currParents = graph.parentWays(entity).map(function(w) {
78956           return w.id;
78957         });
78958         if (!parents.length) {
78959           parents = currParents;
78960           continue;
78961         }
78962         parents = (onlyCommonParents ? utilArrayIntersection : utilArrayUnion)(parents, currParents);
78963         if (!parents.length) {
78964           return [];
78965         }
78966       }
78967       return parents;
78968     }
78969     function childNodeIdsOfSelection(onlyCommon) {
78970       var graph = context.graph();
78971       var childs = [];
78972       for (var i2 = 0; i2 < selectedIDs.length; i2++) {
78973         var entity = context.hasEntity(selectedIDs[i2]);
78974         if (!entity || !["area", "line"].includes(entity.geometry(graph))) {
78975           return [];
78976         }
78977         var currChilds = graph.childNodes(entity).map(function(node) {
78978           return node.id;
78979         });
78980         if (!childs.length) {
78981           childs = currChilds;
78982           continue;
78983         }
78984         childs = (onlyCommon ? utilArrayIntersection : utilArrayUnion)(childs, currChilds);
78985         if (!childs.length) {
78986           return [];
78987         }
78988       }
78989       return childs;
78990     }
78991     function checkFocusedParent() {
78992       if (_focusedParentWayId) {
78993         var parents = parentWaysIdsOfSelection(true);
78994         if (parents.indexOf(_focusedParentWayId) === -1)
78995           _focusedParentWayId = null;
78996       }
78997     }
78998     function parentWayIdForVertexNavigation() {
78999       var parentIds = parentWaysIdsOfSelection(true);
79000       if (_focusedParentWayId && parentIds.indexOf(_focusedParentWayId) !== -1) {
79001         return _focusedParentWayId;
79002       }
79003       return parentIds.length ? parentIds[0] : null;
79004     }
79005     mode.selectedIDs = function(val) {
79006       if (!arguments.length)
79007         return selectedIDs;
79008       selectedIDs = val;
79009       return mode;
79010     };
79011     mode.zoomToSelected = function() {
79012       context.map().zoomToEase(selectedEntities());
79013     };
79014     mode.newFeature = function(val) {
79015       if (!arguments.length)
79016         return _newFeature;
79017       _newFeature = val;
79018       return mode;
79019     };
79020     mode.selectBehavior = function(val) {
79021       if (!arguments.length)
79022         return _selectBehavior;
79023       _selectBehavior = val;
79024       return mode;
79025     };
79026     mode.follow = function(val) {
79027       if (!arguments.length)
79028         return _follow;
79029       _follow = val;
79030       return mode;
79031     };
79032     function loadOperations() {
79033       _operations.forEach(function(operation) {
79034         if (operation.behavior) {
79035           context.uninstall(operation.behavior);
79036         }
79037       });
79038       _operations = Object.values(operations_exports).map(function(o) {
79039         return o(context, selectedIDs);
79040       }).filter(function(o) {
79041         return o.id !== "delete" && o.id !== "downgrade" && o.id !== "copy";
79042       }).concat([
79043         // group copy/downgrade/delete operation together at the end of the list
79044         operationCopy(context, selectedIDs),
79045         operationDowngrade(context, selectedIDs),
79046         operationDelete(context, selectedIDs)
79047       ]).filter(function(operation) {
79048         return operation.available();
79049       });
79050       _operations.forEach(function(operation) {
79051         if (operation.behavior) {
79052           context.install(operation.behavior);
79053         }
79054       });
79055       context.ui().closeEditMenu();
79056     }
79057     mode.operations = function() {
79058       return _operations;
79059     };
79060     mode.enter = function() {
79061       if (!checkSelectedIDs())
79062         return;
79063       context.features().forceVisible(selectedIDs);
79064       _modeDragNode.restoreSelectedIDs(selectedIDs);
79065       loadOperations();
79066       if (!_behaviors.length) {
79067         if (!_selectBehavior)
79068           _selectBehavior = behaviorSelect(context);
79069         _behaviors = [
79070           behaviorPaste(context),
79071           _breatheBehavior,
79072           behaviorHover(context).on("hover", context.ui().sidebar.hoverModeSelect),
79073           _selectBehavior,
79074           behaviorLasso(context),
79075           _modeDragNode.behavior,
79076           modeDragNote(context).behavior
79077         ];
79078       }
79079       _behaviors.forEach(context.install);
79080       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);
79081       select_default2(document).call(keybinding);
79082       context.ui().sidebar.select(selectedIDs, _newFeature);
79083       context.history().on("change.select", function() {
79084         loadOperations();
79085         selectElements();
79086       }).on("undone.select", checkSelectedIDs).on("redone.select", checkSelectedIDs);
79087       context.map().on("drawn.select", selectElements).on("crossEditableZoom.select", function() {
79088         selectElements();
79089         _breatheBehavior.restartIfNeeded(context.surface());
79090       });
79091       context.map().doubleUpHandler().on("doubleUp.modeSelect", didDoubleUp);
79092       selectElements();
79093       if (_follow) {
79094         var extent = geoExtent();
79095         var graph = context.graph();
79096         selectedIDs.forEach(function(id2) {
79097           var entity = context.entity(id2);
79098           extent._extend(entity.extent(graph));
79099         });
79100         var loc = extent.center();
79101         context.map().centerEase(loc);
79102         _follow = false;
79103       }
79104       function nudgeSelection(delta) {
79105         return function() {
79106           if (!context.map().withinEditableZoom())
79107             return;
79108           var moveOp = operationMove(context, selectedIDs);
79109           if (moveOp.disabled()) {
79110             context.ui().flash.duration(4e3).iconName("#iD-operation-" + moveOp.id).iconClass("operation disabled").label(moveOp.tooltip())();
79111           } else {
79112             context.perform(actionMove(selectedIDs, delta, context.projection), moveOp.annotation());
79113             context.validator().validate();
79114           }
79115         };
79116       }
79117       function scaleSelection(factor) {
79118         return function() {
79119           if (!context.map().withinEditableZoom())
79120             return;
79121           let nodes = utilGetAllNodes(selectedIDs, context.graph());
79122           let isUp = factor > 1;
79123           if (nodes.length <= 1)
79124             return;
79125           let extent2 = utilTotalExtent(selectedIDs, context.graph());
79126           function scalingDisabled() {
79127             if (tooSmall()) {
79128               return "too_small";
79129             } else if (extent2.percentContainedIn(context.map().extent()) < 0.8) {
79130               return "too_large";
79131             } else if (someMissing() || selectedIDs.some(incompleteRelation)) {
79132               return "not_downloaded";
79133             } else if (selectedIDs.some(context.hasHiddenConnections)) {
79134               return "connected_to_hidden";
79135             }
79136             return false;
79137             function tooSmall() {
79138               if (isUp)
79139                 return false;
79140               let dLon = Math.abs(extent2[1][0] - extent2[0][0]);
79141               let dLat = Math.abs(extent2[1][1] - extent2[0][1]);
79142               return dLon < geoMetersToLon(1, extent2[1][1]) && dLat < geoMetersToLat(1);
79143             }
79144             function someMissing() {
79145               if (context.inIntro())
79146                 return false;
79147               let osm = context.connection();
79148               if (osm) {
79149                 let missing = nodes.filter(function(n2) {
79150                   return !osm.isDataLoaded(n2.loc);
79151                 });
79152                 if (missing.length) {
79153                   missing.forEach(function(loc2) {
79154                     context.loadTileAtLoc(loc2);
79155                   });
79156                   return true;
79157                 }
79158               }
79159               return false;
79160             }
79161             function incompleteRelation(id2) {
79162               let entity = context.entity(id2);
79163               return entity.type === "relation" && !entity.isComplete(context.graph());
79164             }
79165           }
79166           const disabled = scalingDisabled();
79167           if (disabled) {
79168             let multi = selectedIDs.length === 1 ? "single" : "multiple";
79169             context.ui().flash.duration(4e3).iconName("#iD-icon-no").iconClass("operation disabled").label(_t.append("operations.scale." + disabled + "." + multi))();
79170           } else {
79171             const pivot = context.projection(extent2.center());
79172             const annotation = _t("operations.scale.annotation." + (isUp ? "up" : "down") + ".feature", { n: selectedIDs.length });
79173             context.perform(actionScale(selectedIDs, pivot, factor, context.projection), annotation);
79174             context.validator().validate();
79175           }
79176         };
79177       }
79178       function didDoubleUp(d3_event, loc2) {
79179         if (!context.map().withinEditableZoom())
79180           return;
79181         var target = select_default2(d3_event.target);
79182         var datum2 = target.datum();
79183         var entity = datum2 && datum2.properties && datum2.properties.entity;
79184         if (!entity)
79185           return;
79186         if (entity instanceof osmWay && target.classed("target")) {
79187           var choice = geoChooseEdge(context.graph().childNodes(entity), loc2, context.projection);
79188           var prev = entity.nodes[choice.index - 1];
79189           var next = entity.nodes[choice.index];
79190           context.perform(
79191             actionAddMidpoint({ loc: choice.loc, edge: [prev, next] }, osmNode()),
79192             _t("operations.add.annotation.vertex")
79193           );
79194           context.validator().validate();
79195         } else if (entity.type === "midpoint") {
79196           context.perform(
79197             actionAddMidpoint({ loc: entity.loc, edge: entity.edge }, osmNode()),
79198             _t("operations.add.annotation.vertex")
79199           );
79200           context.validator().validate();
79201         }
79202       }
79203       function selectElements() {
79204         if (!checkSelectedIDs())
79205           return;
79206         var surface = context.surface();
79207         surface.selectAll(".selected-member").classed("selected-member", false);
79208         surface.selectAll(".selected").classed("selected", false);
79209         surface.selectAll(".related").classed("related", false);
79210         checkFocusedParent();
79211         if (_focusedParentWayId) {
79212           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
79213         }
79214         if (context.map().withinEditableZoom()) {
79215           surface.selectAll(utilDeepMemberSelector(
79216             selectedIDs,
79217             context.graph(),
79218             true
79219             /* skipMultipolgonMembers */
79220           )).classed("selected-member", true);
79221           surface.selectAll(utilEntityOrDeepMemberSelector(selectedIDs, context.graph())).classed("selected", true);
79222         }
79223       }
79224       function esc() {
79225         if (context.container().select(".combobox").size())
79226           return;
79227         context.enter(modeBrowse(context));
79228       }
79229       function firstVertex(d3_event) {
79230         d3_event.preventDefault();
79231         var entity = singular();
79232         var parentId = parentWayIdForVertexNavigation();
79233         var way;
79234         if (entity && entity.type === "way") {
79235           way = entity;
79236         } else if (parentId) {
79237           way = context.entity(parentId);
79238         }
79239         _focusedParentWayId = way && way.id;
79240         if (way) {
79241           context.enter(
79242             mode.selectedIDs([way.first()]).follow(true)
79243           );
79244         }
79245       }
79246       function lastVertex(d3_event) {
79247         d3_event.preventDefault();
79248         var entity = singular();
79249         var parentId = parentWayIdForVertexNavigation();
79250         var way;
79251         if (entity && entity.type === "way") {
79252           way = entity;
79253         } else if (parentId) {
79254           way = context.entity(parentId);
79255         }
79256         _focusedParentWayId = way && way.id;
79257         if (way) {
79258           context.enter(
79259             mode.selectedIDs([way.last()]).follow(true)
79260           );
79261         }
79262       }
79263       function previousVertex(d3_event) {
79264         d3_event.preventDefault();
79265         var parentId = parentWayIdForVertexNavigation();
79266         _focusedParentWayId = parentId;
79267         if (!parentId)
79268           return;
79269         var way = context.entity(parentId);
79270         var length = way.nodes.length;
79271         var curr = way.nodes.indexOf(selectedIDs[0]);
79272         var index = -1;
79273         if (curr > 0) {
79274           index = curr - 1;
79275         } else if (way.isClosed()) {
79276           index = length - 2;
79277         }
79278         if (index !== -1) {
79279           context.enter(
79280             mode.selectedIDs([way.nodes[index]]).follow(true)
79281           );
79282         }
79283       }
79284       function nextVertex(d3_event) {
79285         d3_event.preventDefault();
79286         var parentId = parentWayIdForVertexNavigation();
79287         _focusedParentWayId = parentId;
79288         if (!parentId)
79289           return;
79290         var way = context.entity(parentId);
79291         var length = way.nodes.length;
79292         var curr = way.nodes.indexOf(selectedIDs[0]);
79293         var index = -1;
79294         if (curr < length - 1) {
79295           index = curr + 1;
79296         } else if (way.isClosed()) {
79297           index = 0;
79298         }
79299         if (index !== -1) {
79300           context.enter(
79301             mode.selectedIDs([way.nodes[index]]).follow(true)
79302           );
79303         }
79304       }
79305       function focusNextParent(d3_event) {
79306         d3_event.preventDefault();
79307         var parents = parentWaysIdsOfSelection(true);
79308         if (!parents || parents.length < 2)
79309           return;
79310         var index = parents.indexOf(_focusedParentWayId);
79311         if (index < 0 || index > parents.length - 2) {
79312           _focusedParentWayId = parents[0];
79313         } else {
79314           _focusedParentWayId = parents[index + 1];
79315         }
79316         var surface = context.surface();
79317         surface.selectAll(".related").classed("related", false);
79318         if (_focusedParentWayId) {
79319           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
79320         }
79321       }
79322       function selectParent(d3_event) {
79323         d3_event.preventDefault();
79324         var currentSelectedIds = mode.selectedIDs();
79325         var parentIds = _focusedParentWayId ? [_focusedParentWayId] : parentWaysIdsOfSelection(false);
79326         if (!parentIds.length)
79327           return;
79328         context.enter(
79329           mode.selectedIDs(parentIds)
79330         );
79331         _focusedVertexIds = currentSelectedIds;
79332       }
79333       function selectChild(d3_event) {
79334         d3_event.preventDefault();
79335         var currentSelectedIds = mode.selectedIDs();
79336         var childIds = _focusedVertexIds ? _focusedVertexIds.filter((id2) => context.hasEntity(id2)) : childNodeIdsOfSelection(true);
79337         if (!childIds || !childIds.length)
79338           return;
79339         if (currentSelectedIds.length === 1)
79340           _focusedParentWayId = currentSelectedIds[0];
79341         context.enter(
79342           mode.selectedIDs(childIds)
79343         );
79344       }
79345     };
79346     mode.exit = function() {
79347       _newFeature = false;
79348       _focusedVertexIds = null;
79349       _operations.forEach(function(operation) {
79350         if (operation.behavior) {
79351           context.uninstall(operation.behavior);
79352         }
79353       });
79354       _operations = [];
79355       _behaviors.forEach(context.uninstall);
79356       select_default2(document).call(keybinding.unbind);
79357       context.ui().closeEditMenu();
79358       context.history().on("change.select", null).on("undone.select", null).on("redone.select", null);
79359       var surface = context.surface();
79360       surface.selectAll(".selected-member").classed("selected-member", false);
79361       surface.selectAll(".selected").classed("selected", false);
79362       surface.selectAll(".highlighted").classed("highlighted", false);
79363       surface.selectAll(".related").classed("related", false);
79364       context.map().on("drawn.select", null);
79365       context.ui().sidebar.hide();
79366       context.features().forceVisible([]);
79367       var entity = singular();
79368       if (_newFeature && entity && entity.type === "relation" && // no tags
79369       Object.keys(entity.tags).length === 0 && // no parent relations
79370       context.graph().parentRelations(entity).length === 0 && // no members or one member with no role
79371       (entity.members.length === 0 || entity.members.length === 1 && !entity.members[0].role)) {
79372         var deleteAction = actionDeleteRelation(
79373           entity.id,
79374           true
79375           /* don't delete untagged members */
79376         );
79377         context.perform(deleteAction, _t("operations.delete.annotation.relation"));
79378         context.validator().validate();
79379       }
79380     };
79381     return mode;
79382   }
79383
79384   // modules/behavior/lasso.js
79385   function behaviorLasso(context) {
79386     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
79387     var behavior = function(selection2) {
79388       var lasso;
79389       function pointerdown(d3_event) {
79390         var button = 0;
79391         if (d3_event.button === button && d3_event.shiftKey === true) {
79392           lasso = null;
79393           select_default2(window).on(_pointerPrefix + "move.lasso", pointermove).on(_pointerPrefix + "up.lasso", pointerup);
79394           d3_event.stopPropagation();
79395         }
79396       }
79397       function pointermove() {
79398         if (!lasso) {
79399           lasso = uiLasso(context);
79400           context.surface().call(lasso);
79401         }
79402         lasso.p(context.map().mouse());
79403       }
79404       function normalize2(a, b) {
79405         return [
79406           [Math.min(a[0], b[0]), Math.min(a[1], b[1])],
79407           [Math.max(a[0], b[0]), Math.max(a[1], b[1])]
79408         ];
79409       }
79410       function lassoed() {
79411         if (!lasso)
79412           return [];
79413         var graph = context.graph();
79414         var limitToNodes;
79415         if (context.map().editableDataEnabled(
79416           true
79417           /* skipZoomCheck */
79418         ) && context.map().isInWideSelection()) {
79419           limitToNodes = new Set(utilGetAllNodes(context.selectedIDs(), graph));
79420         } else if (!context.map().editableDataEnabled()) {
79421           return [];
79422         }
79423         var bounds = lasso.extent().map(context.projection.invert);
79424         var extent = geoExtent(normalize2(bounds[0], bounds[1]));
79425         var intersects = context.history().intersects(extent).filter(function(entity) {
79426           return entity.type === "node" && (!limitToNodes || limitToNodes.has(entity)) && geoPointInPolygon(context.projection(entity.loc), lasso.coordinates) && !context.features().isHidden(entity, graph, entity.geometry(graph));
79427         });
79428         intersects.sort(function(node1, node2) {
79429           var parents1 = graph.parentWays(node1);
79430           var parents2 = graph.parentWays(node2);
79431           if (parents1.length && parents2.length) {
79432             var sharedParents = utilArrayIntersection(parents1, parents2);
79433             if (sharedParents.length) {
79434               var sharedParentNodes = sharedParents[0].nodes;
79435               return sharedParentNodes.indexOf(node1.id) - sharedParentNodes.indexOf(node2.id);
79436             } else {
79437               return Number(parents1[0].id.slice(1)) - Number(parents2[0].id.slice(1));
79438             }
79439           } else if (parents1.length || parents2.length) {
79440             return parents1.length - parents2.length;
79441           }
79442           return node1.loc[0] - node2.loc[0];
79443         });
79444         return intersects.map(function(entity) {
79445           return entity.id;
79446         });
79447       }
79448       function pointerup() {
79449         select_default2(window).on(_pointerPrefix + "move.lasso", null).on(_pointerPrefix + "up.lasso", null);
79450         if (!lasso)
79451           return;
79452         var ids = lassoed();
79453         lasso.close();
79454         if (ids.length) {
79455           context.enter(modeSelect(context, ids));
79456         }
79457       }
79458       selection2.on(_pointerPrefix + "down.lasso", pointerdown);
79459     };
79460     behavior.off = function(selection2) {
79461       selection2.on(_pointerPrefix + "down.lasso", null);
79462     };
79463     return behavior;
79464   }
79465
79466   // modules/modes/browse.js
79467   function modeBrowse(context) {
79468     var mode = {
79469       button: "browse",
79470       id: "browse",
79471       title: _t.append("modes.browse.title"),
79472       description: _t.append("modes.browse.description")
79473     };
79474     var sidebar;
79475     var _selectBehavior;
79476     var _behaviors = [];
79477     mode.selectBehavior = function(val) {
79478       if (!arguments.length)
79479         return _selectBehavior;
79480       _selectBehavior = val;
79481       return mode;
79482     };
79483     mode.enter = function() {
79484       if (!_behaviors.length) {
79485         if (!_selectBehavior)
79486           _selectBehavior = behaviorSelect(context);
79487         _behaviors = [
79488           behaviorPaste(context),
79489           behaviorHover(context).on("hover", context.ui().sidebar.hover),
79490           _selectBehavior,
79491           behaviorLasso(context),
79492           modeDragNode(context).behavior,
79493           modeDragNote(context).behavior
79494         ];
79495       }
79496       _behaviors.forEach(context.install);
79497       if (document.activeElement && document.activeElement.blur) {
79498         document.activeElement.blur();
79499       }
79500       if (sidebar) {
79501         context.ui().sidebar.show(sidebar);
79502       } else {
79503         context.ui().sidebar.select(null);
79504       }
79505     };
79506     mode.exit = function() {
79507       context.ui().sidebar.hover.cancel();
79508       _behaviors.forEach(context.uninstall);
79509       if (sidebar) {
79510         context.ui().sidebar.hide();
79511       }
79512     };
79513     mode.sidebar = function(_) {
79514       if (!arguments.length)
79515         return sidebar;
79516       sidebar = _;
79517       return mode;
79518     };
79519     mode.operations = function() {
79520       return [operationPaste(context)];
79521     };
79522     return mode;
79523   }
79524
79525   // modules/behavior/add_way.js
79526   function behaviorAddWay(context) {
79527     var dispatch10 = dispatch_default("start", "startFromWay", "startFromNode");
79528     var draw = behaviorDraw(context);
79529     function behavior(surface) {
79530       draw.on("click", function() {
79531         dispatch10.apply("start", this, arguments);
79532       }).on("clickWay", function() {
79533         dispatch10.apply("startFromWay", this, arguments);
79534       }).on("clickNode", function() {
79535         dispatch10.apply("startFromNode", this, arguments);
79536       }).on("cancel", behavior.cancel).on("finish", behavior.cancel);
79537       context.map().dblclickZoomEnable(false);
79538       surface.call(draw);
79539     }
79540     behavior.off = function(surface) {
79541       surface.call(draw.off);
79542     };
79543     behavior.cancel = function() {
79544       window.setTimeout(function() {
79545         context.map().dblclickZoomEnable(true);
79546       }, 1e3);
79547       context.enter(modeBrowse(context));
79548     };
79549     return utilRebind(behavior, dispatch10, "on");
79550   }
79551
79552   // modules/behavior/hash.js
79553   function behaviorHash(context) {
79554     var _cachedHash = null;
79555     var _latitudeLimit = 90 - 1e-8;
79556     function computedHashParameters() {
79557       var map2 = context.map();
79558       var center = map2.center();
79559       var zoom = map2.zoom();
79560       var precision2 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
79561       var oldParams = utilObjectOmit(
79562         utilStringQs(window.location.hash),
79563         ["comment", "source", "hashtags", "walkthrough"]
79564       );
79565       var newParams = {};
79566       delete oldParams.id;
79567       var selected = context.selectedIDs().filter(function(id2) {
79568         return context.hasEntity(id2);
79569       });
79570       if (selected.length) {
79571         newParams.id = selected.join(",");
79572       }
79573       newParams.map = zoom.toFixed(2) + "/" + center[1].toFixed(precision2) + "/" + center[0].toFixed(precision2);
79574       return Object.assign(oldParams, newParams);
79575     }
79576     function computedHash() {
79577       return "#" + utilQsString(computedHashParameters(), true);
79578     }
79579     function computedTitle(includeChangeCount) {
79580       var baseTitle = context.documentTitleBase() || "iD";
79581       var contextual;
79582       var changeCount;
79583       var titleID;
79584       var selected = context.selectedIDs().filter(function(id2) {
79585         return context.hasEntity(id2);
79586       });
79587       if (selected.length) {
79588         var firstLabel = utilDisplayLabel(context.entity(selected[0]), context.graph());
79589         if (selected.length > 1) {
79590           contextual = _t("title.labeled_and_more", {
79591             labeled: firstLabel,
79592             count: selected.length - 1
79593           });
79594         } else {
79595           contextual = firstLabel;
79596         }
79597         titleID = "context";
79598       }
79599       if (includeChangeCount) {
79600         changeCount = context.history().difference().summary().length;
79601         if (changeCount > 0) {
79602           titleID = contextual ? "changes_context" : "changes";
79603         }
79604       }
79605       if (titleID) {
79606         return _t("title.format." + titleID, {
79607           changes: changeCount,
79608           base: baseTitle,
79609           context: contextual
79610         });
79611       }
79612       return baseTitle;
79613     }
79614     function updateTitle(includeChangeCount) {
79615       if (!context.setsDocumentTitle())
79616         return;
79617       var newTitle = computedTitle(includeChangeCount);
79618       if (document.title !== newTitle) {
79619         document.title = newTitle;
79620       }
79621     }
79622     function updateHashIfNeeded() {
79623       if (context.inIntro())
79624         return;
79625       var latestHash = computedHash();
79626       if (_cachedHash !== latestHash) {
79627         _cachedHash = latestHash;
79628         window.history.replaceState(null, computedTitle(
79629           false
79630           /* includeChangeCount */
79631         ), latestHash);
79632         updateTitle(
79633           true
79634           /* includeChangeCount */
79635         );
79636         const q = utilStringQs(latestHash);
79637         if (q.map) {
79638           corePreferences("map-location", q.map);
79639         }
79640       }
79641     }
79642     var _throttledUpdate = throttle_default(updateHashIfNeeded, 500);
79643     var _throttledUpdateTitle = throttle_default(function() {
79644       updateTitle(
79645         true
79646         /* includeChangeCount */
79647       );
79648     }, 500);
79649     function hashchange() {
79650       if (window.location.hash === _cachedHash)
79651         return;
79652       _cachedHash = window.location.hash;
79653       var q = utilStringQs(_cachedHash);
79654       var mapArgs = (q.map || "").split("/").map(Number);
79655       if (mapArgs.length < 3 || mapArgs.some(isNaN)) {
79656         updateHashIfNeeded();
79657       } else {
79658         if (_cachedHash === computedHash())
79659           return;
79660         var mode = context.mode();
79661         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
79662         if (q.id && mode) {
79663           var ids = q.id.split(",").filter(function(id2) {
79664             return context.hasEntity(id2);
79665           });
79666           if (ids.length && (mode.id === "browse" || mode.id === "select" && !utilArrayIdentical(mode.selectedIDs(), ids))) {
79667             context.enter(modeSelect(context, ids));
79668             return;
79669           }
79670         }
79671         var center = context.map().center();
79672         var dist = geoSphericalDistance(center, [mapArgs[2], mapArgs[1]]);
79673         var maxdist = 500;
79674         if (mode && mode.id.match(/^draw/) !== null && dist > maxdist) {
79675           context.enter(modeBrowse(context));
79676           return;
79677         }
79678       }
79679     }
79680     function behavior() {
79681       context.map().on("move.behaviorHash", _throttledUpdate);
79682       context.history().on("change.behaviorHash", _throttledUpdateTitle);
79683       context.on("enter.behaviorHash", _throttledUpdate);
79684       select_default2(window).on("hashchange.behaviorHash", hashchange);
79685       var q = utilStringQs(window.location.hash);
79686       if (q.id) {
79687         context.zoomToEntity(q.id.split(",")[0], !q.map);
79688       }
79689       if (q.walkthrough === "true") {
79690         behavior.startWalkthrough = true;
79691       }
79692       if (q.map) {
79693         behavior.hadLocation = true;
79694       } else if (!q.id && corePreferences("map-location")) {
79695         const mapArgs = corePreferences("map-location").split("/").map(Number);
79696         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
79697         updateHashIfNeeded();
79698         behavior.hadLocation = true;
79699       }
79700       hashchange();
79701       updateTitle(false);
79702     }
79703     behavior.off = function() {
79704       _throttledUpdate.cancel();
79705       _throttledUpdateTitle.cancel();
79706       context.map().on("move.behaviorHash", null);
79707       context.on("enter.behaviorHash", null);
79708       select_default2(window).on("hashchange.behaviorHash", null);
79709       window.location.hash = "";
79710     };
79711     return behavior;
79712   }
79713
79714   // node_modules/d3-brush/src/brush.js
79715   var { abs: abs2, max: max2, min: min2 } = Math;
79716   function number1(e) {
79717     return [+e[0], +e[1]];
79718   }
79719   function number22(e) {
79720     return [number1(e[0]), number1(e[1])];
79721   }
79722   var X = {
79723     name: "x",
79724     handles: ["w", "e"].map(type),
79725     input: function(x, e) {
79726       return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]];
79727     },
79728     output: function(xy) {
79729       return xy && [xy[0][0], xy[1][0]];
79730     }
79731   };
79732   var Y = {
79733     name: "y",
79734     handles: ["n", "s"].map(type),
79735     input: function(y, e) {
79736       return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]];
79737     },
79738     output: function(xy) {
79739       return xy && [xy[0][1], xy[1][1]];
79740     }
79741   };
79742   var XY = {
79743     name: "xy",
79744     handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type),
79745     input: function(xy) {
79746       return xy == null ? null : number22(xy);
79747     },
79748     output: function(xy) {
79749       return xy;
79750     }
79751   };
79752   function type(t) {
79753     return { type: t };
79754   }
79755
79756   // modules/index.js
79757   var debug = false;
79758   var d3 = {
79759     dispatch: dispatch_default,
79760     geoMercator: mercator_default,
79761     geoProjection: projection,
79762     polygonArea: area_default3,
79763     polygonCentroid: centroid_default2,
79764     select: select_default2,
79765     selectAll: selectAll_default2,
79766     timerFlush
79767   };
79768
79769   // modules/id.js
79770   window.requestIdleCallback = window.requestIdleCallback || function(cb) {
79771     var start2 = Date.now();
79772     return window.requestAnimationFrame(function() {
79773       cb({
79774         didTimeout: false,
79775         timeRemaining: function() {
79776           return Math.max(0, 50 - (Date.now() - start2));
79777         }
79778       });
79779     });
79780   };
79781   window.cancelIdleCallback = window.cancelIdleCallback || function(id2) {
79782     window.cancelAnimationFrame(id2);
79783   };
79784   window.iD = modules_exports;
79785 })();
79786 //# sourceMappingURL=iD.js.map