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;
11 var __export = (target, all) => {
13 __defProp(target, name, { get: all[name], enumerable: true });
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 });
23 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28 // node_modules/diacritics/index.js
29 var require_diacritics = __commonJS({
30 "node_modules/diacritics/index.js"(exports2) {
31 exports2.remove = removeDiacritics2;
32 var replacementList = [
43 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"
51 chars: "\xC6\u01FC\u01E2"
71 chars: "\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0181"
75 chars: "\u24B8\uFF23\uA73E\u1E08\u0106C\u0108\u010A\u010C\xC7\u0187\u023B"
79 chars: "\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018A\u0189\u1D05\uA779"
95 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"
99 chars: "\uA77C\u24BB\uFF26\u1E1E\u0191\uA77B"
103 chars: "\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E\u0262"
107 chars: "\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"
111 chars: "\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"
115 chars: "\u24BF\uFF2A\u0134\u0248\u0237"
119 chars: "\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"
123 chars: "\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"
135 chars: "\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C\u03FB"
139 chars: "\uA7A4\u0220\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u019D\uA790\u1D0E"
151 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"
171 chars: "\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"
175 chars: "\u24C6\uFF31\uA756\uA758\u024A"
179 chars: "\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"
183 chars: "\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"
187 chars: "\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"
199 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"
203 chars: "\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"
211 chars: "\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"
215 chars: "\u24CD\uFF38\u1E8A\u1E8C"
219 chars: "\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"
223 chars: "\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"
227 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"
235 chars: "\xE6\u01FD\u01E3"
247 chars: "\uA739\uA73B"
255 chars: "\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253\u0182"
259 chars: "\uFF43\u24D2\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"
263 chars: "\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\u018B\u13E7\u0501\uA7AA"
271 chars: "\u01F3\u01C6"
275 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"
279 chars: "\u24D5\uFF46\u1E1F\u0192"
303 chars: "\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\uA77F\u1D79"
307 chars: "\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"
315 chars: "\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"
319 chars: "\u24D9\uFF4A\u0135\u01F0\u0249"
323 chars: "\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"
327 chars: "\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747\u026D"
335 chars: "\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"
339 chars: "\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5\u043B\u0509"
347 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"
367 chars: "\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755\u03C1"
371 chars: "\u24E0\uFF51\u024B\uA757\uA759"
375 chars: "\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"
379 chars: "\u24E2\uFF53\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B\u0282"
387 chars: "\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"
399 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"
403 chars: "\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"
411 chars: "\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"
415 chars: "\u24E7\uFF58\u1E8B\u1E8D"
419 chars: "\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"
423 chars: "\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"
426 var diacriticsMap = {};
427 for (i2 = 0; i2 < replacementList.length; i2 += 1) {
428 chars = replacementList[i2].chars;
429 for (j2 = 0; j2 < chars.length; j2 += 1) {
430 diacriticsMap[chars[j2]] = replacementList[i2].base;
436 function removeDiacritics2(str2) {
437 return str2.replace(/[^\u0000-\u007e]/g, function(c) {
438 return diacriticsMap[c] || c;
441 exports2.replacementList = replacementList;
442 exports2.diacriticsMap = diacriticsMap;
446 // node_modules/alif-toolkit/lib/isArabic.js
447 var require_isArabic = __commonJS({
448 "node_modules/alif-toolkit/lib/isArabic.js"(exports2) {
450 Object.defineProperty(exports2, "__esModule", { value: true });
461 function isArabic(char) {
462 if (char.length > 1) {
463 throw new Error("isArabic works on only one-character strings");
465 let code = char.charCodeAt(0);
466 for (let i2 = 0; i2 < arabicBlocks.length; i2++) {
467 let block2 = arabicBlocks[i2];
468 if (code >= block2[0] && code <= block2[1]) {
474 exports2.isArabic = isArabic;
475 function isMath(char) {
476 if (char.length > 2) {
477 throw new Error("isMath works on only one-character strings");
479 let code = char.charCodeAt(0);
480 return code >= 1632 && code <= 1644 || code >= 1776 && code <= 1785;
482 exports2.isMath = isMath;
486 // node_modules/alif-toolkit/lib/unicode-arabic.js
487 var require_unicode_arabic = __commonJS({
488 "node_modules/alif-toolkit/lib/unicode-arabic.js"(exports2) {
490 Object.defineProperty(exports2, "__esModule", { value: true });
491 var arabicReference = {
501 "isolated": "\uFE81",
509 "isolated": "\uFE83",
517 "isolated": "\uFE87",
522 "isolated": "\uFB50",
525 "wavy_hamza_above": [
528 "wavy_hamza_below": [
539 "indic_three_above": [
549 "isolated": "\uFE8D",
559 "three_dots_horizontally_below": [
562 "dot_below_three_dots_above": [
565 "three_dots_pointing_upwards_below": [
568 "three_dots_pointing_upwards_below_two_dots_above": [
571 "two_dots_below_dot_above": [
574 "inverted_small_v_below": [
586 "small_meem_above": [
589 "isolated": "\uFE8F",
598 "isolated": "\uFE93",
608 "three_dots_above_downwards": [
614 "isolated": "\uFE95",
623 "isolated": "\uFE99",
635 "isolated": "\uFE9D",
647 "two_dots_vertical_above": [
650 "three_dots_above": [
656 "three_dots_pointing_upwards_below": [
662 "small_tah_two_dots": [
668 "indic_four_below": [
671 "isolated": "\uFEA1",
680 "isolated": "\uFEA5",
695 "dot_below_small_tah": [
698 "three_dots_above_downwards": [
707 "two_dots_vertically_below_small_tah": [
710 "inverted_small_v_below": [
713 "three_dots_below": [
716 "isolated": "\uFEA9",
723 "isolated": "\uFEAB",
742 "dot_below_dot_above": [
757 "two_dots_vertically_above": [
763 "small_tah_two_dots": [
769 "small_noon_above": [
772 "isolated": "\uFEAD",
779 "inverted_v_above": [
782 "isolated": "\uFEAF",
789 "dot_below_dot_above": [
792 "three_dots_below": [
795 "three_dots_below_three_dots_above": [
801 "two_dots_vertically_above": [
804 "small_tah_two_dots": [
807 "indic_four_above": [
813 "isolated": "\uFEB1",
825 "isolated": "\uFEB5",
837 "three_dots_above": [
840 "three_dots_below": [
843 "isolated": "\uFEB9",
855 "isolated": "\uFEBD",
864 "three_dots_above": [
870 "isolated": "\uFEC1",
879 "isolated": "\uFEC5",
888 "three_dots_above": [
894 "three_dots_pointing_downwards_above": [
897 "two_dots_vertically_above": [
900 "three_dots_below": [
903 "isolated": "\uFEC9",
915 "isolated": "\uFECD",
933 "three_dots_below": [
939 "three_dots_pointing_upwards_below": [
942 "dot_below_three_dots_above": [
945 "isolated": "\uFED1",
960 "three_dots_above": [
966 "isolated": "\uFED5",
984 "three_dots_below": [
993 "isolated": "\uFED9",
1008 "three_dots_above": [
1011 "three_dots_below": [
1020 "isolated": "\uFEDD",
1022 "initial": "\uFEDF",
1035 "three_dots_above": [
1038 "isolated": "\uFEE1",
1040 "initial": "\uFEE3",
1053 "three_dots_above": [
1065 "isolated": "\uFEE5",
1067 "initial": "\uFEE7",
1074 "isolated": "\uFEE9",
1076 "initial": "\uFEEB",
1088 "isolated": "\uFE85",
1104 "indic_two_above": [
1107 "indic_three_above": [
1113 "isolated": "\uFEED",
1124 "initial": "\uFBE8",
1126 "isolated": "\uFEEF",
1138 "isolated": "\uFE89",
1140 "initial": "\uFE8B",
1143 "two_dots_below_hamza_above": [
1156 "three_dots_below": [
1159 "two_dots_below_dot_above": [
1162 "two_dots_below_small_noon_above": [
1165 "isolated": "\uFEF1",
1167 "initial": "\uFEF3",
1174 "isolated": "\uFB66",
1176 "initial": "\uFB68",
1183 "isolated": "\uFB5E",
1185 "initial": "\uFB60",
1192 "isolated": "\uFB52",
1194 "initial": "\uFB54",
1201 "small_meem_above": [
1204 "isolated": "\uFB56",
1206 "initial": "\uFB58",
1213 "isolated": "\uFB62",
1215 "initial": "\uFB64",
1222 "isolated": "\uFB5A",
1224 "initial": "\uFB5C",
1231 "isolated": "\uFB76",
1233 "initial": "\uFB78",
1240 "isolated": "\uFB72",
1242 "initial": "\uFB74",
1252 "isolated": "\uFB7A",
1254 "initial": "\uFB7C",
1261 "isolated": "\uFB7E",
1263 "initial": "\uFB80",
1270 "isolated": "\uFB88",
1277 "isolated": "\uFB84",
1284 "isolated": "\uFB82",
1292 "isolated": "\uFB86",
1299 "isolated": "\uFB8C",
1306 "isolated": "\uFB8A",
1313 "isolated": "\uFB6A",
1315 "initial": "\uFB6C",
1322 "isolated": "\uFB6E",
1324 "initial": "\uFB70",
1334 "three_dots_above": [
1337 "three_dots_pointing_upwards_below": [
1340 "isolated": "\uFB8E",
1342 "initial": "\uFB90",
1349 "isolated": "\uFBD3",
1351 "initial": "\uFBD5",
1364 "three_dots_above": [
1367 "inverted_stroke": [
1370 "isolated": "\uFB92",
1372 "initial": "\uFB94",
1379 "isolated": "\uFB9A",
1381 "initial": "\uFB9C",
1388 "isolated": "\uFB96",
1390 "initial": "\uFB98",
1397 "isolated": "\uFB9E",
1404 "isolated": "\uFBA0",
1406 "initial": "\uFBA2",
1409 "heh doachashmee": {
1413 "isolated": "\uFBAA",
1415 "initial": "\uFBAC",
1426 "isolated": "\uFBA6",
1428 "initial": "\uFBA8",
1431 "teh marbuta goal": {
1440 "isolated": "\uFBE0",
1447 "isolated": "\uFBD9",
1459 "isolated": "\uFBDD"
1461 "isolated": "\uFBD7",
1468 "isolated": "\uFBDB",
1475 "isolated": "\uFBE2",
1482 "isolated": "\uFBDE",
1489 "indic_two_above": [
1492 "indic_three_above": [
1495 "indic_four_above": [
1498 "isolated": "\uFBFC",
1500 "initial": "\uFBFE",
1507 "isolated": "\uFBE4",
1509 "initial": "\uFBE6",
1521 "isolated": "\uFBB0",
1524 "indic_two_above": [
1527 "indic_three_above": [
1530 "isolated": "\uFBAE",
1537 "isolated": "\u06D5",
1544 "isolated": "\uFBA4",
1579 exports2.default = arabicReference;
1583 // node_modules/alif-toolkit/lib/unicode-ligatures.js
1584 var require_unicode_ligatures = __commonJS({
1585 "node_modules/alif-toolkit/lib/unicode-ligatures.js"(exports2) {
1587 Object.defineProperty(exports2, "__esModule", { value: true });
1588 var ligatureReference = {
1590 "isolated": "\uFBEA",
1594 "isolated": "\uFBEC",
1598 "isolated": "\uFBEE",
1602 "isolated": "\uFBF0",
1606 "isolated": "\uFBF2",
1610 "isolated": "\uFBF4",
1614 "isolated": "\uFBF6",
1620 "isolated": "\uFBF9",
1624 "isolated": "\uFC03",
1628 "isolated": "\uFC00",
1632 "isolated": "\uFC01",
1636 "isolated": "\uFC02",
1638 "initial": "\uFC9A",
1642 "isolated": "\uFC04",
1646 "isolated": "\uFC05",
1650 "isolated": "\uFC06",
1654 "isolated": "\uFC07",
1658 "isolated": "\uFC08",
1660 "initial": "\uFC9F",
1664 "isolated": "\uFC09",
1668 "isolated": "\uFC0A",
1672 "isolated": "\uFC0B",
1676 "isolated": "\uFC0C",
1680 "isolated": "\uFC0D",
1684 "isolated": "\uFC0E",
1686 "initial": "\uFCA4",
1690 "isolated": "\uFC0F",
1694 "isolated": "\uFC10",
1698 "isolated": "\uFC11"
1701 "isolated": "\uFC12",
1703 "initial": "\uFCA6",
1707 "isolated": "\uFC13",
1711 "isolated": "\uFC14"
1714 "isolated": "\uFC15",
1718 "isolated": "\uFC16",
1722 "isolated": "\uFC17",
1726 "isolated": "\uFC18",
1730 "isolated": "\uFC19",
1734 "isolated": "\uFC1A"
1737 "isolated": "\uFC1B",
1741 "isolated": "\uFC1C",
1742 "initial": "\uFCAD",
1746 "isolated": "\uFC1D",
1747 "initial": "\uFCAE",
1751 "isolated": "\uFC1E",
1752 "initial": "\uFCAF",
1756 "isolated": "\uFC1F",
1757 "initial": "\uFCB0",
1761 "isolated": "\uFC20",
1765 "isolated": "\uFC21",
1769 "isolated": "\uFC22",
1773 "isolated": "\uFC23",
1777 "isolated": "\uFC24",
1781 "isolated": "\uFC25",
1785 "isolated": "\uFC26",
1789 "isolated": "\uFC27",
1790 "initial": "\uFD33",
1794 "isolated": "\uFC28",
1795 "initial": "\uFCB9",
1799 "isolated": "\uFC29",
1803 "isolated": "\uFC2A",
1807 "isolated": "\uFC2B",
1811 "isolated": "\uFC2C",
1815 "isolated": "\uFC2D",
1819 "isolated": "\uFC2E",
1823 "isolated": "\uFC2F",
1827 "isolated": "\uFC30",
1831 "isolated": "\uFC31",
1835 "isolated": "\uFC32",
1839 "isolated": "\uFC33",
1843 "isolated": "\uFC34",
1847 "isolated": "\uFC35",
1851 "isolated": "\uFC36",
1855 "isolated": "\uFC37",
1859 "isolated": "\uFC38",
1863 "isolated": "\uFC39",
1867 "isolated": "\uFC3A",
1871 "isolated": "\uFC3B",
1873 "initial": "\uFCC7",
1877 "isolated": "\uFC3C",
1879 "initial": "\uFCC8",
1883 "isolated": "\uFC3D",
1887 "isolated": "\uFC3E",
1891 "isolated": "\uFC3F",
1895 "isolated": "\uFC40",
1899 "isolated": "\uFC41",
1903 "isolated": "\uFC42",
1905 "initial": "\uFCCC",
1909 "isolated": "\uFC43",
1913 "isolated": "\uFC44",
1917 "isolated": "\uFC45",
1921 "isolated": "\uFC46",
1925 "isolated": "\uFC47",
1929 "isolated": "\uFC48",
1934 "isolated": "\uFC49"
1937 "isolated": "\uFC4A"
1940 "isolated": "\uFC4B",
1944 "isolated": "\uFC4C",
1948 "isolated": "\uFC4D",
1952 "isolated": "\uFC4E",
1954 "initial": "\uFCD5",
1958 "isolated": "\uFC4F",
1962 "isolated": "\uFC50",
1966 "isolated": "\uFC51",
1970 "isolated": "\uFC52",
1974 "isolated": "\uFC53"
1977 "isolated": "\uFC54"
1980 "isolated": "\uFC55",
1984 "isolated": "\uFC56",
1988 "isolated": "\uFC57",
1992 "isolated": "\uFC58",
1994 "initial": "\uFCDD",
1998 "isolated": "\uFC59",
2002 "isolated": "\uFC5A",
2006 "isolated": "\uFC5B"
2009 "isolated": "\uFC5C"
2012 "isolated": "\uFC5D",
2016 "isolated": "\uFC5E"
2019 "isolated": "\uFC5F"
2022 "isolated": "\uFC60"
2025 "isolated": "\uFC61"
2028 "isolated": "\uFC62"
2031 "isolated": "\uFC63"
2097 "initial": "\uFC9B",
2101 "initial": "\uFCA0",
2105 "initial": "\uFCA5",
2115 "initial": "\uFCD6",
2122 "initial": "\uFCDE",
2134 "isolated": "\uFD0C",
2142 "\u0640\u064E\u0651": {
2145 "\u0640\u064F\u0651": {
2148 "\u0640\u0650\u0651": {
2152 "isolated": "\uFCF5",
2156 "isolated": "\uFCF6",
2160 "isolated": "\uFCF7",
2164 "isolated": "\uFCF8",
2168 "isolated": "\uFCF9",
2172 "isolated": "\uFCFA",
2176 "isolated": "\uFCFB"
2179 "isolated": "\uFCFC",
2183 "isolated": "\uFCFD",
2187 "isolated": "\uFCFE",
2191 "isolated": "\uFCFF",
2195 "isolated": "\uFD00",
2199 "isolated": "\uFD01",
2203 "isolated": "\uFD02",
2207 "isolated": "\uFD03",
2211 "isolated": "\uFD04",
2215 "isolated": "\uFD05",
2219 "isolated": "\uFD06",
2223 "isolated": "\uFD07",
2227 "isolated": "\uFD08",
2231 "isolated": "\uFD09",
2233 "initial": "\uFD2D",
2237 "isolated": "\uFD0A",
2239 "initial": "\uFD2E",
2243 "isolated": "\uFD0B",
2245 "initial": "\uFD2F",
2249 "isolated": "\uFD0D",
2253 "isolated": "\uFD0E",
2257 "isolated": "\uFD0F",
2261 "isolated": "\uFD10",
2267 "\u062A\u062C\u0645": {
2270 "\u062A\u062D\u062C": {
2274 "\u062A\u062D\u0645": {
2277 "\u062A\u062E\u0645": {
2280 "\u062A\u0645\u062C": {
2283 "\u062A\u0645\u062D": {
2286 "\u062A\u0645\u062E": {
2289 "\u062C\u0645\u062D": {
2293 "\u062D\u0645\u064A": {
2296 "\u062D\u0645\u0649": {
2299 "\u0633\u062D\u062C": {
2302 "\u0633\u062C\u062D": {
2305 "\u0633\u062C\u0649": {
2308 "\u0633\u0645\u062D": {
2312 "\u0633\u0645\u062C": {
2315 "\u0633\u0645\u0645": {
2319 "\u0635\u062D\u062D": {
2323 "\u0635\u0645\u0645": {
2327 "\u0634\u062D\u0645": {
2331 "\u0634\u062C\u064A": {
2334 "\u0634\u0645\u062E": {
2338 "\u0634\u0645\u0645": {
2342 "\u0636\u062D\u0649": {
2345 "\u0636\u062E\u0645": {
2349 "\u0636\u0645\u062D": {
2352 "\u0637\u0645\u062D": {
2355 "\u0637\u0645\u0645": {
2358 "\u0637\u0645\u064A": {
2361 "\u0639\u062C\u0645": {
2365 "\u0639\u0645\u0645": {
2369 "\u0639\u0645\u0649": {
2372 "\u063A\u0645\u0645": {
2375 "\u063A\u0645\u064A": {
2378 "\u063A\u0645\u0649": {
2381 "\u0641\u062E\u0645": {
2385 "\u0642\u0645\u062D": {
2389 "\u0642\u0645\u0645": {
2392 "\u0644\u062D\u0645": {
2396 "\u0644\u062D\u064A": {
2399 "\u0644\u062D\u0649": {
2402 "\u0644\u062C\u062C": {
2403 "initial": "\uFD83",
2406 "\u0644\u062E\u0645": {
2410 "\u0644\u0645\u062D": {
2414 "\u0645\u062D\u062C": {
2417 "\u0645\u062D\u0645": {
2420 "\u0645\u062D\u064A": {
2423 "\u0645\u062C\u062D": {
2426 "\u0645\u062C\u0645": {
2429 "\u0645\u062E\u062C": {
2432 "\u0645\u062E\u0645": {
2435 "\u0645\u062C\u062E": {
2438 "\u0647\u0645\u062C": {
2441 "\u0647\u0645\u0645": {
2444 "\u0646\u062D\u0645": {
2447 "\u0646\u062D\u0649": {
2450 "\u0646\u062C\u0645": {
2454 "\u0646\u062C\u0649": {
2457 "\u0646\u0645\u064A": {
2460 "\u0646\u0645\u0649": {
2463 "\u064A\u0645\u0645": {
2467 "\u0628\u062E\u064A": {
2470 "\u062A\u062C\u064A": {
2473 "\u062A\u062C\u0649": {
2476 "\u062A\u062E\u064A": {
2479 "\u062A\u062E\u0649": {
2482 "\u062A\u0645\u064A": {
2485 "\u062A\u0645\u0649": {
2488 "\u062C\u0645\u064A": {
2491 "\u062C\u062D\u0649": {
2494 "\u062C\u0645\u0649": {
2497 "\u0633\u062E\u0649": {
2500 "\u0635\u062D\u064A": {
2503 "\u0634\u062D\u064A": {
2506 "\u0636\u062D\u064A": {
2509 "\u0644\u062C\u064A": {
2512 "\u0644\u0645\u064A": {
2515 "\u064A\u062D\u064A": {
2518 "\u064A\u062C\u064A": {
2521 "\u064A\u0645\u064A": {
2524 "\u0645\u0645\u064A": {
2527 "\u0642\u0645\u064A": {
2530 "\u0646\u062D\u064A": {
2533 "\u0639\u0645\u064A": {
2536 "\u0643\u0645\u064A": {
2539 "\u0646\u062C\u062D": {
2540 "initial": "\uFDB8",
2543 "\u0645\u062E\u064A": {
2546 "\u0644\u062C\u0645": {
2547 "initial": "\uFDBA",
2550 "\u0643\u0645\u0645": {
2554 "\u062C\u062D\u064A": {
2557 "\u062D\u062C\u064A": {
2560 "\u0645\u062C\u064A": {
2563 "\u0641\u0645\u064A": {
2566 "\u0628\u062D\u064A": {
2569 "\u0633\u062E\u064A": {
2572 "\u0646\u062C\u064A": {
2576 "isolated": "\uFEF5",
2580 "isolated": "\uFEF7",
2584 "isolated": "\uFEF9",
2588 "isolated": "\uFEFB",
2592 "\u0635\u0644\u06D2": "\uFDF0",
2593 "\u0642\u0644\u06D2": "\uFDF1",
2594 "\u0627\u0644\u0644\u0647": "\uFDF2",
2595 "\u0627\u0643\u0628\u0631": "\uFDF3",
2596 "\u0645\u062D\u0645\u062F": "\uFDF4",
2597 "\u0635\u0644\u0639\u0645": "\uFDF5",
2598 "\u0631\u0633\u0648\u0644": "\uFDF6",
2599 "\u0639\u0644\u064A\u0647": "\uFDF7",
2600 "\u0648\u0633\u0644\u0645": "\uFDF8",
2601 "\u0635\u0644\u0649": "\uFDF9",
2602 "\u0635\u0644\u0649\u0627\u0644\u0644\u0647\u0639\u0644\u064A\u0647\u0648\u0633\u0644\u0645": "\uFDFA",
2603 "\u062C\u0644\u062C\u0644\u0627\u0644\u0647": "\uFDFB",
2604 "\u0631\u06CC\u0627\u0644": "\uFDFC"
2607 exports2.default = ligatureReference;
2611 // node_modules/alif-toolkit/lib/reference.js
2612 var require_reference = __commonJS({
2613 "node_modules/alif-toolkit/lib/reference.js"(exports2) {
2615 Object.defineProperty(exports2, "__esModule", { value: true });
2616 var unicode_arabic_1 = require_unicode_arabic();
2617 var unicode_ligatures_1 = require_unicode_ligatures();
2618 var letterList = Object.keys(unicode_arabic_1.default);
2619 exports2.letterList = letterList;
2620 var ligatureList = Object.keys(unicode_ligatures_1.default);
2621 exports2.ligatureList = ligatureList;
2622 var ligatureWordList = Object.keys(unicode_ligatures_1.default.words);
2623 exports2.ligatureWordList = ligatureWordList;
2624 var lams = "\u0644\u06B5\u06B6\u06B7\u06B8";
2625 exports2.lams = lams;
2626 var alefs = "\u0627\u0622\u0623\u0625\u0671\u0672\u0673\u0675\u0773\u0774";
2627 exports2.alefs = alefs;
2628 var tashkeel = "\u0605\u0640\u0670\u0674\u06DF\u06E7\u06E8";
2629 exports2.tashkeel = tashkeel;
2630 function addToTashkeel(start2, finish) {
2631 for (var i2 = start2; i2 <= finish; i2++) {
2632 exports2.tashkeel = tashkeel += String.fromCharCode(i2);
2635 addToTashkeel(1552, 1562);
2636 addToTashkeel(1611, 1631);
2637 addToTashkeel(1750, 1756);
2638 addToTashkeel(1760, 1764);
2639 addToTashkeel(1770, 1773);
2640 addToTashkeel(2259, 2273);
2641 addToTashkeel(2275, 2303);
2642 addToTashkeel(65136, 65151);
2643 var lineBreakers = "\u0627\u0629\u0648\u06C0\u06CF\u06FD\u06FE\u076B\u076C\u0771\u0773\u0774\u0778\u0779\u08E2\u08B1\u08B2\u08B9";
2644 exports2.lineBreakers = lineBreakers;
2645 function addToLineBreakers(start2, finish) {
2646 for (var i2 = start2; i2 <= finish; i2++) {
2647 exports2.lineBreakers = lineBreakers += String.fromCharCode(i2);
2650 addToLineBreakers(1536, 1567);
2651 addToLineBreakers(1569, 1573);
2652 addToLineBreakers(1583, 1586);
2653 addToLineBreakers(1632, 1645);
2654 addToLineBreakers(1649, 1655);
2655 addToLineBreakers(1672, 1689);
2656 addToLineBreakers(1731, 1739);
2657 addToLineBreakers(1746, 1785);
2658 addToLineBreakers(1881, 1883);
2659 addToLineBreakers(2218, 2222);
2660 addToLineBreakers(64336, 65021);
2661 addToLineBreakers(65152, 65276);
2662 addToLineBreakers(69216, 69247);
2663 addToLineBreakers(126064, 126143);
2664 addToLineBreakers(126464, 126719);
2668 // node_modules/alif-toolkit/lib/GlyphSplitter.js
2669 var require_GlyphSplitter = __commonJS({
2670 "node_modules/alif-toolkit/lib/GlyphSplitter.js"(exports2) {
2672 Object.defineProperty(exports2, "__esModule", { value: true });
2673 var isArabic_1 = require_isArabic();
2674 var reference_1 = require_reference();
2675 function GlyphSplitter(word) {
2677 let lastLetter = "";
2678 word.split("").forEach((letter) => {
2679 if (isArabic_1.isArabic(letter)) {
2680 if (reference_1.tashkeel.indexOf(letter) > -1) {
2681 letters[letters.length - 1] += letter;
2682 } 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)) {
2683 letters[letters.length - 1] += letter;
2685 letters.push(letter);
2688 letters.push(letter);
2690 if (reference_1.tashkeel.indexOf(letter) === -1) {
2691 lastLetter = letter;
2696 exports2.GlyphSplitter = GlyphSplitter;
2700 // node_modules/alif-toolkit/lib/BaselineSplitter.js
2701 var require_BaselineSplitter = __commonJS({
2702 "node_modules/alif-toolkit/lib/BaselineSplitter.js"(exports2) {
2704 Object.defineProperty(exports2, "__esModule", { value: true });
2705 var isArabic_1 = require_isArabic();
2706 var reference_1 = require_reference();
2707 function BaselineSplitter(word) {
2709 let lastLetter = "";
2710 word.split("").forEach((letter) => {
2711 if (isArabic_1.isArabic(letter) && isArabic_1.isArabic(lastLetter)) {
2712 if (lastLetter.length && reference_1.tashkeel.indexOf(letter) > -1) {
2713 letters[letters.length - 1] += letter;
2714 } else if (reference_1.lineBreakers.indexOf(lastLetter) > -1) {
2715 letters.push(letter);
2717 letters[letters.length - 1] += letter;
2720 letters.push(letter);
2722 if (reference_1.tashkeel.indexOf(letter) === -1) {
2723 lastLetter = letter;
2728 exports2.BaselineSplitter = BaselineSplitter;
2732 // node_modules/alif-toolkit/lib/Normalization.js
2733 var require_Normalization = __commonJS({
2734 "node_modules/alif-toolkit/lib/Normalization.js"(exports2) {
2736 Object.defineProperty(exports2, "__esModule", { value: true });
2737 var unicode_arabic_1 = require_unicode_arabic();
2738 var unicode_ligatures_1 = require_unicode_ligatures();
2739 var isArabic_1 = require_isArabic();
2740 var reference_1 = require_reference();
2741 function Normal(word, breakPresentationForm) {
2742 if (typeof breakPresentationForm === "undefined") {
2743 breakPresentationForm = true;
2745 let returnable = "";
2746 word.split("").forEach((letter) => {
2747 if (!isArabic_1.isArabic(letter)) {
2748 returnable += letter;
2751 for (let w = 0; w < reference_1.letterList.length; w++) {
2752 let letterForms = unicode_arabic_1.default[reference_1.letterList[w]];
2753 let versions = Object.keys(letterForms);
2754 for (let v = 0; v < versions.length; v++) {
2755 let localVersion = letterForms[versions[v]];
2756 if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2757 let embeddedForms = Object.keys(localVersion);
2758 for (let ef = 0; ef < embeddedForms.length; ef++) {
2759 let form = localVersion[embeddedForms[ef]];
2760 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2761 if (form === letter) {
2762 if (breakPresentationForm && localVersion["normal"] && ["isolated", "initial", "medial", "final"].indexOf(embeddedForms[ef]) > -1) {
2763 if (typeof localVersion["normal"] === "object") {
2764 returnable += localVersion["normal"][0];
2766 returnable += localVersion["normal"];
2770 returnable += letter;
2772 } else if (typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2773 returnable += form[0];
2778 } else if (localVersion === letter) {
2779 if (breakPresentationForm && letterForms["normal"] && ["isolated", "initial", "medial", "final"].indexOf(versions[v]) > -1) {
2780 if (typeof letterForms["normal"] === "object") {
2781 returnable += letterForms["normal"][0];
2783 returnable += letterForms["normal"];
2787 returnable += letter;
2789 } else if (typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2790 returnable += localVersion[0];
2795 for (let v2 = 0; v2 < reference_1.ligatureList.length; v2++) {
2796 let normalForm = reference_1.ligatureList[v2];
2797 if (normalForm !== "words") {
2798 let ligForms = Object.keys(unicode_ligatures_1.default[normalForm]);
2799 for (let f2 = 0; f2 < ligForms.length; f2++) {
2800 if (unicode_ligatures_1.default[normalForm][ligForms[f2]] === letter) {
2801 returnable += normalForm;
2807 for (let v3 = 0; v3 < reference_1.ligatureWordList.length; v3++) {
2808 let normalForm = reference_1.ligatureWordList[v3];
2809 if (unicode_ligatures_1.default.words[normalForm] === letter) {
2810 returnable += normalForm;
2814 returnable += letter;
2818 exports2.Normal = Normal;
2822 // node_modules/alif-toolkit/lib/CharShaper.js
2823 var require_CharShaper = __commonJS({
2824 "node_modules/alif-toolkit/lib/CharShaper.js"(exports2) {
2826 Object.defineProperty(exports2, "__esModule", { value: true });
2827 var unicode_arabic_1 = require_unicode_arabic();
2828 var isArabic_1 = require_isArabic();
2829 var reference_1 = require_reference();
2830 function CharShaper(letter, form) {
2831 if (!isArabic_1.isArabic(letter)) {
2832 throw new Error("Not Arabic");
2834 if (letter === "\u0621") {
2837 for (let w = 0; w < reference_1.letterList.length; w++) {
2838 let letterForms = unicode_arabic_1.default[reference_1.letterList[w]];
2839 let versions = Object.keys(letterForms);
2840 for (let v = 0; v < versions.length; v++) {
2841 let localVersion = letterForms[versions[v]];
2842 if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2843 if (versions.indexOf(form) > -1) {
2844 return letterForms[form];
2846 } else if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2847 let embeddedVersions = Object.keys(localVersion);
2848 for (let ev = 0; ev < embeddedVersions.length; ev++) {
2849 if (localVersion[embeddedVersions[ev]] === letter || typeof localVersion[embeddedVersions[ev]] === "object" && localVersion[embeddedVersions[ev]].indexOf && localVersion[embeddedVersions[ev]].indexOf(letter) > -1) {
2850 if (embeddedVersions.indexOf(form) > -1) {
2851 return localVersion[form];
2859 exports2.CharShaper = CharShaper;
2863 // node_modules/alif-toolkit/lib/WordShaper.js
2864 var require_WordShaper = __commonJS({
2865 "node_modules/alif-toolkit/lib/WordShaper.js"(exports2) {
2867 Object.defineProperty(exports2, "__esModule", { value: true });
2868 var isArabic_1 = require_isArabic();
2869 var reference_1 = require_reference();
2870 var CharShaper_1 = require_CharShaper();
2871 var unicode_ligatures_1 = require_unicode_ligatures();
2872 function WordShaper2(word) {
2873 let state = "initial";
2875 for (let w = 0; w < word.length; w++) {
2876 let nextLetter = " ";
2877 for (let nxw = w + 1; nxw < word.length; nxw++) {
2878 if (!isArabic_1.isArabic(word[nxw])) {
2881 if (reference_1.tashkeel.indexOf(word[nxw]) === -1) {
2882 nextLetter = word[nxw];
2886 if (!isArabic_1.isArabic(word[w]) || isArabic_1.isMath(word[w])) {
2889 } else if (reference_1.tashkeel.indexOf(word[w]) > -1) {
2891 } else if (nextLetter === " " || reference_1.lineBreakers.indexOf(word[w]) > -1) {
2892 output += CharShaper_1.CharShaper(word[w], state === "initial" ? "isolated" : "final");
2894 } else if (reference_1.lams.indexOf(word[w]) > -1 && reference_1.alefs.indexOf(nextLetter) > -1) {
2895 output += unicode_ligatures_1.default[word[w] + nextLetter][state === "initial" ? "isolated" : "final"];
2896 while (word[w] !== nextLetter) {
2901 output += CharShaper_1.CharShaper(word[w], state);
2907 exports2.WordShaper = WordShaper2;
2911 // node_modules/alif-toolkit/lib/ParentLetter.js
2912 var require_ParentLetter = __commonJS({
2913 "node_modules/alif-toolkit/lib/ParentLetter.js"(exports2) {
2915 Object.defineProperty(exports2, "__esModule", { value: true });
2916 var unicode_arabic_1 = require_unicode_arabic();
2917 var isArabic_1 = require_isArabic();
2918 var reference_1 = require_reference();
2919 function ParentLetter(letter) {
2920 if (!isArabic_1.isArabic(letter)) {
2921 throw new Error("Not an Arabic letter");
2923 for (let w = 0; w < reference_1.letterList.length; w++) {
2924 let letterForms = unicode_arabic_1.default[reference_1.letterList[w]];
2925 let versions = Object.keys(letterForms);
2926 for (let v = 0; v < versions.length; v++) {
2927 let localVersion = letterForms[versions[v]];
2928 if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2929 let embeddedForms = Object.keys(localVersion);
2930 for (let ef = 0; ef < embeddedForms.length; ef++) {
2931 let form = localVersion[embeddedForms[ef]];
2932 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2933 return localVersion;
2936 } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2943 exports2.ParentLetter = ParentLetter;
2944 function GrandparentLetter(letter) {
2945 if (!isArabic_1.isArabic(letter)) {
2946 throw new Error("Not an Arabic letter");
2948 for (let w = 0; w < reference_1.letterList.length; w++) {
2949 let letterForms = unicode_arabic_1.default[reference_1.letterList[w]];
2950 let versions = Object.keys(letterForms);
2951 for (let v = 0; v < versions.length; v++) {
2952 let localVersion = letterForms[versions[v]];
2953 if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2954 let embeddedForms = Object.keys(localVersion);
2955 for (let ef = 0; ef < embeddedForms.length; ef++) {
2956 let form = localVersion[embeddedForms[ef]];
2957 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2961 } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2968 exports2.GrandparentLetter = GrandparentLetter;
2972 // node_modules/alif-toolkit/lib/index.js
2973 var require_lib = __commonJS({
2974 "node_modules/alif-toolkit/lib/index.js"(exports2) {
2976 Object.defineProperty(exports2, "__esModule", { value: true });
2977 var isArabic_1 = require_isArabic();
2978 exports2.isArabic = isArabic_1.isArabic;
2979 var GlyphSplitter_1 = require_GlyphSplitter();
2980 exports2.GlyphSplitter = GlyphSplitter_1.GlyphSplitter;
2981 var BaselineSplitter_1 = require_BaselineSplitter();
2982 exports2.BaselineSplitter = BaselineSplitter_1.BaselineSplitter;
2983 var Normalization_1 = require_Normalization();
2984 exports2.Normal = Normalization_1.Normal;
2985 var CharShaper_1 = require_CharShaper();
2986 exports2.CharShaper = CharShaper_1.CharShaper;
2987 var WordShaper_1 = require_WordShaper();
2988 exports2.WordShaper = WordShaper_1.WordShaper;
2989 var ParentLetter_1 = require_ParentLetter();
2990 exports2.ParentLetter = ParentLetter_1.ParentLetter;
2991 exports2.GrandparentLetter = ParentLetter_1.GrandparentLetter;
2995 // node_modules/vparse/index.js
2996 var require_vparse = __commonJS({
2997 "node_modules/vparse/index.js"(exports2, module2) {
2998 (function(window2) {
3000 function parseVersion3(v) {
3001 var m = v.replace(/[^0-9.]/g, "").match(/[0-9]*\.|[0-9]+/g) || [];
3008 v.isEmpty = !v.major && !v.minor && !v.patch && !v.build;
3009 v.parsed = [v.major, v.minor, v.patch, v.build];
3010 v.text = v.parsed.join(".");
3011 v.compare = compare;
3014 function compare(v) {
3015 if (typeof v === "string") {
3016 v = parseVersion3(v);
3018 for (var i2 = 0; i2 < 4; i2++) {
3019 if (this.parsed[i2] !== v.parsed[i2]) {
3020 return this.parsed[i2] > v.parsed[i2] ? 1 : -1;
3025 if (typeof module2 === "object" && module2 && typeof module2.exports === "object") {
3026 module2.exports = parseVersion3;
3028 window2.parseVersion = parseVersion3;
3034 // node_modules/which-polygon/node_modules/quickselect/quickselect.js
3035 var require_quickselect = __commonJS({
3036 "node_modules/which-polygon/node_modules/quickselect/quickselect.js"(exports2, module2) {
3037 (function(global3, factory) {
3038 typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global3.quickselect = factory();
3039 })(exports2, function() {
3041 function quickselect2(arr, k, left, right, compare) {
3042 quickselectStep(arr, k, left || 0, right || arr.length - 1, compare || defaultCompare);
3044 function quickselectStep(arr, k, left, right, compare) {
3045 while (right > left) {
3046 if (right - left > 600) {
3047 var n2 = right - left + 1;
3048 var m = k - left + 1;
3049 var z = Math.log(n2);
3050 var s = 0.5 * Math.exp(2 * z / 3);
3051 var sd = 0.5 * Math.sqrt(z * s * (n2 - s) / n2) * (m - n2 / 2 < 0 ? -1 : 1);
3052 var newLeft = Math.max(left, Math.floor(k - m * s / n2 + sd));
3053 var newRight = Math.min(right, Math.floor(k + (n2 - m) * s / n2 + sd));
3054 quickselectStep(arr, k, newLeft, newRight, compare);
3059 swap2(arr, left, k);
3060 if (compare(arr[right], t) > 0)
3061 swap2(arr, left, right);
3066 while (compare(arr[i2], t) < 0)
3068 while (compare(arr[j2], t) > 0)
3071 if (compare(arr[left], t) === 0)
3072 swap2(arr, left, j2);
3075 swap2(arr, j2, right);
3083 function swap2(arr, i2, j2) {
3088 function defaultCompare(a, b) {
3089 return a < b ? -1 : a > b ? 1 : 0;
3091 return quickselect2;
3096 // node_modules/which-polygon/node_modules/rbush/index.js
3097 var require_rbush = __commonJS({
3098 "node_modules/which-polygon/node_modules/rbush/index.js"(exports2, module2) {
3100 module2.exports = rbush;
3101 module2.exports.default = rbush;
3102 var quickselect2 = require_quickselect();
3103 function rbush(maxEntries, format2) {
3104 if (!(this instanceof rbush))
3105 return new rbush(maxEntries, format2);
3106 this._maxEntries = Math.max(4, maxEntries || 9);
3107 this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
3109 this._initFormat(format2);
3115 return this._all(this.data, []);
3117 search: function(bbox2) {
3118 var node = this.data, result = [], toBBox = this.toBBox;
3119 if (!intersects(bbox2, node))
3121 var nodesToSearch = [], i2, len, child, childBBox;
3123 for (i2 = 0, len = node.children.length; i2 < len; i2++) {
3124 child = node.children[i2];
3125 childBBox = node.leaf ? toBBox(child) : child;
3126 if (intersects(bbox2, childBBox)) {
3129 else if (contains(bbox2, childBBox))
3130 this._all(child, result);
3132 nodesToSearch.push(child);
3135 node = nodesToSearch.pop();
3139 collides: function(bbox2) {
3140 var node = this.data, toBBox = this.toBBox;
3141 if (!intersects(bbox2, node))
3143 var nodesToSearch = [], i2, len, child, childBBox;
3145 for (i2 = 0, len = node.children.length; i2 < len; i2++) {
3146 child = node.children[i2];
3147 childBBox = node.leaf ? toBBox(child) : child;
3148 if (intersects(bbox2, childBBox)) {
3149 if (node.leaf || contains(bbox2, childBBox))
3151 nodesToSearch.push(child);
3154 node = nodesToSearch.pop();
3158 load: function(data) {
3159 if (!(data && data.length))
3161 if (data.length < this._minEntries) {
3162 for (var i2 = 0, len = data.length; i2 < len; i2++) {
3163 this.insert(data[i2]);
3167 var node = this._build(data.slice(), 0, data.length - 1, 0);
3168 if (!this.data.children.length) {
3170 } else if (this.data.height === node.height) {
3171 this._splitRoot(this.data, node);
3173 if (this.data.height < node.height) {
3174 var tmpNode = this.data;
3178 this._insert(node, this.data.height - node.height - 1, true);
3182 insert: function(item) {
3184 this._insert(item, this.data.height - 1);
3188 this.data = createNode([]);
3191 remove: function(item, equalsFn) {
3194 var node = this.data, bbox2 = this.toBBox(item), path = [], indexes = [], i2, parent, index, goingUp;
3195 while (node || path.length) {
3198 parent = path[path.length - 1];
3203 index = findItem(item, node.children, equalsFn);
3205 node.children.splice(index, 1);
3207 this._condense(path);
3211 if (!goingUp && !node.leaf && contains(node, bbox2)) {
3216 node = node.children[0];
3217 } else if (parent) {
3219 node = parent.children[i2];
3226 toBBox: function(item) {
3229 compareMinX: compareNodeMinX,
3230 compareMinY: compareNodeMinY,
3231 toJSON: function() {
3234 fromJSON: function(data) {
3238 _all: function(node, result) {
3239 var nodesToSearch = [];
3242 result.push.apply(result, node.children);
3244 nodesToSearch.push.apply(nodesToSearch, node.children);
3245 node = nodesToSearch.pop();
3249 _build: function(items, left, right, height) {
3250 var N = right - left + 1, M = this._maxEntries, node;
3252 node = createNode(items.slice(left, right + 1));
3253 calcBBox(node, this.toBBox);
3257 height = Math.ceil(Math.log(N) / Math.log(M));
3258 M = Math.ceil(N / Math.pow(M, height - 1));
3260 node = createNode([]);
3262 node.height = height;
3263 var N2 = Math.ceil(N / M), N1 = N2 * Math.ceil(Math.sqrt(M)), i2, j2, right2, right3;
3264 multiSelect(items, left, right, N1, this.compareMinX);
3265 for (i2 = left; i2 <= right; i2 += N1) {
3266 right2 = Math.min(i2 + N1 - 1, right);
3267 multiSelect(items, i2, right2, N2, this.compareMinY);
3268 for (j2 = i2; j2 <= right2; j2 += N2) {
3269 right3 = Math.min(j2 + N2 - 1, right2);
3270 node.children.push(this._build(items, j2, right3, height - 1));
3273 calcBBox(node, this.toBBox);
3276 _chooseSubtree: function(bbox2, node, level, path) {
3277 var i2, len, child, targetNode, area, enlargement, minArea, minEnlargement;
3280 if (node.leaf || path.length - 1 === level)
3282 minArea = minEnlargement = Infinity;
3283 for (i2 = 0, len = node.children.length; i2 < len; i2++) {
3284 child = node.children[i2];
3285 area = bboxArea(child);
3286 enlargement = enlargedArea(bbox2, child) - area;
3287 if (enlargement < minEnlargement) {
3288 minEnlargement = enlargement;
3289 minArea = area < minArea ? area : minArea;
3291 } else if (enlargement === minEnlargement) {
3292 if (area < minArea) {
3298 node = targetNode || node.children[0];
3302 _insert: function(item, level, isNode) {
3303 var toBBox = this.toBBox, bbox2 = isNode ? item : toBBox(item), insertPath = [];
3304 var node = this._chooseSubtree(bbox2, this.data, level, insertPath);
3305 node.children.push(item);
3306 extend2(node, bbox2);
3307 while (level >= 0) {
3308 if (insertPath[level].children.length > this._maxEntries) {
3309 this._split(insertPath, level);
3314 this._adjustParentBBoxes(bbox2, insertPath, level);
3316 _split: function(insertPath, level) {
3317 var node = insertPath[level], M = node.children.length, m = this._minEntries;
3318 this._chooseSplitAxis(node, m, M);
3319 var splitIndex = this._chooseSplitIndex(node, m, M);
3320 var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
3321 newNode.height = node.height;
3322 newNode.leaf = node.leaf;
3323 calcBBox(node, this.toBBox);
3324 calcBBox(newNode, this.toBBox);
3326 insertPath[level - 1].children.push(newNode);
3328 this._splitRoot(node, newNode);
3330 _splitRoot: function(node, newNode) {
3331 this.data = createNode([node, newNode]);
3332 this.data.height = node.height + 1;
3333 this.data.leaf = false;
3334 calcBBox(this.data, this.toBBox);
3336 _chooseSplitIndex: function(node, m, M) {
3337 var i2, bbox1, bbox2, overlap, area, minOverlap, minArea, index;
3338 minOverlap = minArea = Infinity;
3339 for (i2 = m; i2 <= M - m; i2++) {
3340 bbox1 = distBBox(node, 0, i2, this.toBBox);
3341 bbox2 = distBBox(node, i2, M, this.toBBox);
3342 overlap = intersectionArea(bbox1, bbox2);
3343 area = bboxArea(bbox1) + bboxArea(bbox2);
3344 if (overlap < minOverlap) {
3345 minOverlap = overlap;
3347 minArea = area < minArea ? area : minArea;
3348 } else if (overlap === minOverlap) {
3349 if (area < minArea) {
3357 _chooseSplitAxis: function(node, m, M) {
3358 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);
3359 if (xMargin < yMargin)
3360 node.children.sort(compareMinX);
3362 _allDistMargin: function(node, m, M, compare) {
3363 node.children.sort(compare);
3364 var toBBox = this.toBBox, leftBBox = distBBox(node, 0, m, toBBox), rightBBox = distBBox(node, M - m, M, toBBox), margin = bboxMargin(leftBBox) + bboxMargin(rightBBox), i2, child;
3365 for (i2 = m; i2 < M - m; i2++) {
3366 child = node.children[i2];
3367 extend2(leftBBox, node.leaf ? toBBox(child) : child);
3368 margin += bboxMargin(leftBBox);
3370 for (i2 = M - m - 1; i2 >= m; i2--) {
3371 child = node.children[i2];
3372 extend2(rightBBox, node.leaf ? toBBox(child) : child);
3373 margin += bboxMargin(rightBBox);
3377 _adjustParentBBoxes: function(bbox2, path, level) {
3378 for (var i2 = level; i2 >= 0; i2--) {
3379 extend2(path[i2], bbox2);
3382 _condense: function(path) {
3383 for (var i2 = path.length - 1, siblings; i2 >= 0; i2--) {
3384 if (path[i2].children.length === 0) {
3386 siblings = path[i2 - 1].children;
3387 siblings.splice(siblings.indexOf(path[i2]), 1);
3391 calcBBox(path[i2], this.toBBox);
3394 _initFormat: function(format2) {
3395 var compareArr = ["return a", " - b", ";"];
3396 this.compareMinX = new Function("a", "b", compareArr.join(format2[0]));
3397 this.compareMinY = new Function("a", "b", compareArr.join(format2[1]));
3398 this.toBBox = new Function(
3400 "return {minX: a" + format2[0] + ", minY: a" + format2[1] + ", maxX: a" + format2[2] + ", maxY: a" + format2[3] + "};"
3404 function findItem(item, items, equalsFn) {
3406 return items.indexOf(item);
3407 for (var i2 = 0; i2 < items.length; i2++) {
3408 if (equalsFn(item, items[i2]))
3413 function calcBBox(node, toBBox) {
3414 distBBox(node, 0, node.children.length, toBBox, node);
3416 function distBBox(node, k, p, toBBox, destNode) {
3418 destNode = createNode(null);
3419 destNode.minX = Infinity;
3420 destNode.minY = Infinity;
3421 destNode.maxX = -Infinity;
3422 destNode.maxY = -Infinity;
3423 for (var i2 = k, child; i2 < p; i2++) {
3424 child = node.children[i2];
3425 extend2(destNode, node.leaf ? toBBox(child) : child);
3429 function extend2(a, b) {
3430 a.minX = Math.min(a.minX, b.minX);
3431 a.minY = Math.min(a.minY, b.minY);
3432 a.maxX = Math.max(a.maxX, b.maxX);
3433 a.maxY = Math.max(a.maxY, b.maxY);
3436 function compareNodeMinX(a, b) {
3437 return a.minX - b.minX;
3439 function compareNodeMinY(a, b) {
3440 return a.minY - b.minY;
3442 function bboxArea(a) {
3443 return (a.maxX - a.minX) * (a.maxY - a.minY);
3445 function bboxMargin(a) {
3446 return a.maxX - a.minX + (a.maxY - a.minY);
3448 function enlargedArea(a, b) {
3449 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));
3451 function intersectionArea(a, b) {
3452 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);
3453 return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
3455 function contains(a, b) {
3456 return a.minX <= b.minX && a.minY <= b.minY && b.maxX <= a.maxX && b.maxY <= a.maxY;
3458 function intersects(a, b) {
3459 return b.minX <= a.maxX && b.minY <= a.maxY && b.maxX >= a.minX && b.maxY >= a.minY;
3461 function createNode(children2) {
3463 children: children2,
3472 function multiSelect(arr, left, right, n2, compare) {
3473 var stack = [left, right], mid;
3474 while (stack.length) {
3475 right = stack.pop();
3477 if (right - left <= n2)
3479 mid = left + Math.ceil((right - left) / n2 / 2) * n2;
3480 quickselect2(arr, mid, left, right, compare);
3481 stack.push(left, mid, mid, right);
3487 // node_modules/lineclip/index.js
3488 var require_lineclip = __commonJS({
3489 "node_modules/lineclip/index.js"(exports2, module2) {
3491 module2.exports = lineclip2;
3492 lineclip2.polyline = lineclip2;
3493 lineclip2.polygon = polygonclip2;
3494 function lineclip2(points, bbox2, result) {
3495 var len = points.length, codeA = bitCode2(points[0], bbox2), part = [], i2, a, b, codeB, lastCode;
3498 for (i2 = 1; i2 < len; i2++) {
3501 codeB = lastCode = bitCode2(b, bbox2);
3503 if (!(codeA | codeB)) {
3505 if (codeB !== lastCode) {
3511 } else if (i2 === len - 1) {
3515 } else if (codeA & codeB) {
3518 a = intersect2(a, b, codeA, bbox2);
3519 codeA = bitCode2(a, bbox2);
3521 b = intersect2(a, b, codeB, bbox2);
3522 codeB = bitCode2(b, bbox2);
3531 function polygonclip2(points, bbox2) {
3532 var result, edge, prev, prevInside, i2, p, inside;
3533 for (edge = 1; edge <= 8; edge *= 2) {
3535 prev = points[points.length - 1];
3536 prevInside = !(bitCode2(prev, bbox2) & edge);
3537 for (i2 = 0; i2 < points.length; i2++) {
3539 inside = !(bitCode2(p, bbox2) & edge);
3540 if (inside !== prevInside)
3541 result.push(intersect2(prev, p, edge, bbox2));
3545 prevInside = inside;
3553 function intersect2(a, b, edge, bbox2) {
3554 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;
3556 function bitCode2(p, bbox2) {
3558 if (p[0] < bbox2[0])
3560 else if (p[0] > bbox2[2])
3562 if (p[1] < bbox2[1])
3564 else if (p[1] > bbox2[3])
3571 // node_modules/which-polygon/index.js
3572 var require_which_polygon = __commonJS({
3573 "node_modules/which-polygon/index.js"(exports2, module2) {
3575 var rbush = require_rbush();
3576 var lineclip2 = require_lineclip();
3577 module2.exports = whichPolygon5;
3578 function whichPolygon5(data) {
3580 for (var i2 = 0; i2 < data.features.length; i2++) {
3581 var feature3 = data.features[i2];
3582 var coords = feature3.geometry.coordinates;
3583 if (feature3.geometry.type === "Polygon") {
3584 bboxes.push(treeItem(coords, feature3.properties));
3585 } else if (feature3.geometry.type === "MultiPolygon") {
3586 for (var j2 = 0; j2 < coords.length; j2++) {
3587 bboxes.push(treeItem(coords[j2], feature3.properties));
3591 var tree = rbush().load(bboxes);
3592 function query(p, multi) {
3593 var output = [], result = tree.search({
3599 for (var i3 = 0; i3 < result.length; i3++) {
3600 if (insidePolygon(result[i3].coords, p)) {
3602 output.push(result[i3].props);
3604 return result[i3].props;
3607 return multi && output.length ? output : null;
3610 query.bbox = function queryBBox(bbox2) {
3612 var result = tree.search({
3618 for (var i3 = 0; i3 < result.length; i3++) {
3619 if (polygonIntersectsBBox(result[i3].coords, bbox2)) {
3620 output.push(result[i3].props);
3627 function polygonIntersectsBBox(polygon2, bbox2) {
3629 (bbox2[0] + bbox2[2]) / 2,
3630 (bbox2[1] + bbox2[3]) / 2
3632 if (insidePolygon(polygon2, bboxCenter))
3634 for (var i2 = 0; i2 < polygon2.length; i2++) {
3635 if (lineclip2(polygon2[i2], bbox2).length > 0)
3640 function insidePolygon(rings, p) {
3642 for (var i2 = 0, len = rings.length; i2 < len; i2++) {
3643 var ring = rings[i2];
3644 for (var j2 = 0, len2 = ring.length, k = len2 - 1; j2 < len2; k = j2++) {
3645 if (rayIntersect(p, ring[j2], ring[k]))
3651 function rayIntersect(p, p1, p2) {
3652 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];
3654 function treeItem(coords, props) {
3663 for (var i2 = 0; i2 < coords[0].length; i2++) {
3664 var p = coords[0][i2];
3665 item.minX = Math.min(item.minX, p[0]);
3666 item.minY = Math.min(item.minY, p[1]);
3667 item.maxX = Math.max(item.maxX, p[0]);
3668 item.maxY = Math.max(item.maxY, p[1]);
3675 // node_modules/wgs84/index.js
3676 var require_wgs84 = __commonJS({
3677 "node_modules/wgs84/index.js"(exports2, module2) {
3678 module2.exports.RADIUS = 6378137;
3679 module2.exports.FLATTENING = 1 / 298.257223563;
3680 module2.exports.POLAR_RADIUS = 63567523142e-4;
3684 // node_modules/@mapbox/geojson-area/index.js
3685 var require_geojson_area = __commonJS({
3686 "node_modules/@mapbox/geojson-area/index.js"(exports2, module2) {
3687 var wgs84 = require_wgs84();
3688 module2.exports.geometry = geometry;
3689 module2.exports.ring = ringArea;
3690 function geometry(_) {
3694 return polygonArea(_.coordinates);
3695 case "MultiPolygon":
3696 for (i2 = 0; i2 < _.coordinates.length; i2++) {
3697 area += polygonArea(_.coordinates[i2]);
3703 case "MultiLineString":
3705 case "GeometryCollection":
3706 for (i2 = 0; i2 < _.geometries.length; i2++) {
3707 area += geometry(_.geometries[i2]);
3712 function polygonArea(coords) {
3714 if (coords && coords.length > 0) {
3715 area += Math.abs(ringArea(coords[0]));
3716 for (var i2 = 1; i2 < coords.length; i2++) {
3717 area -= Math.abs(ringArea(coords[i2]));
3722 function ringArea(coords) {
3723 var p1, p2, p3, lowerIndex, middleIndex, upperIndex, i2, area = 0, coordsLength = coords.length;
3724 if (coordsLength > 2) {
3725 for (i2 = 0; i2 < coordsLength; i2++) {
3726 if (i2 === coordsLength - 2) {
3727 lowerIndex = coordsLength - 2;
3728 middleIndex = coordsLength - 1;
3730 } else if (i2 === coordsLength - 1) {
3731 lowerIndex = coordsLength - 1;
3736 middleIndex = i2 + 1;
3737 upperIndex = i2 + 2;
3739 p1 = coords[lowerIndex];
3740 p2 = coords[middleIndex];
3741 p3 = coords[upperIndex];
3742 area += (rad(p3[0]) - rad(p1[0])) * Math.sin(rad(p2[1]));
3744 area = area * wgs84.RADIUS * wgs84.RADIUS / 2;
3749 return _ * Math.PI / 180;
3754 // node_modules/circle-to-polygon/input-validation/validateCenter.js
3755 var require_validateCenter = __commonJS({
3756 "node_modules/circle-to-polygon/input-validation/validateCenter.js"(exports2) {
3757 exports2.validateCenter = function validateCenter(center) {
3758 var validCenterLengths = [2, 3];
3759 if (!Array.isArray(center) || !validCenterLengths.includes(center.length)) {
3760 throw new Error("ERROR! Center has to be an array of length two or three");
3762 var [lng, lat] = center;
3763 if (typeof lng !== "number" || typeof lat !== "number") {
3765 `ERROR! Longitude and Latitude has to be numbers but where ${typeof lng} and ${typeof lat}`
3768 if (lng > 180 || lng < -180) {
3769 throw new Error(`ERROR! Longitude has to be between -180 and 180 but was ${lng}`);
3771 if (lat > 90 || lat < -90) {
3772 throw new Error(`ERROR! Latitude has to be between -90 and 90 but was ${lat}`);
3778 // node_modules/circle-to-polygon/input-validation/validateRadius.js
3779 var require_validateRadius = __commonJS({
3780 "node_modules/circle-to-polygon/input-validation/validateRadius.js"(exports2) {
3781 exports2.validateRadius = function validateRadius(radius) {
3782 if (typeof radius !== "number") {
3783 throw new Error(`ERROR! Radius has to be a positive number but was: ${typeof radius}`);
3786 throw new Error(`ERROR! Radius has to be a positive number but was: ${radius}`);
3792 // node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js
3793 var require_validateNumberOfEdges = __commonJS({
3794 "node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js"(exports2) {
3795 exports2.validateNumberOfEdges = function validateNumberOfEdges(numberOfEdges) {
3796 if (typeof numberOfEdges !== "number") {
3797 const ARGUMENT_TYPE = Array.isArray(numberOfEdges) ? "array" : typeof numberOfEdges;
3798 throw new Error(`ERROR! Number of edges has to be a number but was: ${ARGUMENT_TYPE}`);
3800 if (numberOfEdges < 3) {
3801 throw new Error(`ERROR! Number of edges has to be at least 3 but was: ${numberOfEdges}`);
3807 // node_modules/circle-to-polygon/input-validation/validateEarthRadius.js
3808 var require_validateEarthRadius = __commonJS({
3809 "node_modules/circle-to-polygon/input-validation/validateEarthRadius.js"(exports2) {
3810 exports2.validateEarthRadius = function validateEarthRadius(earthRadius2) {
3811 if (typeof earthRadius2 !== "number") {
3812 const ARGUMENT_TYPE = Array.isArray(earthRadius2) ? "array" : typeof earthRadius2;
3813 throw new Error(`ERROR! Earth radius has to be a number but was: ${ARGUMENT_TYPE}`);
3815 if (earthRadius2 <= 0) {
3816 throw new Error(`ERROR! Earth radius has to be a positive number but was: ${earthRadius2}`);
3822 // node_modules/circle-to-polygon/input-validation/validateBearing.js
3823 var require_validateBearing = __commonJS({
3824 "node_modules/circle-to-polygon/input-validation/validateBearing.js"(exports2) {
3825 exports2.validateBearing = function validateBearing(bearing) {
3826 if (typeof bearing !== "number") {
3827 const ARGUMENT_TYPE = Array.isArray(bearing) ? "array" : typeof bearing;
3828 throw new Error(`ERROR! Bearing has to be a number but was: ${ARGUMENT_TYPE}`);
3834 // node_modules/circle-to-polygon/input-validation/index.js
3835 var require_input_validation = __commonJS({
3836 "node_modules/circle-to-polygon/input-validation/index.js"(exports2) {
3837 var validateCenter = require_validateCenter().validateCenter;
3838 var validateRadius = require_validateRadius().validateRadius;
3839 var validateNumberOfEdges = require_validateNumberOfEdges().validateNumberOfEdges;
3840 var validateEarthRadius = require_validateEarthRadius().validateEarthRadius;
3841 var validateBearing = require_validateBearing().validateBearing;
3842 function validateInput({ center, radius, numberOfEdges, earthRadius: earthRadius2, bearing }) {
3843 validateCenter(center);
3844 validateRadius(radius);
3845 validateNumberOfEdges(numberOfEdges);
3846 validateEarthRadius(earthRadius2);
3847 validateBearing(bearing);
3849 exports2.validateCenter = validateCenter;
3850 exports2.validateRadius = validateRadius;
3851 exports2.validateNumberOfEdges = validateNumberOfEdges;
3852 exports2.validateEarthRadius = validateEarthRadius;
3853 exports2.validateBearing = validateBearing;
3854 exports2.validateInput = validateInput;
3858 // node_modules/circle-to-polygon/index.js
3859 var require_circle_to_polygon = __commonJS({
3860 "node_modules/circle-to-polygon/index.js"(exports2, module2) {
3862 var { validateInput } = require_input_validation();
3863 var defaultEarthRadius = 6378137;
3864 function toRadians(angleInDegrees) {
3865 return angleInDegrees * Math.PI / 180;
3867 function toDegrees(angleInRadians) {
3868 return angleInRadians * 180 / Math.PI;
3870 function offset(c1, distance, earthRadius2, bearing) {
3871 var lat1 = toRadians(c1[1]);
3872 var lon1 = toRadians(c1[0]);
3873 var dByR = distance / earthRadius2;
3874 var lat = Math.asin(
3875 Math.sin(lat1) * Math.cos(dByR) + Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing)
3877 var lon = lon1 + Math.atan2(
3878 Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1),
3879 Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat)
3881 return [toDegrees(lon), toDegrees(lat)];
3883 module2.exports = function circleToPolygon2(center, radius, options2) {
3884 var n2 = getNumberOfEdges(options2);
3885 var earthRadius2 = getEarthRadius(options2);
3886 var bearing = getBearing(options2);
3887 var direction = getDirection(options2);
3888 validateInput({ center, radius, numberOfEdges: n2, earthRadius: earthRadius2, bearing });
3889 var start2 = toRadians(bearing);
3890 var coordinates = [];
3891 for (var i2 = 0; i2 < n2; ++i2) {
3897 start2 + direction * 2 * Math.PI * -i2 / n2
3901 coordinates.push(coordinates[0]);
3904 coordinates: [coordinates]
3907 function getNumberOfEdges(options2) {
3908 if (isUndefinedOrNull(options2)) {
3910 } else if (isObjectNotArray(options2)) {
3911 var numberOfEdges = options2.numberOfEdges;
3912 return numberOfEdges === void 0 ? 32 : numberOfEdges;
3916 function getEarthRadius(options2) {
3917 if (isUndefinedOrNull(options2)) {
3918 return defaultEarthRadius;
3919 } else if (isObjectNotArray(options2)) {
3920 var earthRadius2 = options2.earthRadius;
3921 return earthRadius2 === void 0 ? defaultEarthRadius : earthRadius2;
3923 return defaultEarthRadius;
3925 function getDirection(options2) {
3926 if (isObjectNotArray(options2) && options2.rightHandRule) {
3931 function getBearing(options2) {
3932 if (isUndefinedOrNull(options2)) {
3934 } else if (isObjectNotArray(options2)) {
3935 var bearing = options2.bearing;
3936 return bearing === void 0 ? 0 : bearing;
3940 function isObjectNotArray(argument) {
3941 return argument !== null && typeof argument === "object" && !Array.isArray(argument);
3943 function isUndefinedOrNull(argument) {
3944 return argument === null || argument === void 0;
3949 // node_modules/polygon-clipping/dist/polygon-clipping.umd.js
3950 var require_polygon_clipping_umd = __commonJS({
3951 "node_modules/polygon-clipping/dist/polygon-clipping.umd.js"(exports2, module2) {
3952 (function(global3, factory) {
3953 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());
3954 })(exports2, function() {
3956 function _classCallCheck(instance, Constructor) {
3957 if (!(instance instanceof Constructor)) {
3958 throw new TypeError("Cannot call a class as a function");
3961 function _defineProperties(target, props) {
3962 for (var i2 = 0; i2 < props.length; i2++) {
3963 var descriptor = props[i2];
3964 descriptor.enumerable = descriptor.enumerable || false;
3965 descriptor.configurable = true;
3966 if ("value" in descriptor)
3967 descriptor.writable = true;
3968 Object.defineProperty(target, descriptor.key, descriptor);
3971 function _createClass(Constructor, protoProps, staticProps) {
3973 _defineProperties(Constructor.prototype, protoProps);
3975 _defineProperties(Constructor, staticProps);
3978 var Node = function() {
3979 function Node2(key, data) {
3988 function DEFAULT_COMPARE(a, b) {
3989 return a > b ? 1 : a < b ? -1 : 0;
3991 function splay(i2, t, comparator) {
3992 var N = new Node(null, null);
3996 var cmp2 = comparator(i2, t.key);
3998 if (t.left === null)
4000 if (comparator(i2, t.left.key) < 0) {
4005 if (t.left === null)
4011 } else if (cmp2 > 0) {
4012 if (t.right === null)
4014 if (comparator(i2, t.right.key) > 0) {
4019 if (t.right === null)
4034 function insert(i2, data, t, comparator) {
4035 var node = new Node(i2, data);
4037 node.left = node.right = null;
4040 t = splay(i2, t, comparator);
4041 var cmp2 = comparator(i2, t.key);
4046 } else if (cmp2 >= 0) {
4047 node.right = t.right;
4053 function split(key, v, comparator) {
4057 v = splay(key, v, comparator);
4058 var cmp2 = comparator(v.key, key);
4062 } else if (cmp2 < 0) {
4077 function merge3(left, right, comparator) {
4082 right = splay(left.key, right, comparator);
4086 function printRow(root3, prefix, isTail, out, printNode) {
4088 out("" + prefix + (isTail ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ") + printNode(root3) + "\n");
4089 var indent2 = prefix + (isTail ? " " : "\u2502 ");
4091 printRow(root3.left, indent2, false, out, printNode);
4093 printRow(root3.right, indent2, true, out, printNode);
4096 var Tree = function() {
4097 function Tree2(comparator) {
4098 if (comparator === void 0) {
4099 comparator = DEFAULT_COMPARE;
4103 this._comparator = comparator;
4105 Tree2.prototype.insert = function(key, data) {
4107 return this._root = insert(key, data, this._root, this._comparator);
4109 Tree2.prototype.add = function(key, data) {
4110 var node = new Node(key, data);
4111 if (this._root === null) {
4112 node.left = node.right = null;
4116 var comparator = this._comparator;
4117 var t = splay(key, this._root, comparator);
4118 var cmp2 = comparator(key, t.key);
4126 } else if (cmp2 > 0) {
4127 node.right = t.right;
4136 Tree2.prototype.remove = function(key) {
4137 this._root = this._remove(key, this._root, this._comparator);
4139 Tree2.prototype._remove = function(i2, t, comparator) {
4143 t = splay(i2, t, comparator);
4144 var cmp2 = comparator(i2, t.key);
4146 if (t.left === null) {
4149 x = splay(i2, t.left, comparator);
4157 Tree2.prototype.pop = function() {
4158 var node = this._root;
4163 this._root = splay(node.key, this._root, this._comparator);
4164 this._root = this._remove(node.key, this._root, this._comparator);
4172 Tree2.prototype.findStatic = function(key) {
4173 var current = this._root;
4174 var compare = this._comparator;
4176 var cmp2 = compare(key, current.key);
4180 current = current.left;
4182 current = current.right;
4186 Tree2.prototype.find = function(key) {
4188 this._root = splay(key, this._root, this._comparator);
4189 if (this._comparator(key, this._root.key) !== 0)
4194 Tree2.prototype.contains = function(key) {
4195 var current = this._root;
4196 var compare = this._comparator;
4198 var cmp2 = compare(key, current.key);
4202 current = current.left;
4204 current = current.right;
4208 Tree2.prototype.forEach = function(visitor, ctx) {
4209 var current = this._root;
4213 if (current !== null) {
4215 current = current.left;
4217 if (Q.length !== 0) {
4219 visitor.call(ctx, current);
4220 current = current.right;
4227 Tree2.prototype.range = function(low, high, fn, ctx) {
4229 var compare = this._comparator;
4230 var node = this._root;
4232 while (Q.length !== 0 || node) {
4238 cmp2 = compare(node.key, high);
4241 } else if (compare(node.key, low) >= 0) {
4242 if (fn.call(ctx, node))
4250 Tree2.prototype.keys = function() {
4252 this.forEach(function(_a) {
4254 return keys.push(key);
4258 Tree2.prototype.values = function() {
4260 this.forEach(function(_a) {
4262 return values.push(data);
4266 Tree2.prototype.min = function() {
4268 return this.minNode(this._root).key;
4271 Tree2.prototype.max = function() {
4273 return this.maxNode(this._root).key;
4276 Tree2.prototype.minNode = function(t) {
4286 Tree2.prototype.maxNode = function(t) {
4296 Tree2.prototype.at = function(index2) {
4297 var current = this._root;
4304 current = current.left;
4311 current = current.right;
4318 Tree2.prototype.next = function(d) {
4319 var root3 = this._root;
4320 var successor = null;
4322 successor = d.right;
4323 while (successor.left) {
4324 successor = successor.left;
4328 var comparator = this._comparator;
4330 var cmp2 = comparator(d.key, root3.key);
4333 else if (cmp2 < 0) {
4337 root3 = root3.right;
4341 Tree2.prototype.prev = function(d) {
4342 var root3 = this._root;
4343 var predecessor = null;
4344 if (d.left !== null) {
4345 predecessor = d.left;
4346 while (predecessor.right) {
4347 predecessor = predecessor.right;
4351 var comparator = this._comparator;
4353 var cmp2 = comparator(d.key, root3.key);
4359 predecessor = root3;
4360 root3 = root3.right;
4365 Tree2.prototype.clear = function() {
4370 Tree2.prototype.toList = function() {
4371 return toList(this._root);
4373 Tree2.prototype.load = function(keys, values, presort) {
4374 if (values === void 0) {
4377 if (presort === void 0) {
4380 var size = keys.length;
4381 var comparator = this._comparator;
4383 sort(keys, values, 0, size - 1, comparator);
4384 if (this._root === null) {
4385 this._root = loadRecursive(keys, values, 0, size);
4388 var mergedList = mergeLists(this.toList(), createList(keys, values), comparator);
4389 size = this._size + size;
4390 this._root = sortedListToBST({
4396 Tree2.prototype.isEmpty = function() {
4397 return this._root === null;
4399 Object.defineProperty(Tree2.prototype, "size", {
4400 get: function get4() {
4406 Object.defineProperty(Tree2.prototype, "root", {
4407 get: function get4() {
4413 Tree2.prototype.toString = function(printNode) {
4414 if (printNode === void 0) {
4415 printNode = function printNode2(n2) {
4416 return String(n2.key);
4420 printRow(this._root, "", true, function(v) {
4423 return out.join("");
4425 Tree2.prototype.update = function(key, newKey, newData) {
4426 var comparator = this._comparator;
4427 var _a = split(key, this._root, comparator), left = _a.left, right = _a.right;
4428 if (comparator(key, newKey) < 0) {
4429 right = insert(newKey, newData, right, comparator);
4431 left = insert(newKey, newData, left, comparator);
4433 this._root = merge3(left, right, comparator);
4435 Tree2.prototype.split = function(key) {
4436 return split(key, this._root, this._comparator);
4440 function loadRecursive(keys, values, start2, end) {
4441 var size = end - start2;
4443 var middle = start2 + Math.floor(size / 2);
4444 var key = keys[middle];
4445 var data = values[middle];
4446 var node = new Node(key, data);
4447 node.left = loadRecursive(keys, values, start2, middle);
4448 node.right = loadRecursive(keys, values, middle + 1, end);
4453 function createList(keys, values) {
4454 var head = new Node(null, null);
4456 for (var i2 = 0; i2 < keys.length; i2++) {
4457 p = p.next = new Node(keys[i2], values[i2]);
4462 function toList(root3) {
4463 var current = root3;
4466 var head = new Node(null, null);
4471 current = current.left;
4474 current = p = p.next = Q.pop();
4475 current = current.right;
4483 function sortedListToBST(list, start2, end) {
4484 var size = end - start2;
4486 var middle = start2 + Math.floor(size / 2);
4487 var left = sortedListToBST(list, start2, middle);
4488 var root3 = list.head;
4490 list.head = list.head.next;
4491 root3.right = sortedListToBST(list, middle + 1, end);
4496 function mergeLists(l1, l2, compare) {
4497 var head = new Node(null, null);
4501 while (p1 !== null && p2 !== null) {
4502 if (compare(p1.key, p2.key) < 0) {
4513 } else if (p2 !== null) {
4518 function sort(keys, values, left, right, compare) {
4521 var pivot = keys[left + right >> 1];
4527 } while (compare(keys[i2], pivot) < 0);
4530 } while (compare(keys[j2], pivot) > 0);
4534 keys[i2] = keys[j2];
4537 values[i2] = values[j2];
4540 sort(keys, values, left, j2, compare);
4541 sort(keys, values, j2 + 1, right, compare);
4543 var isInBbox = function isInBbox2(bbox2, point2) {
4544 return bbox2.ll.x <= point2.x && point2.x <= bbox2.ur.x && bbox2.ll.y <= point2.y && point2.y <= bbox2.ur.y;
4546 var getBboxOverlap = function getBboxOverlap2(b1, b2) {
4547 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)
4549 var lowerX = b1.ll.x < b2.ll.x ? b2.ll.x : b1.ll.x;
4550 var upperX = b1.ur.x < b2.ur.x ? b1.ur.x : b2.ur.x;
4551 var lowerY = b1.ll.y < b2.ll.y ? b2.ll.y : b1.ll.y;
4552 var upperY = b1.ur.y < b2.ur.y ? b1.ur.y : b2.ur.y;
4564 var epsilon3 = Number.EPSILON;
4565 if (epsilon3 === void 0)
4566 epsilon3 = Math.pow(2, -52);
4567 var EPSILON_SQ = epsilon3 * epsilon3;
4568 var cmp = function cmp2(a, b) {
4569 if (-epsilon3 < a && a < epsilon3) {
4570 if (-epsilon3 < b && b < epsilon3) {
4575 if (ab * ab < EPSILON_SQ * a * b) {
4578 return a < b ? -1 : 1;
4580 var PtRounder = /* @__PURE__ */ function() {
4581 function PtRounder2() {
4582 _classCallCheck(this, PtRounder2);
4585 _createClass(PtRounder2, [{
4587 value: function reset() {
4588 this.xRounder = new CoordRounder();
4589 this.yRounder = new CoordRounder();
4593 value: function round(x, y) {
4595 x: this.xRounder.round(x),
4596 y: this.yRounder.round(y)
4602 var CoordRounder = /* @__PURE__ */ function() {
4603 function CoordRounder2() {
4604 _classCallCheck(this, CoordRounder2);
4605 this.tree = new Tree();
4608 _createClass(CoordRounder2, [{
4610 value: function round(coord2) {
4611 var node = this.tree.add(coord2);
4612 var prevNode = this.tree.prev(node);
4613 if (prevNode !== null && cmp(node.key, prevNode.key) === 0) {
4614 this.tree.remove(coord2);
4615 return prevNode.key;
4617 var nextNode = this.tree.next(node);
4618 if (nextNode !== null && cmp(node.key, nextNode.key) === 0) {
4619 this.tree.remove(coord2);
4620 return nextNode.key;
4625 return CoordRounder2;
4627 var rounder = new PtRounder();
4628 var crossProduct = function crossProduct2(a, b) {
4629 return a.x * b.y - a.y * b.x;
4631 var dotProduct = function dotProduct2(a, b) {
4632 return a.x * b.x + a.y * b.y;
4634 var compareVectorAngles = function compareVectorAngles2(basePt, endPt1, endPt2) {
4636 x: endPt1.x - basePt.x,
4637 y: endPt1.y - basePt.y
4640 x: endPt2.x - basePt.x,
4641 y: endPt2.y - basePt.y
4643 var kross = crossProduct(v1, v2);
4644 return cmp(kross, 0);
4646 var length = function length2(v) {
4647 return Math.sqrt(dotProduct(v, v));
4649 var sineOfAngle = function sineOfAngle2(pShared, pBase, pAngle) {
4651 x: pBase.x - pShared.x,
4652 y: pBase.y - pShared.y
4655 x: pAngle.x - pShared.x,
4656 y: pAngle.y - pShared.y
4658 return crossProduct(vAngle, vBase) / length(vAngle) / length(vBase);
4660 var cosineOfAngle = function cosineOfAngle2(pShared, pBase, pAngle) {
4662 x: pBase.x - pShared.x,
4663 y: pBase.y - pShared.y
4666 x: pAngle.x - pShared.x,
4667 y: pAngle.y - pShared.y
4669 return dotProduct(vAngle, vBase) / length(vAngle) / length(vBase);
4671 var horizontalIntersection = function horizontalIntersection2(pt, v, y) {
4675 x: pt.x + v.x / v.y * (y - pt.y),
4679 var verticalIntersection = function verticalIntersection2(pt, v, x) {
4684 y: pt.y + v.y / v.x * (x - pt.x)
4687 var intersection = function intersection2(pt1, v1, pt2, v2) {
4689 return verticalIntersection(pt2, v2, pt1.x);
4691 return verticalIntersection(pt1, v1, pt2.x);
4693 return horizontalIntersection(pt2, v2, pt1.y);
4695 return horizontalIntersection(pt1, v1, pt2.y);
4696 var kross = crossProduct(v1, v2);
4703 var d1 = crossProduct(ve, v1) / kross;
4704 var d2 = crossProduct(ve, v2) / kross;
4705 var x12 = pt1.x + d2 * v1.x, x2 = pt2.x + d1 * v2.x;
4706 var y12 = pt1.y + d2 * v1.y, y2 = pt2.y + d1 * v2.y;
4707 var x = (x12 + x2) / 2;
4708 var y = (y12 + y2) / 2;
4714 var SweepEvent = /* @__PURE__ */ function() {
4715 _createClass(SweepEvent2, null, [{
4717 value: function compare(a, b) {
4718 var ptCmp = SweepEvent2.comparePoints(a.point, b.point);
4721 if (a.point !== b.point)
4723 if (a.isLeft !== b.isLeft)
4724 return a.isLeft ? 1 : -1;
4725 return Segment.compare(a.segment, b.segment);
4728 key: "comparePoints",
4729 value: function comparePoints(aPt, bPt) {
4741 function SweepEvent2(point2, isLeft) {
4742 _classCallCheck(this, SweepEvent2);
4743 if (point2.events === void 0)
4744 point2.events = [this];
4746 point2.events.push(this);
4747 this.point = point2;
4748 this.isLeft = isLeft;
4750 _createClass(SweepEvent2, [{
4752 value: function link2(other) {
4753 if (other.point === this.point) {
4754 throw new Error("Tried to link already linked events");
4756 var otherEvents = other.point.events;
4757 for (var i2 = 0, iMax = otherEvents.length; i2 < iMax; i2++) {
4758 var evt = otherEvents[i2];
4759 this.point.events.push(evt);
4760 evt.point = this.point;
4762 this.checkForConsuming();
4765 key: "checkForConsuming",
4766 value: function checkForConsuming() {
4767 var numEvents = this.point.events.length;
4768 for (var i2 = 0; i2 < numEvents; i2++) {
4769 var evt1 = this.point.events[i2];
4770 if (evt1.segment.consumedBy !== void 0)
4772 for (var j2 = i2 + 1; j2 < numEvents; j2++) {
4773 var evt2 = this.point.events[j2];
4774 if (evt2.consumedBy !== void 0)
4776 if (evt1.otherSE.point.events !== evt2.otherSE.point.events)
4778 evt1.segment.consume(evt2.segment);
4783 key: "getAvailableLinkedEvents",
4784 value: function getAvailableLinkedEvents() {
4786 for (var i2 = 0, iMax = this.point.events.length; i2 < iMax; i2++) {
4787 var evt = this.point.events[i2];
4788 if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {
4795 key: "getLeftmostComparator",
4796 value: function getLeftmostComparator(baseEvent) {
4798 var cache = /* @__PURE__ */ new Map();
4799 var fillCache = function fillCache2(linkedEvent) {
4800 var nextEvent = linkedEvent.otherSE;
4801 cache.set(linkedEvent, {
4802 sine: sineOfAngle(_this.point, baseEvent.point, nextEvent.point),
4803 cosine: cosineOfAngle(_this.point, baseEvent.point, nextEvent.point)
4806 return function(a, b) {
4811 var _cache$get = cache.get(a), asine = _cache$get.sine, acosine = _cache$get.cosine;
4812 var _cache$get2 = cache.get(b), bsine = _cache$get2.sine, bcosine = _cache$get2.cosine;
4813 if (asine >= 0 && bsine >= 0) {
4814 if (acosine < bcosine)
4816 if (acosine > bcosine)
4820 if (asine < 0 && bsine < 0) {
4821 if (acosine < bcosine)
4823 if (acosine > bcosine)
4838 var Segment = /* @__PURE__ */ function() {
4839 _createClass(Segment2, null, [{
4841 value: function compare(a, b) {
4842 var alx = a.leftSE.point.x;
4843 var blx = b.leftSE.point.x;
4844 var arx = a.rightSE.point.x;
4845 var brx = b.rightSE.point.x;
4850 var aly = a.leftSE.point.y;
4851 var bly = b.leftSE.point.y;
4852 var ary = a.rightSE.point.y;
4853 var bry = b.rightSE.point.y;
4855 if (bly < aly && bly < ary)
4857 if (bly > aly && bly > ary)
4859 var aCmpBLeft = a.comparePoint(b.leftSE.point);
4864 var bCmpARight = b.comparePoint(a.rightSE.point);
4865 if (bCmpARight !== 0)
4870 if (aly < bly && aly < bry)
4872 if (aly > bly && aly > bry)
4874 var bCmpALeft = b.comparePoint(a.leftSE.point);
4875 if (bCmpALeft !== 0)
4877 var aCmpBRight = a.comparePoint(b.rightSE.point);
4889 var _bCmpARight = b.comparePoint(a.rightSE.point);
4890 if (_bCmpARight !== 0)
4894 var _aCmpBRight = a.comparePoint(b.rightSE.point);
4895 if (_aCmpBRight < 0)
4897 if (_aCmpBRight > 0)
4905 if (ay > ax && by < bx)
4907 if (ay < ax && by > bx)
4925 function Segment2(leftSE, rightSE, rings, windings) {
4926 _classCallCheck(this, Segment2);
4927 this.id = ++segmentId;
4928 this.leftSE = leftSE;
4929 leftSE.segment = this;
4930 leftSE.otherSE = rightSE;
4931 this.rightSE = rightSE;
4932 rightSE.segment = this;
4933 rightSE.otherSE = leftSE;
4935 this.windings = windings;
4937 _createClass(Segment2, [{
4938 key: "replaceRightSE",
4939 value: function replaceRightSE(newRightSE) {
4940 this.rightSE = newRightSE;
4941 this.rightSE.segment = this;
4942 this.rightSE.otherSE = this.leftSE;
4943 this.leftSE.otherSE = this.rightSE;
4947 value: function bbox2() {
4948 var y12 = this.leftSE.point.y;
4949 var y2 = this.rightSE.point.y;
4952 x: this.leftSE.point.x,
4953 y: y12 < y2 ? y12 : y2
4956 x: this.rightSE.point.x,
4957 y: y12 > y2 ? y12 : y2
4963 value: function vector() {
4965 x: this.rightSE.point.x - this.leftSE.point.x,
4966 y: this.rightSE.point.y - this.leftSE.point.y
4970 key: "isAnEndpoint",
4971 value: function isAnEndpoint(pt) {
4972 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;
4975 key: "comparePoint",
4976 value: function comparePoint(point2) {
4977 if (this.isAnEndpoint(point2))
4979 var lPt = this.leftSE.point;
4980 var rPt = this.rightSE.point;
4981 var v = this.vector();
4982 if (lPt.x === rPt.x) {
4983 if (point2.x === lPt.x)
4985 return point2.x < lPt.x ? 1 : -1;
4987 var yDist = (point2.y - lPt.y) / v.y;
4988 var xFromYDist = lPt.x + yDist * v.x;
4989 if (point2.x === xFromYDist)
4991 var xDist = (point2.x - lPt.x) / v.x;
4992 var yFromXDist = lPt.y + xDist * v.y;
4993 if (point2.y === yFromXDist)
4995 return point2.y < yFromXDist ? -1 : 1;
4998 key: "getIntersection",
4999 value: function getIntersection(other) {
5000 var tBbox = this.bbox();
5001 var oBbox = other.bbox();
5002 var bboxOverlap = getBboxOverlap(tBbox, oBbox);
5003 if (bboxOverlap === null)
5005 var tlp = this.leftSE.point;
5006 var trp = this.rightSE.point;
5007 var olp = other.leftSE.point;
5008 var orp = other.rightSE.point;
5009 var touchesOtherLSE = isInBbox(tBbox, olp) && this.comparePoint(olp) === 0;
5010 var touchesThisLSE = isInBbox(oBbox, tlp) && other.comparePoint(tlp) === 0;
5011 var touchesOtherRSE = isInBbox(tBbox, orp) && this.comparePoint(orp) === 0;
5012 var touchesThisRSE = isInBbox(oBbox, trp) && other.comparePoint(trp) === 0;
5013 if (touchesThisLSE && touchesOtherLSE) {
5014 if (touchesThisRSE && !touchesOtherRSE)
5016 if (!touchesThisRSE && touchesOtherRSE)
5020 if (touchesThisLSE) {
5021 if (touchesOtherRSE) {
5022 if (tlp.x === orp.x && tlp.y === orp.y)
5027 if (touchesOtherLSE) {
5028 if (touchesThisRSE) {
5029 if (trp.x === olp.x && trp.y === olp.y)
5034 if (touchesThisRSE && touchesOtherRSE)
5038 if (touchesOtherRSE)
5040 var pt = intersection(tlp, this.vector(), olp, other.vector());
5043 if (!isInBbox(bboxOverlap, pt))
5045 return rounder.round(pt.x, pt.y);
5049 value: function split2(point2) {
5051 var alreadyLinked = point2.events !== void 0;
5052 var newLeftSE = new SweepEvent(point2, true);
5053 var newRightSE = new SweepEvent(point2, false);
5054 var oldRightSE = this.rightSE;
5055 this.replaceRightSE(newRightSE);
5056 newEvents.push(newRightSE);
5057 newEvents.push(newLeftSE);
5058 var newSeg = new Segment2(newLeftSE, oldRightSE, this.rings.slice(), this.windings.slice());
5059 if (SweepEvent.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {
5060 newSeg.swapEvents();
5062 if (SweepEvent.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {
5065 if (alreadyLinked) {
5066 newLeftSE.checkForConsuming();
5067 newRightSE.checkForConsuming();
5073 value: function swapEvents() {
5074 var tmpEvt = this.rightSE;
5075 this.rightSE = this.leftSE;
5076 this.leftSE = tmpEvt;
5077 this.leftSE.isLeft = true;
5078 this.rightSE.isLeft = false;
5079 for (var i2 = 0, iMax = this.windings.length; i2 < iMax; i2++) {
5080 this.windings[i2] *= -1;
5085 value: function consume(other) {
5086 var consumer = this;
5087 var consumee = other;
5088 while (consumer.consumedBy) {
5089 consumer = consumer.consumedBy;
5091 while (consumee.consumedBy) {
5092 consumee = consumee.consumedBy;
5094 var cmp2 = Segment2.compare(consumer, consumee);
5099 consumer = consumee;
5102 if (consumer.prev === consumee) {
5103 var _tmp = consumer;
5104 consumer = consumee;
5107 for (var i2 = 0, iMax = consumee.rings.length; i2 < iMax; i2++) {
5108 var ring = consumee.rings[i2];
5109 var winding = consumee.windings[i2];
5110 var index2 = consumer.rings.indexOf(ring);
5111 if (index2 === -1) {
5112 consumer.rings.push(ring);
5113 consumer.windings.push(winding);
5115 consumer.windings[index2] += winding;
5117 consumee.rings = null;
5118 consumee.windings = null;
5119 consumee.consumedBy = consumer;
5120 consumee.leftSE.consumedBy = consumer.leftSE;
5121 consumee.rightSE.consumedBy = consumer.rightSE;
5124 key: "prevInResult",
5125 value: function prevInResult() {
5126 if (this._prevInResult !== void 0)
5127 return this._prevInResult;
5129 this._prevInResult = null;
5130 else if (this.prev.isInResult())
5131 this._prevInResult = this.prev;
5133 this._prevInResult = this.prev.prevInResult();
5134 return this._prevInResult;
5138 value: function beforeState() {
5139 if (this._beforeState !== void 0)
5140 return this._beforeState;
5142 this._beforeState = {
5148 var seg = this.prev.consumedBy || this.prev;
5149 this._beforeState = seg.afterState();
5151 return this._beforeState;
5155 value: function afterState() {
5156 if (this._afterState !== void 0)
5157 return this._afterState;
5158 var beforeState = this.beforeState();
5159 this._afterState = {
5160 rings: beforeState.rings.slice(0),
5161 windings: beforeState.windings.slice(0),
5164 var ringsAfter = this._afterState.rings;
5165 var windingsAfter = this._afterState.windings;
5166 var mpsAfter = this._afterState.multiPolys;
5167 for (var i2 = 0, iMax = this.rings.length; i2 < iMax; i2++) {
5168 var ring = this.rings[i2];
5169 var winding = this.windings[i2];
5170 var index2 = ringsAfter.indexOf(ring);
5171 if (index2 === -1) {
5172 ringsAfter.push(ring);
5173 windingsAfter.push(winding);
5175 windingsAfter[index2] += winding;
5177 var polysAfter = [];
5178 var polysExclude = [];
5179 for (var _i = 0, _iMax = ringsAfter.length; _i < _iMax; _i++) {
5180 if (windingsAfter[_i] === 0)
5182 var _ring = ringsAfter[_i];
5183 var poly = _ring.poly;
5184 if (polysExclude.indexOf(poly) !== -1)
5186 if (_ring.isExterior)
5187 polysAfter.push(poly);
5189 if (polysExclude.indexOf(poly) === -1)
5190 polysExclude.push(poly);
5191 var _index = polysAfter.indexOf(_ring.poly);
5193 polysAfter.splice(_index, 1);
5196 for (var _i2 = 0, _iMax2 = polysAfter.length; _i2 < _iMax2; _i2++) {
5197 var mp = polysAfter[_i2].multiPoly;
5198 if (mpsAfter.indexOf(mp) === -1)
5201 return this._afterState;
5205 value: function isInResult() {
5206 if (this.consumedBy)
5208 if (this._isInResult !== void 0)
5209 return this._isInResult;
5210 var mpsBefore = this.beforeState().multiPolys;
5211 var mpsAfter = this.afterState().multiPolys;
5212 switch (operation.type) {
5214 var noBefores = mpsBefore.length === 0;
5215 var noAfters = mpsAfter.length === 0;
5216 this._isInResult = noBefores !== noAfters;
5219 case "intersection": {
5222 if (mpsBefore.length < mpsAfter.length) {
5223 least = mpsBefore.length;
5224 most = mpsAfter.length;
5226 least = mpsAfter.length;
5227 most = mpsBefore.length;
5229 this._isInResult = most === operation.numMultiPolys && least < most;
5233 var diff = Math.abs(mpsBefore.length - mpsAfter.length);
5234 this._isInResult = diff % 2 === 1;
5237 case "difference": {
5238 var isJustSubject = function isJustSubject2(mps) {
5239 return mps.length === 1 && mps[0].isSubject;
5241 this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);
5245 throw new Error("Unrecognized operation type found ".concat(operation.type));
5247 return this._isInResult;
5251 value: function fromRing(pt1, pt2, ring) {
5252 var leftPt, rightPt, winding;
5253 var cmpPts = SweepEvent.comparePoints(pt1, pt2);
5258 } else if (cmpPts > 0) {
5263 throw new Error("Tried to create degenerate segment at [".concat(pt1.x, ", ").concat(pt1.y, "]"));
5264 var leftSE = new SweepEvent(leftPt, true);
5265 var rightSE = new SweepEvent(rightPt, false);
5266 return new Segment2(leftSE, rightSE, [ring], [winding]);
5271 var RingIn = /* @__PURE__ */ function() {
5272 function RingIn2(geomRing, poly, isExterior) {
5273 _classCallCheck(this, RingIn2);
5274 if (!Array.isArray(geomRing) || geomRing.length === 0) {
5275 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5278 this.isExterior = isExterior;
5280 if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
5281 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5283 var firstPoint = rounder.round(geomRing[0][0], geomRing[0][1]);
5294 var prevPoint = firstPoint;
5295 for (var i2 = 1, iMax = geomRing.length; i2 < iMax; i2++) {
5296 if (typeof geomRing[i2][0] !== "number" || typeof geomRing[i2][1] !== "number") {
5297 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5299 var point2 = rounder.round(geomRing[i2][0], geomRing[i2][1]);
5300 if (point2.x === prevPoint.x && point2.y === prevPoint.y)
5302 this.segments.push(Segment.fromRing(prevPoint, point2, this));
5303 if (point2.x < this.bbox.ll.x)
5304 this.bbox.ll.x = point2.x;
5305 if (point2.y < this.bbox.ll.y)
5306 this.bbox.ll.y = point2.y;
5307 if (point2.x > this.bbox.ur.x)
5308 this.bbox.ur.x = point2.x;
5309 if (point2.y > this.bbox.ur.y)
5310 this.bbox.ur.y = point2.y;
5313 if (firstPoint.x !== prevPoint.x || firstPoint.y !== prevPoint.y) {
5314 this.segments.push(Segment.fromRing(prevPoint, firstPoint, this));
5317 _createClass(RingIn2, [{
5318 key: "getSweepEvents",
5319 value: function getSweepEvents() {
5320 var sweepEvents = [];
5321 for (var i2 = 0, iMax = this.segments.length; i2 < iMax; i2++) {
5322 var segment = this.segments[i2];
5323 sweepEvents.push(segment.leftSE);
5324 sweepEvents.push(segment.rightSE);
5331 var PolyIn = /* @__PURE__ */ function() {
5332 function PolyIn2(geomPoly, multiPoly) {
5333 _classCallCheck(this, PolyIn2);
5334 if (!Array.isArray(geomPoly)) {
5335 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5337 this.exteriorRing = new RingIn(geomPoly[0], this, true);
5340 x: this.exteriorRing.bbox.ll.x,
5341 y: this.exteriorRing.bbox.ll.y
5344 x: this.exteriorRing.bbox.ur.x,
5345 y: this.exteriorRing.bbox.ur.y
5348 this.interiorRings = [];
5349 for (var i2 = 1, iMax = geomPoly.length; i2 < iMax; i2++) {
5350 var ring = new RingIn(geomPoly[i2], this, false);
5351 if (ring.bbox.ll.x < this.bbox.ll.x)
5352 this.bbox.ll.x = ring.bbox.ll.x;
5353 if (ring.bbox.ll.y < this.bbox.ll.y)
5354 this.bbox.ll.y = ring.bbox.ll.y;
5355 if (ring.bbox.ur.x > this.bbox.ur.x)
5356 this.bbox.ur.x = ring.bbox.ur.x;
5357 if (ring.bbox.ur.y > this.bbox.ur.y)
5358 this.bbox.ur.y = ring.bbox.ur.y;
5359 this.interiorRings.push(ring);
5361 this.multiPoly = multiPoly;
5363 _createClass(PolyIn2, [{
5364 key: "getSweepEvents",
5365 value: function getSweepEvents() {
5366 var sweepEvents = this.exteriorRing.getSweepEvents();
5367 for (var i2 = 0, iMax = this.interiorRings.length; i2 < iMax; i2++) {
5368 var ringSweepEvents = this.interiorRings[i2].getSweepEvents();
5369 for (var j2 = 0, jMax = ringSweepEvents.length; j2 < jMax; j2++) {
5370 sweepEvents.push(ringSweepEvents[j2]);
5378 var MultiPolyIn = /* @__PURE__ */ function() {
5379 function MultiPolyIn2(geom, isSubject) {
5380 _classCallCheck(this, MultiPolyIn2);
5381 if (!Array.isArray(geom)) {
5382 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5385 if (typeof geom[0][0][0] === "number")
5392 x: Number.POSITIVE_INFINITY,
5393 y: Number.POSITIVE_INFINITY
5396 x: Number.NEGATIVE_INFINITY,
5397 y: Number.NEGATIVE_INFINITY
5400 for (var i2 = 0, iMax = geom.length; i2 < iMax; i2++) {
5401 var poly = new PolyIn(geom[i2], this);
5402 if (poly.bbox.ll.x < this.bbox.ll.x)
5403 this.bbox.ll.x = poly.bbox.ll.x;
5404 if (poly.bbox.ll.y < this.bbox.ll.y)
5405 this.bbox.ll.y = poly.bbox.ll.y;
5406 if (poly.bbox.ur.x > this.bbox.ur.x)
5407 this.bbox.ur.x = poly.bbox.ur.x;
5408 if (poly.bbox.ur.y > this.bbox.ur.y)
5409 this.bbox.ur.y = poly.bbox.ur.y;
5410 this.polys.push(poly);
5412 this.isSubject = isSubject;
5414 _createClass(MultiPolyIn2, [{
5415 key: "getSweepEvents",
5416 value: function getSweepEvents() {
5417 var sweepEvents = [];
5418 for (var i2 = 0, iMax = this.polys.length; i2 < iMax; i2++) {
5419 var polySweepEvents = this.polys[i2].getSweepEvents();
5420 for (var j2 = 0, jMax = polySweepEvents.length; j2 < jMax; j2++) {
5421 sweepEvents.push(polySweepEvents[j2]);
5427 return MultiPolyIn2;
5429 var RingOut = /* @__PURE__ */ function() {
5430 _createClass(RingOut2, null, [{
5432 value: function factory(allSegments) {
5434 for (var i2 = 0, iMax = allSegments.length; i2 < iMax; i2++) {
5435 var segment = allSegments[i2];
5436 if (!segment.isInResult() || segment.ringOut)
5438 var prevEvent = null;
5439 var event = segment.leftSE;
5440 var nextEvent = segment.rightSE;
5441 var events = [event];
5442 var startingPoint = event.point;
5443 var intersectionLEs = [];
5448 if (event.point === startingPoint)
5451 var availableLEs = event.getAvailableLinkedEvents();
5452 if (availableLEs.length === 0) {
5453 var firstPt = events[0].point;
5454 var lastPt = events[events.length - 1].point;
5455 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, "]."));
5457 if (availableLEs.length === 1) {
5458 nextEvent = availableLEs[0].otherSE;
5462 for (var j2 = 0, jMax = intersectionLEs.length; j2 < jMax; j2++) {
5463 if (intersectionLEs[j2].point === event.point) {
5468 if (indexLE !== null) {
5469 var intersectionLE = intersectionLEs.splice(indexLE)[0];
5470 var ringEvents = events.splice(intersectionLE.index);
5471 ringEvents.unshift(ringEvents[0].otherSE);
5472 ringsOut.push(new RingOut2(ringEvents.reverse()));
5475 intersectionLEs.push({
5476 index: events.length,
5479 var comparator = event.getLeftmostComparator(prevEvent);
5480 nextEvent = availableLEs.sort(comparator)[0].otherSE;
5484 ringsOut.push(new RingOut2(events));
5489 function RingOut2(events) {
5490 _classCallCheck(this, RingOut2);
5491 this.events = events;
5492 for (var i2 = 0, iMax = events.length; i2 < iMax; i2++) {
5493 events[i2].segment.ringOut = this;
5497 _createClass(RingOut2, [{
5499 value: function getGeom2() {
5500 var prevPt = this.events[0].point;
5501 var points = [prevPt];
5502 for (var i2 = 1, iMax = this.events.length - 1; i2 < iMax; i2++) {
5503 var _pt = this.events[i2].point;
5504 var _nextPt = this.events[i2 + 1].point;
5505 if (compareVectorAngles(_pt, prevPt, _nextPt) === 0)
5510 if (points.length === 1)
5513 var nextPt = points[1];
5514 if (compareVectorAngles(pt, prevPt, nextPt) === 0)
5516 points.push(points[0]);
5517 var step = this.isExteriorRing() ? 1 : -1;
5518 var iStart = this.isExteriorRing() ? 0 : points.length - 1;
5519 var iEnd = this.isExteriorRing() ? points.length : -1;
5520 var orderedPoints = [];
5521 for (var _i = iStart; _i != iEnd; _i += step) {
5522 orderedPoints.push([points[_i].x, points[_i].y]);
5524 return orderedPoints;
5527 key: "isExteriorRing",
5528 value: function isExteriorRing() {
5529 if (this._isExteriorRing === void 0) {
5530 var enclosing = this.enclosingRing();
5531 this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;
5533 return this._isExteriorRing;
5536 key: "enclosingRing",
5537 value: function enclosingRing() {
5538 if (this._enclosingRing === void 0) {
5539 this._enclosingRing = this._calcEnclosingRing();
5541 return this._enclosingRing;
5544 key: "_calcEnclosingRing",
5545 value: function _calcEnclosingRing() {
5546 var leftMostEvt = this.events[0];
5547 for (var i2 = 1, iMax = this.events.length; i2 < iMax; i2++) {
5548 var evt = this.events[i2];
5549 if (SweepEvent.compare(leftMostEvt, evt) > 0)
5552 var prevSeg = leftMostEvt.segment.prevInResult();
5553 var prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
5558 return prevSeg.ringOut;
5559 if (prevPrevSeg.ringOut !== prevSeg.ringOut) {
5560 if (prevPrevSeg.ringOut.enclosingRing() !== prevSeg.ringOut) {
5561 return prevSeg.ringOut;
5563 return prevSeg.ringOut.enclosingRing();
5565 prevSeg = prevPrevSeg.prevInResult();
5566 prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
5572 var PolyOut = /* @__PURE__ */ function() {
5573 function PolyOut2(exteriorRing) {
5574 _classCallCheck(this, PolyOut2);
5575 this.exteriorRing = exteriorRing;
5576 exteriorRing.poly = this;
5577 this.interiorRings = [];
5579 _createClass(PolyOut2, [{
5581 value: function addInterior(ring) {
5582 this.interiorRings.push(ring);
5587 value: function getGeom2() {
5588 var geom = [this.exteriorRing.getGeom()];
5589 if (geom[0] === null)
5591 for (var i2 = 0, iMax = this.interiorRings.length; i2 < iMax; i2++) {
5592 var ringGeom = this.interiorRings[i2].getGeom();
5593 if (ringGeom === null)
5595 geom.push(ringGeom);
5602 var MultiPolyOut = /* @__PURE__ */ function() {
5603 function MultiPolyOut2(rings) {
5604 _classCallCheck(this, MultiPolyOut2);
5606 this.polys = this._composePolys(rings);
5608 _createClass(MultiPolyOut2, [{
5610 value: function getGeom2() {
5612 for (var i2 = 0, iMax = this.polys.length; i2 < iMax; i2++) {
5613 var polyGeom = this.polys[i2].getGeom();
5614 if (polyGeom === null)
5616 geom.push(polyGeom);
5621 key: "_composePolys",
5622 value: function _composePolys(rings) {
5624 for (var i2 = 0, iMax = rings.length; i2 < iMax; i2++) {
5625 var ring = rings[i2];
5628 if (ring.isExteriorRing())
5629 polys.push(new PolyOut(ring));
5631 var enclosingRing = ring.enclosingRing();
5632 if (!enclosingRing.poly)
5633 polys.push(new PolyOut(enclosingRing));
5634 enclosingRing.poly.addInterior(ring);
5640 return MultiPolyOut2;
5642 var SweepLine = /* @__PURE__ */ function() {
5643 function SweepLine2(queue) {
5644 var comparator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Segment.compare;
5645 _classCallCheck(this, SweepLine2);
5647 this.tree = new Tree(comparator);
5650 _createClass(SweepLine2, [{
5652 value: function process2(event) {
5653 var segment = event.segment;
5655 if (event.consumedBy) {
5657 this.queue.remove(event.otherSE);
5659 this.tree.remove(segment);
5662 var node = event.isLeft ? this.tree.insert(segment) : this.tree.find(segment);
5664 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.");
5665 var prevNode = node;
5666 var nextNode = node;
5667 var prevSeg = void 0;
5668 var nextSeg = void 0;
5669 while (prevSeg === void 0) {
5670 prevNode = this.tree.prev(prevNode);
5671 if (prevNode === null)
5673 else if (prevNode.key.consumedBy === void 0)
5674 prevSeg = prevNode.key;
5676 while (nextSeg === void 0) {
5677 nextNode = this.tree.next(nextNode);
5678 if (nextNode === null)
5680 else if (nextNode.key.consumedBy === void 0)
5681 nextSeg = nextNode.key;
5684 var prevMySplitter = null;
5686 var prevInter = prevSeg.getIntersection(segment);
5687 if (prevInter !== null) {
5688 if (!segment.isAnEndpoint(prevInter))
5689 prevMySplitter = prevInter;
5690 if (!prevSeg.isAnEndpoint(prevInter)) {
5691 var newEventsFromSplit = this._splitSafely(prevSeg, prevInter);
5692 for (var i2 = 0, iMax = newEventsFromSplit.length; i2 < iMax; i2++) {
5693 newEvents.push(newEventsFromSplit[i2]);
5698 var nextMySplitter = null;
5700 var nextInter = nextSeg.getIntersection(segment);
5701 if (nextInter !== null) {
5702 if (!segment.isAnEndpoint(nextInter))
5703 nextMySplitter = nextInter;
5704 if (!nextSeg.isAnEndpoint(nextInter)) {
5705 var _newEventsFromSplit = this._splitSafely(nextSeg, nextInter);
5706 for (var _i = 0, _iMax = _newEventsFromSplit.length; _i < _iMax; _i++) {
5707 newEvents.push(_newEventsFromSplit[_i]);
5712 if (prevMySplitter !== null || nextMySplitter !== null) {
5713 var mySplitter = null;
5714 if (prevMySplitter === null)
5715 mySplitter = nextMySplitter;
5716 else if (nextMySplitter === null)
5717 mySplitter = prevMySplitter;
5719 var cmpSplitters = SweepEvent.comparePoints(prevMySplitter, nextMySplitter);
5720 mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;
5722 this.queue.remove(segment.rightSE);
5723 newEvents.push(segment.rightSE);
5724 var _newEventsFromSplit2 = segment.split(mySplitter);
5725 for (var _i2 = 0, _iMax2 = _newEventsFromSplit2.length; _i2 < _iMax2; _i2++) {
5726 newEvents.push(_newEventsFromSplit2[_i2]);
5729 if (newEvents.length > 0) {
5730 this.tree.remove(segment);
5731 newEvents.push(event);
5733 this.segments.push(segment);
5734 segment.prev = prevSeg;
5737 if (prevSeg && nextSeg) {
5738 var inter = prevSeg.getIntersection(nextSeg);
5739 if (inter !== null) {
5740 if (!prevSeg.isAnEndpoint(inter)) {
5741 var _newEventsFromSplit3 = this._splitSafely(prevSeg, inter);
5742 for (var _i3 = 0, _iMax3 = _newEventsFromSplit3.length; _i3 < _iMax3; _i3++) {
5743 newEvents.push(_newEventsFromSplit3[_i3]);
5746 if (!nextSeg.isAnEndpoint(inter)) {
5747 var _newEventsFromSplit4 = this._splitSafely(nextSeg, inter);
5748 for (var _i4 = 0, _iMax4 = _newEventsFromSplit4.length; _i4 < _iMax4; _i4++) {
5749 newEvents.push(_newEventsFromSplit4[_i4]);
5754 this.tree.remove(segment);
5759 key: "_splitSafely",
5760 value: function _splitSafely(seg, pt) {
5761 this.tree.remove(seg);
5762 var rightSE = seg.rightSE;
5763 this.queue.remove(rightSE);
5764 var newEvents = seg.split(pt);
5765 newEvents.push(rightSE);
5766 if (seg.consumedBy === void 0)
5767 this.tree.insert(seg);
5773 var POLYGON_CLIPPING_MAX_QUEUE_SIZE = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1e6;
5774 var POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1e6;
5775 var Operation = /* @__PURE__ */ function() {
5776 function Operation2() {
5777 _classCallCheck(this, Operation2);
5779 _createClass(Operation2, [{
5781 value: function run(type3, geom, moreGeoms) {
5782 operation.type = type3;
5784 var multipolys = [new MultiPolyIn(geom, true)];
5785 for (var i2 = 0, iMax = moreGeoms.length; i2 < iMax; i2++) {
5786 multipolys.push(new MultiPolyIn(moreGeoms[i2], false));
5788 operation.numMultiPolys = multipolys.length;
5789 if (operation.type === "difference") {
5790 var subject = multipolys[0];
5792 while (_i < multipolys.length) {
5793 if (getBboxOverlap(multipolys[_i].bbox, subject.bbox) !== null)
5796 multipolys.splice(_i, 1);
5799 if (operation.type === "intersection") {
5800 for (var _i2 = 0, _iMax = multipolys.length; _i2 < _iMax; _i2++) {
5801 var mpA = multipolys[_i2];
5802 for (var j2 = _i2 + 1, jMax = multipolys.length; j2 < jMax; j2++) {
5803 if (getBboxOverlap(mpA.bbox, multipolys[j2].bbox) === null)
5808 var queue = new Tree(SweepEvent.compare);
5809 for (var _i3 = 0, _iMax2 = multipolys.length; _i3 < _iMax2; _i3++) {
5810 var sweepEvents = multipolys[_i3].getSweepEvents();
5811 for (var _j = 0, _jMax = sweepEvents.length; _j < _jMax; _j++) {
5812 queue.insert(sweepEvents[_j]);
5813 if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
5814 throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");
5818 var sweepLine = new SweepLine(queue);
5819 var prevQueueSize = queue.size;
5820 var node = queue.pop();
5823 if (queue.size === prevQueueSize) {
5824 var seg = evt.segment;
5825 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.");
5827 if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
5828 throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");
5830 if (sweepLine.segments.length > POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS) {
5831 throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");
5833 var newEvents = sweepLine.process(evt);
5834 for (var _i4 = 0, _iMax3 = newEvents.length; _i4 < _iMax3; _i4++) {
5835 var _evt = newEvents[_i4];
5836 if (_evt.consumedBy === void 0)
5839 prevQueueSize = queue.size;
5843 var ringsOut = RingOut.factory(sweepLine.segments);
5844 var result = new MultiPolyOut(ringsOut);
5845 return result.getGeom();
5850 var operation = new Operation();
5851 var union = function union2(geom) {
5852 for (var _len = arguments.length, moreGeoms = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
5853 moreGeoms[_key - 1] = arguments[_key];
5855 return operation.run("union", geom, moreGeoms);
5857 var intersection$1 = function intersection2(geom) {
5858 for (var _len2 = arguments.length, moreGeoms = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
5859 moreGeoms[_key2 - 1] = arguments[_key2];
5861 return operation.run("intersection", geom, moreGeoms);
5863 var xor = function xor2(geom) {
5864 for (var _len3 = arguments.length, moreGeoms = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
5865 moreGeoms[_key3 - 1] = arguments[_key3];
5867 return operation.run("xor", geom, moreGeoms);
5869 var difference = function difference2(subjectGeom) {
5870 for (var _len4 = arguments.length, clippingGeoms = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
5871 clippingGeoms[_key4 - 1] = arguments[_key4];
5873 return operation.run("difference", subjectGeom, clippingGeoms);
5877 intersection: intersection$1,
5886 // node_modules/geojson-precision/index.js
5887 var require_geojson_precision = __commonJS({
5888 "node_modules/geojson-precision/index.js"(exports2, module2) {
5890 function parse(t, coordinatePrecision, extrasPrecision) {
5891 function point2(p) {
5892 return p.map(function(e, index) {
5894 return 1 * e.toFixed(coordinatePrecision);
5896 return 1 * e.toFixed(extrasPrecision);
5901 return l.map(point2);
5904 return p.map(multi);
5906 function multiPoly(m) {
5909 function geometry(obj) {
5915 obj.coordinates = point2(obj.coordinates);
5919 obj.coordinates = multi(obj.coordinates);
5922 case "MultiLineString":
5923 obj.coordinates = poly(obj.coordinates);
5925 case "MultiPolygon":
5926 obj.coordinates = multiPoly(obj.coordinates);
5928 case "GeometryCollection":
5929 obj.geometries = obj.geometries.map(geometry);
5935 function feature3(obj) {
5936 obj.geometry = geometry(obj.geometry);
5939 function featureCollection(f2) {
5940 f2.features = f2.features.map(feature3);
5943 function geometryCollection(g) {
5944 g.geometries = g.geometries.map(geometry);
5953 case "GeometryCollection":
5954 return geometryCollection(t);
5955 case "FeatureCollection":
5956 return featureCollection(t);
5961 case "MultiPolygon":
5962 case "MultiLineString":
5968 module2.exports = parse;
5969 module2.exports.parse = parse;
5974 // node_modules/@aitodotai/json-stringify-pretty-compact/index.js
5975 var require_json_stringify_pretty_compact = __commonJS({
5976 "node_modules/@aitodotai/json-stringify-pretty-compact/index.js"(exports2, module2) {
5977 function isObject3(obj) {
5978 return typeof obj === "object" && obj !== null;
5980 function forEach(obj, cb) {
5981 if (Array.isArray(obj)) {
5983 } else if (isObject3(obj)) {
5984 Object.keys(obj).forEach(function(key) {
5990 function getTreeDepth(obj) {
5992 if (Array.isArray(obj) || isObject3(obj)) {
5993 forEach(obj, function(val) {
5994 if (Array.isArray(val) || isObject3(val)) {
5995 var tmpDepth = getTreeDepth(val);
5996 if (tmpDepth > depth) {
6005 function stringify3(obj, options2) {
6006 options2 = options2 || {};
6007 var indent2 = JSON.stringify([1], null, get4(options2, "indent", 2)).slice(2, -3);
6008 var addMargin = get4(options2, "margins", false);
6009 var addArrayMargin = get4(options2, "arrayMargins", false);
6010 var addObjectMargin = get4(options2, "objectMargins", false);
6011 var maxLength = indent2 === "" ? Infinity : get4(options2, "maxLength", 80);
6012 var maxNesting = get4(options2, "maxNesting", Infinity);
6013 return function _stringify(obj2, currentIndent, reserved) {
6014 if (obj2 && typeof obj2.toJSON === "function") {
6015 obj2 = obj2.toJSON();
6017 var string = JSON.stringify(obj2);
6018 if (string === void 0) {
6021 var length = maxLength - currentIndent.length - reserved;
6022 var treeDepth = getTreeDepth(obj2);
6023 if (treeDepth <= maxNesting && string.length <= length) {
6024 var prettified = prettify(string, {
6029 if (prettified.length <= length) {
6033 if (isObject3(obj2)) {
6034 var nextIndent = currentIndent + indent2;
6037 var comma = function(array2, index2) {
6038 return index2 === array2.length - 1 ? 0 : 1;
6040 if (Array.isArray(obj2)) {
6041 for (var index = 0; index < obj2.length; index++) {
6043 _stringify(obj2[index], nextIndent, comma(obj2, index)) || "null"
6048 Object.keys(obj2).forEach(function(key, index2, array2) {
6049 var keyPart = JSON.stringify(key) + ": ";
6050 var value = _stringify(
6053 keyPart.length + comma(array2, index2)
6055 if (value !== void 0) {
6056 items.push(keyPart + value);
6061 if (items.length > 0) {
6064 indent2 + items.join(",\n" + nextIndent),
6066 ].join("\n" + currentIndent);
6072 var stringOrChar = /("(?:[^\\"]|\\.)*")|[:,\][}{]/g;
6073 function prettify(string, options2) {
6074 options2 = options2 || {};
6083 if (options2.addMargin || options2.addObjectMargin) {
6087 if (options2.addMargin || options2.addArrayMargin) {
6091 return string.replace(stringOrChar, function(match, string2) {
6092 return string2 ? match : tokens[match];
6095 function get4(options2, name, defaultValue) {
6096 return name in options2 ? options2[name] : defaultValue;
6098 module2.exports = stringify3;
6102 // node_modules/aes-js/index.js
6103 var require_aes_js = __commonJS({
6104 "node_modules/aes-js/index.js"(exports2, module2) {
6107 function checkInt(value) {
6108 return parseInt(value) === value;
6110 function checkInts(arrayish) {
6111 if (!checkInt(arrayish.length)) {
6114 for (var i2 = 0; i2 < arrayish.length; i2++) {
6115 if (!checkInt(arrayish[i2]) || arrayish[i2] < 0 || arrayish[i2] > 255) {
6121 function coerceArray(arg, copy2) {
6122 if (arg.buffer && arg.name === "Uint8Array") {
6127 arg = Array.prototype.slice.call(arg);
6132 if (Array.isArray(arg)) {
6133 if (!checkInts(arg)) {
6134 throw new Error("Array contains invalid value: " + arg);
6136 return new Uint8Array(arg);
6138 if (checkInt(arg.length) && checkInts(arg)) {
6139 return new Uint8Array(arg);
6141 throw new Error("unsupported array-like object");
6143 function createArray(length) {
6144 return new Uint8Array(length);
6146 function copyArray(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) {
6147 if (sourceStart != null || sourceEnd != null) {
6148 if (sourceArray.slice) {
6149 sourceArray = sourceArray.slice(sourceStart, sourceEnd);
6151 sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd);
6154 targetArray.set(sourceArray, targetStart);
6156 var convertUtf8 = function() {
6157 function toBytes(text2) {
6158 var result = [], i2 = 0;
6159 text2 = encodeURI(text2);
6160 while (i2 < text2.length) {
6161 var c = text2.charCodeAt(i2++);
6163 result.push(parseInt(text2.substr(i2, 2), 16));
6169 return coerceArray(result);
6171 function fromBytes(bytes) {
6172 var result = [], i2 = 0;
6173 while (i2 < bytes.length) {
6176 result.push(String.fromCharCode(c));
6178 } else if (c > 191 && c < 224) {
6179 result.push(String.fromCharCode((c & 31) << 6 | bytes[i2 + 1] & 63));
6182 result.push(String.fromCharCode((c & 15) << 12 | (bytes[i2 + 1] & 63) << 6 | bytes[i2 + 2] & 63));
6186 return result.join("");
6193 var convertHex = function() {
6194 function toBytes(text2) {
6196 for (var i2 = 0; i2 < text2.length; i2 += 2) {
6197 result.push(parseInt(text2.substr(i2, 2), 16));
6201 var Hex = "0123456789abcdef";
6202 function fromBytes(bytes) {
6204 for (var i2 = 0; i2 < bytes.length; i2++) {
6206 result.push(Hex[(v & 240) >> 4] + Hex[v & 15]);
6208 return result.join("");
6215 var numberOfRounds = { 16: 10, 24: 12, 32: 14 };
6216 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];
6217 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];
6218 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];
6219 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];
6220 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];
6221 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];
6222 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];
6223 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];
6224 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];
6225 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];
6226 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];
6227 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];
6228 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];
6229 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];
6230 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];
6231 function convertToInt32(bytes) {
6233 for (var i2 = 0; i2 < bytes.length; i2 += 4) {
6235 bytes[i2] << 24 | bytes[i2 + 1] << 16 | bytes[i2 + 2] << 8 | bytes[i2 + 3]
6240 var AES = function(key) {
6241 if (!(this instanceof AES)) {
6242 throw Error("AES must be instanitated with `new`");
6244 Object.defineProperty(this, "key", {
6245 value: coerceArray(key, true)
6249 AES.prototype._prepare = function() {
6250 var rounds = numberOfRounds[this.key.length];
6251 if (rounds == null) {
6252 throw new Error("invalid key size (must be 16, 24 or 32 bytes)");
6256 for (var i2 = 0; i2 <= rounds; i2++) {
6257 this._Ke.push([0, 0, 0, 0]);
6258 this._Kd.push([0, 0, 0, 0]);
6260 var roundKeyCount = (rounds + 1) * 4;
6261 var KC = this.key.length / 4;
6262 var tk = convertToInt32(this.key);
6264 for (var i2 = 0; i2 < KC; i2++) {
6266 this._Ke[index][i2 % 4] = tk[i2];
6267 this._Kd[rounds - index][i2 % 4] = tk[i2];
6269 var rconpointer = 0;
6271 while (t < roundKeyCount) {
6273 tk[0] ^= S[tt >> 16 & 255] << 24 ^ S[tt >> 8 & 255] << 16 ^ S[tt & 255] << 8 ^ S[tt >> 24 & 255] ^ rcon[rconpointer] << 24;
6276 for (var i2 = 1; i2 < KC; i2++) {
6277 tk[i2] ^= tk[i2 - 1];
6280 for (var i2 = 1; i2 < KC / 2; i2++) {
6281 tk[i2] ^= tk[i2 - 1];
6283 tt = tk[KC / 2 - 1];
6284 tk[KC / 2] ^= S[tt & 255] ^ S[tt >> 8 & 255] << 8 ^ S[tt >> 16 & 255] << 16 ^ S[tt >> 24 & 255] << 24;
6285 for (var i2 = KC / 2 + 1; i2 < KC; i2++) {
6286 tk[i2] ^= tk[i2 - 1];
6290 while (i2 < KC && t < roundKeyCount) {
6293 this._Ke[r][c] = tk[i2];
6294 this._Kd[rounds - r][c] = tk[i2++];
6298 for (var r = 1; r < rounds; r++) {
6299 for (var c = 0; c < 4; c++) {
6300 tt = this._Kd[r][c];
6301 this._Kd[r][c] = U1[tt >> 24 & 255] ^ U2[tt >> 16 & 255] ^ U3[tt >> 8 & 255] ^ U4[tt & 255];
6305 AES.prototype.encrypt = function(plaintext) {
6306 if (plaintext.length != 16) {
6307 throw new Error("invalid plaintext size (must be 16 bytes)");
6309 var rounds = this._Ke.length - 1;
6310 var a = [0, 0, 0, 0];
6311 var t = convertToInt32(plaintext);
6312 for (var i2 = 0; i2 < 4; i2++) {
6313 t[i2] ^= this._Ke[0][i2];
6315 for (var r = 1; r < rounds; r++) {
6316 for (var i2 = 0; i2 < 4; i2++) {
6317 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];
6321 var result = createArray(16), tt;
6322 for (var i2 = 0; i2 < 4; i2++) {
6323 tt = this._Ke[rounds][i2];
6324 result[4 * i2] = (S[t[i2] >> 24 & 255] ^ tt >> 24) & 255;
6325 result[4 * i2 + 1] = (S[t[(i2 + 1) % 4] >> 16 & 255] ^ tt >> 16) & 255;
6326 result[4 * i2 + 2] = (S[t[(i2 + 2) % 4] >> 8 & 255] ^ tt >> 8) & 255;
6327 result[4 * i2 + 3] = (S[t[(i2 + 3) % 4] & 255] ^ tt) & 255;
6331 AES.prototype.decrypt = function(ciphertext) {
6332 if (ciphertext.length != 16) {
6333 throw new Error("invalid ciphertext size (must be 16 bytes)");
6335 var rounds = this._Kd.length - 1;
6336 var a = [0, 0, 0, 0];
6337 var t = convertToInt32(ciphertext);
6338 for (var i2 = 0; i2 < 4; i2++) {
6339 t[i2] ^= this._Kd[0][i2];
6341 for (var r = 1; r < rounds; r++) {
6342 for (var i2 = 0; i2 < 4; i2++) {
6343 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];
6347 var result = createArray(16), tt;
6348 for (var i2 = 0; i2 < 4; i2++) {
6349 tt = this._Kd[rounds][i2];
6350 result[4 * i2] = (Si[t[i2] >> 24 & 255] ^ tt >> 24) & 255;
6351 result[4 * i2 + 1] = (Si[t[(i2 + 3) % 4] >> 16 & 255] ^ tt >> 16) & 255;
6352 result[4 * i2 + 2] = (Si[t[(i2 + 2) % 4] >> 8 & 255] ^ tt >> 8) & 255;
6353 result[4 * i2 + 3] = (Si[t[(i2 + 1) % 4] & 255] ^ tt) & 255;
6357 var ModeOfOperationECB = function(key) {
6358 if (!(this instanceof ModeOfOperationECB)) {
6359 throw Error("AES must be instanitated with `new`");
6361 this.description = "Electronic Code Block";
6363 this._aes = new AES(key);
6365 ModeOfOperationECB.prototype.encrypt = function(plaintext) {
6366 plaintext = coerceArray(plaintext);
6367 if (plaintext.length % 16 !== 0) {
6368 throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
6370 var ciphertext = createArray(plaintext.length);
6371 var block2 = createArray(16);
6372 for (var i2 = 0; i2 < plaintext.length; i2 += 16) {
6373 copyArray(plaintext, block2, 0, i2, i2 + 16);
6374 block2 = this._aes.encrypt(block2);
6375 copyArray(block2, ciphertext, i2);
6379 ModeOfOperationECB.prototype.decrypt = function(ciphertext) {
6380 ciphertext = coerceArray(ciphertext);
6381 if (ciphertext.length % 16 !== 0) {
6382 throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
6384 var plaintext = createArray(ciphertext.length);
6385 var block2 = createArray(16);
6386 for (var i2 = 0; i2 < ciphertext.length; i2 += 16) {
6387 copyArray(ciphertext, block2, 0, i2, i2 + 16);
6388 block2 = this._aes.decrypt(block2);
6389 copyArray(block2, plaintext, i2);
6393 var ModeOfOperationCBC = function(key, iv) {
6394 if (!(this instanceof ModeOfOperationCBC)) {
6395 throw Error("AES must be instanitated with `new`");
6397 this.description = "Cipher Block Chaining";
6400 iv = createArray(16);
6401 } else if (iv.length != 16) {
6402 throw new Error("invalid initialation vector size (must be 16 bytes)");
6404 this._lastCipherblock = coerceArray(iv, true);
6405 this._aes = new AES(key);
6407 ModeOfOperationCBC.prototype.encrypt = function(plaintext) {
6408 plaintext = coerceArray(plaintext);
6409 if (plaintext.length % 16 !== 0) {
6410 throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
6412 var ciphertext = createArray(plaintext.length);
6413 var block2 = createArray(16);
6414 for (var i2 = 0; i2 < plaintext.length; i2 += 16) {
6415 copyArray(plaintext, block2, 0, i2, i2 + 16);
6416 for (var j2 = 0; j2 < 16; j2++) {
6417 block2[j2] ^= this._lastCipherblock[j2];
6419 this._lastCipherblock = this._aes.encrypt(block2);
6420 copyArray(this._lastCipherblock, ciphertext, i2);
6424 ModeOfOperationCBC.prototype.decrypt = function(ciphertext) {
6425 ciphertext = coerceArray(ciphertext);
6426 if (ciphertext.length % 16 !== 0) {
6427 throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
6429 var plaintext = createArray(ciphertext.length);
6430 var block2 = createArray(16);
6431 for (var i2 = 0; i2 < ciphertext.length; i2 += 16) {
6432 copyArray(ciphertext, block2, 0, i2, i2 + 16);
6433 block2 = this._aes.decrypt(block2);
6434 for (var j2 = 0; j2 < 16; j2++) {
6435 plaintext[i2 + j2] = block2[j2] ^ this._lastCipherblock[j2];
6437 copyArray(ciphertext, this._lastCipherblock, 0, i2, i2 + 16);
6441 var ModeOfOperationCFB = function(key, iv, segmentSize) {
6442 if (!(this instanceof ModeOfOperationCFB)) {
6443 throw Error("AES must be instanitated with `new`");
6445 this.description = "Cipher Feedback";
6448 iv = createArray(16);
6449 } else if (iv.length != 16) {
6450 throw new Error("invalid initialation vector size (must be 16 size)");
6455 this.segmentSize = segmentSize;
6456 this._shiftRegister = coerceArray(iv, true);
6457 this._aes = new AES(key);
6459 ModeOfOperationCFB.prototype.encrypt = function(plaintext) {
6460 if (plaintext.length % this.segmentSize != 0) {
6461 throw new Error("invalid plaintext size (must be segmentSize bytes)");
6463 var encrypted = coerceArray(plaintext, true);
6465 for (var i2 = 0; i2 < encrypted.length; i2 += this.segmentSize) {
6466 xorSegment = this._aes.encrypt(this._shiftRegister);
6467 for (var j2 = 0; j2 < this.segmentSize; j2++) {
6468 encrypted[i2 + j2] ^= xorSegment[j2];
6470 copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
6471 copyArray(encrypted, this._shiftRegister, 16 - this.segmentSize, i2, i2 + this.segmentSize);
6475 ModeOfOperationCFB.prototype.decrypt = function(ciphertext) {
6476 if (ciphertext.length % this.segmentSize != 0) {
6477 throw new Error("invalid ciphertext size (must be segmentSize bytes)");
6479 var plaintext = coerceArray(ciphertext, true);
6481 for (var i2 = 0; i2 < plaintext.length; i2 += this.segmentSize) {
6482 xorSegment = this._aes.encrypt(this._shiftRegister);
6483 for (var j2 = 0; j2 < this.segmentSize; j2++) {
6484 plaintext[i2 + j2] ^= xorSegment[j2];
6486 copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
6487 copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i2, i2 + this.segmentSize);
6491 var ModeOfOperationOFB = function(key, iv) {
6492 if (!(this instanceof ModeOfOperationOFB)) {
6493 throw Error("AES must be instanitated with `new`");
6495 this.description = "Output Feedback";
6498 iv = createArray(16);
6499 } else if (iv.length != 16) {
6500 throw new Error("invalid initialation vector size (must be 16 bytes)");
6502 this._lastPrecipher = coerceArray(iv, true);
6503 this._lastPrecipherIndex = 16;
6504 this._aes = new AES(key);
6506 ModeOfOperationOFB.prototype.encrypt = function(plaintext) {
6507 var encrypted = coerceArray(plaintext, true);
6508 for (var i2 = 0; i2 < encrypted.length; i2++) {
6509 if (this._lastPrecipherIndex === 16) {
6510 this._lastPrecipher = this._aes.encrypt(this._lastPrecipher);
6511 this._lastPrecipherIndex = 0;
6513 encrypted[i2] ^= this._lastPrecipher[this._lastPrecipherIndex++];
6517 ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt;
6518 var Counter = function(initialValue) {
6519 if (!(this instanceof Counter)) {
6520 throw Error("Counter must be instanitated with `new`");
6522 if (initialValue !== 0 && !initialValue) {
6525 if (typeof initialValue === "number") {
6526 this._counter = createArray(16);
6527 this.setValue(initialValue);
6529 this.setBytes(initialValue);
6532 Counter.prototype.setValue = function(value) {
6533 if (typeof value !== "number" || parseInt(value) != value) {
6534 throw new Error("invalid counter value (must be an integer)");
6536 if (value > Number.MAX_SAFE_INTEGER) {
6537 throw new Error("integer value out of safe range");
6539 for (var index = 15; index >= 0; --index) {
6540 this._counter[index] = value % 256;
6541 value = parseInt(value / 256);
6544 Counter.prototype.setBytes = function(bytes) {
6545 bytes = coerceArray(bytes, true);
6546 if (bytes.length != 16) {
6547 throw new Error("invalid counter bytes size (must be 16 bytes)");
6549 this._counter = bytes;
6551 Counter.prototype.increment = function() {
6552 for (var i2 = 15; i2 >= 0; i2--) {
6553 if (this._counter[i2] === 255) {
6554 this._counter[i2] = 0;
6556 this._counter[i2]++;
6561 var ModeOfOperationCTR = function(key, counter) {
6562 if (!(this instanceof ModeOfOperationCTR)) {
6563 throw Error("AES must be instanitated with `new`");
6565 this.description = "Counter";
6567 if (!(counter instanceof Counter)) {
6568 counter = new Counter(counter);
6570 this._counter = counter;
6571 this._remainingCounter = null;
6572 this._remainingCounterIndex = 16;
6573 this._aes = new AES(key);
6575 ModeOfOperationCTR.prototype.encrypt = function(plaintext) {
6576 var encrypted = coerceArray(plaintext, true);
6577 for (var i2 = 0; i2 < encrypted.length; i2++) {
6578 if (this._remainingCounterIndex === 16) {
6579 this._remainingCounter = this._aes.encrypt(this._counter._counter);
6580 this._remainingCounterIndex = 0;
6581 this._counter.increment();
6583 encrypted[i2] ^= this._remainingCounter[this._remainingCounterIndex++];
6587 ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt;
6588 function pkcs7pad(data) {
6589 data = coerceArray(data, true);
6590 var padder = 16 - data.length % 16;
6591 var result = createArray(data.length + padder);
6592 copyArray(data, result);
6593 for (var i2 = data.length; i2 < result.length; i2++) {
6594 result[i2] = padder;
6598 function pkcs7strip(data) {
6599 data = coerceArray(data, true);
6600 if (data.length < 16) {
6601 throw new Error("PKCS#7 invalid length");
6603 var padder = data[data.length - 1];
6605 throw new Error("PKCS#7 padding byte out of range");
6607 var length = data.length - padder;
6608 for (var i2 = 0; i2 < padder; i2++) {
6609 if (data[length + i2] !== padder) {
6610 throw new Error("PKCS#7 invalid padding byte");
6613 var result = createArray(length);
6614 copyArray(data, result, 0, 0, length);
6621 ecb: ModeOfOperationECB,
6622 cbc: ModeOfOperationCBC,
6623 cfb: ModeOfOperationCFB,
6624 ofb: ModeOfOperationOFB,
6625 ctr: ModeOfOperationCTR
6643 if (typeof exports2 !== "undefined") {
6644 module2.exports = aesjs2;
6645 } else if (typeof define === "function" && define.amd) {
6646 define([], function() {
6651 aesjs2._aesjs = root3.aesjs;
6653 root3.aesjs = aesjs2;
6659 // node_modules/fast-deep-equal/index.js
6660 var require_fast_deep_equal = __commonJS({
6661 "node_modules/fast-deep-equal/index.js"(exports2, module2) {
6663 module2.exports = function equal(a, b) {
6666 if (a && b && typeof a == "object" && typeof b == "object") {
6667 if (a.constructor !== b.constructor)
6669 var length, i2, keys;
6670 if (Array.isArray(a)) {
6672 if (length != b.length)
6674 for (i2 = length; i2-- !== 0; )
6675 if (!equal(a[i2], b[i2]))
6679 if (a.constructor === RegExp)
6680 return a.source === b.source && a.flags === b.flags;
6681 if (a.valueOf !== Object.prototype.valueOf)
6682 return a.valueOf() === b.valueOf();
6683 if (a.toString !== Object.prototype.toString)
6684 return a.toString() === b.toString();
6685 keys = Object.keys(a);
6686 length = keys.length;
6687 if (length !== Object.keys(b).length)
6689 for (i2 = length; i2-- !== 0; )
6690 if (!Object.prototype.hasOwnProperty.call(b, keys[i2]))
6692 for (i2 = length; i2-- !== 0; ) {
6694 if (!equal(a[key], b[key]))
6699 return a !== a && b !== b;
6704 // node_modules/lodash/lodash.js
6705 var require_lodash = __commonJS({
6706 "node_modules/lodash/lodash.js"(exports2, module2) {
6709 var VERSION = "4.17.21";
6710 var LARGE_ARRAY_SIZE = 200;
6711 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`";
6712 var HASH_UNDEFINED = "__lodash_hash_undefined__";
6713 var MAX_MEMOIZE_SIZE = 500;
6714 var PLACEHOLDER = "__lodash_placeholder__";
6715 var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
6716 var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
6717 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;
6718 var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
6719 var HOT_COUNT = 800, HOT_SPAN = 16;
6720 var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
6721 var INFINITY2 = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN2 = 0 / 0;
6722 var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
6724 ["ary", WRAP_ARY_FLAG],
6725 ["bind", WRAP_BIND_FLAG],
6726 ["bindKey", WRAP_BIND_KEY_FLAG],
6727 ["curry", WRAP_CURRY_FLAG],
6728 ["curryRight", WRAP_CURRY_RIGHT_FLAG],
6729 ["flip", WRAP_FLIP_FLAG],
6730 ["partial", WRAP_PARTIAL_FLAG],
6731 ["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
6732 ["rearg", WRAP_REARG_FLAG]
6734 var argsTag = "[object Arguments]", arrayTag = "[object Array]", asyncTag = "[object AsyncFunction]", boolTag = "[object Boolean]", dateTag = "[object Date]", domExcTag = "[object DOMException]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", nullTag2 = "[object Null]", objectTag = "[object Object]", promiseTag = "[object Promise]", proxyTag = "[object Proxy]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag2 = "[object Symbol]", undefinedTag2 = "[object Undefined]", weakMapTag = "[object WeakMap]", weakSetTag = "[object WeakSet]";
6735 var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
6736 var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
6737 var reEscapedHtml2 = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml2 = /[&<>"']/g, reHasEscapedHtml2 = RegExp(reEscapedHtml2.source), reHasUnescapedHtml2 = RegExp(reUnescapedHtml2.source);
6738 var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
6739 var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
6740 var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source);
6741 var reTrimStart2 = /^\s+/;
6742 var reWhitespace2 = /\s/;
6743 var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
6744 var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
6745 var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
6746 var reEscapeChar = /\\(\\)?/g;
6747 var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
6748 var reFlags = /\w*$/;
6749 var reIsBadHex2 = /^[-+]0x[0-9a-f]+$/i;
6750 var reIsBinary2 = /^0b[01]+$/i;
6751 var reIsHostCtor = /^\[object .+?Constructor\]$/;
6752 var reIsOctal2 = /^0o[0-7]+$/i;
6753 var reIsUint = /^(?:0|[1-9]\d*)$/;
6754 var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
6755 var reNoMatch = /($^)/;
6756 var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
6757 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;
6758 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";
6759 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("|") + ")";
6760 var reApos = RegExp(rsApos, "g");
6761 var reComboMark = RegExp(rsCombo, "g");
6762 var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
6763 var reUnicodeWord = RegExp([
6764 rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
6765 rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
6766 rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
6767 rsUpper + "+" + rsOptContrUpper,
6773 var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
6774 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 ]/;
6775 var contextProps = [
6797 "Uint8ClampedArray",
6807 var templateCounter = -1;
6808 var typedArrayTags = {};
6809 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
6810 typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
6811 var cloneableTags = {};
6812 cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag2] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
6813 cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
6814 var deburredLetters = {
7006 var htmlEscapes2 = {
7013 var htmlUnescapes2 = {
7020 var stringEscapes = {
7028 var freeParseFloat = parseFloat, freeParseInt2 = parseInt;
7029 var freeGlobal2 = typeof global == "object" && global && global.Object === Object && global;
7030 var freeSelf2 = typeof self == "object" && self && self.Object === Object && self;
7031 var root3 = freeGlobal2 || freeSelf2 || Function("return this")();
7032 var freeExports = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2;
7033 var freeModule = freeExports && typeof module2 == "object" && module2 && !module2.nodeType && module2;
7034 var moduleExports = freeModule && freeModule.exports === freeExports;
7035 var freeProcess = moduleExports && freeGlobal2.process;
7036 var nodeUtil = function() {
7038 var types = freeModule && freeModule.require && freeModule.require("util").types;
7042 return freeProcess && freeProcess.binding && freeProcess.binding("util");
7046 var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, nodeIsDate = nodeUtil && nodeUtil.isDate, nodeIsMap = nodeUtil && nodeUtil.isMap, nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, nodeIsSet = nodeUtil && nodeUtil.isSet, nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
7047 function apply(func, thisArg, args) {
7048 switch (args.length) {
7050 return func.call(thisArg);
7052 return func.call(thisArg, args[0]);
7054 return func.call(thisArg, args[0], args[1]);
7056 return func.call(thisArg, args[0], args[1], args[2]);
7058 return func.apply(thisArg, args);
7060 function arrayAggregator(array2, setter, iteratee, accumulator) {
7061 var index = -1, length = array2 == null ? 0 : array2.length;
7062 while (++index < length) {
7063 var value = array2[index];
7064 setter(accumulator, value, iteratee(value), array2);
7068 function arrayEach(array2, iteratee) {
7069 var index = -1, length = array2 == null ? 0 : array2.length;
7070 while (++index < length) {
7071 if (iteratee(array2[index], index, array2) === false) {
7077 function arrayEachRight(array2, iteratee) {
7078 var length = array2 == null ? 0 : array2.length;
7080 if (iteratee(array2[length], length, array2) === false) {
7086 function arrayEvery(array2, predicate) {
7087 var index = -1, length = array2 == null ? 0 : array2.length;
7088 while (++index < length) {
7089 if (!predicate(array2[index], index, array2)) {
7095 function arrayFilter(array2, predicate) {
7096 var index = -1, length = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
7097 while (++index < length) {
7098 var value = array2[index];
7099 if (predicate(value, index, array2)) {
7100 result[resIndex++] = value;
7105 function arrayIncludes(array2, value) {
7106 var length = array2 == null ? 0 : array2.length;
7107 return !!length && baseIndexOf(array2, value, 0) > -1;
7109 function arrayIncludesWith(array2, value, comparator) {
7110 var index = -1, length = array2 == null ? 0 : array2.length;
7111 while (++index < length) {
7112 if (comparator(value, array2[index])) {
7118 function arrayMap2(array2, iteratee) {
7119 var index = -1, length = array2 == null ? 0 : array2.length, result = Array(length);
7120 while (++index < length) {
7121 result[index] = iteratee(array2[index], index, array2);
7125 function arrayPush(array2, values) {
7126 var index = -1, length = values.length, offset = array2.length;
7127 while (++index < length) {
7128 array2[offset + index] = values[index];
7132 function arrayReduce(array2, iteratee, accumulator, initAccum) {
7133 var index = -1, length = array2 == null ? 0 : array2.length;
7134 if (initAccum && length) {
7135 accumulator = array2[++index];
7137 while (++index < length) {
7138 accumulator = iteratee(accumulator, array2[index], index, array2);
7142 function arrayReduceRight(array2, iteratee, accumulator, initAccum) {
7143 var length = array2 == null ? 0 : array2.length;
7144 if (initAccum && length) {
7145 accumulator = array2[--length];
7148 accumulator = iteratee(accumulator, array2[length], length, array2);
7152 function arraySome(array2, predicate) {
7153 var index = -1, length = array2 == null ? 0 : array2.length;
7154 while (++index < length) {
7155 if (predicate(array2[index], index, array2)) {
7161 var asciiSize = baseProperty("length");
7162 function asciiToArray(string) {
7163 return string.split("");
7165 function asciiWords(string) {
7166 return string.match(reAsciiWord) || [];
7168 function baseFindKey(collection, predicate, eachFunc) {
7170 eachFunc(collection, function(value, key, collection2) {
7171 if (predicate(value, key, collection2)) {
7178 function baseFindIndex(array2, predicate, fromIndex, fromRight) {
7179 var length = array2.length, index = fromIndex + (fromRight ? 1 : -1);
7180 while (fromRight ? index-- : ++index < length) {
7181 if (predicate(array2[index], index, array2)) {
7187 function baseIndexOf(array2, value, fromIndex) {
7188 return value === value ? strictIndexOf(array2, value, fromIndex) : baseFindIndex(array2, baseIsNaN, fromIndex);
7190 function baseIndexOfWith(array2, value, fromIndex, comparator) {
7191 var index = fromIndex - 1, length = array2.length;
7192 while (++index < length) {
7193 if (comparator(array2[index], value)) {
7199 function baseIsNaN(value) {
7200 return value !== value;
7202 function baseMean(array2, iteratee) {
7203 var length = array2 == null ? 0 : array2.length;
7204 return length ? baseSum(array2, iteratee) / length : NAN2;
7206 function baseProperty(key) {
7207 return function(object) {
7208 return object == null ? undefined2 : object[key];
7211 function basePropertyOf2(object) {
7212 return function(key) {
7213 return object == null ? undefined2 : object[key];
7216 function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
7217 eachFunc(collection, function(value, index, collection2) {
7218 accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
7222 function baseSortBy(array2, comparer) {
7223 var length = array2.length;
7224 array2.sort(comparer);
7226 array2[length] = array2[length].value;
7230 function baseSum(array2, iteratee) {
7231 var result, index = -1, length = array2.length;
7232 while (++index < length) {
7233 var current = iteratee(array2[index]);
7234 if (current !== undefined2) {
7235 result = result === undefined2 ? current : result + current;
7240 function baseTimes(n2, iteratee) {
7241 var index = -1, result = Array(n2);
7242 while (++index < n2) {
7243 result[index] = iteratee(index);
7247 function baseToPairs(object, props) {
7248 return arrayMap2(props, function(key) {
7249 return [key, object[key]];
7252 function baseTrim2(string) {
7253 return string ? string.slice(0, trimmedEndIndex2(string) + 1).replace(reTrimStart2, "") : string;
7255 function baseUnary(func) {
7256 return function(value) {
7260 function baseValues(object, props) {
7261 return arrayMap2(props, function(key) {
7265 function cacheHas(cache, key) {
7266 return cache.has(key);
7268 function charsStartIndex(strSymbols, chrSymbols) {
7269 var index = -1, length = strSymbols.length;
7270 while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
7274 function charsEndIndex(strSymbols, chrSymbols) {
7275 var index = strSymbols.length;
7276 while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
7280 function countHolders(array2, placeholder) {
7281 var length = array2.length, result = 0;
7283 if (array2[length] === placeholder) {
7289 var deburrLetter = basePropertyOf2(deburredLetters);
7290 var escapeHtmlChar2 = basePropertyOf2(htmlEscapes2);
7291 function escapeStringChar(chr) {
7292 return "\\" + stringEscapes[chr];
7294 function getValue(object, key) {
7295 return object == null ? undefined2 : object[key];
7297 function hasUnicode(string) {
7298 return reHasUnicode.test(string);
7300 function hasUnicodeWord(string) {
7301 return reHasUnicodeWord.test(string);
7303 function iteratorToArray(iterator) {
7304 var data, result = [];
7305 while (!(data = iterator.next()).done) {
7306 result.push(data.value);
7310 function mapToArray(map2) {
7311 var index = -1, result = Array(map2.size);
7312 map2.forEach(function(value, key) {
7313 result[++index] = [key, value];
7317 function overArg(func, transform2) {
7318 return function(arg) {
7319 return func(transform2(arg));
7322 function replaceHolders(array2, placeholder) {
7323 var index = -1, length = array2.length, resIndex = 0, result = [];
7324 while (++index < length) {
7325 var value = array2[index];
7326 if (value === placeholder || value === PLACEHOLDER) {
7327 array2[index] = PLACEHOLDER;
7328 result[resIndex++] = index;
7333 function setToArray(set3) {
7334 var index = -1, result = Array(set3.size);
7335 set3.forEach(function(value) {
7336 result[++index] = value;
7340 function setToPairs(set3) {
7341 var index = -1, result = Array(set3.size);
7342 set3.forEach(function(value) {
7343 result[++index] = [value, value];
7347 function strictIndexOf(array2, value, fromIndex) {
7348 var index = fromIndex - 1, length = array2.length;
7349 while (++index < length) {
7350 if (array2[index] === value) {
7356 function strictLastIndexOf(array2, value, fromIndex) {
7357 var index = fromIndex + 1;
7359 if (array2[index] === value) {
7365 function stringSize(string) {
7366 return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
7368 function stringToArray(string) {
7369 return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
7371 function trimmedEndIndex2(string) {
7372 var index = string.length;
7373 while (index-- && reWhitespace2.test(string.charAt(index))) {
7377 var unescapeHtmlChar2 = basePropertyOf2(htmlUnescapes2);
7378 function unicodeSize(string) {
7379 var result = reUnicode.lastIndex = 0;
7380 while (reUnicode.test(string)) {
7385 function unicodeToArray(string) {
7386 return string.match(reUnicode) || [];
7388 function unicodeWords(string) {
7389 return string.match(reUnicodeWord) || [];
7391 var runInContext = function runInContext2(context) {
7392 context = context == null ? root3 : _.defaults(root3.Object(), context, _.pick(root3, contextProps));
7393 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;
7394 var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto3 = Object2.prototype;
7395 var coreJsData = context["__core-js_shared__"];
7396 var funcToString = funcProto.toString;
7397 var hasOwnProperty2 = objectProto3.hasOwnProperty;
7399 var maskSrcKey = function() {
7400 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
7401 return uid ? "Symbol(src)_1." + uid : "";
7403 var nativeObjectToString3 = objectProto3.toString;
7404 var objectCtorString = funcToString.call(Object2);
7405 var oldDash = root3._;
7406 var reIsNative = RegExp2(
7407 "^" + funcToString.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
7409 var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol3 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto3.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol3 ? Symbol3.isConcatSpreadable : undefined2, symIterator = Symbol3 ? Symbol3.iterator : undefined2, symToStringTag3 = Symbol3 ? Symbol3.toStringTag : undefined2;
7410 var defineProperty = function() {
7412 var func = getNative(Object2, "defineProperty");
7418 var ctxClearTimeout = context.clearTimeout !== root3.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root3.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root3.setTimeout && context.setTimeout;
7419 var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax2 = Math2.max, nativeMin2 = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
7420 var DataView2 = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
7421 var metaMap = WeakMap && new WeakMap();
7423 var dataViewCtorString = toSource(DataView2), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap);
7424 var symbolProto2 = Symbol3 ? Symbol3.prototype : undefined2, symbolValueOf = symbolProto2 ? symbolProto2.valueOf : undefined2, symbolToString2 = symbolProto2 ? symbolProto2.toString : undefined2;
7425 function lodash(value) {
7426 if (isObjectLike2(value) && !isArray2(value) && !(value instanceof LazyWrapper)) {
7427 if (value instanceof LodashWrapper) {
7430 if (hasOwnProperty2.call(value, "__wrapped__")) {
7431 return wrapperClone(value);
7434 return new LodashWrapper(value);
7436 var baseCreate = function() {
7439 return function(proto) {
7440 if (!isObject3(proto)) {
7444 return objectCreate(proto);
7446 object.prototype = proto;
7447 var result2 = new object();
7448 object.prototype = undefined2;
7452 function baseLodash() {
7454 function LodashWrapper(value, chainAll) {
7455 this.__wrapped__ = value;
7456 this.__actions__ = [];
7457 this.__chain__ = !!chainAll;
7459 this.__values__ = undefined2;
7461 lodash.templateSettings = {
7463 "evaluate": reEvaluate,
7464 "interpolate": reInterpolate,
7470 lodash.prototype = baseLodash.prototype;
7471 lodash.prototype.constructor = lodash;
7472 LodashWrapper.prototype = baseCreate(baseLodash.prototype);
7473 LodashWrapper.prototype.constructor = LodashWrapper;
7474 function LazyWrapper(value) {
7475 this.__wrapped__ = value;
7476 this.__actions__ = [];
7478 this.__filtered__ = false;
7479 this.__iteratees__ = [];
7480 this.__takeCount__ = MAX_ARRAY_LENGTH;
7481 this.__views__ = [];
7483 function lazyClone() {
7484 var result2 = new LazyWrapper(this.__wrapped__);
7485 result2.__actions__ = copyArray(this.__actions__);
7486 result2.__dir__ = this.__dir__;
7487 result2.__filtered__ = this.__filtered__;
7488 result2.__iteratees__ = copyArray(this.__iteratees__);
7489 result2.__takeCount__ = this.__takeCount__;
7490 result2.__views__ = copyArray(this.__views__);
7493 function lazyReverse() {
7494 if (this.__filtered__) {
7495 var result2 = new LazyWrapper(this);
7496 result2.__dir__ = -1;
7497 result2.__filtered__ = true;
7499 result2 = this.clone();
7500 result2.__dir__ *= -1;
7504 function lazyValue() {
7505 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__);
7506 if (!isArr || !isRight && arrLength == length && takeCount == length) {
7507 return baseWrapperValue(array2, this.__actions__);
7511 while (length-- && resIndex < takeCount) {
7513 var iterIndex = -1, value = array2[index];
7514 while (++iterIndex < iterLength) {
7515 var data = iteratees[iterIndex], iteratee2 = data.iteratee, type3 = data.type, computed = iteratee2(value);
7516 if (type3 == LAZY_MAP_FLAG) {
7518 } else if (!computed) {
7519 if (type3 == LAZY_FILTER_FLAG) {
7526 result2[resIndex++] = value;
7530 LazyWrapper.prototype = baseCreate(baseLodash.prototype);
7531 LazyWrapper.prototype.constructor = LazyWrapper;
7532 function Hash(entries) {
7533 var index = -1, length = entries == null ? 0 : entries.length;
7535 while (++index < length) {
7536 var entry = entries[index];
7537 this.set(entry[0], entry[1]);
7540 function hashClear() {
7541 this.__data__ = nativeCreate ? nativeCreate(null) : {};
7544 function hashDelete(key) {
7545 var result2 = this.has(key) && delete this.__data__[key];
7546 this.size -= result2 ? 1 : 0;
7549 function hashGet(key) {
7550 var data = this.__data__;
7552 var result2 = data[key];
7553 return result2 === HASH_UNDEFINED ? undefined2 : result2;
7555 return hasOwnProperty2.call(data, key) ? data[key] : undefined2;
7557 function hashHas(key) {
7558 var data = this.__data__;
7559 return nativeCreate ? data[key] !== undefined2 : hasOwnProperty2.call(data, key);
7561 function hashSet(key, value) {
7562 var data = this.__data__;
7563 this.size += this.has(key) ? 0 : 1;
7564 data[key] = nativeCreate && value === undefined2 ? HASH_UNDEFINED : value;
7567 Hash.prototype.clear = hashClear;
7568 Hash.prototype["delete"] = hashDelete;
7569 Hash.prototype.get = hashGet;
7570 Hash.prototype.has = hashHas;
7571 Hash.prototype.set = hashSet;
7572 function ListCache(entries) {
7573 var index = -1, length = entries == null ? 0 : entries.length;
7575 while (++index < length) {
7576 var entry = entries[index];
7577 this.set(entry[0], entry[1]);
7580 function listCacheClear() {
7584 function listCacheDelete(key) {
7585 var data = this.__data__, index = assocIndexOf(data, key);
7589 var lastIndex = data.length - 1;
7590 if (index == lastIndex) {
7593 splice.call(data, index, 1);
7598 function listCacheGet(key) {
7599 var data = this.__data__, index = assocIndexOf(data, key);
7600 return index < 0 ? undefined2 : data[index][1];
7602 function listCacheHas(key) {
7603 return assocIndexOf(this.__data__, key) > -1;
7605 function listCacheSet(key, value) {
7606 var data = this.__data__, index = assocIndexOf(data, key);
7609 data.push([key, value]);
7611 data[index][1] = value;
7615 ListCache.prototype.clear = listCacheClear;
7616 ListCache.prototype["delete"] = listCacheDelete;
7617 ListCache.prototype.get = listCacheGet;
7618 ListCache.prototype.has = listCacheHas;
7619 ListCache.prototype.set = listCacheSet;
7620 function MapCache(entries) {
7621 var index = -1, length = entries == null ? 0 : entries.length;
7623 while (++index < length) {
7624 var entry = entries[index];
7625 this.set(entry[0], entry[1]);
7628 function mapCacheClear() {
7632 "map": new (Map2 || ListCache)(),
7633 "string": new Hash()
7636 function mapCacheDelete(key) {
7637 var result2 = getMapData(this, key)["delete"](key);
7638 this.size -= result2 ? 1 : 0;
7641 function mapCacheGet(key) {
7642 return getMapData(this, key).get(key);
7644 function mapCacheHas(key) {
7645 return getMapData(this, key).has(key);
7647 function mapCacheSet(key, value) {
7648 var data = getMapData(this, key), size2 = data.size;
7649 data.set(key, value);
7650 this.size += data.size == size2 ? 0 : 1;
7653 MapCache.prototype.clear = mapCacheClear;
7654 MapCache.prototype["delete"] = mapCacheDelete;
7655 MapCache.prototype.get = mapCacheGet;
7656 MapCache.prototype.has = mapCacheHas;
7657 MapCache.prototype.set = mapCacheSet;
7658 function SetCache(values2) {
7659 var index = -1, length = values2 == null ? 0 : values2.length;
7660 this.__data__ = new MapCache();
7661 while (++index < length) {
7662 this.add(values2[index]);
7665 function setCacheAdd(value) {
7666 this.__data__.set(value, HASH_UNDEFINED);
7669 function setCacheHas(value) {
7670 return this.__data__.has(value);
7672 SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
7673 SetCache.prototype.has = setCacheHas;
7674 function Stack(entries) {
7675 var data = this.__data__ = new ListCache(entries);
7676 this.size = data.size;
7678 function stackClear() {
7679 this.__data__ = new ListCache();
7682 function stackDelete(key) {
7683 var data = this.__data__, result2 = data["delete"](key);
7684 this.size = data.size;
7687 function stackGet(key) {
7688 return this.__data__.get(key);
7690 function stackHas(key) {
7691 return this.__data__.has(key);
7693 function stackSet(key, value) {
7694 var data = this.__data__;
7695 if (data instanceof ListCache) {
7696 var pairs = data.__data__;
7697 if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
7698 pairs.push([key, value]);
7699 this.size = ++data.size;
7702 data = this.__data__ = new MapCache(pairs);
7704 data.set(key, value);
7705 this.size = data.size;
7708 Stack.prototype.clear = stackClear;
7709 Stack.prototype["delete"] = stackDelete;
7710 Stack.prototype.get = stackGet;
7711 Stack.prototype.has = stackHas;
7712 Stack.prototype.set = stackSet;
7713 function arrayLikeKeys(value, inherited) {
7714 var isArr = isArray2(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.length;
7715 for (var key in value) {
7716 if ((inherited || hasOwnProperty2.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
7722 function arraySample(array2) {
7723 var length = array2.length;
7724 return length ? array2[baseRandom(0, length - 1)] : undefined2;
7726 function arraySampleSize(array2, n2) {
7727 return shuffleSelf(copyArray(array2), baseClamp(n2, 0, array2.length));
7729 function arrayShuffle(array2) {
7730 return shuffleSelf(copyArray(array2));
7732 function assignMergeValue(object, key, value) {
7733 if (value !== undefined2 && !eq(object[key], value) || value === undefined2 && !(key in object)) {
7734 baseAssignValue(object, key, value);
7737 function assignValue(object, key, value) {
7738 var objValue = object[key];
7739 if (!(hasOwnProperty2.call(object, key) && eq(objValue, value)) || value === undefined2 && !(key in object)) {
7740 baseAssignValue(object, key, value);
7743 function assocIndexOf(array2, key) {
7744 var length = array2.length;
7746 if (eq(array2[length][0], key)) {
7752 function baseAggregator(collection, setter, iteratee2, accumulator) {
7753 baseEach(collection, function(value, key, collection2) {
7754 setter(accumulator, value, iteratee2(value), collection2);
7758 function baseAssign(object, source) {
7759 return object && copyObject(source, keys(source), object);
7761 function baseAssignIn(object, source) {
7762 return object && copyObject(source, keysIn(source), object);
7764 function baseAssignValue(object, key, value) {
7765 if (key == "__proto__" && defineProperty) {
7766 defineProperty(object, key, {
7767 "configurable": true,
7773 object[key] = value;
7776 function baseAt(object, paths) {
7777 var index = -1, length = paths.length, result2 = Array2(length), skip = object == null;
7778 while (++index < length) {
7779 result2[index] = skip ? undefined2 : get4(object, paths[index]);
7783 function baseClamp(number3, lower2, upper) {
7784 if (number3 === number3) {
7785 if (upper !== undefined2) {
7786 number3 = number3 <= upper ? number3 : upper;
7788 if (lower2 !== undefined2) {
7789 number3 = number3 >= lower2 ? number3 : lower2;
7794 function baseClone(value, bitmask, customizer, key, object, stack) {
7795 var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
7797 result2 = object ? customizer(value, key, object, stack) : customizer(value);
7799 if (result2 !== undefined2) {
7802 if (!isObject3(value)) {
7805 var isArr = isArray2(value);
7807 result2 = initCloneArray(value);
7809 return copyArray(value, result2);
7812 var tag = getTag(value), isFunc = tag == funcTag || tag == genTag;
7813 if (isBuffer(value)) {
7814 return cloneBuffer(value, isDeep);
7816 if (tag == objectTag || tag == argsTag || isFunc && !object) {
7817 result2 = isFlat || isFunc ? {} : initCloneObject(value);
7819 return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value));
7822 if (!cloneableTags[tag]) {
7823 return object ? value : {};
7825 result2 = initCloneByTag(value, tag, isDeep);
7828 stack || (stack = new Stack());
7829 var stacked = stack.get(value);
7833 stack.set(value, result2);
7835 value.forEach(function(subValue) {
7836 result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
7838 } else if (isMap(value)) {
7839 value.forEach(function(subValue, key2) {
7840 result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
7843 var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
7844 var props = isArr ? undefined2 : keysFunc(value);
7845 arrayEach(props || value, function(subValue, key2) {
7848 subValue = value[key2];
7850 assignValue(result2, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
7854 function baseConforms(source) {
7855 var props = keys(source);
7856 return function(object) {
7857 return baseConformsTo(object, source, props);
7860 function baseConformsTo(object, source, props) {
7861 var length = props.length;
7862 if (object == null) {
7865 object = Object2(object);
7867 var key = props[length], predicate = source[key], value = object[key];
7868 if (value === undefined2 && !(key in object) || !predicate(value)) {
7874 function baseDelay(func, wait, args) {
7875 if (typeof func != "function") {
7876 throw new TypeError2(FUNC_ERROR_TEXT3);
7878 return setTimeout2(function() {
7879 func.apply(undefined2, args);
7882 function baseDifference(array2, values2, iteratee2, comparator) {
7883 var index = -1, includes2 = arrayIncludes, isCommon = true, length = array2.length, result2 = [], valuesLength = values2.length;
7888 values2 = arrayMap2(values2, baseUnary(iteratee2));
7891 includes2 = arrayIncludesWith;
7893 } else if (values2.length >= LARGE_ARRAY_SIZE) {
7894 includes2 = cacheHas;
7896 values2 = new SetCache(values2);
7899 while (++index < length) {
7900 var value = array2[index], computed = iteratee2 == null ? value : iteratee2(value);
7901 value = comparator || value !== 0 ? value : 0;
7902 if (isCommon && computed === computed) {
7903 var valuesIndex = valuesLength;
7904 while (valuesIndex--) {
7905 if (values2[valuesIndex] === computed) {
7909 result2.push(value);
7910 } else if (!includes2(values2, computed, comparator)) {
7911 result2.push(value);
7916 var baseEach = createBaseEach(baseForOwn);
7917 var baseEachRight = createBaseEach(baseForOwnRight, true);
7918 function baseEvery(collection, predicate) {
7920 baseEach(collection, function(value, index, collection2) {
7921 result2 = !!predicate(value, index, collection2);
7926 function baseExtremum(array2, iteratee2, comparator) {
7927 var index = -1, length = array2.length;
7928 while (++index < length) {
7929 var value = array2[index], current = iteratee2(value);
7930 if (current != null && (computed === undefined2 ? current === current && !isSymbol2(current) : comparator(current, computed))) {
7931 var computed = current, result2 = value;
7936 function baseFill(array2, value, start2, end) {
7937 var length = array2.length;
7938 start2 = toInteger(start2);
7940 start2 = -start2 > length ? 0 : length + start2;
7942 end = end === undefined2 || end > length ? length : toInteger(end);
7946 end = start2 > end ? 0 : toLength(end);
7947 while (start2 < end) {
7948 array2[start2++] = value;
7952 function baseFilter(collection, predicate) {
7954 baseEach(collection, function(value, index, collection2) {
7955 if (predicate(value, index, collection2)) {
7956 result2.push(value);
7961 function baseFlatten(array2, depth, predicate, isStrict, result2) {
7962 var index = -1, length = array2.length;
7963 predicate || (predicate = isFlattenable);
7964 result2 || (result2 = []);
7965 while (++index < length) {
7966 var value = array2[index];
7967 if (depth > 0 && predicate(value)) {
7969 baseFlatten(value, depth - 1, predicate, isStrict, result2);
7971 arrayPush(result2, value);
7973 } else if (!isStrict) {
7974 result2[result2.length] = value;
7979 var baseFor = createBaseFor();
7980 var baseForRight = createBaseFor(true);
7981 function baseForOwn(object, iteratee2) {
7982 return object && baseFor(object, iteratee2, keys);
7984 function baseForOwnRight(object, iteratee2) {
7985 return object && baseForRight(object, iteratee2, keys);
7987 function baseFunctions(object, props) {
7988 return arrayFilter(props, function(key) {
7989 return isFunction(object[key]);
7992 function baseGet(object, path) {
7993 path = castPath(path, object);
7994 var index = 0, length = path.length;
7995 while (object != null && index < length) {
7996 object = object[toKey(path[index++])];
7998 return index && index == length ? object : undefined2;
8000 function baseGetAllKeys(object, keysFunc, symbolsFunc) {
8001 var result2 = keysFunc(object);
8002 return isArray2(object) ? result2 : arrayPush(result2, symbolsFunc(object));
8004 function baseGetTag2(value) {
8005 if (value == null) {
8006 return value === undefined2 ? undefinedTag2 : nullTag2;
8008 return symToStringTag3 && symToStringTag3 in Object2(value) ? getRawTag2(value) : objectToString2(value);
8010 function baseGt(value, other) {
8011 return value > other;
8013 function baseHas(object, key) {
8014 return object != null && hasOwnProperty2.call(object, key);
8016 function baseHasIn(object, key) {
8017 return object != null && key in Object2(object);
8019 function baseInRange(number3, start2, end) {
8020 return number3 >= nativeMin2(start2, end) && number3 < nativeMax2(start2, end);
8022 function baseIntersection(arrays, iteratee2, comparator) {
8023 var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = [];
8024 while (othIndex--) {
8025 var array2 = arrays[othIndex];
8026 if (othIndex && iteratee2) {
8027 array2 = arrayMap2(array2, baseUnary(iteratee2));
8029 maxLength = nativeMin2(array2.length, maxLength);
8030 caches[othIndex] = !comparator && (iteratee2 || length >= 120 && array2.length >= 120) ? new SetCache(othIndex && array2) : undefined2;
8033 var index = -1, seen = caches[0];
8035 while (++index < length && result2.length < maxLength) {
8036 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
8037 value = comparator || value !== 0 ? value : 0;
8038 if (!(seen ? cacheHas(seen, computed) : includes2(result2, computed, comparator))) {
8039 othIndex = othLength;
8040 while (--othIndex) {
8041 var cache = caches[othIndex];
8042 if (!(cache ? cacheHas(cache, computed) : includes2(arrays[othIndex], computed, comparator))) {
8047 seen.push(computed);
8049 result2.push(value);
8054 function baseInverter(object, setter, iteratee2, accumulator) {
8055 baseForOwn(object, function(value, key, object2) {
8056 setter(accumulator, iteratee2(value), key, object2);
8060 function baseInvoke(object, path, args) {
8061 path = castPath(path, object);
8062 object = parent(object, path);
8063 var func = object == null ? object : object[toKey(last(path))];
8064 return func == null ? undefined2 : apply(func, object, args);
8066 function baseIsArguments(value) {
8067 return isObjectLike2(value) && baseGetTag2(value) == argsTag;
8069 function baseIsArrayBuffer(value) {
8070 return isObjectLike2(value) && baseGetTag2(value) == arrayBufferTag;
8072 function baseIsDate(value) {
8073 return isObjectLike2(value) && baseGetTag2(value) == dateTag;
8075 function baseIsEqual(value, other, bitmask, customizer, stack) {
8076 if (value === other) {
8079 if (value == null || other == null || !isObjectLike2(value) && !isObjectLike2(other)) {
8080 return value !== value && other !== other;
8082 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
8084 function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
8085 var objIsArr = isArray2(object), othIsArr = isArray2(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
8086 objTag = objTag == argsTag ? objectTag : objTag;
8087 othTag = othTag == argsTag ? objectTag : othTag;
8088 var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
8089 if (isSameTag && isBuffer(object)) {
8090 if (!isBuffer(other)) {
8096 if (isSameTag && !objIsObj) {
8097 stack || (stack = new Stack());
8098 return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
8100 if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
8101 var objIsWrapped = objIsObj && hasOwnProperty2.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty2.call(other, "__wrapped__");
8102 if (objIsWrapped || othIsWrapped) {
8103 var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
8104 stack || (stack = new Stack());
8105 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
8111 stack || (stack = new Stack());
8112 return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
8114 function baseIsMap(value) {
8115 return isObjectLike2(value) && getTag(value) == mapTag;
8117 function baseIsMatch(object, source, matchData, customizer) {
8118 var index = matchData.length, length = index, noCustomizer = !customizer;
8119 if (object == null) {
8122 object = Object2(object);
8124 var data = matchData[index];
8125 if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
8129 while (++index < length) {
8130 data = matchData[index];
8131 var key = data[0], objValue = object[key], srcValue = data[1];
8132 if (noCustomizer && data[2]) {
8133 if (objValue === undefined2 && !(key in object)) {
8137 var stack = new Stack();
8139 var result2 = customizer(objValue, srcValue, key, object, source, stack);
8141 if (!(result2 === undefined2 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result2)) {
8148 function baseIsNative(value) {
8149 if (!isObject3(value) || isMasked(value)) {
8152 var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
8153 return pattern.test(toSource(value));
8155 function baseIsRegExp(value) {
8156 return isObjectLike2(value) && baseGetTag2(value) == regexpTag;
8158 function baseIsSet(value) {
8159 return isObjectLike2(value) && getTag(value) == setTag;
8161 function baseIsTypedArray(value) {
8162 return isObjectLike2(value) && isLength(value.length) && !!typedArrayTags[baseGetTag2(value)];
8164 function baseIteratee(value) {
8165 if (typeof value == "function") {
8168 if (value == null) {
8171 if (typeof value == "object") {
8172 return isArray2(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
8174 return property(value);
8176 function baseKeys(object) {
8177 if (!isPrototype(object)) {
8178 return nativeKeys(object);
8181 for (var key in Object2(object)) {
8182 if (hasOwnProperty2.call(object, key) && key != "constructor") {
8188 function baseKeysIn(object) {
8189 if (!isObject3(object)) {
8190 return nativeKeysIn(object);
8192 var isProto = isPrototype(object), result2 = [];
8193 for (var key in object) {
8194 if (!(key == "constructor" && (isProto || !hasOwnProperty2.call(object, key)))) {
8200 function baseLt(value, other) {
8201 return value < other;
8203 function baseMap(collection, iteratee2) {
8204 var index = -1, result2 = isArrayLike(collection) ? Array2(collection.length) : [];
8205 baseEach(collection, function(value, key, collection2) {
8206 result2[++index] = iteratee2(value, key, collection2);
8210 function baseMatches(source) {
8211 var matchData = getMatchData(source);
8212 if (matchData.length == 1 && matchData[0][2]) {
8213 return matchesStrictComparable(matchData[0][0], matchData[0][1]);
8215 return function(object) {
8216 return object === source || baseIsMatch(object, source, matchData);
8219 function baseMatchesProperty(path, srcValue) {
8220 if (isKey(path) && isStrictComparable(srcValue)) {
8221 return matchesStrictComparable(toKey(path), srcValue);
8223 return function(object) {
8224 var objValue = get4(object, path);
8225 return objValue === undefined2 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
8228 function baseMerge(object, source, srcIndex, customizer, stack) {
8229 if (object === source) {
8232 baseFor(source, function(srcValue, key) {
8233 stack || (stack = new Stack());
8234 if (isObject3(srcValue)) {
8235 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
8237 var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined2;
8238 if (newValue === undefined2) {
8239 newValue = srcValue;
8241 assignMergeValue(object, key, newValue);
8245 function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
8246 var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
8248 assignMergeValue(object, key, stacked);
8251 var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2;
8252 var isCommon = newValue === undefined2;
8254 var isArr = isArray2(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
8255 newValue = srcValue;
8256 if (isArr || isBuff || isTyped) {
8257 if (isArray2(objValue)) {
8258 newValue = objValue;
8259 } else if (isArrayLikeObject(objValue)) {
8260 newValue = copyArray(objValue);
8261 } else if (isBuff) {
8263 newValue = cloneBuffer(srcValue, true);
8264 } else if (isTyped) {
8266 newValue = cloneTypedArray(srcValue, true);
8270 } else if (isPlainObject(srcValue) || isArguments(srcValue)) {
8271 newValue = objValue;
8272 if (isArguments(objValue)) {
8273 newValue = toPlainObject(objValue);
8274 } else if (!isObject3(objValue) || isFunction(objValue)) {
8275 newValue = initCloneObject(srcValue);
8282 stack.set(srcValue, newValue);
8283 mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
8284 stack["delete"](srcValue);
8286 assignMergeValue(object, key, newValue);
8288 function baseNth(array2, n2) {
8289 var length = array2.length;
8293 n2 += n2 < 0 ? length : 0;
8294 return isIndex(n2, length) ? array2[n2] : undefined2;
8296 function baseOrderBy(collection, iteratees, orders) {
8297 if (iteratees.length) {
8298 iteratees = arrayMap2(iteratees, function(iteratee2) {
8299 if (isArray2(iteratee2)) {
8300 return function(value) {
8301 return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2);
8307 iteratees = [identity4];
8310 iteratees = arrayMap2(iteratees, baseUnary(getIteratee()));
8311 var result2 = baseMap(collection, function(value, key, collection2) {
8312 var criteria = arrayMap2(iteratees, function(iteratee2) {
8313 return iteratee2(value);
8315 return { "criteria": criteria, "index": ++index, "value": value };
8317 return baseSortBy(result2, function(object, other) {
8318 return compareMultiple(object, other, orders);
8321 function basePick(object, paths) {
8322 return basePickBy(object, paths, function(value, path) {
8323 return hasIn(object, path);
8326 function basePickBy(object, paths, predicate) {
8327 var index = -1, length = paths.length, result2 = {};
8328 while (++index < length) {
8329 var path = paths[index], value = baseGet(object, path);
8330 if (predicate(value, path)) {
8331 baseSet(result2, castPath(path, object), value);
8336 function basePropertyDeep(path) {
8337 return function(object) {
8338 return baseGet(object, path);
8341 function basePullAll(array2, values2, iteratee2, comparator) {
8342 var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values2.length, seen = array2;
8343 if (array2 === values2) {
8344 values2 = copyArray(values2);
8347 seen = arrayMap2(array2, baseUnary(iteratee2));
8349 while (++index < length) {
8350 var fromIndex = 0, value = values2[index], computed = iteratee2 ? iteratee2(value) : value;
8351 while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) {
8352 if (seen !== array2) {
8353 splice.call(seen, fromIndex, 1);
8355 splice.call(array2, fromIndex, 1);
8360 function basePullAt(array2, indexes) {
8361 var length = array2 ? indexes.length : 0, lastIndex = length - 1;
8363 var index = indexes[length];
8364 if (length == lastIndex || index !== previous) {
8365 var previous = index;
8366 if (isIndex(index)) {
8367 splice.call(array2, index, 1);
8369 baseUnset(array2, index);
8375 function baseRandom(lower2, upper) {
8376 return lower2 + nativeFloor(nativeRandom() * (upper - lower2 + 1));
8378 function baseRange(start2, end, step, fromRight) {
8379 var index = -1, length = nativeMax2(nativeCeil((end - start2) / (step || 1)), 0), result2 = Array2(length);
8381 result2[fromRight ? length : ++index] = start2;
8386 function baseRepeat(string, n2) {
8388 if (!string || n2 < 1 || n2 > MAX_SAFE_INTEGER) {
8395 n2 = nativeFloor(n2 / 2);
8402 function baseRest(func, start2) {
8403 return setToString(overRest(func, start2, identity4), func + "");
8405 function baseSample(collection) {
8406 return arraySample(values(collection));
8408 function baseSampleSize(collection, n2) {
8409 var array2 = values(collection);
8410 return shuffleSelf(array2, baseClamp(n2, 0, array2.length));
8412 function baseSet(object, path, value, customizer) {
8413 if (!isObject3(object)) {
8416 path = castPath(path, object);
8417 var index = -1, length = path.length, lastIndex = length - 1, nested = object;
8418 while (nested != null && ++index < length) {
8419 var key = toKey(path[index]), newValue = value;
8420 if (key === "__proto__" || key === "constructor" || key === "prototype") {
8423 if (index != lastIndex) {
8424 var objValue = nested[key];
8425 newValue = customizer ? customizer(objValue, key, nested) : undefined2;
8426 if (newValue === undefined2) {
8427 newValue = isObject3(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
8430 assignValue(nested, key, newValue);
8431 nested = nested[key];
8435 var baseSetData = !metaMap ? identity4 : function(func, data) {
8436 metaMap.set(func, data);
8439 var baseSetToString = !defineProperty ? identity4 : function(func, string) {
8440 return defineProperty(func, "toString", {
8441 "configurable": true,
8442 "enumerable": false,
8443 "value": constant(string),
8447 function baseShuffle(collection) {
8448 return shuffleSelf(values(collection));
8450 function baseSlice(array2, start2, end) {
8451 var index = -1, length = array2.length;
8453 start2 = -start2 > length ? 0 : length + start2;
8455 end = end > length ? length : end;
8459 length = start2 > end ? 0 : end - start2 >>> 0;
8461 var result2 = Array2(length);
8462 while (++index < length) {
8463 result2[index] = array2[index + start2];
8467 function baseSome(collection, predicate) {
8469 baseEach(collection, function(value, index, collection2) {
8470 result2 = predicate(value, index, collection2);
8475 function baseSortedIndex(array2, value, retHighest) {
8476 var low = 0, high = array2 == null ? low : array2.length;
8477 if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
8478 while (low < high) {
8479 var mid = low + high >>> 1, computed = array2[mid];
8480 if (computed !== null && !isSymbol2(computed) && (retHighest ? computed <= value : computed < value)) {
8488 return baseSortedIndexBy(array2, value, identity4, retHighest);
8490 function baseSortedIndexBy(array2, value, iteratee2, retHighest) {
8491 var low = 0, high = array2 == null ? 0 : array2.length;
8495 value = iteratee2(value);
8496 var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol2(value), valIsUndefined = value === undefined2;
8497 while (low < high) {
8498 var mid = nativeFloor((low + high) / 2), computed = iteratee2(array2[mid]), othIsDefined = computed !== undefined2, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol2(computed);
8500 var setLow = retHighest || othIsReflexive;
8501 } else if (valIsUndefined) {
8502 setLow = othIsReflexive && (retHighest || othIsDefined);
8503 } else if (valIsNull) {
8504 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
8505 } else if (valIsSymbol) {
8506 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
8507 } else if (othIsNull || othIsSymbol) {
8510 setLow = retHighest ? computed <= value : computed < value;
8518 return nativeMin2(high, MAX_ARRAY_INDEX);
8520 function baseSortedUniq(array2, iteratee2) {
8521 var index = -1, length = array2.length, resIndex = 0, result2 = [];
8522 while (++index < length) {
8523 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
8524 if (!index || !eq(computed, seen)) {
8525 var seen = computed;
8526 result2[resIndex++] = value === 0 ? 0 : value;
8531 function baseToNumber(value) {
8532 if (typeof value == "number") {
8535 if (isSymbol2(value)) {
8540 function baseToString2(value) {
8541 if (typeof value == "string") {
8544 if (isArray2(value)) {
8545 return arrayMap2(value, baseToString2) + "";
8547 if (isSymbol2(value)) {
8548 return symbolToString2 ? symbolToString2.call(value) : "";
8550 var result2 = value + "";
8551 return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2;
8553 function baseUniq(array2, iteratee2, comparator) {
8554 var index = -1, includes2 = arrayIncludes, length = array2.length, isCommon = true, result2 = [], seen = result2;
8557 includes2 = arrayIncludesWith;
8558 } else if (length >= LARGE_ARRAY_SIZE) {
8559 var set4 = iteratee2 ? null : createSet(array2);
8561 return setToArray(set4);
8564 includes2 = cacheHas;
8565 seen = new SetCache();
8567 seen = iteratee2 ? [] : result2;
8570 while (++index < length) {
8571 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
8572 value = comparator || value !== 0 ? value : 0;
8573 if (isCommon && computed === computed) {
8574 var seenIndex = seen.length;
8575 while (seenIndex--) {
8576 if (seen[seenIndex] === computed) {
8581 seen.push(computed);
8583 result2.push(value);
8584 } else if (!includes2(seen, computed, comparator)) {
8585 if (seen !== result2) {
8586 seen.push(computed);
8588 result2.push(value);
8593 function baseUnset(object, path) {
8594 path = castPath(path, object);
8595 object = parent(object, path);
8596 return object == null || delete object[toKey(last(path))];
8598 function baseUpdate(object, path, updater, customizer) {
8599 return baseSet(object, path, updater(baseGet(object, path)), customizer);
8601 function baseWhile(array2, predicate, isDrop, fromRight) {
8602 var length = array2.length, index = fromRight ? length : -1;
8603 while ((fromRight ? index-- : ++index < length) && predicate(array2[index], index, array2)) {
8605 return isDrop ? baseSlice(array2, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array2, fromRight ? index + 1 : 0, fromRight ? length : index);
8607 function baseWrapperValue(value, actions) {
8608 var result2 = value;
8609 if (result2 instanceof LazyWrapper) {
8610 result2 = result2.value();
8612 return arrayReduce(actions, function(result3, action) {
8613 return action.func.apply(action.thisArg, arrayPush([result3], action.args));
8616 function baseXor(arrays, iteratee2, comparator) {
8617 var length = arrays.length;
8619 return length ? baseUniq(arrays[0]) : [];
8621 var index = -1, result2 = Array2(length);
8622 while (++index < length) {
8623 var array2 = arrays[index], othIndex = -1;
8624 while (++othIndex < length) {
8625 if (othIndex != index) {
8626 result2[index] = baseDifference(result2[index] || array2, arrays[othIndex], iteratee2, comparator);
8630 return baseUniq(baseFlatten(result2, 1), iteratee2, comparator);
8632 function baseZipObject(props, values2, assignFunc) {
8633 var index = -1, length = props.length, valsLength = values2.length, result2 = {};
8634 while (++index < length) {
8635 var value = index < valsLength ? values2[index] : undefined2;
8636 assignFunc(result2, props[index], value);
8640 function castArrayLikeObject(value) {
8641 return isArrayLikeObject(value) ? value : [];
8643 function castFunction(value) {
8644 return typeof value == "function" ? value : identity4;
8646 function castPath(value, object) {
8647 if (isArray2(value)) {
8650 return isKey(value, object) ? [value] : stringToPath(toString2(value));
8652 var castRest = baseRest;
8653 function castSlice(array2, start2, end) {
8654 var length = array2.length;
8655 end = end === undefined2 ? length : end;
8656 return !start2 && end >= length ? array2 : baseSlice(array2, start2, end);
8658 var clearTimeout2 = ctxClearTimeout || function(id2) {
8659 return root3.clearTimeout(id2);
8661 function cloneBuffer(buffer, isDeep) {
8663 return buffer.slice();
8665 var length = buffer.length, result2 = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
8666 buffer.copy(result2);
8669 function cloneArrayBuffer(arrayBuffer) {
8670 var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
8671 new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer));
8674 function cloneDataView(dataView, isDeep) {
8675 var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
8676 return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
8678 function cloneRegExp(regexp) {
8679 var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp));
8680 result2.lastIndex = regexp.lastIndex;
8683 function cloneSymbol(symbol) {
8684 return symbolValueOf ? Object2(symbolValueOf.call(symbol)) : {};
8686 function cloneTypedArray(typedArray, isDeep) {
8687 var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
8688 return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
8690 function compareAscending(value, other) {
8691 if (value !== other) {
8692 var valIsDefined = value !== undefined2, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol2(value);
8693 var othIsDefined = other !== undefined2, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol2(other);
8694 if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
8697 if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
8703 function compareMultiple(object, other, orders) {
8704 var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
8705 while (++index < length) {
8706 var result2 = compareAscending(objCriteria[index], othCriteria[index]);
8708 if (index >= ordersLength) {
8711 var order = orders[index];
8712 return result2 * (order == "desc" ? -1 : 1);
8715 return object.index - other.index;
8717 function composeArgs(args, partials, holders, isCurried) {
8718 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;
8719 while (++leftIndex < leftLength) {
8720 result2[leftIndex] = partials[leftIndex];
8722 while (++argsIndex < holdersLength) {
8723 if (isUncurried || argsIndex < argsLength) {
8724 result2[holders[argsIndex]] = args[argsIndex];
8727 while (rangeLength--) {
8728 result2[leftIndex++] = args[argsIndex++];
8732 function composeArgsRight(args, partials, holders, isCurried) {
8733 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;
8734 while (++argsIndex < rangeLength) {
8735 result2[argsIndex] = args[argsIndex];
8737 var offset = argsIndex;
8738 while (++rightIndex < rightLength) {
8739 result2[offset + rightIndex] = partials[rightIndex];
8741 while (++holdersIndex < holdersLength) {
8742 if (isUncurried || argsIndex < argsLength) {
8743 result2[offset + holders[holdersIndex]] = args[argsIndex++];
8748 function copyArray(source, array2) {
8749 var index = -1, length = source.length;
8750 array2 || (array2 = Array2(length));
8751 while (++index < length) {
8752 array2[index] = source[index];
8756 function copyObject(source, props, object, customizer) {
8757 var isNew = !object;
8758 object || (object = {});
8759 var index = -1, length = props.length;
8760 while (++index < length) {
8761 var key = props[index];
8762 var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined2;
8763 if (newValue === undefined2) {
8764 newValue = source[key];
8767 baseAssignValue(object, key, newValue);
8769 assignValue(object, key, newValue);
8774 function copySymbols(source, object) {
8775 return copyObject(source, getSymbols(source), object);
8777 function copySymbolsIn(source, object) {
8778 return copyObject(source, getSymbolsIn(source), object);
8780 function createAggregator(setter, initializer) {
8781 return function(collection, iteratee2) {
8782 var func = isArray2(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
8783 return func(collection, setter, getIteratee(iteratee2, 2), accumulator);
8786 function createAssigner(assigner) {
8787 return baseRest(function(object, sources) {
8788 var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined2, guard = length > 2 ? sources[2] : undefined2;
8789 customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : undefined2;
8790 if (guard && isIterateeCall(sources[0], sources[1], guard)) {
8791 customizer = length < 3 ? undefined2 : customizer;
8794 object = Object2(object);
8795 while (++index < length) {
8796 var source = sources[index];
8798 assigner(object, source, index, customizer);
8804 function createBaseEach(eachFunc, fromRight) {
8805 return function(collection, iteratee2) {
8806 if (collection == null) {
8809 if (!isArrayLike(collection)) {
8810 return eachFunc(collection, iteratee2);
8812 var length = collection.length, index = fromRight ? length : -1, iterable = Object2(collection);
8813 while (fromRight ? index-- : ++index < length) {
8814 if (iteratee2(iterable[index], index, iterable) === false) {
8821 function createBaseFor(fromRight) {
8822 return function(object, iteratee2, keysFunc) {
8823 var index = -1, iterable = Object2(object), props = keysFunc(object), length = props.length;
8825 var key = props[fromRight ? length : ++index];
8826 if (iteratee2(iterable[key], key, iterable) === false) {
8833 function createBind(func, bitmask, thisArg) {
8834 var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
8835 function wrapper() {
8836 var fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
8837 return fn.apply(isBind ? thisArg : this, arguments);
8841 function createCaseFirst(methodName) {
8842 return function(string) {
8843 string = toString2(string);
8844 var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined2;
8845 var chr = strSymbols ? strSymbols[0] : string.charAt(0);
8846 var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
8847 return chr[methodName]() + trailing;
8850 function createCompounder(callback) {
8851 return function(string) {
8852 return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
8855 function createCtor(Ctor) {
8857 var args = arguments;
8858 switch (args.length) {
8862 return new Ctor(args[0]);
8864 return new Ctor(args[0], args[1]);
8866 return new Ctor(args[0], args[1], args[2]);
8868 return new Ctor(args[0], args[1], args[2], args[3]);
8870 return new Ctor(args[0], args[1], args[2], args[3], args[4]);
8872 return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
8874 return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
8876 var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args);
8877 return isObject3(result2) ? result2 : thisBinding;
8880 function createCurry(func, bitmask, arity) {
8881 var Ctor = createCtor(func);
8882 function wrapper() {
8883 var length = arguments.length, args = Array2(length), index = length, placeholder = getHolder(wrapper);
8885 args[index] = arguments[index];
8887 var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
8888 length -= holders.length;
8889 if (length < arity) {
8890 return createRecurry(
8894 wrapper.placeholder,
8903 var fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
8904 return apply(fn, this, args);
8908 function createFind(findIndexFunc) {
8909 return function(collection, predicate, fromIndex) {
8910 var iterable = Object2(collection);
8911 if (!isArrayLike(collection)) {
8912 var iteratee2 = getIteratee(predicate, 3);
8913 collection = keys(collection);
8914 predicate = function(key) {
8915 return iteratee2(iterable[key], key, iterable);
8918 var index = findIndexFunc(collection, predicate, fromIndex);
8919 return index > -1 ? iterable[iteratee2 ? collection[index] : index] : undefined2;
8922 function createFlow(fromRight) {
8923 return flatRest(function(funcs) {
8924 var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru;
8929 var func = funcs[index];
8930 if (typeof func != "function") {
8931 throw new TypeError2(FUNC_ERROR_TEXT3);
8933 if (prereq && !wrapper && getFuncName(func) == "wrapper") {
8934 var wrapper = new LodashWrapper([], true);
8937 index = wrapper ? index : length;
8938 while (++index < length) {
8939 func = funcs[index];
8940 var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : undefined2;
8941 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) {
8942 wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
8944 wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
8948 var args = arguments, value = args[0];
8949 if (wrapper && args.length == 1 && isArray2(value)) {
8950 return wrapper.plant(value).value();
8952 var index2 = 0, result2 = length ? funcs[index2].apply(this, args) : value;
8953 while (++index2 < length) {
8954 result2 = funcs[index2].call(this, result2);
8960 function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) {
8961 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);
8962 function wrapper() {
8963 var length = arguments.length, args = Array2(length), index = length;
8965 args[index] = arguments[index];
8968 var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
8971 args = composeArgs(args, partials, holders, isCurried);
8973 if (partialsRight) {
8974 args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
8976 length -= holdersCount;
8977 if (isCurried && length < arity) {
8978 var newHolders = replaceHolders(args, placeholder);
8979 return createRecurry(
8983 wrapper.placeholder,
8992 var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
8993 length = args.length;
8995 args = reorder(args, argPos);
8996 } else if (isFlip && length > 1) {
8999 if (isAry && ary2 < length) {
9002 if (this && this !== root3 && this instanceof wrapper) {
9003 fn = Ctor || createCtor(fn);
9005 return fn.apply(thisBinding, args);
9009 function createInverter(setter, toIteratee) {
9010 return function(object, iteratee2) {
9011 return baseInverter(object, setter, toIteratee(iteratee2), {});
9014 function createMathOperation(operator, defaultValue) {
9015 return function(value, other) {
9017 if (value === undefined2 && other === undefined2) {
9018 return defaultValue;
9020 if (value !== undefined2) {
9023 if (other !== undefined2) {
9024 if (result2 === undefined2) {
9027 if (typeof value == "string" || typeof other == "string") {
9028 value = baseToString2(value);
9029 other = baseToString2(other);
9031 value = baseToNumber(value);
9032 other = baseToNumber(other);
9034 result2 = operator(value, other);
9039 function createOver(arrayFunc) {
9040 return flatRest(function(iteratees) {
9041 iteratees = arrayMap2(iteratees, baseUnary(getIteratee()));
9042 return baseRest(function(args) {
9044 return arrayFunc(iteratees, function(iteratee2) {
9045 return apply(iteratee2, thisArg, args);
9050 function createPadding(length, chars) {
9051 chars = chars === undefined2 ? " " : baseToString2(chars);
9052 var charsLength = chars.length;
9053 if (charsLength < 2) {
9054 return charsLength ? baseRepeat(chars, length) : chars;
9056 var result2 = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
9057 return hasUnicode(chars) ? castSlice(stringToArray(result2), 0, length).join("") : result2.slice(0, length);
9059 function createPartial(func, bitmask, thisArg, partials) {
9060 var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
9061 function wrapper() {
9062 var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
9063 while (++leftIndex < leftLength) {
9064 args[leftIndex] = partials[leftIndex];
9066 while (argsLength--) {
9067 args[leftIndex++] = arguments[++argsIndex];
9069 return apply(fn, isBind ? thisArg : this, args);
9073 function createRange(fromRight) {
9074 return function(start2, end, step) {
9075 if (step && typeof step != "number" && isIterateeCall(start2, end, step)) {
9076 end = step = undefined2;
9078 start2 = toFinite(start2);
9079 if (end === undefined2) {
9083 end = toFinite(end);
9085 step = step === undefined2 ? start2 < end ? 1 : -1 : toFinite(step);
9086 return baseRange(start2, end, step, fromRight);
9089 function createRelationalOperation(operator) {
9090 return function(value, other) {
9091 if (!(typeof value == "string" && typeof other == "string")) {
9092 value = toNumber2(value);
9093 other = toNumber2(other);
9095 return operator(value, other);
9098 function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) {
9099 var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined2, newHoldersRight = isCurry ? undefined2 : holders, newPartials = isCurry ? partials : undefined2, newPartialsRight = isCurry ? undefined2 : partials;
9100 bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG;
9101 bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
9102 if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
9103 bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
9117 var result2 = wrapFunc.apply(undefined2, newData);
9118 if (isLaziable(func)) {
9119 setData(result2, newData);
9121 result2.placeholder = placeholder;
9122 return setWrapToString(result2, func, bitmask);
9124 function createRound(methodName) {
9125 var func = Math2[methodName];
9126 return function(number3, precision2) {
9127 number3 = toNumber2(number3);
9128 precision2 = precision2 == null ? 0 : nativeMin2(toInteger(precision2), 292);
9129 if (precision2 && nativeIsFinite(number3)) {
9130 var pair2 = (toString2(number3) + "e").split("e"), value = func(pair2[0] + "e" + (+pair2[1] + precision2));
9131 pair2 = (toString2(value) + "e").split("e");
9132 return +(pair2[0] + "e" + (+pair2[1] - precision2));
9134 return func(number3);
9137 var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY2) ? noop3 : function(values2) {
9138 return new Set2(values2);
9140 function createToPairs(keysFunc) {
9141 return function(object) {
9142 var tag = getTag(object);
9143 if (tag == mapTag) {
9144 return mapToArray(object);
9146 if (tag == setTag) {
9147 return setToPairs(object);
9149 return baseToPairs(object, keysFunc(object));
9152 function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) {
9153 var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
9154 if (!isBindKey && typeof func != "function") {
9155 throw new TypeError2(FUNC_ERROR_TEXT3);
9157 var length = partials ? partials.length : 0;
9159 bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
9160 partials = holders = undefined2;
9162 ary2 = ary2 === undefined2 ? ary2 : nativeMax2(toInteger(ary2), 0);
9163 arity = arity === undefined2 ? arity : toInteger(arity);
9164 length -= holders ? holders.length : 0;
9165 if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
9166 var partialsRight = partials, holdersRight = holders;
9167 partials = holders = undefined2;
9169 var data = isBindKey ? undefined2 : getData(func);
9183 mergeData(newData, data);
9186 bitmask = newData[1];
9187 thisArg = newData[2];
9188 partials = newData[3];
9189 holders = newData[4];
9190 arity = newData[9] = newData[9] === undefined2 ? isBindKey ? 0 : func.length : nativeMax2(newData[9] - length, 0);
9191 if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
9192 bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
9194 if (!bitmask || bitmask == WRAP_BIND_FLAG) {
9195 var result2 = createBind(func, bitmask, thisArg);
9196 } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
9197 result2 = createCurry(func, bitmask, arity);
9198 } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
9199 result2 = createPartial(func, bitmask, thisArg, partials);
9201 result2 = createHybrid.apply(undefined2, newData);
9203 var setter = data ? baseSetData : setData;
9204 return setWrapToString(setter(result2, newData), func, bitmask);
9206 function customDefaultsAssignIn(objValue, srcValue, key, object) {
9207 if (objValue === undefined2 || eq(objValue, objectProto3[key]) && !hasOwnProperty2.call(object, key)) {
9212 function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
9213 if (isObject3(objValue) && isObject3(srcValue)) {
9214 stack.set(srcValue, objValue);
9215 baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack);
9216 stack["delete"](srcValue);
9220 function customOmitClone(value) {
9221 return isPlainObject(value) ? undefined2 : value;
9223 function equalArrays(array2, other, bitmask, customizer, equalFunc, stack) {
9224 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array2.length, othLength = other.length;
9225 if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
9228 var arrStacked = stack.get(array2);
9229 var othStacked = stack.get(other);
9230 if (arrStacked && othStacked) {
9231 return arrStacked == other && othStacked == array2;
9233 var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined2;
9234 stack.set(array2, other);
9235 stack.set(other, array2);
9236 while (++index < arrLength) {
9237 var arrValue = array2[index], othValue = other[index];
9239 var compared = isPartial ? customizer(othValue, arrValue, index, other, array2, stack) : customizer(arrValue, othValue, index, array2, other, stack);
9241 if (compared !== undefined2) {
9249 if (!arraySome(other, function(othValue2, othIndex) {
9250 if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
9251 return seen.push(othIndex);
9257 } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
9262 stack["delete"](array2);
9263 stack["delete"](other);
9266 function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
9269 if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
9272 object = object.buffer;
9273 other = other.buffer;
9274 case arrayBufferTag:
9275 if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) {
9282 return eq(+object, +other);
9284 return object.name == other.name && object.message == other.message;
9287 return object == other + "";
9289 var convert = mapToArray;
9291 var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
9292 convert || (convert = setToArray);
9293 if (object.size != other.size && !isPartial) {
9296 var stacked = stack.get(object);
9298 return stacked == other;
9300 bitmask |= COMPARE_UNORDERED_FLAG;
9301 stack.set(object, other);
9302 var result2 = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
9303 stack["delete"](object);
9306 if (symbolValueOf) {
9307 return symbolValueOf.call(object) == symbolValueOf.call(other);
9312 function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
9313 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
9314 if (objLength != othLength && !isPartial) {
9317 var index = objLength;
9319 var key = objProps[index];
9320 if (!(isPartial ? key in other : hasOwnProperty2.call(other, key))) {
9324 var objStacked = stack.get(object);
9325 var othStacked = stack.get(other);
9326 if (objStacked && othStacked) {
9327 return objStacked == other && othStacked == object;
9330 stack.set(object, other);
9331 stack.set(other, object);
9332 var skipCtor = isPartial;
9333 while (++index < objLength) {
9334 key = objProps[index];
9335 var objValue = object[key], othValue = other[key];
9337 var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
9339 if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
9343 skipCtor || (skipCtor = key == "constructor");
9345 if (result2 && !skipCtor) {
9346 var objCtor = object.constructor, othCtor = other.constructor;
9347 if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
9351 stack["delete"](object);
9352 stack["delete"](other);
9355 function flatRest(func) {
9356 return setToString(overRest(func, undefined2, flatten2), func + "");
9358 function getAllKeys(object) {
9359 return baseGetAllKeys(object, keys, getSymbols);
9361 function getAllKeysIn(object) {
9362 return baseGetAllKeys(object, keysIn, getSymbolsIn);
9364 var getData = !metaMap ? noop3 : function(func) {
9365 return metaMap.get(func);
9367 function getFuncName(func) {
9368 var result2 = func.name + "", array2 = realNames[result2], length = hasOwnProperty2.call(realNames, result2) ? array2.length : 0;
9370 var data = array2[length], otherFunc = data.func;
9371 if (otherFunc == null || otherFunc == func) {
9377 function getHolder(func) {
9378 var object = hasOwnProperty2.call(lodash, "placeholder") ? lodash : func;
9379 return object.placeholder;
9381 function getIteratee() {
9382 var result2 = lodash.iteratee || iteratee;
9383 result2 = result2 === iteratee ? baseIteratee : result2;
9384 return arguments.length ? result2(arguments[0], arguments[1]) : result2;
9386 function getMapData(map3, key) {
9387 var data = map3.__data__;
9388 return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
9390 function getMatchData(object) {
9391 var result2 = keys(object), length = result2.length;
9393 var key = result2[length], value = object[key];
9394 result2[length] = [key, value, isStrictComparable(value)];
9398 function getNative(object, key) {
9399 var value = getValue(object, key);
9400 return baseIsNative(value) ? value : undefined2;
9402 function getRawTag2(value) {
9403 var isOwn = hasOwnProperty2.call(value, symToStringTag3), tag = value[symToStringTag3];
9405 value[symToStringTag3] = undefined2;
9406 var unmasked = true;
9409 var result2 = nativeObjectToString3.call(value);
9412 value[symToStringTag3] = tag;
9414 delete value[symToStringTag3];
9419 var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
9420 if (object == null) {
9423 object = Object2(object);
9424 return arrayFilter(nativeGetSymbols(object), function(symbol) {
9425 return propertyIsEnumerable.call(object, symbol);
9428 var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
9431 arrayPush(result2, getSymbols(object));
9432 object = getPrototype(object);
9436 var getTag = baseGetTag2;
9437 if (DataView2 && getTag(new DataView2(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
9438 getTag = function(value) {
9439 var result2 = baseGetTag2(value), Ctor = result2 == objectTag ? value.constructor : undefined2, ctorString = Ctor ? toSource(Ctor) : "";
9441 switch (ctorString) {
9442 case dataViewCtorString:
9446 case promiseCtorString:
9450 case weakMapCtorString:
9457 function getView(start2, end, transforms) {
9458 var index = -1, length = transforms.length;
9459 while (++index < length) {
9460 var data = transforms[index], size2 = data.size;
9461 switch (data.type) {
9469 end = nativeMin2(end, start2 + size2);
9472 start2 = nativeMax2(start2, end - size2);
9476 return { "start": start2, "end": end };
9478 function getWrapDetails(source) {
9479 var match = source.match(reWrapDetails);
9480 return match ? match[1].split(reSplitDetails) : [];
9482 function hasPath(object, path, hasFunc) {
9483 path = castPath(path, object);
9484 var index = -1, length = path.length, result2 = false;
9485 while (++index < length) {
9486 var key = toKey(path[index]);
9487 if (!(result2 = object != null && hasFunc(object, key))) {
9490 object = object[key];
9492 if (result2 || ++index != length) {
9495 length = object == null ? 0 : object.length;
9496 return !!length && isLength(length) && isIndex(key, length) && (isArray2(object) || isArguments(object));
9498 function initCloneArray(array2) {
9499 var length = array2.length, result2 = new array2.constructor(length);
9500 if (length && typeof array2[0] == "string" && hasOwnProperty2.call(array2, "index")) {
9501 result2.index = array2.index;
9502 result2.input = array2.input;
9506 function initCloneObject(object) {
9507 return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
9509 function initCloneByTag(object, tag, isDeep) {
9510 var Ctor = object.constructor;
9512 case arrayBufferTag:
9513 return cloneArrayBuffer(object);
9516 return new Ctor(+object);
9518 return cloneDataView(object, isDeep);
9525 case uint8ClampedTag:
9528 return cloneTypedArray(object, isDeep);
9533 return new Ctor(object);
9535 return cloneRegExp(object);
9539 return cloneSymbol(object);
9542 function insertWrapDetails(source, details) {
9543 var length = details.length;
9547 var lastIndex = length - 1;
9548 details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex];
9549 details = details.join(length > 2 ? ", " : " ");
9550 return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
9552 function isFlattenable(value) {
9553 return isArray2(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
9555 function isIndex(value, length) {
9556 var type3 = typeof value;
9557 length = length == null ? MAX_SAFE_INTEGER : length;
9558 return !!length && (type3 == "number" || type3 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
9560 function isIterateeCall(value, index, object) {
9561 if (!isObject3(object)) {
9564 var type3 = typeof index;
9565 if (type3 == "number" ? isArrayLike(object) && isIndex(index, object.length) : type3 == "string" && index in object) {
9566 return eq(object[index], value);
9570 function isKey(value, object) {
9571 if (isArray2(value)) {
9574 var type3 = typeof value;
9575 if (type3 == "number" || type3 == "symbol" || type3 == "boolean" || value == null || isSymbol2(value)) {
9578 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object);
9580 function isKeyable(value) {
9581 var type3 = typeof value;
9582 return type3 == "string" || type3 == "number" || type3 == "symbol" || type3 == "boolean" ? value !== "__proto__" : value === null;
9584 function isLaziable(func) {
9585 var funcName = getFuncName(func), other = lodash[funcName];
9586 if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
9589 if (func === other) {
9592 var data = getData(other);
9593 return !!data && func === data[0];
9595 function isMasked(func) {
9596 return !!maskSrcKey && maskSrcKey in func;
9598 var isMaskable = coreJsData ? isFunction : stubFalse;
9599 function isPrototype(value) {
9600 var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto3;
9601 return value === proto;
9603 function isStrictComparable(value) {
9604 return value === value && !isObject3(value);
9606 function matchesStrictComparable(key, srcValue) {
9607 return function(object) {
9608 if (object == null) {
9611 return object[key] === srcValue && (srcValue !== undefined2 || key in Object2(object));
9614 function memoizeCapped(func) {
9615 var result2 = memoize(func, function(key) {
9616 if (cache.size === MAX_MEMOIZE_SIZE) {
9621 var cache = result2.cache;
9624 function mergeData(data, source) {
9625 var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
9626 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;
9627 if (!(isCommon || isCombo)) {
9630 if (srcBitmask & WRAP_BIND_FLAG) {
9631 data[2] = source[2];
9632 newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
9634 var value = source[3];
9636 var partials = data[3];
9637 data[3] = partials ? composeArgs(partials, value, source[4]) : value;
9638 data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
9643 data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
9644 data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
9650 if (srcBitmask & WRAP_ARY_FLAG) {
9651 data[8] = data[8] == null ? source[8] : nativeMin2(data[8], source[8]);
9653 if (data[9] == null) {
9654 data[9] = source[9];
9656 data[0] = source[0];
9657 data[1] = newBitmask;
9660 function nativeKeysIn(object) {
9662 if (object != null) {
9663 for (var key in Object2(object)) {
9669 function objectToString2(value) {
9670 return nativeObjectToString3.call(value);
9672 function overRest(func, start2, transform3) {
9673 start2 = nativeMax2(start2 === undefined2 ? func.length - 1 : start2, 0);
9675 var args = arguments, index = -1, length = nativeMax2(args.length - start2, 0), array2 = Array2(length);
9676 while (++index < length) {
9677 array2[index] = args[start2 + index];
9680 var otherArgs = Array2(start2 + 1);
9681 while (++index < start2) {
9682 otherArgs[index] = args[index];
9684 otherArgs[start2] = transform3(array2);
9685 return apply(func, this, otherArgs);
9688 function parent(object, path) {
9689 return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
9691 function reorder(array2, indexes) {
9692 var arrLength = array2.length, length = nativeMin2(indexes.length, arrLength), oldArray = copyArray(array2);
9694 var index = indexes[length];
9695 array2[length] = isIndex(index, arrLength) ? oldArray[index] : undefined2;
9699 function safeGet(object, key) {
9700 if (key === "constructor" && typeof object[key] === "function") {
9703 if (key == "__proto__") {
9708 var setData = shortOut(baseSetData);
9709 var setTimeout2 = ctxSetTimeout || function(func, wait) {
9710 return root3.setTimeout(func, wait);
9712 var setToString = shortOut(baseSetToString);
9713 function setWrapToString(wrapper, reference, bitmask) {
9714 var source = reference + "";
9715 return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
9717 function shortOut(func) {
9718 var count = 0, lastCalled = 0;
9720 var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
9722 if (remaining > 0) {
9723 if (++count >= HOT_COUNT) {
9724 return arguments[0];
9729 return func.apply(undefined2, arguments);
9732 function shuffleSelf(array2, size2) {
9733 var index = -1, length = array2.length, lastIndex = length - 1;
9734 size2 = size2 === undefined2 ? length : size2;
9735 while (++index < size2) {
9736 var rand = baseRandom(index, lastIndex), value = array2[rand];
9737 array2[rand] = array2[index];
9738 array2[index] = value;
9740 array2.length = size2;
9743 var stringToPath = memoizeCapped(function(string) {
9745 if (string.charCodeAt(0) === 46) {
9748 string.replace(rePropName, function(match, number3, quote2, subString) {
9749 result2.push(quote2 ? subString.replace(reEscapeChar, "$1") : number3 || match);
9753 function toKey(value) {
9754 if (typeof value == "string" || isSymbol2(value)) {
9757 var result2 = value + "";
9758 return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2;
9760 function toSource(func) {
9763 return funcToString.call(func);
9773 function updateWrapDetails(details, bitmask) {
9774 arrayEach(wrapFlags, function(pair2) {
9775 var value = "_." + pair2[0];
9776 if (bitmask & pair2[1] && !arrayIncludes(details, value)) {
9777 details.push(value);
9780 return details.sort();
9782 function wrapperClone(wrapper) {
9783 if (wrapper instanceof LazyWrapper) {
9784 return wrapper.clone();
9786 var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
9787 result2.__actions__ = copyArray(wrapper.__actions__);
9788 result2.__index__ = wrapper.__index__;
9789 result2.__values__ = wrapper.__values__;
9792 function chunk(array2, size2, guard) {
9793 if (guard ? isIterateeCall(array2, size2, guard) : size2 === undefined2) {
9796 size2 = nativeMax2(toInteger(size2), 0);
9798 var length = array2 == null ? 0 : array2.length;
9799 if (!length || size2 < 1) {
9802 var index = 0, resIndex = 0, result2 = Array2(nativeCeil(length / size2));
9803 while (index < length) {
9804 result2[resIndex++] = baseSlice(array2, index, index += size2);
9808 function compact(array2) {
9809 var index = -1, length = array2 == null ? 0 : array2.length, resIndex = 0, result2 = [];
9810 while (++index < length) {
9811 var value = array2[index];
9813 result2[resIndex++] = value;
9819 var length = arguments.length;
9823 var args = Array2(length - 1), array2 = arguments[0], index = length;
9825 args[index - 1] = arguments[index];
9827 return arrayPush(isArray2(array2) ? copyArray(array2) : [array2], baseFlatten(args, 1));
9829 var difference = baseRest(function(array2, values2) {
9830 return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true)) : [];
9832 var differenceBy = baseRest(function(array2, values2) {
9833 var iteratee2 = last(values2);
9834 if (isArrayLikeObject(iteratee2)) {
9835 iteratee2 = undefined2;
9837 return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)) : [];
9839 var differenceWith = baseRest(function(array2, values2) {
9840 var comparator = last(values2);
9841 if (isArrayLikeObject(comparator)) {
9842 comparator = undefined2;
9844 return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true), undefined2, comparator) : [];
9846 function drop(array2, n2, guard) {
9847 var length = array2 == null ? 0 : array2.length;
9851 n2 = guard || n2 === undefined2 ? 1 : toInteger(n2);
9852 return baseSlice(array2, n2 < 0 ? 0 : n2, length);
9854 function dropRight(array2, n2, guard) {
9855 var length = array2 == null ? 0 : array2.length;
9859 n2 = guard || n2 === undefined2 ? 1 : toInteger(n2);
9861 return baseSlice(array2, 0, n2 < 0 ? 0 : n2);
9863 function dropRightWhile(array2, predicate) {
9864 return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), true, true) : [];
9866 function dropWhile(array2, predicate) {
9867 return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), true) : [];
9869 function fill(array2, value, start2, end) {
9870 var length = array2 == null ? 0 : array2.length;
9874 if (start2 && typeof start2 != "number" && isIterateeCall(array2, value, start2)) {
9878 return baseFill(array2, value, start2, end);
9880 function findIndex(array2, predicate, fromIndex) {
9881 var length = array2 == null ? 0 : array2.length;
9885 var index = fromIndex == null ? 0 : toInteger(fromIndex);
9887 index = nativeMax2(length + index, 0);
9889 return baseFindIndex(array2, getIteratee(predicate, 3), index);
9891 function findLastIndex(array2, predicate, fromIndex) {
9892 var length = array2 == null ? 0 : array2.length;
9896 var index = length - 1;
9897 if (fromIndex !== undefined2) {
9898 index = toInteger(fromIndex);
9899 index = fromIndex < 0 ? nativeMax2(length + index, 0) : nativeMin2(index, length - 1);
9901 return baseFindIndex(array2, getIteratee(predicate, 3), index, true);
9903 function flatten2(array2) {
9904 var length = array2 == null ? 0 : array2.length;
9905 return length ? baseFlatten(array2, 1) : [];
9907 function flattenDeep(array2) {
9908 var length = array2 == null ? 0 : array2.length;
9909 return length ? baseFlatten(array2, INFINITY2) : [];
9911 function flattenDepth(array2, depth) {
9912 var length = array2 == null ? 0 : array2.length;
9916 depth = depth === undefined2 ? 1 : toInteger(depth);
9917 return baseFlatten(array2, depth);
9919 function fromPairs(pairs) {
9920 var index = -1, length = pairs == null ? 0 : pairs.length, result2 = {};
9921 while (++index < length) {
9922 var pair2 = pairs[index];
9923 result2[pair2[0]] = pair2[1];
9927 function head(array2) {
9928 return array2 && array2.length ? array2[0] : undefined2;
9930 function indexOf(array2, value, fromIndex) {
9931 var length = array2 == null ? 0 : array2.length;
9935 var index = fromIndex == null ? 0 : toInteger(fromIndex);
9937 index = nativeMax2(length + index, 0);
9939 return baseIndexOf(array2, value, index);
9941 function initial(array2) {
9942 var length = array2 == null ? 0 : array2.length;
9943 return length ? baseSlice(array2, 0, -1) : [];
9945 var intersection = baseRest(function(arrays) {
9946 var mapped = arrayMap2(arrays, castArrayLikeObject);
9947 return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
9949 var intersectionBy = baseRest(function(arrays) {
9950 var iteratee2 = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
9951 if (iteratee2 === last(mapped)) {
9952 iteratee2 = undefined2;
9956 return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : [];
9958 var intersectionWith = baseRest(function(arrays) {
9959 var comparator = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
9960 comparator = typeof comparator == "function" ? comparator : undefined2;
9964 return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
9966 function join(array2, separator) {
9967 return array2 == null ? "" : nativeJoin.call(array2, separator);
9969 function last(array2) {
9970 var length = array2 == null ? 0 : array2.length;
9971 return length ? array2[length - 1] : undefined2;
9973 function lastIndexOf(array2, value, fromIndex) {
9974 var length = array2 == null ? 0 : array2.length;
9979 if (fromIndex !== undefined2) {
9980 index = toInteger(fromIndex);
9981 index = index < 0 ? nativeMax2(length + index, 0) : nativeMin2(index, length - 1);
9983 return value === value ? strictLastIndexOf(array2, value, index) : baseFindIndex(array2, baseIsNaN, index, true);
9985 function nth(array2, n2) {
9986 return array2 && array2.length ? baseNth(array2, toInteger(n2)) : undefined2;
9988 var pull = baseRest(pullAll);
9989 function pullAll(array2, values2) {
9990 return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
9992 function pullAllBy(array2, values2, iteratee2) {
9993 return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2, getIteratee(iteratee2, 2)) : array2;
9995 function pullAllWith(array2, values2, comparator) {
9996 return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2, undefined2, comparator) : array2;
9998 var pullAt = flatRest(function(array2, indexes) {
9999 var length = array2 == null ? 0 : array2.length, result2 = baseAt(array2, indexes);
10000 basePullAt(array2, arrayMap2(indexes, function(index) {
10001 return isIndex(index, length) ? +index : index;
10002 }).sort(compareAscending));
10005 function remove2(array2, predicate) {
10007 if (!(array2 && array2.length)) {
10010 var index = -1, indexes = [], length = array2.length;
10011 predicate = getIteratee(predicate, 3);
10012 while (++index < length) {
10013 var value = array2[index];
10014 if (predicate(value, index, array2)) {
10015 result2.push(value);
10016 indexes.push(index);
10019 basePullAt(array2, indexes);
10022 function reverse(array2) {
10023 return array2 == null ? array2 : nativeReverse.call(array2);
10025 function slice(array2, start2, end) {
10026 var length = array2 == null ? 0 : array2.length;
10030 if (end && typeof end != "number" && isIterateeCall(array2, start2, end)) {
10034 start2 = start2 == null ? 0 : toInteger(start2);
10035 end = end === undefined2 ? length : toInteger(end);
10037 return baseSlice(array2, start2, end);
10039 function sortedIndex(array2, value) {
10040 return baseSortedIndex(array2, value);
10042 function sortedIndexBy(array2, value, iteratee2) {
10043 return baseSortedIndexBy(array2, value, getIteratee(iteratee2, 2));
10045 function sortedIndexOf(array2, value) {
10046 var length = array2 == null ? 0 : array2.length;
10048 var index = baseSortedIndex(array2, value);
10049 if (index < length && eq(array2[index], value)) {
10055 function sortedLastIndex(array2, value) {
10056 return baseSortedIndex(array2, value, true);
10058 function sortedLastIndexBy(array2, value, iteratee2) {
10059 return baseSortedIndexBy(array2, value, getIteratee(iteratee2, 2), true);
10061 function sortedLastIndexOf(array2, value) {
10062 var length = array2 == null ? 0 : array2.length;
10064 var index = baseSortedIndex(array2, value, true) - 1;
10065 if (eq(array2[index], value)) {
10071 function sortedUniq(array2) {
10072 return array2 && array2.length ? baseSortedUniq(array2) : [];
10074 function sortedUniqBy(array2, iteratee2) {
10075 return array2 && array2.length ? baseSortedUniq(array2, getIteratee(iteratee2, 2)) : [];
10077 function tail(array2) {
10078 var length = array2 == null ? 0 : array2.length;
10079 return length ? baseSlice(array2, 1, length) : [];
10081 function take(array2, n2, guard) {
10082 if (!(array2 && array2.length)) {
10085 n2 = guard || n2 === undefined2 ? 1 : toInteger(n2);
10086 return baseSlice(array2, 0, n2 < 0 ? 0 : n2);
10088 function takeRight(array2, n2, guard) {
10089 var length = array2 == null ? 0 : array2.length;
10093 n2 = guard || n2 === undefined2 ? 1 : toInteger(n2);
10095 return baseSlice(array2, n2 < 0 ? 0 : n2, length);
10097 function takeRightWhile(array2, predicate) {
10098 return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), false, true) : [];
10100 function takeWhile(array2, predicate) {
10101 return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3)) : [];
10103 var union = baseRest(function(arrays) {
10104 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
10106 var unionBy = baseRest(function(arrays) {
10107 var iteratee2 = last(arrays);
10108 if (isArrayLikeObject(iteratee2)) {
10109 iteratee2 = undefined2;
10111 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2));
10113 var unionWith = baseRest(function(arrays) {
10114 var comparator = last(arrays);
10115 comparator = typeof comparator == "function" ? comparator : undefined2;
10116 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined2, comparator);
10118 function uniq(array2) {
10119 return array2 && array2.length ? baseUniq(array2) : [];
10121 function uniqBy(array2, iteratee2) {
10122 return array2 && array2.length ? baseUniq(array2, getIteratee(iteratee2, 2)) : [];
10124 function uniqWith(array2, comparator) {
10125 comparator = typeof comparator == "function" ? comparator : undefined2;
10126 return array2 && array2.length ? baseUniq(array2, undefined2, comparator) : [];
10128 function unzip(array2) {
10129 if (!(array2 && array2.length)) {
10133 array2 = arrayFilter(array2, function(group) {
10134 if (isArrayLikeObject(group)) {
10135 length = nativeMax2(group.length, length);
10139 return baseTimes(length, function(index) {
10140 return arrayMap2(array2, baseProperty(index));
10143 function unzipWith(array2, iteratee2) {
10144 if (!(array2 && array2.length)) {
10147 var result2 = unzip(array2);
10148 if (iteratee2 == null) {
10151 return arrayMap2(result2, function(group) {
10152 return apply(iteratee2, undefined2, group);
10155 var without = baseRest(function(array2, values2) {
10156 return isArrayLikeObject(array2) ? baseDifference(array2, values2) : [];
10158 var xor = baseRest(function(arrays) {
10159 return baseXor(arrayFilter(arrays, isArrayLikeObject));
10161 var xorBy = baseRest(function(arrays) {
10162 var iteratee2 = last(arrays);
10163 if (isArrayLikeObject(iteratee2)) {
10164 iteratee2 = undefined2;
10166 return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee2, 2));
10168 var xorWith = baseRest(function(arrays) {
10169 var comparator = last(arrays);
10170 comparator = typeof comparator == "function" ? comparator : undefined2;
10171 return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined2, comparator);
10173 var zip = baseRest(unzip);
10174 function zipObject(props, values2) {
10175 return baseZipObject(props || [], values2 || [], assignValue);
10177 function zipObjectDeep(props, values2) {
10178 return baseZipObject(props || [], values2 || [], baseSet);
10180 var zipWith = baseRest(function(arrays) {
10181 var length = arrays.length, iteratee2 = length > 1 ? arrays[length - 1] : undefined2;
10182 iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined2;
10183 return unzipWith(arrays, iteratee2);
10185 function chain(value) {
10186 var result2 = lodash(value);
10187 result2.__chain__ = true;
10190 function tap(value, interceptor) {
10191 interceptor(value);
10194 function thru(value, interceptor) {
10195 return interceptor(value);
10197 var wrapperAt = flatRest(function(paths) {
10198 var length = paths.length, start2 = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
10199 return baseAt(object, paths);
10201 if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start2)) {
10202 return this.thru(interceptor);
10204 value = value.slice(start2, +start2 + (length ? 1 : 0));
10205 value.__actions__.push({
10207 "args": [interceptor],
10208 "thisArg": undefined2
10210 return new LodashWrapper(value, this.__chain__).thru(function(array2) {
10211 if (length && !array2.length) {
10212 array2.push(undefined2);
10217 function wrapperChain() {
10218 return chain(this);
10220 function wrapperCommit() {
10221 return new LodashWrapper(this.value(), this.__chain__);
10223 function wrapperNext() {
10224 if (this.__values__ === undefined2) {
10225 this.__values__ = toArray(this.value());
10227 var done = this.__index__ >= this.__values__.length, value = done ? undefined2 : this.__values__[this.__index__++];
10228 return { "done": done, "value": value };
10230 function wrapperToIterator() {
10233 function wrapperPlant(value) {
10234 var result2, parent2 = this;
10235 while (parent2 instanceof baseLodash) {
10236 var clone2 = wrapperClone(parent2);
10237 clone2.__index__ = 0;
10238 clone2.__values__ = undefined2;
10240 previous.__wrapped__ = clone2;
10244 var previous = clone2;
10245 parent2 = parent2.__wrapped__;
10247 previous.__wrapped__ = value;
10250 function wrapperReverse() {
10251 var value = this.__wrapped__;
10252 if (value instanceof LazyWrapper) {
10253 var wrapped = value;
10254 if (this.__actions__.length) {
10255 wrapped = new LazyWrapper(this);
10257 wrapped = wrapped.reverse();
10258 wrapped.__actions__.push({
10261 "thisArg": undefined2
10263 return new LodashWrapper(wrapped, this.__chain__);
10265 return this.thru(reverse);
10267 function wrapperValue() {
10268 return baseWrapperValue(this.__wrapped__, this.__actions__);
10270 var countBy = createAggregator(function(result2, value, key) {
10271 if (hasOwnProperty2.call(result2, key)) {
10274 baseAssignValue(result2, key, 1);
10277 function every(collection, predicate, guard) {
10278 var func = isArray2(collection) ? arrayEvery : baseEvery;
10279 if (guard && isIterateeCall(collection, predicate, guard)) {
10280 predicate = undefined2;
10282 return func(collection, getIteratee(predicate, 3));
10284 function filter2(collection, predicate) {
10285 var func = isArray2(collection) ? arrayFilter : baseFilter;
10286 return func(collection, getIteratee(predicate, 3));
10288 var find2 = createFind(findIndex);
10289 var findLast = createFind(findLastIndex);
10290 function flatMap(collection, iteratee2) {
10291 return baseFlatten(map2(collection, iteratee2), 1);
10293 function flatMapDeep(collection, iteratee2) {
10294 return baseFlatten(map2(collection, iteratee2), INFINITY2);
10296 function flatMapDepth(collection, iteratee2, depth) {
10297 depth = depth === undefined2 ? 1 : toInteger(depth);
10298 return baseFlatten(map2(collection, iteratee2), depth);
10300 function forEach(collection, iteratee2) {
10301 var func = isArray2(collection) ? arrayEach : baseEach;
10302 return func(collection, getIteratee(iteratee2, 3));
10304 function forEachRight(collection, iteratee2) {
10305 var func = isArray2(collection) ? arrayEachRight : baseEachRight;
10306 return func(collection, getIteratee(iteratee2, 3));
10308 var groupBy = createAggregator(function(result2, value, key) {
10309 if (hasOwnProperty2.call(result2, key)) {
10310 result2[key].push(value);
10312 baseAssignValue(result2, key, [value]);
10315 function includes(collection, value, fromIndex, guard) {
10316 collection = isArrayLike(collection) ? collection : values(collection);
10317 fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
10318 var length = collection.length;
10319 if (fromIndex < 0) {
10320 fromIndex = nativeMax2(length + fromIndex, 0);
10322 return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
10324 var invokeMap = baseRest(function(collection, path, args) {
10325 var index = -1, isFunc = typeof path == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : [];
10326 baseEach(collection, function(value) {
10327 result2[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
10331 var keyBy = createAggregator(function(result2, value, key) {
10332 baseAssignValue(result2, key, value);
10334 function map2(collection, iteratee2) {
10335 var func = isArray2(collection) ? arrayMap2 : baseMap;
10336 return func(collection, getIteratee(iteratee2, 3));
10338 function orderBy(collection, iteratees, orders, guard) {
10339 if (collection == null) {
10342 if (!isArray2(iteratees)) {
10343 iteratees = iteratees == null ? [] : [iteratees];
10345 orders = guard ? undefined2 : orders;
10346 if (!isArray2(orders)) {
10347 orders = orders == null ? [] : [orders];
10349 return baseOrderBy(collection, iteratees, orders);
10351 var partition = createAggregator(function(result2, value, key) {
10352 result2[key ? 0 : 1].push(value);
10356 function reduce(collection, iteratee2, accumulator) {
10357 var func = isArray2(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
10358 return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach);
10360 function reduceRight(collection, iteratee2, accumulator) {
10361 var func = isArray2(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
10362 return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight);
10364 function reject(collection, predicate) {
10365 var func = isArray2(collection) ? arrayFilter : baseFilter;
10366 return func(collection, negate(getIteratee(predicate, 3)));
10368 function sample(collection) {
10369 var func = isArray2(collection) ? arraySample : baseSample;
10370 return func(collection);
10372 function sampleSize(collection, n2, guard) {
10373 if (guard ? isIterateeCall(collection, n2, guard) : n2 === undefined2) {
10376 n2 = toInteger(n2);
10378 var func = isArray2(collection) ? arraySampleSize : baseSampleSize;
10379 return func(collection, n2);
10381 function shuffle(collection) {
10382 var func = isArray2(collection) ? arrayShuffle : baseShuffle;
10383 return func(collection);
10385 function size(collection) {
10386 if (collection == null) {
10389 if (isArrayLike(collection)) {
10390 return isString(collection) ? stringSize(collection) : collection.length;
10392 var tag = getTag(collection);
10393 if (tag == mapTag || tag == setTag) {
10394 return collection.size;
10396 return baseKeys(collection).length;
10398 function some(collection, predicate, guard) {
10399 var func = isArray2(collection) ? arraySome : baseSome;
10400 if (guard && isIterateeCall(collection, predicate, guard)) {
10401 predicate = undefined2;
10403 return func(collection, getIteratee(predicate, 3));
10405 var sortBy = baseRest(function(collection, iteratees) {
10406 if (collection == null) {
10409 var length = iteratees.length;
10410 if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
10412 } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
10413 iteratees = [iteratees[0]];
10415 return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
10417 var now3 = ctxNow || function() {
10418 return root3.Date.now();
10420 function after(n2, func) {
10421 if (typeof func != "function") {
10422 throw new TypeError2(FUNC_ERROR_TEXT3);
10424 n2 = toInteger(n2);
10425 return function() {
10427 return func.apply(this, arguments);
10431 function ary(func, n2, guard) {
10432 n2 = guard ? undefined2 : n2;
10433 n2 = func && n2 == null ? func.length : n2;
10434 return createWrap(func, WRAP_ARY_FLAG, undefined2, undefined2, undefined2, undefined2, n2);
10436 function before(n2, func) {
10438 if (typeof func != "function") {
10439 throw new TypeError2(FUNC_ERROR_TEXT3);
10441 n2 = toInteger(n2);
10442 return function() {
10444 result2 = func.apply(this, arguments);
10452 var bind = baseRest(function(func, thisArg, partials) {
10453 var bitmask = WRAP_BIND_FLAG;
10454 if (partials.length) {
10455 var holders = replaceHolders(partials, getHolder(bind));
10456 bitmask |= WRAP_PARTIAL_FLAG;
10458 return createWrap(func, bitmask, thisArg, partials, holders);
10460 var bindKey2 = baseRest(function(object, key, partials) {
10461 var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
10462 if (partials.length) {
10463 var holders = replaceHolders(partials, getHolder(bindKey2));
10464 bitmask |= WRAP_PARTIAL_FLAG;
10466 return createWrap(key, bitmask, object, partials, holders);
10468 function curry(func, arity, guard) {
10469 arity = guard ? undefined2 : arity;
10470 var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
10471 result2.placeholder = curry.placeholder;
10474 function curryRight(func, arity, guard) {
10475 arity = guard ? undefined2 : arity;
10476 var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
10477 result2.placeholder = curryRight.placeholder;
10480 function debounce2(func, wait, options2) {
10481 var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
10482 if (typeof func != "function") {
10483 throw new TypeError2(FUNC_ERROR_TEXT3);
10485 wait = toNumber2(wait) || 0;
10486 if (isObject3(options2)) {
10487 leading = !!options2.leading;
10488 maxing = "maxWait" in options2;
10489 maxWait = maxing ? nativeMax2(toNumber2(options2.maxWait) || 0, wait) : maxWait;
10490 trailing = "trailing" in options2 ? !!options2.trailing : trailing;
10492 function invokeFunc(time) {
10493 var args = lastArgs, thisArg = lastThis;
10494 lastArgs = lastThis = undefined2;
10495 lastInvokeTime = time;
10496 result2 = func.apply(thisArg, args);
10499 function leadingEdge(time) {
10500 lastInvokeTime = time;
10501 timerId = setTimeout2(timerExpired, wait);
10502 return leading ? invokeFunc(time) : result2;
10504 function remainingWait(time) {
10505 var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
10506 return maxing ? nativeMin2(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
10508 function shouldInvoke(time) {
10509 var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
10510 return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
10512 function timerExpired() {
10514 if (shouldInvoke(time)) {
10515 return trailingEdge(time);
10517 timerId = setTimeout2(timerExpired, remainingWait(time));
10519 function trailingEdge(time) {
10520 timerId = undefined2;
10521 if (trailing && lastArgs) {
10522 return invokeFunc(time);
10524 lastArgs = lastThis = undefined2;
10527 function cancel() {
10528 if (timerId !== undefined2) {
10529 clearTimeout2(timerId);
10531 lastInvokeTime = 0;
10532 lastArgs = lastCallTime = lastThis = timerId = undefined2;
10535 return timerId === undefined2 ? result2 : trailingEdge(now3());
10537 function debounced() {
10538 var time = now3(), isInvoking = shouldInvoke(time);
10539 lastArgs = arguments;
10541 lastCallTime = time;
10543 if (timerId === undefined2) {
10544 return leadingEdge(lastCallTime);
10547 clearTimeout2(timerId);
10548 timerId = setTimeout2(timerExpired, wait);
10549 return invokeFunc(lastCallTime);
10552 if (timerId === undefined2) {
10553 timerId = setTimeout2(timerExpired, wait);
10557 debounced.cancel = cancel;
10558 debounced.flush = flush;
10561 var defer = baseRest(function(func, args) {
10562 return baseDelay(func, 1, args);
10564 var delay = baseRest(function(func, wait, args) {
10565 return baseDelay(func, toNumber2(wait) || 0, args);
10567 function flip(func) {
10568 return createWrap(func, WRAP_FLIP_FLAG);
10570 function memoize(func, resolver) {
10571 if (typeof func != "function" || resolver != null && typeof resolver != "function") {
10572 throw new TypeError2(FUNC_ERROR_TEXT3);
10574 var memoized = function() {
10575 var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
10576 if (cache.has(key)) {
10577 return cache.get(key);
10579 var result2 = func.apply(this, args);
10580 memoized.cache = cache.set(key, result2) || cache;
10583 memoized.cache = new (memoize.Cache || MapCache)();
10586 memoize.Cache = MapCache;
10587 function negate(predicate) {
10588 if (typeof predicate != "function") {
10589 throw new TypeError2(FUNC_ERROR_TEXT3);
10591 return function() {
10592 var args = arguments;
10593 switch (args.length) {
10595 return !predicate.call(this);
10597 return !predicate.call(this, args[0]);
10599 return !predicate.call(this, args[0], args[1]);
10601 return !predicate.call(this, args[0], args[1], args[2]);
10603 return !predicate.apply(this, args);
10606 function once(func) {
10607 return before(2, func);
10609 var overArgs = castRest(function(func, transforms) {
10610 transforms = transforms.length == 1 && isArray2(transforms[0]) ? arrayMap2(transforms[0], baseUnary(getIteratee())) : arrayMap2(baseFlatten(transforms, 1), baseUnary(getIteratee()));
10611 var funcsLength = transforms.length;
10612 return baseRest(function(args) {
10613 var index = -1, length = nativeMin2(args.length, funcsLength);
10614 while (++index < length) {
10615 args[index] = transforms[index].call(this, args[index]);
10617 return apply(func, this, args);
10620 var partial = baseRest(function(func, partials) {
10621 var holders = replaceHolders(partials, getHolder(partial));
10622 return createWrap(func, WRAP_PARTIAL_FLAG, undefined2, partials, holders);
10624 var partialRight = baseRest(function(func, partials) {
10625 var holders = replaceHolders(partials, getHolder(partialRight));
10626 return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders);
10628 var rearg = flatRest(function(func, indexes) {
10629 return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes);
10631 function rest(func, start2) {
10632 if (typeof func != "function") {
10633 throw new TypeError2(FUNC_ERROR_TEXT3);
10635 start2 = start2 === undefined2 ? start2 : toInteger(start2);
10636 return baseRest(func, start2);
10638 function spread(func, start2) {
10639 if (typeof func != "function") {
10640 throw new TypeError2(FUNC_ERROR_TEXT3);
10642 start2 = start2 == null ? 0 : nativeMax2(toInteger(start2), 0);
10643 return baseRest(function(args) {
10644 var array2 = args[start2], otherArgs = castSlice(args, 0, start2);
10646 arrayPush(otherArgs, array2);
10648 return apply(func, this, otherArgs);
10651 function throttle2(func, wait, options2) {
10652 var leading = true, trailing = true;
10653 if (typeof func != "function") {
10654 throw new TypeError2(FUNC_ERROR_TEXT3);
10656 if (isObject3(options2)) {
10657 leading = "leading" in options2 ? !!options2.leading : leading;
10658 trailing = "trailing" in options2 ? !!options2.trailing : trailing;
10660 return debounce2(func, wait, {
10661 "leading": leading,
10663 "trailing": trailing
10666 function unary(func) {
10667 return ary(func, 1);
10669 function wrap2(value, wrapper) {
10670 return partial(castFunction(wrapper), value);
10672 function castArray() {
10673 if (!arguments.length) {
10676 var value = arguments[0];
10677 return isArray2(value) ? value : [value];
10679 function clone(value) {
10680 return baseClone(value, CLONE_SYMBOLS_FLAG);
10682 function cloneWith(value, customizer) {
10683 customizer = typeof customizer == "function" ? customizer : undefined2;
10684 return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
10686 function cloneDeep(value) {
10687 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
10689 function cloneDeepWith(value, customizer) {
10690 customizer = typeof customizer == "function" ? customizer : undefined2;
10691 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
10693 function conformsTo(object, source) {
10694 return source == null || baseConformsTo(object, source, keys(source));
10696 function eq(value, other) {
10697 return value === other || value !== value && other !== other;
10699 var gt = createRelationalOperation(baseGt);
10700 var gte = createRelationalOperation(function(value, other) {
10701 return value >= other;
10703 var isArguments = baseIsArguments(function() {
10705 }()) ? baseIsArguments : function(value) {
10706 return isObjectLike2(value) && hasOwnProperty2.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
10708 var isArray2 = Array2.isArray;
10709 var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
10710 function isArrayLike(value) {
10711 return value != null && isLength(value.length) && !isFunction(value);
10713 function isArrayLikeObject(value) {
10714 return isObjectLike2(value) && isArrayLike(value);
10716 function isBoolean(value) {
10717 return value === true || value === false || isObjectLike2(value) && baseGetTag2(value) == boolTag;
10719 var isBuffer = nativeIsBuffer || stubFalse;
10720 var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
10721 function isElement2(value) {
10722 return isObjectLike2(value) && value.nodeType === 1 && !isPlainObject(value);
10724 function isEmpty(value) {
10725 if (value == null) {
10728 if (isArrayLike(value) && (isArray2(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
10729 return !value.length;
10731 var tag = getTag(value);
10732 if (tag == mapTag || tag == setTag) {
10733 return !value.size;
10735 if (isPrototype(value)) {
10736 return !baseKeys(value).length;
10738 for (var key in value) {
10739 if (hasOwnProperty2.call(value, key)) {
10745 function isEqual(value, other) {
10746 return baseIsEqual(value, other);
10748 function isEqualWith(value, other, customizer) {
10749 customizer = typeof customizer == "function" ? customizer : undefined2;
10750 var result2 = customizer ? customizer(value, other) : undefined2;
10751 return result2 === undefined2 ? baseIsEqual(value, other, undefined2, customizer) : !!result2;
10753 function isError(value) {
10754 if (!isObjectLike2(value)) {
10757 var tag = baseGetTag2(value);
10758 return tag == errorTag || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
10760 function isFinite2(value) {
10761 return typeof value == "number" && nativeIsFinite(value);
10763 function isFunction(value) {
10764 if (!isObject3(value)) {
10767 var tag = baseGetTag2(value);
10768 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
10770 function isInteger(value) {
10771 return typeof value == "number" && value == toInteger(value);
10773 function isLength(value) {
10774 return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
10776 function isObject3(value) {
10777 var type3 = typeof value;
10778 return value != null && (type3 == "object" || type3 == "function");
10780 function isObjectLike2(value) {
10781 return value != null && typeof value == "object";
10783 var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
10784 function isMatch(object, source) {
10785 return object === source || baseIsMatch(object, source, getMatchData(source));
10787 function isMatchWith(object, source, customizer) {
10788 customizer = typeof customizer == "function" ? customizer : undefined2;
10789 return baseIsMatch(object, source, getMatchData(source), customizer);
10791 function isNaN2(value) {
10792 return isNumber2(value) && value != +value;
10794 function isNative(value) {
10795 if (isMaskable(value)) {
10796 throw new Error2(CORE_ERROR_TEXT);
10798 return baseIsNative(value);
10800 function isNull(value) {
10801 return value === null;
10803 function isNil(value) {
10804 return value == null;
10806 function isNumber2(value) {
10807 return typeof value == "number" || isObjectLike2(value) && baseGetTag2(value) == numberTag;
10809 function isPlainObject(value) {
10810 if (!isObjectLike2(value) || baseGetTag2(value) != objectTag) {
10813 var proto = getPrototype(value);
10814 if (proto === null) {
10817 var Ctor = hasOwnProperty2.call(proto, "constructor") && proto.constructor;
10818 return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
10820 var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
10821 function isSafeInteger(value) {
10822 return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
10824 var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
10825 function isString(value) {
10826 return typeof value == "string" || !isArray2(value) && isObjectLike2(value) && baseGetTag2(value) == stringTag;
10828 function isSymbol2(value) {
10829 return typeof value == "symbol" || isObjectLike2(value) && baseGetTag2(value) == symbolTag2;
10831 var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
10832 function isUndefined(value) {
10833 return value === undefined2;
10835 function isWeakMap(value) {
10836 return isObjectLike2(value) && getTag(value) == weakMapTag;
10838 function isWeakSet(value) {
10839 return isObjectLike2(value) && baseGetTag2(value) == weakSetTag;
10841 var lt = createRelationalOperation(baseLt);
10842 var lte = createRelationalOperation(function(value, other) {
10843 return value <= other;
10845 function toArray(value) {
10849 if (isArrayLike(value)) {
10850 return isString(value) ? stringToArray(value) : copyArray(value);
10852 if (symIterator && value[symIterator]) {
10853 return iteratorToArray(value[symIterator]());
10855 var tag = getTag(value), func = tag == mapTag ? mapToArray : tag == setTag ? setToArray : values;
10856 return func(value);
10858 function toFinite(value) {
10860 return value === 0 ? value : 0;
10862 value = toNumber2(value);
10863 if (value === INFINITY2 || value === -INFINITY2) {
10864 var sign2 = value < 0 ? -1 : 1;
10865 return sign2 * MAX_INTEGER;
10867 return value === value ? value : 0;
10869 function toInteger(value) {
10870 var result2 = toFinite(value), remainder = result2 % 1;
10871 return result2 === result2 ? remainder ? result2 - remainder : result2 : 0;
10873 function toLength(value) {
10874 return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
10876 function toNumber2(value) {
10877 if (typeof value == "number") {
10880 if (isSymbol2(value)) {
10883 if (isObject3(value)) {
10884 var other = typeof value.valueOf == "function" ? value.valueOf() : value;
10885 value = isObject3(other) ? other + "" : other;
10887 if (typeof value != "string") {
10888 return value === 0 ? value : +value;
10890 value = baseTrim2(value);
10891 var isBinary = reIsBinary2.test(value);
10892 return isBinary || reIsOctal2.test(value) ? freeParseInt2(value.slice(2), isBinary ? 2 : 8) : reIsBadHex2.test(value) ? NAN2 : +value;
10894 function toPlainObject(value) {
10895 return copyObject(value, keysIn(value));
10897 function toSafeInteger(value) {
10898 return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0;
10900 function toString2(value) {
10901 return value == null ? "" : baseToString2(value);
10903 var assign = createAssigner(function(object, source) {
10904 if (isPrototype(source) || isArrayLike(source)) {
10905 copyObject(source, keys(source), object);
10908 for (var key in source) {
10909 if (hasOwnProperty2.call(source, key)) {
10910 assignValue(object, key, source[key]);
10914 var assignIn = createAssigner(function(object, source) {
10915 copyObject(source, keysIn(source), object);
10917 var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
10918 copyObject(source, keysIn(source), object, customizer);
10920 var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
10921 copyObject(source, keys(source), object, customizer);
10923 var at = flatRest(baseAt);
10924 function create2(prototype, properties) {
10925 var result2 = baseCreate(prototype);
10926 return properties == null ? result2 : baseAssign(result2, properties);
10928 var defaults2 = baseRest(function(object, sources) {
10929 object = Object2(object);
10931 var length = sources.length;
10932 var guard = length > 2 ? sources[2] : undefined2;
10933 if (guard && isIterateeCall(sources[0], sources[1], guard)) {
10936 while (++index < length) {
10937 var source = sources[index];
10938 var props = keysIn(source);
10939 var propsIndex = -1;
10940 var propsLength = props.length;
10941 while (++propsIndex < propsLength) {
10942 var key = props[propsIndex];
10943 var value = object[key];
10944 if (value === undefined2 || eq(value, objectProto3[key]) && !hasOwnProperty2.call(object, key)) {
10945 object[key] = source[key];
10951 var defaultsDeep = baseRest(function(args) {
10952 args.push(undefined2, customDefaultsMerge);
10953 return apply(mergeWith, undefined2, args);
10955 function findKey(object, predicate) {
10956 return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
10958 function findLastKey(object, predicate) {
10959 return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
10961 function forIn(object, iteratee2) {
10962 return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn);
10964 function forInRight(object, iteratee2) {
10965 return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn);
10967 function forOwn(object, iteratee2) {
10968 return object && baseForOwn(object, getIteratee(iteratee2, 3));
10970 function forOwnRight(object, iteratee2) {
10971 return object && baseForOwnRight(object, getIteratee(iteratee2, 3));
10973 function functions(object) {
10974 return object == null ? [] : baseFunctions(object, keys(object));
10976 function functionsIn(object) {
10977 return object == null ? [] : baseFunctions(object, keysIn(object));
10979 function get4(object, path, defaultValue) {
10980 var result2 = object == null ? undefined2 : baseGet(object, path);
10981 return result2 === undefined2 ? defaultValue : result2;
10983 function has(object, path) {
10984 return object != null && hasPath(object, path, baseHas);
10986 function hasIn(object, path) {
10987 return object != null && hasPath(object, path, baseHasIn);
10989 var invert = createInverter(function(result2, value, key) {
10990 if (value != null && typeof value.toString != "function") {
10991 value = nativeObjectToString3.call(value);
10993 result2[value] = key;
10994 }, constant(identity4));
10995 var invertBy = createInverter(function(result2, value, key) {
10996 if (value != null && typeof value.toString != "function") {
10997 value = nativeObjectToString3.call(value);
10999 if (hasOwnProperty2.call(result2, value)) {
11000 result2[value].push(key);
11002 result2[value] = [key];
11005 var invoke = baseRest(baseInvoke);
11006 function keys(object) {
11007 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
11009 function keysIn(object) {
11010 return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
11012 function mapKeys(object, iteratee2) {
11014 iteratee2 = getIteratee(iteratee2, 3);
11015 baseForOwn(object, function(value, key, object2) {
11016 baseAssignValue(result2, iteratee2(value, key, object2), value);
11020 function mapValues(object, iteratee2) {
11022 iteratee2 = getIteratee(iteratee2, 3);
11023 baseForOwn(object, function(value, key, object2) {
11024 baseAssignValue(result2, key, iteratee2(value, key, object2));
11028 var merge3 = createAssigner(function(object, source, srcIndex) {
11029 baseMerge(object, source, srcIndex);
11031 var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
11032 baseMerge(object, source, srcIndex, customizer);
11034 var omit = flatRest(function(object, paths) {
11036 if (object == null) {
11039 var isDeep = false;
11040 paths = arrayMap2(paths, function(path) {
11041 path = castPath(path, object);
11042 isDeep || (isDeep = path.length > 1);
11045 copyObject(object, getAllKeysIn(object), result2);
11047 result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
11049 var length = paths.length;
11051 baseUnset(result2, paths[length]);
11055 function omitBy(object, predicate) {
11056 return pickBy(object, negate(getIteratee(predicate)));
11058 var pick = flatRest(function(object, paths) {
11059 return object == null ? {} : basePick(object, paths);
11061 function pickBy(object, predicate) {
11062 if (object == null) {
11065 var props = arrayMap2(getAllKeysIn(object), function(prop) {
11068 predicate = getIteratee(predicate);
11069 return basePickBy(object, props, function(value, path) {
11070 return predicate(value, path[0]);
11073 function result(object, path, defaultValue) {
11074 path = castPath(path, object);
11075 var index = -1, length = path.length;
11078 object = undefined2;
11080 while (++index < length) {
11081 var value = object == null ? undefined2 : object[toKey(path[index])];
11082 if (value === undefined2) {
11084 value = defaultValue;
11086 object = isFunction(value) ? value.call(object) : value;
11090 function set3(object, path, value) {
11091 return object == null ? object : baseSet(object, path, value);
11093 function setWith(object, path, value, customizer) {
11094 customizer = typeof customizer == "function" ? customizer : undefined2;
11095 return object == null ? object : baseSet(object, path, value, customizer);
11097 var toPairs = createToPairs(keys);
11098 var toPairsIn = createToPairs(keysIn);
11099 function transform2(object, iteratee2, accumulator) {
11100 var isArr = isArray2(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object);
11101 iteratee2 = getIteratee(iteratee2, 4);
11102 if (accumulator == null) {
11103 var Ctor = object && object.constructor;
11105 accumulator = isArr ? new Ctor() : [];
11106 } else if (isObject3(object)) {
11107 accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
11112 (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
11113 return iteratee2(accumulator, value, index, object2);
11115 return accumulator;
11117 function unset(object, path) {
11118 return object == null ? true : baseUnset(object, path);
11120 function update(object, path, updater) {
11121 return object == null ? object : baseUpdate(object, path, castFunction(updater));
11123 function updateWith(object, path, updater, customizer) {
11124 customizer = typeof customizer == "function" ? customizer : undefined2;
11125 return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
11127 function values(object) {
11128 return object == null ? [] : baseValues(object, keys(object));
11130 function valuesIn(object) {
11131 return object == null ? [] : baseValues(object, keysIn(object));
11133 function clamp3(number3, lower2, upper) {
11134 if (upper === undefined2) {
11136 lower2 = undefined2;
11138 if (upper !== undefined2) {
11139 upper = toNumber2(upper);
11140 upper = upper === upper ? upper : 0;
11142 if (lower2 !== undefined2) {
11143 lower2 = toNumber2(lower2);
11144 lower2 = lower2 === lower2 ? lower2 : 0;
11146 return baseClamp(toNumber2(number3), lower2, upper);
11148 function inRange(number3, start2, end) {
11149 start2 = toFinite(start2);
11150 if (end === undefined2) {
11154 end = toFinite(end);
11156 number3 = toNumber2(number3);
11157 return baseInRange(number3, start2, end);
11159 function random(lower2, upper, floating) {
11160 if (floating && typeof floating != "boolean" && isIterateeCall(lower2, upper, floating)) {
11161 upper = floating = undefined2;
11163 if (floating === undefined2) {
11164 if (typeof upper == "boolean") {
11166 upper = undefined2;
11167 } else if (typeof lower2 == "boolean") {
11169 lower2 = undefined2;
11172 if (lower2 === undefined2 && upper === undefined2) {
11176 lower2 = toFinite(lower2);
11177 if (upper === undefined2) {
11181 upper = toFinite(upper);
11184 if (lower2 > upper) {
11189 if (floating || lower2 % 1 || upper % 1) {
11190 var rand = nativeRandom();
11191 return nativeMin2(lower2 + rand * (upper - lower2 + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
11193 return baseRandom(lower2, upper);
11195 var camelCase = createCompounder(function(result2, word, index) {
11196 word = word.toLowerCase();
11197 return result2 + (index ? capitalize(word) : word);
11199 function capitalize(string) {
11200 return upperFirst(toString2(string).toLowerCase());
11202 function deburr(string) {
11203 string = toString2(string);
11204 return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
11206 function endsWith(string, target, position) {
11207 string = toString2(string);
11208 target = baseToString2(target);
11209 var length = string.length;
11210 position = position === undefined2 ? length : baseClamp(toInteger(position), 0, length);
11211 var end = position;
11212 position -= target.length;
11213 return position >= 0 && string.slice(position, end) == target;
11215 function escape6(string) {
11216 string = toString2(string);
11217 return string && reHasUnescapedHtml2.test(string) ? string.replace(reUnescapedHtml2, escapeHtmlChar2) : string;
11219 function escapeRegExp(string) {
11220 string = toString2(string);
11221 return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string;
11223 var kebabCase = createCompounder(function(result2, word, index) {
11224 return result2 + (index ? "-" : "") + word.toLowerCase();
11226 var lowerCase = createCompounder(function(result2, word, index) {
11227 return result2 + (index ? " " : "") + word.toLowerCase();
11229 var lowerFirst = createCaseFirst("toLowerCase");
11230 function pad2(string, length, chars) {
11231 string = toString2(string);
11232 length = toInteger(length);
11233 var strLength = length ? stringSize(string) : 0;
11234 if (!length || strLength >= length) {
11237 var mid = (length - strLength) / 2;
11238 return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars);
11240 function padEnd(string, length, chars) {
11241 string = toString2(string);
11242 length = toInteger(length);
11243 var strLength = length ? stringSize(string) : 0;
11244 return length && strLength < length ? string + createPadding(length - strLength, chars) : string;
11246 function padStart(string, length, chars) {
11247 string = toString2(string);
11248 length = toInteger(length);
11249 var strLength = length ? stringSize(string) : 0;
11250 return length && strLength < length ? createPadding(length - strLength, chars) + string : string;
11252 function parseInt2(string, radix, guard) {
11253 if (guard || radix == null) {
11255 } else if (radix) {
11258 return nativeParseInt(toString2(string).replace(reTrimStart2, ""), radix || 0);
11260 function repeat(string, n2, guard) {
11261 if (guard ? isIterateeCall(string, n2, guard) : n2 === undefined2) {
11264 n2 = toInteger(n2);
11266 return baseRepeat(toString2(string), n2);
11268 function replace() {
11269 var args = arguments, string = toString2(args[0]);
11270 return args.length < 3 ? string : string.replace(args[1], args[2]);
11272 var snakeCase = createCompounder(function(result2, word, index) {
11273 return result2 + (index ? "_" : "") + word.toLowerCase();
11275 function split(string, separator, limit) {
11276 if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
11277 separator = limit = undefined2;
11279 limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0;
11283 string = toString2(string);
11284 if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
11285 separator = baseToString2(separator);
11286 if (!separator && hasUnicode(string)) {
11287 return castSlice(stringToArray(string), 0, limit);
11290 return string.split(separator, limit);
11292 var startCase = createCompounder(function(result2, word, index) {
11293 return result2 + (index ? " " : "") + upperFirst(word);
11295 function startsWith(string, target, position) {
11296 string = toString2(string);
11297 position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
11298 target = baseToString2(target);
11299 return string.slice(position, position + target.length) == target;
11301 function template(string, options2, guard) {
11302 var settings = lodash.templateSettings;
11303 if (guard && isIterateeCall(string, options2, guard)) {
11304 options2 = undefined2;
11306 string = toString2(string);
11307 options2 = assignInWith({}, options2, settings, customDefaultsAssignIn);
11308 var imports = assignInWith({}, options2.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
11309 var isEscaping, isEvaluating, index = 0, interpolate = options2.interpolate || reNoMatch, source = "__p += '";
11310 var reDelimiters = RegExp2(
11311 (options2.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options2.evaluate || reNoMatch).source + "|$",
11314 var sourceURL = "//# sourceURL=" + (hasOwnProperty2.call(options2, "sourceURL") ? (options2.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
11315 string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
11316 interpolateValue || (interpolateValue = esTemplateValue);
11317 source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
11320 source += "' +\n__e(" + escapeValue + ") +\n'";
11322 if (evaluateValue) {
11323 isEvaluating = true;
11324 source += "';\n" + evaluateValue + ";\n__p += '";
11326 if (interpolateValue) {
11327 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
11329 index = offset + match.length;
11333 var variable = hasOwnProperty2.call(options2, "variable") && options2.variable;
11335 source = "with (obj) {\n" + source + "\n}\n";
11336 } else if (reForbiddenIdentifierChars.test(variable)) {
11337 throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT);
11339 source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
11340 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}";
11341 var result2 = attempt(function() {
11342 return Function2(importsKeys, sourceURL + "return " + source).apply(undefined2, importsValues);
11344 result2.source = source;
11345 if (isError(result2)) {
11350 function toLower(value) {
11351 return toString2(value).toLowerCase();
11353 function toUpper(value) {
11354 return toString2(value).toUpperCase();
11356 function trim(string, chars, guard) {
11357 string = toString2(string);
11358 if (string && (guard || chars === undefined2)) {
11359 return baseTrim2(string);
11361 if (!string || !(chars = baseToString2(chars))) {
11364 var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start2 = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
11365 return castSlice(strSymbols, start2, end).join("");
11367 function trimEnd(string, chars, guard) {
11368 string = toString2(string);
11369 if (string && (guard || chars === undefined2)) {
11370 return string.slice(0, trimmedEndIndex2(string) + 1);
11372 if (!string || !(chars = baseToString2(chars))) {
11375 var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
11376 return castSlice(strSymbols, 0, end).join("");
11378 function trimStart(string, chars, guard) {
11379 string = toString2(string);
11380 if (string && (guard || chars === undefined2)) {
11381 return string.replace(reTrimStart2, "");
11383 if (!string || !(chars = baseToString2(chars))) {
11386 var strSymbols = stringToArray(string), start2 = charsStartIndex(strSymbols, stringToArray(chars));
11387 return castSlice(strSymbols, start2).join("");
11389 function truncate(string, options2) {
11390 var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
11391 if (isObject3(options2)) {
11392 var separator = "separator" in options2 ? options2.separator : separator;
11393 length = "length" in options2 ? toInteger(options2.length) : length;
11394 omission = "omission" in options2 ? baseToString2(options2.omission) : omission;
11396 string = toString2(string);
11397 var strLength = string.length;
11398 if (hasUnicode(string)) {
11399 var strSymbols = stringToArray(string);
11400 strLength = strSymbols.length;
11402 if (length >= strLength) {
11405 var end = length - stringSize(omission);
11409 var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
11410 if (separator === undefined2) {
11411 return result2 + omission;
11414 end += result2.length - end;
11416 if (isRegExp(separator)) {
11417 if (string.slice(end).search(separator)) {
11418 var match, substring = result2;
11419 if (!separator.global) {
11420 separator = RegExp2(separator.source, toString2(reFlags.exec(separator)) + "g");
11422 separator.lastIndex = 0;
11423 while (match = separator.exec(substring)) {
11424 var newEnd = match.index;
11426 result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd);
11428 } else if (string.indexOf(baseToString2(separator), end) != end) {
11429 var index = result2.lastIndexOf(separator);
11431 result2 = result2.slice(0, index);
11434 return result2 + omission;
11436 function unescape4(string) {
11437 string = toString2(string);
11438 return string && reHasEscapedHtml2.test(string) ? string.replace(reEscapedHtml2, unescapeHtmlChar2) : string;
11440 var upperCase = createCompounder(function(result2, word, index) {
11441 return result2 + (index ? " " : "") + word.toUpperCase();
11443 var upperFirst = createCaseFirst("toUpperCase");
11444 function words(string, pattern, guard) {
11445 string = toString2(string);
11446 pattern = guard ? undefined2 : pattern;
11447 if (pattern === undefined2) {
11448 return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
11450 return string.match(pattern) || [];
11452 var attempt = baseRest(function(func, args) {
11454 return apply(func, undefined2, args);
11456 return isError(e) ? e : new Error2(e);
11459 var bindAll = flatRest(function(object, methodNames) {
11460 arrayEach(methodNames, function(key) {
11462 baseAssignValue(object, key, bind(object[key], object));
11466 function cond(pairs) {
11467 var length = pairs == null ? 0 : pairs.length, toIteratee = getIteratee();
11468 pairs = !length ? [] : arrayMap2(pairs, function(pair2) {
11469 if (typeof pair2[1] != "function") {
11470 throw new TypeError2(FUNC_ERROR_TEXT3);
11472 return [toIteratee(pair2[0]), pair2[1]];
11474 return baseRest(function(args) {
11476 while (++index < length) {
11477 var pair2 = pairs[index];
11478 if (apply(pair2[0], this, args)) {
11479 return apply(pair2[1], this, args);
11484 function conforms(source) {
11485 return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
11487 function constant(value) {
11488 return function() {
11492 function defaultTo(value, defaultValue) {
11493 return value == null || value !== value ? defaultValue : value;
11495 var flow = createFlow();
11496 var flowRight = createFlow(true);
11497 function identity4(value) {
11500 function iteratee(func) {
11501 return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG));
11503 function matches(source) {
11504 return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
11506 function matchesProperty(path, srcValue) {
11507 return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
11509 var method = baseRest(function(path, args) {
11510 return function(object) {
11511 return baseInvoke(object, path, args);
11514 var methodOf = baseRest(function(object, args) {
11515 return function(path) {
11516 return baseInvoke(object, path, args);
11519 function mixin(object, source, options2) {
11520 var props = keys(source), methodNames = baseFunctions(source, props);
11521 if (options2 == null && !(isObject3(source) && (methodNames.length || !props.length))) {
11525 methodNames = baseFunctions(source, keys(source));
11527 var chain2 = !(isObject3(options2) && "chain" in options2) || !!options2.chain, isFunc = isFunction(object);
11528 arrayEach(methodNames, function(methodName) {
11529 var func = source[methodName];
11530 object[methodName] = func;
11532 object.prototype[methodName] = function() {
11533 var chainAll = this.__chain__;
11534 if (chain2 || chainAll) {
11535 var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray(this.__actions__);
11536 actions.push({ "func": func, "args": arguments, "thisArg": object });
11537 result2.__chain__ = chainAll;
11540 return func.apply(object, arrayPush([this.value()], arguments));
11546 function noConflict() {
11547 if (root3._ === this) {
11554 function nthArg(n2) {
11555 n2 = toInteger(n2);
11556 return baseRest(function(args) {
11557 return baseNth(args, n2);
11560 var over = createOver(arrayMap2);
11561 var overEvery = createOver(arrayEvery);
11562 var overSome = createOver(arraySome);
11563 function property(path) {
11564 return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
11566 function propertyOf(object) {
11567 return function(path) {
11568 return object == null ? undefined2 : baseGet(object, path);
11571 var range3 = createRange();
11572 var rangeRight = createRange(true);
11573 function stubArray() {
11576 function stubFalse() {
11579 function stubObject() {
11582 function stubString() {
11585 function stubTrue() {
11588 function times(n2, iteratee2) {
11589 n2 = toInteger(n2);
11590 if (n2 < 1 || n2 > MAX_SAFE_INTEGER) {
11593 var index = MAX_ARRAY_LENGTH, length = nativeMin2(n2, MAX_ARRAY_LENGTH);
11594 iteratee2 = getIteratee(iteratee2);
11595 n2 -= MAX_ARRAY_LENGTH;
11596 var result2 = baseTimes(length, iteratee2);
11597 while (++index < n2) {
11602 function toPath(value) {
11603 if (isArray2(value)) {
11604 return arrayMap2(value, toKey);
11606 return isSymbol2(value) ? [value] : copyArray(stringToPath(toString2(value)));
11608 function uniqueId(prefix) {
11609 var id2 = ++idCounter;
11610 return toString2(prefix) + id2;
11612 var add = createMathOperation(function(augend, addend) {
11613 return augend + addend;
11615 var ceil = createRound("ceil");
11616 var divide = createMathOperation(function(dividend, divisor) {
11617 return dividend / divisor;
11619 var floor = createRound("floor");
11620 function max3(array2) {
11621 return array2 && array2.length ? baseExtremum(array2, identity4, baseGt) : undefined2;
11623 function maxBy(array2, iteratee2) {
11624 return array2 && array2.length ? baseExtremum(array2, getIteratee(iteratee2, 2), baseGt) : undefined2;
11626 function mean(array2) {
11627 return baseMean(array2, identity4);
11629 function meanBy(array2, iteratee2) {
11630 return baseMean(array2, getIteratee(iteratee2, 2));
11632 function min3(array2) {
11633 return array2 && array2.length ? baseExtremum(array2, identity4, baseLt) : undefined2;
11635 function minBy(array2, iteratee2) {
11636 return array2 && array2.length ? baseExtremum(array2, getIteratee(iteratee2, 2), baseLt) : undefined2;
11638 var multiply = createMathOperation(function(multiplier, multiplicand) {
11639 return multiplier * multiplicand;
11641 var round = createRound("round");
11642 var subtract = createMathOperation(function(minuend, subtrahend) {
11643 return minuend - subtrahend;
11645 function sum(array2) {
11646 return array2 && array2.length ? baseSum(array2, identity4) : 0;
11648 function sumBy(array2, iteratee2) {
11649 return array2 && array2.length ? baseSum(array2, getIteratee(iteratee2, 2)) : 0;
11651 lodash.after = after;
11653 lodash.assign = assign;
11654 lodash.assignIn = assignIn;
11655 lodash.assignInWith = assignInWith;
11656 lodash.assignWith = assignWith;
11658 lodash.before = before;
11659 lodash.bind = bind;
11660 lodash.bindAll = bindAll;
11661 lodash.bindKey = bindKey2;
11662 lodash.castArray = castArray;
11663 lodash.chain = chain;
11664 lodash.chunk = chunk;
11665 lodash.compact = compact;
11666 lodash.concat = concat;
11667 lodash.cond = cond;
11668 lodash.conforms = conforms;
11669 lodash.constant = constant;
11670 lodash.countBy = countBy;
11671 lodash.create = create2;
11672 lodash.curry = curry;
11673 lodash.curryRight = curryRight;
11674 lodash.debounce = debounce2;
11675 lodash.defaults = defaults2;
11676 lodash.defaultsDeep = defaultsDeep;
11677 lodash.defer = defer;
11678 lodash.delay = delay;
11679 lodash.difference = difference;
11680 lodash.differenceBy = differenceBy;
11681 lodash.differenceWith = differenceWith;
11682 lodash.drop = drop;
11683 lodash.dropRight = dropRight;
11684 lodash.dropRightWhile = dropRightWhile;
11685 lodash.dropWhile = dropWhile;
11686 lodash.fill = fill;
11687 lodash.filter = filter2;
11688 lodash.flatMap = flatMap;
11689 lodash.flatMapDeep = flatMapDeep;
11690 lodash.flatMapDepth = flatMapDepth;
11691 lodash.flatten = flatten2;
11692 lodash.flattenDeep = flattenDeep;
11693 lodash.flattenDepth = flattenDepth;
11694 lodash.flip = flip;
11695 lodash.flow = flow;
11696 lodash.flowRight = flowRight;
11697 lodash.fromPairs = fromPairs;
11698 lodash.functions = functions;
11699 lodash.functionsIn = functionsIn;
11700 lodash.groupBy = groupBy;
11701 lodash.initial = initial;
11702 lodash.intersection = intersection;
11703 lodash.intersectionBy = intersectionBy;
11704 lodash.intersectionWith = intersectionWith;
11705 lodash.invert = invert;
11706 lodash.invertBy = invertBy;
11707 lodash.invokeMap = invokeMap;
11708 lodash.iteratee = iteratee;
11709 lodash.keyBy = keyBy;
11710 lodash.keys = keys;
11711 lodash.keysIn = keysIn;
11713 lodash.mapKeys = mapKeys;
11714 lodash.mapValues = mapValues;
11715 lodash.matches = matches;
11716 lodash.matchesProperty = matchesProperty;
11717 lodash.memoize = memoize;
11718 lodash.merge = merge3;
11719 lodash.mergeWith = mergeWith;
11720 lodash.method = method;
11721 lodash.methodOf = methodOf;
11722 lodash.mixin = mixin;
11723 lodash.negate = negate;
11724 lodash.nthArg = nthArg;
11725 lodash.omit = omit;
11726 lodash.omitBy = omitBy;
11727 lodash.once = once;
11728 lodash.orderBy = orderBy;
11729 lodash.over = over;
11730 lodash.overArgs = overArgs;
11731 lodash.overEvery = overEvery;
11732 lodash.overSome = overSome;
11733 lodash.partial = partial;
11734 lodash.partialRight = partialRight;
11735 lodash.partition = partition;
11736 lodash.pick = pick;
11737 lodash.pickBy = pickBy;
11738 lodash.property = property;
11739 lodash.propertyOf = propertyOf;
11740 lodash.pull = pull;
11741 lodash.pullAll = pullAll;
11742 lodash.pullAllBy = pullAllBy;
11743 lodash.pullAllWith = pullAllWith;
11744 lodash.pullAt = pullAt;
11745 lodash.range = range3;
11746 lodash.rangeRight = rangeRight;
11747 lodash.rearg = rearg;
11748 lodash.reject = reject;
11749 lodash.remove = remove2;
11750 lodash.rest = rest;
11751 lodash.reverse = reverse;
11752 lodash.sampleSize = sampleSize;
11754 lodash.setWith = setWith;
11755 lodash.shuffle = shuffle;
11756 lodash.slice = slice;
11757 lodash.sortBy = sortBy;
11758 lodash.sortedUniq = sortedUniq;
11759 lodash.sortedUniqBy = sortedUniqBy;
11760 lodash.split = split;
11761 lodash.spread = spread;
11762 lodash.tail = tail;
11763 lodash.take = take;
11764 lodash.takeRight = takeRight;
11765 lodash.takeRightWhile = takeRightWhile;
11766 lodash.takeWhile = takeWhile;
11768 lodash.throttle = throttle2;
11769 lodash.thru = thru;
11770 lodash.toArray = toArray;
11771 lodash.toPairs = toPairs;
11772 lodash.toPairsIn = toPairsIn;
11773 lodash.toPath = toPath;
11774 lodash.toPlainObject = toPlainObject;
11775 lodash.transform = transform2;
11776 lodash.unary = unary;
11777 lodash.union = union;
11778 lodash.unionBy = unionBy;
11779 lodash.unionWith = unionWith;
11780 lodash.uniq = uniq;
11781 lodash.uniqBy = uniqBy;
11782 lodash.uniqWith = uniqWith;
11783 lodash.unset = unset;
11784 lodash.unzip = unzip;
11785 lodash.unzipWith = unzipWith;
11786 lodash.update = update;
11787 lodash.updateWith = updateWith;
11788 lodash.values = values;
11789 lodash.valuesIn = valuesIn;
11790 lodash.without = without;
11791 lodash.words = words;
11792 lodash.wrap = wrap2;
11794 lodash.xorBy = xorBy;
11795 lodash.xorWith = xorWith;
11797 lodash.zipObject = zipObject;
11798 lodash.zipObjectDeep = zipObjectDeep;
11799 lodash.zipWith = zipWith;
11800 lodash.entries = toPairs;
11801 lodash.entriesIn = toPairsIn;
11802 lodash.extend = assignIn;
11803 lodash.extendWith = assignInWith;
11804 mixin(lodash, lodash);
11806 lodash.attempt = attempt;
11807 lodash.camelCase = camelCase;
11808 lodash.capitalize = capitalize;
11809 lodash.ceil = ceil;
11810 lodash.clamp = clamp3;
11811 lodash.clone = clone;
11812 lodash.cloneDeep = cloneDeep;
11813 lodash.cloneDeepWith = cloneDeepWith;
11814 lodash.cloneWith = cloneWith;
11815 lodash.conformsTo = conformsTo;
11816 lodash.deburr = deburr;
11817 lodash.defaultTo = defaultTo;
11818 lodash.divide = divide;
11819 lodash.endsWith = endsWith;
11821 lodash.escape = escape6;
11822 lodash.escapeRegExp = escapeRegExp;
11823 lodash.every = every;
11824 lodash.find = find2;
11825 lodash.findIndex = findIndex;
11826 lodash.findKey = findKey;
11827 lodash.findLast = findLast;
11828 lodash.findLastIndex = findLastIndex;
11829 lodash.findLastKey = findLastKey;
11830 lodash.floor = floor;
11831 lodash.forEach = forEach;
11832 lodash.forEachRight = forEachRight;
11833 lodash.forIn = forIn;
11834 lodash.forInRight = forInRight;
11835 lodash.forOwn = forOwn;
11836 lodash.forOwnRight = forOwnRight;
11841 lodash.hasIn = hasIn;
11842 lodash.head = head;
11843 lodash.identity = identity4;
11844 lodash.includes = includes;
11845 lodash.indexOf = indexOf;
11846 lodash.inRange = inRange;
11847 lodash.invoke = invoke;
11848 lodash.isArguments = isArguments;
11849 lodash.isArray = isArray2;
11850 lodash.isArrayBuffer = isArrayBuffer;
11851 lodash.isArrayLike = isArrayLike;
11852 lodash.isArrayLikeObject = isArrayLikeObject;
11853 lodash.isBoolean = isBoolean;
11854 lodash.isBuffer = isBuffer;
11855 lodash.isDate = isDate;
11856 lodash.isElement = isElement2;
11857 lodash.isEmpty = isEmpty;
11858 lodash.isEqual = isEqual;
11859 lodash.isEqualWith = isEqualWith;
11860 lodash.isError = isError;
11861 lodash.isFinite = isFinite2;
11862 lodash.isFunction = isFunction;
11863 lodash.isInteger = isInteger;
11864 lodash.isLength = isLength;
11865 lodash.isMap = isMap;
11866 lodash.isMatch = isMatch;
11867 lodash.isMatchWith = isMatchWith;
11868 lodash.isNaN = isNaN2;
11869 lodash.isNative = isNative;
11870 lodash.isNil = isNil;
11871 lodash.isNull = isNull;
11872 lodash.isNumber = isNumber2;
11873 lodash.isObject = isObject3;
11874 lodash.isObjectLike = isObjectLike2;
11875 lodash.isPlainObject = isPlainObject;
11876 lodash.isRegExp = isRegExp;
11877 lodash.isSafeInteger = isSafeInteger;
11878 lodash.isSet = isSet;
11879 lodash.isString = isString;
11880 lodash.isSymbol = isSymbol2;
11881 lodash.isTypedArray = isTypedArray;
11882 lodash.isUndefined = isUndefined;
11883 lodash.isWeakMap = isWeakMap;
11884 lodash.isWeakSet = isWeakSet;
11885 lodash.join = join;
11886 lodash.kebabCase = kebabCase;
11887 lodash.last = last;
11888 lodash.lastIndexOf = lastIndexOf;
11889 lodash.lowerCase = lowerCase;
11890 lodash.lowerFirst = lowerFirst;
11894 lodash.maxBy = maxBy;
11895 lodash.mean = mean;
11896 lodash.meanBy = meanBy;
11898 lodash.minBy = minBy;
11899 lodash.stubArray = stubArray;
11900 lodash.stubFalse = stubFalse;
11901 lodash.stubObject = stubObject;
11902 lodash.stubString = stubString;
11903 lodash.stubTrue = stubTrue;
11904 lodash.multiply = multiply;
11906 lodash.noConflict = noConflict;
11907 lodash.noop = noop3;
11910 lodash.padEnd = padEnd;
11911 lodash.padStart = padStart;
11912 lodash.parseInt = parseInt2;
11913 lodash.random = random;
11914 lodash.reduce = reduce;
11915 lodash.reduceRight = reduceRight;
11916 lodash.repeat = repeat;
11917 lodash.replace = replace;
11918 lodash.result = result;
11919 lodash.round = round;
11920 lodash.runInContext = runInContext2;
11921 lodash.sample = sample;
11922 lodash.size = size;
11923 lodash.snakeCase = snakeCase;
11924 lodash.some = some;
11925 lodash.sortedIndex = sortedIndex;
11926 lodash.sortedIndexBy = sortedIndexBy;
11927 lodash.sortedIndexOf = sortedIndexOf;
11928 lodash.sortedLastIndex = sortedLastIndex;
11929 lodash.sortedLastIndexBy = sortedLastIndexBy;
11930 lodash.sortedLastIndexOf = sortedLastIndexOf;
11931 lodash.startCase = startCase;
11932 lodash.startsWith = startsWith;
11933 lodash.subtract = subtract;
11935 lodash.sumBy = sumBy;
11936 lodash.template = template;
11937 lodash.times = times;
11938 lodash.toFinite = toFinite;
11939 lodash.toInteger = toInteger;
11940 lodash.toLength = toLength;
11941 lodash.toLower = toLower;
11942 lodash.toNumber = toNumber2;
11943 lodash.toSafeInteger = toSafeInteger;
11944 lodash.toString = toString2;
11945 lodash.toUpper = toUpper;
11946 lodash.trim = trim;
11947 lodash.trimEnd = trimEnd;
11948 lodash.trimStart = trimStart;
11949 lodash.truncate = truncate;
11950 lodash.unescape = unescape4;
11951 lodash.uniqueId = uniqueId;
11952 lodash.upperCase = upperCase;
11953 lodash.upperFirst = upperFirst;
11954 lodash.each = forEach;
11955 lodash.eachRight = forEachRight;
11956 lodash.first = head;
11957 mixin(lodash, function() {
11959 baseForOwn(lodash, function(func, methodName) {
11960 if (!hasOwnProperty2.call(lodash.prototype, methodName)) {
11961 source[methodName] = func;
11965 }(), { "chain": false });
11966 lodash.VERSION = VERSION;
11967 arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
11968 lodash[methodName].placeholder = lodash;
11970 arrayEach(["drop", "take"], function(methodName, index) {
11971 LazyWrapper.prototype[methodName] = function(n2) {
11972 n2 = n2 === undefined2 ? 1 : nativeMax2(toInteger(n2), 0);
11973 var result2 = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
11974 if (result2.__filtered__) {
11975 result2.__takeCount__ = nativeMin2(n2, result2.__takeCount__);
11977 result2.__views__.push({
11978 "size": nativeMin2(n2, MAX_ARRAY_LENGTH),
11979 "type": methodName + (result2.__dir__ < 0 ? "Right" : "")
11984 LazyWrapper.prototype[methodName + "Right"] = function(n2) {
11985 return this.reverse()[methodName](n2).reverse();
11988 arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
11989 var type3 = index + 1, isFilter = type3 == LAZY_FILTER_FLAG || type3 == LAZY_WHILE_FLAG;
11990 LazyWrapper.prototype[methodName] = function(iteratee2) {
11991 var result2 = this.clone();
11992 result2.__iteratees__.push({
11993 "iteratee": getIteratee(iteratee2, 3),
11996 result2.__filtered__ = result2.__filtered__ || isFilter;
12000 arrayEach(["head", "last"], function(methodName, index) {
12001 var takeName = "take" + (index ? "Right" : "");
12002 LazyWrapper.prototype[methodName] = function() {
12003 return this[takeName](1).value()[0];
12006 arrayEach(["initial", "tail"], function(methodName, index) {
12007 var dropName = "drop" + (index ? "" : "Right");
12008 LazyWrapper.prototype[methodName] = function() {
12009 return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
12012 LazyWrapper.prototype.compact = function() {
12013 return this.filter(identity4);
12015 LazyWrapper.prototype.find = function(predicate) {
12016 return this.filter(predicate).head();
12018 LazyWrapper.prototype.findLast = function(predicate) {
12019 return this.reverse().find(predicate);
12021 LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
12022 if (typeof path == "function") {
12023 return new LazyWrapper(this);
12025 return this.map(function(value) {
12026 return baseInvoke(value, path, args);
12029 LazyWrapper.prototype.reject = function(predicate) {
12030 return this.filter(negate(getIteratee(predicate)));
12032 LazyWrapper.prototype.slice = function(start2, end) {
12033 start2 = toInteger(start2);
12034 var result2 = this;
12035 if (result2.__filtered__ && (start2 > 0 || end < 0)) {
12036 return new LazyWrapper(result2);
12039 result2 = result2.takeRight(-start2);
12040 } else if (start2) {
12041 result2 = result2.drop(start2);
12043 if (end !== undefined2) {
12044 end = toInteger(end);
12045 result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start2);
12049 LazyWrapper.prototype.takeRightWhile = function(predicate) {
12050 return this.reverse().takeWhile(predicate).reverse();
12052 LazyWrapper.prototype.toArray = function() {
12053 return this.take(MAX_ARRAY_LENGTH);
12055 baseForOwn(LazyWrapper.prototype, function(func, methodName) {
12056 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);
12060 lodash.prototype[methodName] = function() {
12061 var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray2(value);
12062 var interceptor = function(value2) {
12063 var result3 = lodashFunc.apply(lodash, arrayPush([value2], args));
12064 return isTaker && chainAll ? result3[0] : result3;
12066 if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
12067 isLazy = useLazy = false;
12069 var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
12070 if (!retUnwrapped && useLazy) {
12071 value = onlyLazy ? value : new LazyWrapper(this);
12072 var result2 = func.apply(value, args);
12073 result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined2 });
12074 return new LodashWrapper(result2, chainAll);
12076 if (isUnwrapped && onlyLazy) {
12077 return func.apply(this, args);
12079 result2 = this.thru(interceptor);
12080 return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
12083 arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
12084 var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
12085 lodash.prototype[methodName] = function() {
12086 var args = arguments;
12087 if (retUnwrapped && !this.__chain__) {
12088 var value = this.value();
12089 return func.apply(isArray2(value) ? value : [], args);
12091 return this[chainName](function(value2) {
12092 return func.apply(isArray2(value2) ? value2 : [], args);
12096 baseForOwn(LazyWrapper.prototype, function(func, methodName) {
12097 var lodashFunc = lodash[methodName];
12099 var key = lodashFunc.name + "";
12100 if (!hasOwnProperty2.call(realNames, key)) {
12101 realNames[key] = [];
12103 realNames[key].push({ "name": methodName, "func": lodashFunc });
12106 realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{
12110 LazyWrapper.prototype.clone = lazyClone;
12111 LazyWrapper.prototype.reverse = lazyReverse;
12112 LazyWrapper.prototype.value = lazyValue;
12113 lodash.prototype.at = wrapperAt;
12114 lodash.prototype.chain = wrapperChain;
12115 lodash.prototype.commit = wrapperCommit;
12116 lodash.prototype.next = wrapperNext;
12117 lodash.prototype.plant = wrapperPlant;
12118 lodash.prototype.reverse = wrapperReverse;
12119 lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
12120 lodash.prototype.first = lodash.prototype.head;
12122 lodash.prototype[symIterator] = wrapperToIterator;
12126 var _ = runInContext();
12127 if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
12129 define(function() {
12132 } else if (freeModule) {
12133 (freeModule.exports = _)._ = _;
12142 // node_modules/rbush/rbush.min.js
12143 var require_rbush_min = __commonJS({
12144 "node_modules/rbush/rbush.min.js"(exports2, module2) {
12146 "object" == typeof exports2 && "undefined" != typeof module2 ? module2.exports = i2() : "function" == typeof define && define.amd ? define(i2) : (t = t || self).RBush = i2();
12147 }(exports2, function() {
12149 function t(t2, r2, e3, a2, h2) {
12150 !function t3(n3, r3, e4, a3, h3) {
12151 for (; a3 > e4; ) {
12152 if (a3 - e4 > 600) {
12153 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));
12154 t3(n3, r3, m2, c2, h3);
12156 var p2 = n3[r3], d2 = e4, x = a3;
12157 for (i2(n3, e4, r3), h3(n3[a3], p2) > 0 && i2(n3, e4, a3); d2 < x; ) {
12158 for (i2(n3, d2, x), d2++, x--; h3(n3[d2], p2) < 0; )
12160 for (; h3(n3[x], p2) > 0; )
12163 0 === h3(n3[e4], p2) ? i2(n3, e4, x) : i2(n3, ++x, a3), x <= r3 && (e4 = x + 1), r3 <= x && (a3 = x - 1);
12165 }(t2, r2, e3 || 0, a2 || t2.length - 1, h2 || n2);
12167 function i2(t2, i3, n3) {
12169 t2[i3] = t2[n3], t2[n3] = r2;
12171 function n2(t2, i3) {
12172 return t2 < i3 ? -1 : t2 > i3 ? 1 : 0;
12174 var r = function(t2) {
12175 void 0 === t2 && (t2 = 9), this._maxEntries = Math.max(4, t2), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
12177 function e(t2, i3, n3) {
12179 return i3.indexOf(t2);
12180 for (var r2 = 0; r2 < i3.length; r2++)
12181 if (n3(t2, i3[r2]))
12185 function a(t2, i3) {
12186 h(t2, 0, t2.children.length, i3, t2);
12188 function h(t2, i3, n3, r2, e3) {
12189 e3 || (e3 = p(null)), e3.minX = 1 / 0, e3.minY = 1 / 0, e3.maxX = -1 / 0, e3.maxY = -1 / 0;
12190 for (var a2 = i3; a2 < n3; a2++) {
12191 var h2 = t2.children[a2];
12192 o(e3, t2.leaf ? r2(h2) : h2);
12196 function o(t2, i3) {
12197 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;
12199 function s(t2, i3) {
12200 return t2.minX - i3.minX;
12202 function l(t2, i3) {
12203 return t2.minY - i3.minY;
12206 return (t2.maxX - t2.minX) * (t2.maxY - t2.minY);
12209 return t2.maxX - t2.minX + (t2.maxY - t2.minY);
12211 function m(t2, i3) {
12212 return t2.minX <= i3.minX && t2.minY <= i3.minY && i3.maxX <= t2.maxX && i3.maxY <= t2.maxY;
12214 function c(t2, i3) {
12215 return i3.minX <= t2.maxX && i3.minY <= t2.maxY && i3.maxX >= t2.minX && i3.maxY >= t2.minY;
12218 return { children: t2, height: 1, leaf: true, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
12220 function d(i3, n3, r2, e3, a2) {
12221 for (var h2 = [n3, r2]; h2.length; )
12222 if (!((r2 = h2.pop()) - (n3 = h2.pop()) <= e3)) {
12223 var o2 = n3 + Math.ceil((r2 - n3) / e3 / 2) * e3;
12224 t(i3, o2, n3, r2, a2), h2.push(n3, o2, o2, r2);
12227 return r.prototype.all = function() {
12228 return this._all(this.data, []);
12229 }, r.prototype.search = function(t2) {
12230 var i3 = this.data, n3 = [];
12233 for (var r2 = this.toBBox, e3 = []; i3; ) {
12234 for (var a2 = 0; a2 < i3.children.length; a2++) {
12235 var h2 = i3.children[a2], o2 = i3.leaf ? r2(h2) : h2;
12236 c(t2, o2) && (i3.leaf ? n3.push(h2) : m(t2, o2) ? this._all(h2, n3) : e3.push(h2));
12241 }, r.prototype.collides = function(t2) {
12242 var i3 = this.data;
12245 for (var n3 = []; i3; ) {
12246 for (var r2 = 0; r2 < i3.children.length; r2++) {
12247 var e3 = i3.children[r2], a2 = i3.leaf ? this.toBBox(e3) : e3;
12249 if (i3.leaf || m(t2, a2))
12257 }, r.prototype.load = function(t2) {
12258 if (!t2 || !t2.length)
12260 if (t2.length < this._minEntries) {
12261 for (var i3 = 0; i3 < t2.length; i3++)
12262 this.insert(t2[i3]);
12265 var n3 = this._build(t2.slice(), 0, t2.length - 1, 0);
12266 if (this.data.children.length)
12267 if (this.data.height === n3.height)
12268 this._splitRoot(this.data, n3);
12270 if (this.data.height < n3.height) {
12271 var r2 = this.data;
12272 this.data = n3, n3 = r2;
12274 this._insert(n3, this.data.height - n3.height - 1, true);
12279 }, r.prototype.insert = function(t2) {
12280 return t2 && this._insert(t2, this.data.height - 1), this;
12281 }, r.prototype.clear = function() {
12282 return this.data = p([]), this;
12283 }, r.prototype.remove = function(t2, i3) {
12286 for (var n3, r2, a2, h2 = this.data, o2 = this.toBBox(t2), s2 = [], l2 = []; h2 || s2.length; ) {
12287 if (h2 || (h2 = s2.pop(), r2 = s2[s2.length - 1], n3 = l2.pop(), a2 = true), h2.leaf) {
12288 var f3 = e(t2, h2.children, i3);
12290 return h2.children.splice(f3, 1), s2.push(h2), this._condense(s2), this;
12292 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]);
12295 }, r.prototype.toBBox = function(t2) {
12297 }, r.prototype.compareMinX = function(t2, i3) {
12298 return t2.minX - i3.minX;
12299 }, r.prototype.compareMinY = function(t2, i3) {
12300 return t2.minY - i3.minY;
12301 }, r.prototype.toJSON = function() {
12303 }, r.prototype.fromJSON = function(t2) {
12304 return this.data = t2, this;
12305 }, r.prototype._all = function(t2, i3) {
12306 for (var n3 = []; t2; )
12307 t2.leaf ? i3.push.apply(i3, t2.children) : n3.push.apply(n3, t2.children), t2 = n3.pop();
12309 }, r.prototype._build = function(t2, i3, n3, r2) {
12310 var e3, h2 = n3 - i3 + 1, o2 = this._maxEntries;
12312 return a(e3 = p(t2.slice(i3, n3 + 1)), this.toBBox), e3;
12313 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;
12314 var s2 = Math.ceil(h2 / o2), l2 = s2 * Math.ceil(Math.sqrt(o2));
12315 d(t2, i3, n3, l2, this.compareMinX);
12316 for (var f3 = i3; f3 <= n3; f3 += l2) {
12317 var u2 = Math.min(f3 + l2 - 1, n3);
12318 d(t2, f3, u2, s2, this.compareMinY);
12319 for (var m2 = f3; m2 <= u2; m2 += s2) {
12320 var c2 = Math.min(m2 + s2 - 1, u2);
12321 e3.children.push(this._build(t2, m2, c2, r2 - 1));
12324 return a(e3, this.toBBox), e3;
12325 }, r.prototype._chooseSubtree = function(t2, i3, n3, r2) {
12326 for (; r2.push(i3), !i3.leaf && r2.length - 1 !== n3; ) {
12327 for (var e3 = 1 / 0, a2 = 1 / 0, h2 = void 0, o2 = 0; o2 < i3.children.length; o2++) {
12328 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);
12329 u2 < a2 ? (a2 = u2, e3 = l2 < e3 ? l2 : e3, h2 = s2) : u2 === a2 && l2 < e3 && (e3 = l2, h2 = s2);
12331 i3 = h2 || i3.children[0];
12335 }, r.prototype._insert = function(t2, i3, n3) {
12336 var r2 = n3 ? t2 : this.toBBox(t2), e3 = [], a2 = this._chooseSubtree(r2, this.data, i3, e3);
12337 for (a2.children.push(t2), o(a2, r2); i3 >= 0 && e3[i3].children.length > this._maxEntries; )
12338 this._split(e3, i3), i3--;
12339 this._adjustParentBBoxes(r2, e3, i3);
12340 }, r.prototype._split = function(t2, i3) {
12341 var n3 = t2[i3], r2 = n3.children.length, e3 = this._minEntries;
12342 this._chooseSplitAxis(n3, e3, r2);
12343 var h2 = this._chooseSplitIndex(n3, e3, r2), o2 = p(n3.children.splice(h2, n3.children.length - h2));
12344 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);
12345 }, r.prototype._splitRoot = function(t2, i3) {
12346 this.data = p([t2, i3]), this.data.height = t2.height + 1, this.data.leaf = false, a(this.data, this.toBBox);
12347 }, r.prototype._chooseSplitIndex = function(t2, i3, n3) {
12348 for (var r2, e3, a2, o2, s2, l2, u2, m2 = 1 / 0, c2 = 1 / 0, p2 = i3; p2 <= n3 - i3; p2++) {
12349 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);
12350 v < m2 ? (m2 = v, r2 = p2, c2 = M < c2 ? M : c2) : v === m2 && M < c2 && (c2 = M, r2 = p2);
12352 return r2 || n3 - i3;
12353 }, r.prototype._chooseSplitAxis = function(t2, i3, n3) {
12354 var r2 = t2.leaf ? this.compareMinX : s, e3 = t2.leaf ? this.compareMinY : l;
12355 this._allDistMargin(t2, i3, n3, r2) < this._allDistMargin(t2, i3, n3, e3) && t2.children.sort(r2);
12356 }, r.prototype._allDistMargin = function(t2, i3, n3, r2) {
12357 t2.children.sort(r2);
12358 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++) {
12359 var m2 = t2.children[f3];
12360 o(a2, t2.leaf ? e3(m2) : m2), l2 += u(a2);
12362 for (var c2 = n3 - i3 - 1; c2 >= i3; c2--) {
12363 var p2 = t2.children[c2];
12364 o(s2, t2.leaf ? e3(p2) : p2), l2 += u(s2);
12367 }, r.prototype._adjustParentBBoxes = function(t2, i3, n3) {
12368 for (var r2 = n3; r2 >= 0; r2--)
12370 }, r.prototype._condense = function(t2) {
12371 for (var i3 = t2.length - 1, n3 = void 0; i3 >= 0; i3--)
12372 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);
12378 // node_modules/ieee754/index.js
12379 var require_ieee754 = __commonJS({
12380 "node_modules/ieee754/index.js"(exports2) {
12381 exports2.read = function(buffer, offset, isLE, mLen, nBytes) {
12383 var eLen = nBytes * 8 - mLen - 1;
12384 var eMax = (1 << eLen) - 1;
12385 var eBias = eMax >> 1;
12387 var i2 = isLE ? nBytes - 1 : 0;
12388 var d = isLE ? -1 : 1;
12389 var s = buffer[offset + i2];
12391 e = s & (1 << -nBits) - 1;
12394 for (; nBits > 0; e = e * 256 + buffer[offset + i2], i2 += d, nBits -= 8) {
12396 m = e & (1 << -nBits) - 1;
12399 for (; nBits > 0; m = m * 256 + buffer[offset + i2], i2 += d, nBits -= 8) {
12403 } else if (e === eMax) {
12404 return m ? NaN : (s ? -1 : 1) * Infinity;
12406 m = m + Math.pow(2, mLen);
12409 return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
12411 exports2.write = function(buffer, value, offset, isLE, mLen, nBytes) {
12413 var eLen = nBytes * 8 - mLen - 1;
12414 var eMax = (1 << eLen) - 1;
12415 var eBias = eMax >> 1;
12416 var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
12417 var i2 = isLE ? 0 : nBytes - 1;
12418 var d = isLE ? 1 : -1;
12419 var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
12420 value = Math.abs(value);
12421 if (isNaN(value) || value === Infinity) {
12422 m = isNaN(value) ? 1 : 0;
12425 e = Math.floor(Math.log(value) / Math.LN2);
12426 if (value * (c = Math.pow(2, -e)) < 1) {
12430 if (e + eBias >= 1) {
12433 value += rt * Math.pow(2, 1 - eBias);
12435 if (value * c >= 2) {
12439 if (e + eBias >= eMax) {
12442 } else if (e + eBias >= 1) {
12443 m = (value * c - 1) * Math.pow(2, mLen);
12446 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
12450 for (; mLen >= 8; buffer[offset + i2] = m & 255, i2 += d, m /= 256, mLen -= 8) {
12454 for (; eLen > 0; buffer[offset + i2] = e & 255, i2 += d, e /= 256, eLen -= 8) {
12456 buffer[offset + i2 - d] |= s * 128;
12461 // node_modules/pbf/index.js
12462 var require_pbf = __commonJS({
12463 "node_modules/pbf/index.js"(exports2, module2) {
12465 module2.exports = Pbf;
12466 var ieee754 = require_ieee754();
12467 function Pbf(buf) {
12468 this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);
12471 this.length = this.buf.length;
12477 var SHIFT_LEFT_32 = (1 << 16) * (1 << 16);
12478 var SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
12479 var TEXT_DECODER_MIN_LENGTH = 12;
12480 var utf8TextDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder("utf8");
12482 destroy: function() {
12485 readFields: function(readField, result, end) {
12486 end = end || this.length;
12487 while (this.pos < end) {
12488 var val = this.readVarint(), tag = val >> 3, startPos = this.pos;
12489 this.type = val & 7;
12490 readField(tag, result, this);
12491 if (this.pos === startPos)
12496 readMessage: function(readField, result) {
12497 return this.readFields(readField, result, this.readVarint() + this.pos);
12499 readFixed32: function() {
12500 var val = readUInt32(this.buf, this.pos);
12504 readSFixed32: function() {
12505 var val = readInt32(this.buf, this.pos);
12509 readFixed64: function() {
12510 var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
12514 readSFixed64: function() {
12515 var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
12519 readFloat: function() {
12520 var val = ieee754.read(this.buf, this.pos, true, 23, 4);
12524 readDouble: function() {
12525 var val = ieee754.read(this.buf, this.pos, true, 52, 8);
12529 readVarint: function(isSigned) {
12530 var buf = this.buf, val, b;
12531 b = buf[this.pos++];
12535 b = buf[this.pos++];
12536 val |= (b & 127) << 7;
12539 b = buf[this.pos++];
12540 val |= (b & 127) << 14;
12543 b = buf[this.pos++];
12544 val |= (b & 127) << 21;
12548 val |= (b & 15) << 28;
12549 return readVarintRemainder(val, isSigned, this);
12551 readVarint64: function() {
12552 return this.readVarint(true);
12554 readSVarint: function() {
12555 var num = this.readVarint();
12556 return num % 2 === 1 ? (num + 1) / -2 : num / 2;
12558 readBoolean: function() {
12559 return Boolean(this.readVarint());
12561 readString: function() {
12562 var end = this.readVarint() + this.pos;
12563 var pos = this.pos;
12565 if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
12566 return readUtf8TextDecoder(this.buf, pos, end);
12568 return readUtf8(this.buf, pos, end);
12570 readBytes: function() {
12571 var end = this.readVarint() + this.pos, buffer = this.buf.subarray(this.pos, end);
12575 readPackedVarint: function(arr, isSigned) {
12576 if (this.type !== Pbf.Bytes)
12577 return arr.push(this.readVarint(isSigned));
12578 var end = readPackedEnd(this);
12580 while (this.pos < end)
12581 arr.push(this.readVarint(isSigned));
12584 readPackedSVarint: function(arr) {
12585 if (this.type !== Pbf.Bytes)
12586 return arr.push(this.readSVarint());
12587 var end = readPackedEnd(this);
12589 while (this.pos < end)
12590 arr.push(this.readSVarint());
12593 readPackedBoolean: function(arr) {
12594 if (this.type !== Pbf.Bytes)
12595 return arr.push(this.readBoolean());
12596 var end = readPackedEnd(this);
12598 while (this.pos < end)
12599 arr.push(this.readBoolean());
12602 readPackedFloat: function(arr) {
12603 if (this.type !== Pbf.Bytes)
12604 return arr.push(this.readFloat());
12605 var end = readPackedEnd(this);
12607 while (this.pos < end)
12608 arr.push(this.readFloat());
12611 readPackedDouble: function(arr) {
12612 if (this.type !== Pbf.Bytes)
12613 return arr.push(this.readDouble());
12614 var end = readPackedEnd(this);
12616 while (this.pos < end)
12617 arr.push(this.readDouble());
12620 readPackedFixed32: function(arr) {
12621 if (this.type !== Pbf.Bytes)
12622 return arr.push(this.readFixed32());
12623 var end = readPackedEnd(this);
12625 while (this.pos < end)
12626 arr.push(this.readFixed32());
12629 readPackedSFixed32: function(arr) {
12630 if (this.type !== Pbf.Bytes)
12631 return arr.push(this.readSFixed32());
12632 var end = readPackedEnd(this);
12634 while (this.pos < end)
12635 arr.push(this.readSFixed32());
12638 readPackedFixed64: function(arr) {
12639 if (this.type !== Pbf.Bytes)
12640 return arr.push(this.readFixed64());
12641 var end = readPackedEnd(this);
12643 while (this.pos < end)
12644 arr.push(this.readFixed64());
12647 readPackedSFixed64: function(arr) {
12648 if (this.type !== Pbf.Bytes)
12649 return arr.push(this.readSFixed64());
12650 var end = readPackedEnd(this);
12652 while (this.pos < end)
12653 arr.push(this.readSFixed64());
12656 skip: function(val) {
12657 var type3 = val & 7;
12658 if (type3 === Pbf.Varint)
12659 while (this.buf[this.pos++] > 127) {
12661 else if (type3 === Pbf.Bytes)
12662 this.pos = this.readVarint() + this.pos;
12663 else if (type3 === Pbf.Fixed32)
12665 else if (type3 === Pbf.Fixed64)
12668 throw new Error("Unimplemented type: " + type3);
12670 writeTag: function(tag, type3) {
12671 this.writeVarint(tag << 3 | type3);
12673 realloc: function(min3) {
12674 var length = this.length || 16;
12675 while (length < this.pos + min3)
12677 if (length !== this.length) {
12678 var buf = new Uint8Array(length);
12681 this.length = length;
12684 finish: function() {
12685 this.length = this.pos;
12687 return this.buf.subarray(0, this.length);
12689 writeFixed32: function(val) {
12691 writeInt32(this.buf, val, this.pos);
12694 writeSFixed32: function(val) {
12696 writeInt32(this.buf, val, this.pos);
12699 writeFixed64: function(val) {
12701 writeInt32(this.buf, val & -1, this.pos);
12702 writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
12705 writeSFixed64: function(val) {
12707 writeInt32(this.buf, val & -1, this.pos);
12708 writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
12711 writeVarint: function(val) {
12713 if (val > 268435455 || val < 0) {
12714 writeBigVarint(val, this);
12718 this.buf[this.pos++] = val & 127 | (val > 127 ? 128 : 0);
12721 this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
12724 this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
12727 this.buf[this.pos++] = val >>> 7 & 127;
12729 writeSVarint: function(val) {
12730 this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);
12732 writeBoolean: function(val) {
12733 this.writeVarint(Boolean(val));
12735 writeString: function(str2) {
12736 str2 = String(str2);
12737 this.realloc(str2.length * 4);
12739 var startPos = this.pos;
12740 this.pos = writeUtf8(this.buf, str2, this.pos);
12741 var len = this.pos - startPos;
12743 makeRoomForExtraLength(startPos, len, this);
12744 this.pos = startPos - 1;
12745 this.writeVarint(len);
12748 writeFloat: function(val) {
12750 ieee754.write(this.buf, val, this.pos, true, 23, 4);
12753 writeDouble: function(val) {
12755 ieee754.write(this.buf, val, this.pos, true, 52, 8);
12758 writeBytes: function(buffer) {
12759 var len = buffer.length;
12760 this.writeVarint(len);
12762 for (var i2 = 0; i2 < len; i2++)
12763 this.buf[this.pos++] = buffer[i2];
12765 writeRawMessage: function(fn, obj) {
12767 var startPos = this.pos;
12769 var len = this.pos - startPos;
12771 makeRoomForExtraLength(startPos, len, this);
12772 this.pos = startPos - 1;
12773 this.writeVarint(len);
12776 writeMessage: function(tag, fn, obj) {
12777 this.writeTag(tag, Pbf.Bytes);
12778 this.writeRawMessage(fn, obj);
12780 writePackedVarint: function(tag, arr) {
12782 this.writeMessage(tag, writePackedVarint, arr);
12784 writePackedSVarint: function(tag, arr) {
12786 this.writeMessage(tag, writePackedSVarint, arr);
12788 writePackedBoolean: function(tag, arr) {
12790 this.writeMessage(tag, writePackedBoolean, arr);
12792 writePackedFloat: function(tag, arr) {
12794 this.writeMessage(tag, writePackedFloat, arr);
12796 writePackedDouble: function(tag, arr) {
12798 this.writeMessage(tag, writePackedDouble, arr);
12800 writePackedFixed32: function(tag, arr) {
12802 this.writeMessage(tag, writePackedFixed32, arr);
12804 writePackedSFixed32: function(tag, arr) {
12806 this.writeMessage(tag, writePackedSFixed32, arr);
12808 writePackedFixed64: function(tag, arr) {
12810 this.writeMessage(tag, writePackedFixed64, arr);
12812 writePackedSFixed64: function(tag, arr) {
12814 this.writeMessage(tag, writePackedSFixed64, arr);
12816 writeBytesField: function(tag, buffer) {
12817 this.writeTag(tag, Pbf.Bytes);
12818 this.writeBytes(buffer);
12820 writeFixed32Field: function(tag, val) {
12821 this.writeTag(tag, Pbf.Fixed32);
12822 this.writeFixed32(val);
12824 writeSFixed32Field: function(tag, val) {
12825 this.writeTag(tag, Pbf.Fixed32);
12826 this.writeSFixed32(val);
12828 writeFixed64Field: function(tag, val) {
12829 this.writeTag(tag, Pbf.Fixed64);
12830 this.writeFixed64(val);
12832 writeSFixed64Field: function(tag, val) {
12833 this.writeTag(tag, Pbf.Fixed64);
12834 this.writeSFixed64(val);
12836 writeVarintField: function(tag, val) {
12837 this.writeTag(tag, Pbf.Varint);
12838 this.writeVarint(val);
12840 writeSVarintField: function(tag, val) {
12841 this.writeTag(tag, Pbf.Varint);
12842 this.writeSVarint(val);
12844 writeStringField: function(tag, str2) {
12845 this.writeTag(tag, Pbf.Bytes);
12846 this.writeString(str2);
12848 writeFloatField: function(tag, val) {
12849 this.writeTag(tag, Pbf.Fixed32);
12850 this.writeFloat(val);
12852 writeDoubleField: function(tag, val) {
12853 this.writeTag(tag, Pbf.Fixed64);
12854 this.writeDouble(val);
12856 writeBooleanField: function(tag, val) {
12857 this.writeVarintField(tag, Boolean(val));
12860 function readVarintRemainder(l, s, p) {
12861 var buf = p.buf, h, b;
12863 h = (b & 112) >> 4;
12865 return toNum(l, h, s);
12867 h |= (b & 127) << 3;
12869 return toNum(l, h, s);
12871 h |= (b & 127) << 10;
12873 return toNum(l, h, s);
12875 h |= (b & 127) << 17;
12877 return toNum(l, h, s);
12879 h |= (b & 127) << 24;
12881 return toNum(l, h, s);
12883 h |= (b & 1) << 31;
12885 return toNum(l, h, s);
12886 throw new Error("Expected varint not more than 10 bytes");
12888 function readPackedEnd(pbf) {
12889 return pbf.type === Pbf.Bytes ? pbf.readVarint() + pbf.pos : pbf.pos + 1;
12891 function toNum(low, high, isSigned) {
12893 return high * 4294967296 + (low >>> 0);
12895 return (high >>> 0) * 4294967296 + (low >>> 0);
12897 function writeBigVarint(val, pbf) {
12900 low = val % 4294967296 | 0;
12901 high = val / 4294967296 | 0;
12903 low = ~(-val % 4294967296);
12904 high = ~(-val / 4294967296);
12905 if (low ^ 4294967295) {
12909 high = high + 1 | 0;
12912 if (val >= 18446744073709552e3 || val < -18446744073709552e3) {
12913 throw new Error("Given varint doesn't fit into 10 bytes");
12916 writeBigVarintLow(low, high, pbf);
12917 writeBigVarintHigh(high, pbf);
12919 function writeBigVarintLow(low, high, pbf) {
12920 pbf.buf[pbf.pos++] = low & 127 | 128;
12922 pbf.buf[pbf.pos++] = low & 127 | 128;
12924 pbf.buf[pbf.pos++] = low & 127 | 128;
12926 pbf.buf[pbf.pos++] = low & 127 | 128;
12928 pbf.buf[pbf.pos] = low & 127;
12930 function writeBigVarintHigh(high, pbf) {
12931 var lsb = (high & 7) << 4;
12932 pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 128 : 0);
12935 pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
12938 pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
12941 pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
12944 pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
12947 pbf.buf[pbf.pos++] = high & 127;
12949 function makeRoomForExtraLength(startPos, len, pbf) {
12950 var extraLen = len <= 16383 ? 1 : len <= 2097151 ? 2 : len <= 268435455 ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
12951 pbf.realloc(extraLen);
12952 for (var i2 = pbf.pos - 1; i2 >= startPos; i2--)
12953 pbf.buf[i2 + extraLen] = pbf.buf[i2];
12955 function writePackedVarint(arr, pbf) {
12956 for (var i2 = 0; i2 < arr.length; i2++)
12957 pbf.writeVarint(arr[i2]);
12959 function writePackedSVarint(arr, pbf) {
12960 for (var i2 = 0; i2 < arr.length; i2++)
12961 pbf.writeSVarint(arr[i2]);
12963 function writePackedFloat(arr, pbf) {
12964 for (var i2 = 0; i2 < arr.length; i2++)
12965 pbf.writeFloat(arr[i2]);
12967 function writePackedDouble(arr, pbf) {
12968 for (var i2 = 0; i2 < arr.length; i2++)
12969 pbf.writeDouble(arr[i2]);
12971 function writePackedBoolean(arr, pbf) {
12972 for (var i2 = 0; i2 < arr.length; i2++)
12973 pbf.writeBoolean(arr[i2]);
12975 function writePackedFixed32(arr, pbf) {
12976 for (var i2 = 0; i2 < arr.length; i2++)
12977 pbf.writeFixed32(arr[i2]);
12979 function writePackedSFixed32(arr, pbf) {
12980 for (var i2 = 0; i2 < arr.length; i2++)
12981 pbf.writeSFixed32(arr[i2]);
12983 function writePackedFixed64(arr, pbf) {
12984 for (var i2 = 0; i2 < arr.length; i2++)
12985 pbf.writeFixed64(arr[i2]);
12987 function writePackedSFixed64(arr, pbf) {
12988 for (var i2 = 0; i2 < arr.length; i2++)
12989 pbf.writeSFixed64(arr[i2]);
12991 function readUInt32(buf, pos) {
12992 return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + buf[pos + 3] * 16777216;
12994 function writeInt32(buf, val, pos) {
12996 buf[pos + 1] = val >>> 8;
12997 buf[pos + 2] = val >>> 16;
12998 buf[pos + 3] = val >>> 24;
13000 function readInt32(buf, pos) {
13001 return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + (buf[pos + 3] << 24);
13003 function readUtf8(buf, pos, end) {
13009 var bytesPerSequence = b0 > 239 ? 4 : b0 > 223 ? 3 : b0 > 191 ? 2 : 1;
13010 if (i2 + bytesPerSequence > end)
13013 if (bytesPerSequence === 1) {
13017 } else if (bytesPerSequence === 2) {
13019 if ((b1 & 192) === 128) {
13020 c = (b0 & 31) << 6 | b1 & 63;
13025 } else if (bytesPerSequence === 3) {
13028 if ((b1 & 192) === 128 && (b2 & 192) === 128) {
13029 c = (b0 & 15) << 12 | (b1 & 63) << 6 | b2 & 63;
13030 if (c <= 2047 || c >= 55296 && c <= 57343) {
13034 } else if (bytesPerSequence === 4) {
13038 if ((b1 & 192) === 128 && (b2 & 192) === 128 && (b3 & 192) === 128) {
13039 c = (b0 & 15) << 18 | (b1 & 63) << 12 | (b2 & 63) << 6 | b3 & 63;
13040 if (c <= 65535 || c >= 1114112) {
13047 bytesPerSequence = 1;
13048 } else if (c > 65535) {
13050 str2 += String.fromCharCode(c >>> 10 & 1023 | 55296);
13051 c = 56320 | c & 1023;
13053 str2 += String.fromCharCode(c);
13054 i2 += bytesPerSequence;
13058 function readUtf8TextDecoder(buf, pos, end) {
13059 return utf8TextDecoder.decode(buf.subarray(pos, end));
13061 function writeUtf8(buf, str2, pos) {
13062 for (var i2 = 0, c, lead; i2 < str2.length; i2++) {
13063 c = str2.charCodeAt(i2);
13064 if (c > 55295 && c < 57344) {
13073 c = lead - 55296 << 10 | c - 56320 | 65536;
13077 if (c > 56319 || i2 + 1 === str2.length) {
13096 buf[pos++] = c >> 6 | 192;
13099 buf[pos++] = c >> 12 | 224;
13101 buf[pos++] = c >> 18 | 240;
13102 buf[pos++] = c >> 12 & 63 | 128;
13104 buf[pos++] = c >> 6 & 63 | 128;
13106 buf[pos++] = c & 63 | 128;
13114 // node_modules/@mapbox/point-geometry/index.js
13115 var require_point_geometry = __commonJS({
13116 "node_modules/@mapbox/point-geometry/index.js"(exports2, module2) {
13118 module2.exports = Point;
13119 function Point(x, y) {
13123 Point.prototype = {
13124 clone: function() {
13125 return new Point(this.x, this.y);
13128 return this.clone()._add(p);
13131 return this.clone()._sub(p);
13133 multByPoint: function(p) {
13134 return this.clone()._multByPoint(p);
13136 divByPoint: function(p) {
13137 return this.clone()._divByPoint(p);
13139 mult: function(k) {
13140 return this.clone()._mult(k);
13143 return this.clone()._div(k);
13145 rotate: function(a) {
13146 return this.clone()._rotate(a);
13148 rotateAround: function(a, p) {
13149 return this.clone()._rotateAround(a, p);
13151 matMult: function(m) {
13152 return this.clone()._matMult(m);
13155 return this.clone()._unit();
13158 return this.clone()._perp();
13160 round: function() {
13161 return this.clone()._round();
13164 return Math.sqrt(this.x * this.x + this.y * this.y);
13166 equals: function(other) {
13167 return this.x === other.x && this.y === other.y;
13169 dist: function(p) {
13170 return Math.sqrt(this.distSqr(p));
13172 distSqr: function(p) {
13173 var dx = p.x - this.x, dy = p.y - this.y;
13174 return dx * dx + dy * dy;
13176 angle: function() {
13177 return Math.atan2(this.y, this.x);
13179 angleTo: function(b) {
13180 return Math.atan2(this.y - b.y, this.x - b.x);
13182 angleWith: function(b) {
13183 return this.angleWithSep(b.x, b.y);
13185 angleWithSep: function(x, y) {
13187 this.x * y - this.y * x,
13188 this.x * x + this.y * y
13191 _matMult: function(m) {
13192 var x = m[0] * this.x + m[1] * this.y, y = m[2] * this.x + m[3] * this.y;
13197 _add: function(p) {
13202 _sub: function(p) {
13207 _mult: function(k) {
13212 _div: function(k) {
13217 _multByPoint: function(p) {
13222 _divByPoint: function(p) {
13227 _unit: function() {
13228 this._div(this.mag());
13231 _perp: function() {
13237 _rotate: function(angle2) {
13238 var cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x = cos2 * this.x - sin2 * this.y, y = sin2 * this.x + cos2 * this.y;
13243 _rotateAround: function(angle2, p) {
13244 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);
13249 _round: function() {
13250 this.x = Math.round(this.x);
13251 this.y = Math.round(this.y);
13255 Point.convert = function(a) {
13256 if (a instanceof Point) {
13259 if (Array.isArray(a)) {
13260 return new Point(a[0], a[1]);
13267 // node_modules/@mapbox/vector-tile/lib/vectortilefeature.js
13268 var require_vectortilefeature = __commonJS({
13269 "node_modules/@mapbox/vector-tile/lib/vectortilefeature.js"(exports2, module2) {
13271 var Point = require_point_geometry();
13272 module2.exports = VectorTileFeature;
13273 function VectorTileFeature(pbf, end, extent, keys, values) {
13274 this.properties = {};
13275 this.extent = extent;
13278 this._geometry = -1;
13280 this._values = values;
13281 pbf.readFields(readFeature, this, end);
13283 function readFeature(tag, feature3, pbf) {
13285 feature3.id = pbf.readVarint();
13287 readTag(pbf, feature3);
13289 feature3.type = pbf.readVarint();
13291 feature3._geometry = pbf.pos;
13293 function readTag(pbf, feature3) {
13294 var end = pbf.readVarint() + pbf.pos;
13295 while (pbf.pos < end) {
13296 var key = feature3._keys[pbf.readVarint()], value = feature3._values[pbf.readVarint()];
13297 feature3.properties[key] = value;
13300 VectorTileFeature.types = ["Unknown", "Point", "LineString", "Polygon"];
13301 VectorTileFeature.prototype.loadGeometry = function() {
13302 var pbf = this._pbf;
13303 pbf.pos = this._geometry;
13304 var end = pbf.readVarint() + pbf.pos, cmd = 1, length = 0, x = 0, y = 0, lines = [], line;
13305 while (pbf.pos < end) {
13307 var cmdLen = pbf.readVarint();
13309 length = cmdLen >> 3;
13312 if (cmd === 1 || cmd === 2) {
13313 x += pbf.readSVarint();
13314 y += pbf.readSVarint();
13320 line.push(new Point(x, y));
13321 } else if (cmd === 7) {
13323 line.push(line[0].clone());
13326 throw new Error("unknown command " + cmd);
13333 VectorTileFeature.prototype.bbox = function() {
13334 var pbf = this._pbf;
13335 pbf.pos = this._geometry;
13336 var end = pbf.readVarint() + pbf.pos, cmd = 1, length = 0, x = 0, y = 0, x12 = Infinity, x2 = -Infinity, y12 = Infinity, y2 = -Infinity;
13337 while (pbf.pos < end) {
13339 var cmdLen = pbf.readVarint();
13341 length = cmdLen >> 3;
13344 if (cmd === 1 || cmd === 2) {
13345 x += pbf.readSVarint();
13346 y += pbf.readSVarint();
13355 } else if (cmd !== 7) {
13356 throw new Error("unknown command " + cmd);
13359 return [x12, y12, x2, y2];
13361 VectorTileFeature.prototype.toGeoJSON = function(x, y, z) {
13362 var size = this.extent * Math.pow(2, z), x05 = this.extent * x, y05 = this.extent * y, coords = this.loadGeometry(), type3 = VectorTileFeature.types[this.type], i2, j2;
13363 function project(line) {
13364 for (var j3 = 0; j3 < line.length; j3++) {
13365 var p = line[j3], y2 = 180 - (p.y + y05) * 360 / size;
13367 (p.x + x05) * 360 / size - 180,
13368 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90
13372 switch (this.type) {
13375 for (i2 = 0; i2 < coords.length; i2++) {
13376 points[i2] = coords[i2][0];
13382 for (i2 = 0; i2 < coords.length; i2++) {
13383 project(coords[i2]);
13387 coords = classifyRings(coords);
13388 for (i2 = 0; i2 < coords.length; i2++) {
13389 for (j2 = 0; j2 < coords[i2].length; j2++) {
13390 project(coords[i2][j2]);
13395 if (coords.length === 1) {
13396 coords = coords[0];
13398 type3 = "Multi" + type3;
13404 coordinates: coords
13406 properties: this.properties
13408 if ("id" in this) {
13409 result.id = this.id;
13413 function classifyRings(rings) {
13414 var len = rings.length;
13417 var polygons = [], polygon2, ccw;
13418 for (var i2 = 0; i2 < len; i2++) {
13419 var area = signedArea(rings[i2]);
13422 if (ccw === void 0)
13424 if (ccw === area < 0) {
13426 polygons.push(polygon2);
13427 polygon2 = [rings[i2]];
13429 polygon2.push(rings[i2]);
13433 polygons.push(polygon2);
13436 function signedArea(ring) {
13438 for (var i2 = 0, len = ring.length, j2 = len - 1, p1, p2; i2 < len; j2 = i2++) {
13441 sum += (p2.x - p1.x) * (p1.y + p2.y);
13448 // node_modules/@mapbox/vector-tile/lib/vectortilelayer.js
13449 var require_vectortilelayer = __commonJS({
13450 "node_modules/@mapbox/vector-tile/lib/vectortilelayer.js"(exports2, module2) {
13452 var VectorTileFeature = require_vectortilefeature();
13453 module2.exports = VectorTileLayer;
13454 function VectorTileLayer(pbf, end) {
13457 this.extent = 4096;
13462 this._features = [];
13463 pbf.readFields(readLayer, this, end);
13464 this.length = this._features.length;
13466 function readLayer(tag, layer, pbf) {
13468 layer.version = pbf.readVarint();
13469 else if (tag === 1)
13470 layer.name = pbf.readString();
13471 else if (tag === 5)
13472 layer.extent = pbf.readVarint();
13473 else if (tag === 2)
13474 layer._features.push(pbf.pos);
13475 else if (tag === 3)
13476 layer._keys.push(pbf.readString());
13477 else if (tag === 4)
13478 layer._values.push(readValueMessage(pbf));
13480 function readValueMessage(pbf) {
13481 var value = null, end = pbf.readVarint() + pbf.pos;
13482 while (pbf.pos < end) {
13483 var tag = pbf.readVarint() >> 3;
13484 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;
13488 VectorTileLayer.prototype.feature = function(i2) {
13489 if (i2 < 0 || i2 >= this._features.length)
13490 throw new Error("feature index out of bounds");
13491 this._pbf.pos = this._features[i2];
13492 var end = this._pbf.readVarint() + this._pbf.pos;
13493 return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);
13498 // node_modules/@mapbox/vector-tile/lib/vectortile.js
13499 var require_vectortile = __commonJS({
13500 "node_modules/@mapbox/vector-tile/lib/vectortile.js"(exports2, module2) {
13502 var VectorTileLayer = require_vectortilelayer();
13503 module2.exports = VectorTile2;
13504 function VectorTile2(pbf, end) {
13505 this.layers = pbf.readFields(readTile, {}, end);
13507 function readTile(tag, layers, pbf) {
13509 var layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
13511 layers[layer.name] = layer;
13517 // node_modules/@mapbox/vector-tile/index.js
13518 var require_vector_tile = __commonJS({
13519 "node_modules/@mapbox/vector-tile/index.js"(exports2, module2) {
13520 module2.exports.VectorTile = require_vectortile();
13521 module2.exports.VectorTileFeature = require_vectortilefeature();
13522 module2.exports.VectorTileLayer = require_vectortilelayer();
13526 // node_modules/fast-json-stable-stringify/index.js
13527 var require_fast_json_stable_stringify = __commonJS({
13528 "node_modules/fast-json-stable-stringify/index.js"(exports2, module2) {
13530 module2.exports = function(data, opts) {
13533 if (typeof opts === "function")
13534 opts = { cmp: opts };
13535 var cycles = typeof opts.cycles === "boolean" ? opts.cycles : false;
13536 var cmp = opts.cmp && function(f2) {
13537 return function(node) {
13538 return function(a, b) {
13539 var aobj = { key: a, value: node[a] };
13540 var bobj = { key: b, value: node[b] };
13541 return f2(aobj, bobj);
13546 return function stringify3(node) {
13547 if (node && node.toJSON && typeof node.toJSON === "function") {
13548 node = node.toJSON();
13550 if (node === void 0)
13552 if (typeof node == "number")
13553 return isFinite(node) ? "" + node : "null";
13554 if (typeof node !== "object")
13555 return JSON.stringify(node);
13557 if (Array.isArray(node)) {
13559 for (i2 = 0; i2 < node.length; i2++) {
13562 out += stringify3(node[i2]) || "null";
13568 if (seen.indexOf(node) !== -1) {
13570 return JSON.stringify("__cycle__");
13571 throw new TypeError("Converting circular structure to JSON");
13573 var seenIndex = seen.push(node) - 1;
13574 var keys = Object.keys(node).sort(cmp && cmp(node));
13576 for (i2 = 0; i2 < keys.length; i2++) {
13577 var key = keys[i2];
13578 var value = stringify3(node[key]);
13583 out += JSON.stringify(key) + ":" + value;
13585 seen.splice(seenIndex, 1);
13586 return "{" + out + "}";
13592 // node_modules/@mapbox/sexagesimal/index.js
13593 var require_sexagesimal = __commonJS({
13594 "node_modules/@mapbox/sexagesimal/index.js"(exports2, module2) {
13595 module2.exports = element;
13596 module2.exports.pair = pair2;
13597 module2.exports.format = format2;
13598 module2.exports.formatPair = formatPair;
13599 module2.exports.coordToDMS = coordToDMS;
13600 function element(input, dims) {
13601 var result = search(input, dims);
13602 return result === null ? null : result.val;
13604 function formatPair(input) {
13605 return format2(input.lat, "lat") + " " + format2(input.lon, "lon");
13607 function format2(input, dim) {
13608 var dms = coordToDMS(input, dim);
13609 return dms.whole + "\xB0 " + (dms.minutes ? dms.minutes + "' " : "") + (dms.seconds ? dms.seconds + '" ' : "") + dms.dir;
13611 function coordToDMS(input, dim) {
13612 var dirs = { lat: ["N", "S"], lon: ["E", "W"] }[dim] || "";
13613 var dir = dirs[input >= 0 ? 0 : 1];
13614 var abs3 = Math.abs(input);
13615 var whole = Math.floor(abs3);
13616 var fraction = abs3 - whole;
13617 var fractionMinutes = fraction * 60;
13618 var minutes = Math.floor(fractionMinutes);
13619 var seconds = Math.floor((fractionMinutes - minutes) * 60);
13627 function search(input, dims) {
13630 if (typeof input !== "string")
13632 input = input.toUpperCase();
13633 var regex = /^[\s\,]*([NSEW])?\s*([\-|\—|\―]?[0-9.]+)[°º˚]?\s*(?:([0-9.]+)['’′‘]\s*)?(?:([0-9.]+)(?:''|"|”|″)\s*)?([NSEW])?/;
13634 var m = input.match(regex);
13637 var matched = m[0];
13639 if (m[1] && m[5]) {
13641 matched = matched.slice(0, -1);
13643 dim = m[1] || m[5];
13645 if (dim && dims.indexOf(dim) === -1)
13647 var deg = m[2] ? parseFloat(m[2]) : 0;
13648 var min3 = m[3] ? parseFloat(m[3]) / 60 : 0;
13649 var sec = m[4] ? parseFloat(m[4]) / 3600 : 0;
13650 var sign2 = deg < 0 ? -1 : 1;
13651 if (dim === "S" || dim === "W")
13654 val: (Math.abs(deg) + min3 + sec) * sign2,
13657 remain: input.slice(matched.length)
13660 function pair2(input, dims) {
13661 input = input.trim();
13662 var one2 = search(input, dims);
13665 input = one2.remain.trim();
13666 var two = search(input, dims);
13667 if (!two || two.remain)
13670 return swapdim(one2.val, two.val, one2.dim);
13672 return [one2.val, two.val];
13675 function swapdim(a, b, dim) {
13676 if (dim === "N" || dim === "S")
13678 if (dim === "W" || dim === "E")
13684 // node_modules/store/src/util.js
13685 var require_util = __commonJS({
13686 "node_modules/store/src/util.js"(exports2, module2) {
13687 var assign = make_assign();
13688 var create2 = make_create();
13689 var trim = make_trim();
13690 var Global = typeof window !== "undefined" ? window : global;
13691 module2.exports = {
13702 isObject: isObject3,
13705 function make_assign() {
13706 if (Object.assign) {
13707 return Object.assign;
13709 return function shimAssign(obj, props1, props2, etc) {
13710 for (var i2 = 1; i2 < arguments.length; i2++) {
13711 each(Object(arguments[i2]), function(val, key) {
13719 function make_create() {
13720 if (Object.create) {
13721 return function create3(obj, assignProps1, assignProps2, etc) {
13722 var assignArgsList = slice(arguments, 1);
13723 return assign.apply(this, [Object.create(obj)].concat(assignArgsList));
13726 let F2 = function() {
13729 return function create3(obj, assignProps1, assignProps2, etc) {
13730 var assignArgsList = slice(arguments, 1);
13731 F2.prototype = obj;
13732 return assign.apply(this, [new F2()].concat(assignArgsList));
13736 function make_trim() {
13737 if (String.prototype.trim) {
13738 return function trim2(str2) {
13739 return String.prototype.trim.call(str2);
13742 return function trim2(str2) {
13743 return str2.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
13747 function bind(obj, fn) {
13748 return function() {
13749 return fn.apply(obj, Array.prototype.slice.call(arguments, 0));
13752 function slice(arr, index) {
13753 return Array.prototype.slice.call(arr, index || 0);
13755 function each(obj, fn) {
13756 pluck(obj, function(val, key) {
13761 function map2(obj, fn) {
13762 var res = isList(obj) ? [] : {};
13763 pluck(obj, function(v, k) {
13769 function pluck(obj, fn) {
13771 for (var i2 = 0; i2 < obj.length; i2++) {
13772 if (fn(obj[i2], i2)) {
13777 for (var key in obj) {
13778 if (obj.hasOwnProperty(key)) {
13779 if (fn(obj[key], key)) {
13786 function isList(val) {
13787 return val != null && typeof val != "function" && typeof val.length == "number";
13789 function isFunction(val) {
13790 return val && {}.toString.call(val) === "[object Function]";
13792 function isObject3(val) {
13793 return val && {}.toString.call(val) === "[object Object]";
13798 // node_modules/store/src/store-engine.js
13799 var require_store_engine = __commonJS({
13800 "node_modules/store/src/store-engine.js"(exports2, module2) {
13801 var util = require_util();
13802 var slice = util.slice;
13803 var pluck = util.pluck;
13804 var each = util.each;
13805 var bind = util.bind;
13806 var create2 = util.create;
13807 var isList = util.isList;
13808 var isFunction = util.isFunction;
13809 var isObject3 = util.isObject;
13810 module2.exports = {
13816 get: function(key, optionalDefaultValue) {
13817 var data = this.storage.read(this._namespacePrefix + key);
13818 return this._deserialize(data, optionalDefaultValue);
13820 set: function(key, value) {
13821 if (value === void 0) {
13822 return this.remove(key);
13824 this.storage.write(this._namespacePrefix + key, this._serialize(value));
13827 remove: function(key) {
13828 this.storage.remove(this._namespacePrefix + key);
13830 each: function(callback) {
13832 this.storage.each(function(val, namespacedKey) {
13833 callback.call(self2, self2._deserialize(val), (namespacedKey || "").replace(self2._namespaceRegexp, ""));
13836 clearAll: function() {
13837 this.storage.clearAll();
13839 hasNamespace: function(namespace) {
13840 return this._namespacePrefix == "__storejs_" + namespace + "_";
13842 createStore: function() {
13843 return createStore.apply(this, arguments);
13845 addPlugin: function(plugin) {
13846 this._addPlugin(plugin);
13848 namespace: function(namespace) {
13849 return createStore(this.storage, this.plugins, namespace);
13853 var _console = typeof console == "undefined" ? null : console;
13857 var fn = _console.warn ? _console.warn : _console.log;
13858 fn.apply(_console, arguments);
13860 function createStore(storages, plugins, namespace) {
13864 if (storages && !isList(storages)) {
13865 storages = [storages];
13867 if (plugins && !isList(plugins)) {
13868 plugins = [plugins];
13870 var namespacePrefix = namespace ? "__storejs_" + namespace + "_" : "";
13871 var namespaceRegexp = namespace ? new RegExp("^" + namespacePrefix) : null;
13872 var legalNamespaces = /^[a-zA-Z0-9_\-]*$/;
13873 if (!legalNamespaces.test(namespace)) {
13874 throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes");
13876 var _privateStoreProps = {
13877 _namespacePrefix: namespacePrefix,
13878 _namespaceRegexp: namespaceRegexp,
13879 _testStorage: function(storage) {
13881 var testStr = "__storejs__test__";
13882 storage.write(testStr, testStr);
13883 var ok = storage.read(testStr) === testStr;
13884 storage.remove(testStr);
13890 _assignPluginFnProp: function(pluginFnProp, propName) {
13891 var oldFn = this[propName];
13892 this[propName] = function pluginFn() {
13893 var args = slice(arguments, 0);
13895 function super_fn() {
13899 each(arguments, function(arg, i2) {
13902 return oldFn.apply(self2, args);
13904 var newFnArgs = [super_fn].concat(args);
13905 return pluginFnProp.apply(self2, newFnArgs);
13908 _serialize: function(obj) {
13909 return JSON.stringify(obj);
13911 _deserialize: function(strVal, defaultVal) {
13917 val = JSON.parse(strVal);
13921 return val !== void 0 ? val : defaultVal;
13923 _addStorage: function(storage) {
13924 if (this.enabled) {
13927 if (this._testStorage(storage)) {
13928 this.storage = storage;
13929 this.enabled = true;
13932 _addPlugin: function(plugin) {
13934 if (isList(plugin)) {
13935 each(plugin, function(plugin2) {
13936 self2._addPlugin(plugin2);
13940 var seenPlugin = pluck(this.plugins, function(seenPlugin2) {
13941 return plugin === seenPlugin2;
13946 this.plugins.push(plugin);
13947 if (!isFunction(plugin)) {
13948 throw new Error("Plugins must be function values that return objects");
13950 var pluginProperties = plugin.call(this);
13951 if (!isObject3(pluginProperties)) {
13952 throw new Error("Plugins must return an object of function properties");
13954 each(pluginProperties, function(pluginFnProp, propName) {
13955 if (!isFunction(pluginFnProp)) {
13956 throw new Error("Bad plugin property: " + propName + " from plugin " + plugin.name + ". Plugins should only return functions.");
13958 self2._assignPluginFnProp(pluginFnProp, propName);
13961 addStorage: function(storage) {
13962 _warn("store.addStorage(storage) is deprecated. Use createStore([storages])");
13963 this._addStorage(storage);
13966 var store2 = create2(_privateStoreProps, storeAPI, {
13970 each(store2, function(prop, propName) {
13971 if (isFunction(prop)) {
13972 store2.raw[propName] = bind(store2, prop);
13975 each(storages, function(storage) {
13976 store2._addStorage(storage);
13978 each(plugins, function(plugin) {
13979 store2._addPlugin(plugin);
13986 // node_modules/store/storages/localStorage.js
13987 var require_localStorage = __commonJS({
13988 "node_modules/store/storages/localStorage.js"(exports2, module2) {
13989 var util = require_util();
13990 var Global = util.Global;
13991 module2.exports = {
13992 name: "localStorage",
13999 function localStorage2() {
14000 return Global.localStorage;
14002 function read(key) {
14003 return localStorage2().getItem(key);
14005 function write(key, data) {
14006 return localStorage2().setItem(key, data);
14008 function each(fn) {
14009 for (var i2 = localStorage2().length - 1; i2 >= 0; i2--) {
14010 var key = localStorage2().key(i2);
14011 fn(read(key), key);
14014 function remove2(key) {
14015 return localStorage2().removeItem(key);
14017 function clearAll() {
14018 return localStorage2().clear();
14023 // node_modules/store/storages/oldFF-globalStorage.js
14024 var require_oldFF_globalStorage = __commonJS({
14025 "node_modules/store/storages/oldFF-globalStorage.js"(exports2, module2) {
14026 var util = require_util();
14027 var Global = util.Global;
14028 module2.exports = {
14029 name: "oldFF-globalStorage",
14036 var globalStorage = Global.globalStorage;
14037 function read(key) {
14038 return globalStorage[key];
14040 function write(key, data) {
14041 globalStorage[key] = data;
14043 function each(fn) {
14044 for (var i2 = globalStorage.length - 1; i2 >= 0; i2--) {
14045 var key = globalStorage.key(i2);
14046 fn(globalStorage[key], key);
14049 function remove2(key) {
14050 return globalStorage.removeItem(key);
14052 function clearAll() {
14053 each(function(key, _) {
14054 delete globalStorage[key];
14060 // node_modules/store/storages/oldIE-userDataStorage.js
14061 var require_oldIE_userDataStorage = __commonJS({
14062 "node_modules/store/storages/oldIE-userDataStorage.js"(exports2, module2) {
14063 var util = require_util();
14064 var Global = util.Global;
14065 module2.exports = {
14066 name: "oldIE-userDataStorage",
14073 var storageName = "storejs";
14074 var doc = Global.document;
14075 var _withStorageEl = _makeIEStorageElFunction();
14076 var disable = (Global.navigator ? Global.navigator.userAgent : "").match(/ (MSIE 8|MSIE 9|MSIE 10)\./);
14077 function write(unfixedKey, data) {
14081 var fixedKey = fixKey(unfixedKey);
14082 _withStorageEl(function(storageEl) {
14083 storageEl.setAttribute(fixedKey, data);
14084 storageEl.save(storageName);
14087 function read(unfixedKey) {
14091 var fixedKey = fixKey(unfixedKey);
14093 _withStorageEl(function(storageEl) {
14094 res = storageEl.getAttribute(fixedKey);
14098 function each(callback) {
14099 _withStorageEl(function(storageEl) {
14100 var attributes = storageEl.XMLDocument.documentElement.attributes;
14101 for (var i2 = attributes.length - 1; i2 >= 0; i2--) {
14102 var attr = attributes[i2];
14103 callback(storageEl.getAttribute(attr.name), attr.name);
14107 function remove2(unfixedKey) {
14108 var fixedKey = fixKey(unfixedKey);
14109 _withStorageEl(function(storageEl) {
14110 storageEl.removeAttribute(fixedKey);
14111 storageEl.save(storageName);
14114 function clearAll() {
14115 _withStorageEl(function(storageEl) {
14116 var attributes = storageEl.XMLDocument.documentElement.attributes;
14117 storageEl.load(storageName);
14118 for (var i2 = attributes.length - 1; i2 >= 0; i2--) {
14119 storageEl.removeAttribute(attributes[i2].name);
14121 storageEl.save(storageName);
14124 var forbiddenCharsRegex = new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]", "g");
14125 function fixKey(key) {
14126 return key.replace(/^\d/, "___$&").replace(forbiddenCharsRegex, "___");
14128 function _makeIEStorageElFunction() {
14129 if (!doc || !doc.documentElement || !doc.documentElement.addBehavior) {
14132 var scriptTag = "script", storageOwner, storageContainer, storageEl;
14134 storageContainer = new ActiveXObject("htmlfile");
14135 storageContainer.open();
14136 storageContainer.write("<" + scriptTag + ">document.w=window</" + scriptTag + '><iframe src="/favicon.ico"></iframe>');
14137 storageContainer.close();
14138 storageOwner = storageContainer.w.frames[0].document;
14139 storageEl = storageOwner.createElement("div");
14141 storageEl = doc.createElement("div");
14142 storageOwner = doc.body;
14144 return function(storeFunction) {
14145 var args = [].slice.call(arguments, 0);
14146 args.unshift(storageEl);
14147 storageOwner.appendChild(storageEl);
14148 storageEl.addBehavior("#default#userData");
14149 storageEl.load(storageName);
14150 storeFunction.apply(this, args);
14151 storageOwner.removeChild(storageEl);
14158 // node_modules/store/storages/cookieStorage.js
14159 var require_cookieStorage = __commonJS({
14160 "node_modules/store/storages/cookieStorage.js"(exports2, module2) {
14161 var util = require_util();
14162 var Global = util.Global;
14163 var trim = util.trim;
14164 module2.exports = {
14165 name: "cookieStorage",
14172 var doc = Global.document;
14173 function read(key) {
14174 if (!key || !_has(key)) {
14177 var regexpStr = "(?:^|.*;\\s*)" + escape(key).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";
14178 return unescape(doc.cookie.replace(new RegExp(regexpStr), "$1"));
14180 function each(callback) {
14181 var cookies = doc.cookie.split(/; ?/g);
14182 for (var i2 = cookies.length - 1; i2 >= 0; i2--) {
14183 if (!trim(cookies[i2])) {
14186 var kvp = cookies[i2].split("=");
14187 var key = unescape(kvp[0]);
14188 var val = unescape(kvp[1]);
14189 callback(val, key);
14192 function write(key, data) {
14196 doc.cookie = escape(key) + "=" + escape(data) + "; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/";
14198 function remove2(key) {
14199 if (!key || !_has(key)) {
14202 doc.cookie = escape(key) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/";
14204 function clearAll() {
14205 each(function(_, key) {
14209 function _has(key) {
14210 return new RegExp("(?:^|;\\s*)" + escape(key).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=").test(doc.cookie);
14215 // node_modules/store/storages/sessionStorage.js
14216 var require_sessionStorage = __commonJS({
14217 "node_modules/store/storages/sessionStorage.js"(exports2, module2) {
14218 var util = require_util();
14219 var Global = util.Global;
14220 module2.exports = {
14221 name: "sessionStorage",
14228 function sessionStorage() {
14229 return Global.sessionStorage;
14231 function read(key) {
14232 return sessionStorage().getItem(key);
14234 function write(key, data) {
14235 return sessionStorage().setItem(key, data);
14237 function each(fn) {
14238 for (var i2 = sessionStorage().length - 1; i2 >= 0; i2--) {
14239 var key = sessionStorage().key(i2);
14240 fn(read(key), key);
14243 function remove2(key) {
14244 return sessionStorage().removeItem(key);
14246 function clearAll() {
14247 return sessionStorage().clear();
14252 // node_modules/store/storages/memoryStorage.js
14253 var require_memoryStorage = __commonJS({
14254 "node_modules/store/storages/memoryStorage.js"(exports2, module2) {
14255 module2.exports = {
14256 name: "memoryStorage",
14263 var memoryStorage = {};
14264 function read(key) {
14265 return memoryStorage[key];
14267 function write(key, data) {
14268 memoryStorage[key] = data;
14270 function each(callback) {
14271 for (var key in memoryStorage) {
14272 if (memoryStorage.hasOwnProperty(key)) {
14273 callback(memoryStorage[key], key);
14277 function remove2(key) {
14278 delete memoryStorage[key];
14280 function clearAll(key) {
14281 memoryStorage = {};
14286 // node_modules/store/storages/all.js
14287 var require_all = __commonJS({
14288 "node_modules/store/storages/all.js"(exports2, module2) {
14289 module2.exports = [
14290 require_localStorage(),
14291 require_oldFF_globalStorage(),
14292 require_oldIE_userDataStorage(),
14293 require_cookieStorage(),
14294 require_sessionStorage(),
14295 require_memoryStorage()
14300 // node_modules/store/plugins/lib/json2.js
14301 var require_json2 = __commonJS({
14302 "node_modules/store/plugins/lib/json2.js"(exports, module) {
14303 if (typeof JSON !== "object") {
14308 var rx_one = /^[\],:{}\s]*$/;
14309 var rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g;
14310 var rx_three = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;
14311 var rx_four = /(?:^|:|,)(?:\s*\[)+/g;
14312 var rx_escapable = /[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
14313 var rx_dangerous = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
14315 return n2 < 10 ? "0" + n2 : n2;
14317 function this_value() {
14318 return this.valueOf();
14320 if (typeof Date.prototype.toJSON !== "function") {
14321 Date.prototype.toJSON = function() {
14322 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;
14324 Boolean.prototype.toJSON = this_value;
14325 Number.prototype.toJSON = this_value;
14326 String.prototype.toJSON = this_value;
14332 function quote(string) {
14333 rx_escapable.lastIndex = 0;
14334 return rx_escapable.test(string) ? '"' + string.replace(rx_escapable, function(a) {
14336 return typeof c === "string" ? c : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
14337 }) + '"' : '"' + string + '"';
14339 function str(key, holder) {
14346 var value = holder[key];
14347 if (value && typeof value === "object" && typeof value.toJSON === "function") {
14348 value = value.toJSON(key);
14350 if (typeof rep === "function") {
14351 value = rep.call(holder, key, value);
14353 switch (typeof value) {
14355 return quote(value);
14357 return isFinite(value) ? String(value) : "null";
14360 return String(value);
14367 if (Object.prototype.toString.apply(value) === "[object Array]") {
14368 length = value.length;
14369 for (i2 = 0; i2 < length; i2 += 1) {
14370 partial[i2] = str(i2, value) || "null";
14372 v = partial.length === 0 ? "[]" : gap ? "[\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "]" : "[" + partial.join(",") + "]";
14376 if (rep && typeof rep === "object") {
14377 length = rep.length;
14378 for (i2 = 0; i2 < length; i2 += 1) {
14379 if (typeof rep[i2] === "string") {
14383 partial.push(quote(k) + (gap ? ": " : ":") + v);
14389 if (Object.prototype.hasOwnProperty.call(value, k)) {
14392 partial.push(quote(k) + (gap ? ": " : ":") + v);
14397 v = partial.length === 0 ? "{}" : gap ? "{\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "}" : "{" + partial.join(",") + "}";
14402 if (typeof JSON.stringify !== "function") {
14412 JSON.stringify = function(value, replacer, space) {
14416 if (typeof space === "number") {
14417 for (i2 = 0; i2 < space; i2 += 1) {
14420 } else if (typeof space === "string") {
14424 if (replacer && typeof replacer !== "function" && (typeof replacer !== "object" || typeof replacer.length !== "number")) {
14425 throw new Error("JSON.stringify");
14427 return str("", { "": value });
14430 if (typeof JSON.parse !== "function") {
14431 JSON.parse = function(text, reviver) {
14433 function walk(holder, key) {
14436 var value = holder[key];
14437 if (value && typeof value === "object") {
14439 if (Object.prototype.hasOwnProperty.call(value, k)) {
14440 v = walk(value, k);
14441 if (v !== void 0) {
14449 return reviver.call(holder, key, value);
14451 text = String(text);
14452 rx_dangerous.lastIndex = 0;
14453 if (rx_dangerous.test(text)) {
14454 text = text.replace(rx_dangerous, function(a) {
14455 return "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
14459 text.replace(rx_two, "@").replace(rx_three, "]").replace(rx_four, "")
14461 j = eval("(" + text + ")");
14462 return typeof reviver === "function" ? walk({ "": j }, "") : j;
14464 throw new SyntaxError("JSON.parse");
14471 // node_modules/store/plugins/json2.js
14472 var require_json22 = __commonJS({
14473 "node_modules/store/plugins/json2.js"(exports2, module2) {
14474 module2.exports = json2Plugin;
14475 function json2Plugin() {
14482 // node_modules/store/dist/store.legacy.js
14483 var require_store_legacy = __commonJS({
14484 "node_modules/store/dist/store.legacy.js"(exports2, module2) {
14485 var engine = require_store_engine();
14486 var storages = require_all();
14487 var plugins = [require_json22()];
14488 module2.exports = engine.createStore(storages, plugins);
14492 // node_modules/whatwg-fetch/fetch.js
14493 var global2 = typeof globalThis !== "undefined" && globalThis || typeof self !== "undefined" && self || typeof global2 !== "undefined" && global2;
14495 searchParams: "URLSearchParams" in global2,
14496 iterable: "Symbol" in global2 && "iterator" in Symbol,
14497 blob: "FileReader" in global2 && "Blob" in global2 && function() {
14505 formData: "FormData" in global2,
14506 arrayBuffer: "ArrayBuffer" in global2
14508 function isDataView(obj) {
14509 return obj && DataView.prototype.isPrototypeOf(obj);
14511 if (support.arrayBuffer) {
14513 "[object Int8Array]",
14514 "[object Uint8Array]",
14515 "[object Uint8ClampedArray]",
14516 "[object Int16Array]",
14517 "[object Uint16Array]",
14518 "[object Int32Array]",
14519 "[object Uint32Array]",
14520 "[object Float32Array]",
14521 "[object Float64Array]"
14523 isArrayBufferView = ArrayBuffer.isView || function(obj) {
14524 return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1;
14528 var isArrayBufferView;
14529 function normalizeName(name) {
14530 if (typeof name !== "string") {
14531 name = String(name);
14533 if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === "") {
14534 throw new TypeError('Invalid character in header field name: "' + name + '"');
14536 return name.toLowerCase();
14538 function normalizeValue(value) {
14539 if (typeof value !== "string") {
14540 value = String(value);
14544 function iteratorFor(items) {
14547 var value = items.shift();
14548 return { done: value === void 0, value };
14551 if (support.iterable) {
14552 iterator[Symbol.iterator] = function() {
14558 function Headers(headers) {
14560 if (headers instanceof Headers) {
14561 headers.forEach(function(value, name) {
14562 this.append(name, value);
14564 } else if (Array.isArray(headers)) {
14565 headers.forEach(function(header) {
14566 this.append(header[0], header[1]);
14568 } else if (headers) {
14569 Object.getOwnPropertyNames(headers).forEach(function(name) {
14570 this.append(name, headers[name]);
14574 Headers.prototype.append = function(name, value) {
14575 name = normalizeName(name);
14576 value = normalizeValue(value);
14577 var oldValue = this.map[name];
14578 this.map[name] = oldValue ? oldValue + ", " + value : value;
14580 Headers.prototype["delete"] = function(name) {
14581 delete this.map[normalizeName(name)];
14583 Headers.prototype.get = function(name) {
14584 name = normalizeName(name);
14585 return this.has(name) ? this.map[name] : null;
14587 Headers.prototype.has = function(name) {
14588 return this.map.hasOwnProperty(normalizeName(name));
14590 Headers.prototype.set = function(name, value) {
14591 this.map[normalizeName(name)] = normalizeValue(value);
14593 Headers.prototype.forEach = function(callback, thisArg) {
14594 for (var name in this.map) {
14595 if (this.map.hasOwnProperty(name)) {
14596 callback.call(thisArg, this.map[name], name, this);
14600 Headers.prototype.keys = function() {
14602 this.forEach(function(value, name) {
14605 return iteratorFor(items);
14607 Headers.prototype.values = function() {
14609 this.forEach(function(value) {
14612 return iteratorFor(items);
14614 Headers.prototype.entries = function() {
14616 this.forEach(function(value, name) {
14617 items.push([name, value]);
14619 return iteratorFor(items);
14621 if (support.iterable) {
14622 Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
14624 function consumed(body) {
14625 if (body.bodyUsed) {
14626 return Promise.reject(new TypeError("Already read"));
14628 body.bodyUsed = true;
14630 function fileReaderReady(reader) {
14631 return new Promise(function(resolve, reject) {
14632 reader.onload = function() {
14633 resolve(reader.result);
14635 reader.onerror = function() {
14636 reject(reader.error);
14640 function readBlobAsArrayBuffer(blob) {
14641 var reader = new FileReader();
14642 var promise = fileReaderReady(reader);
14643 reader.readAsArrayBuffer(blob);
14646 function readBlobAsText(blob) {
14647 var reader = new FileReader();
14648 var promise = fileReaderReady(reader);
14649 reader.readAsText(blob);
14652 function readArrayBufferAsText(buf) {
14653 var view = new Uint8Array(buf);
14654 var chars = new Array(view.length);
14655 for (var i2 = 0; i2 < view.length; i2++) {
14656 chars[i2] = String.fromCharCode(view[i2]);
14658 return chars.join("");
14660 function bufferClone(buf) {
14662 return buf.slice(0);
14664 var view = new Uint8Array(buf.byteLength);
14665 view.set(new Uint8Array(buf));
14666 return view.buffer;
14670 this.bodyUsed = false;
14671 this._initBody = function(body) {
14672 this.bodyUsed = this.bodyUsed;
14673 this._bodyInit = body;
14675 this._bodyText = "";
14676 } else if (typeof body === "string") {
14677 this._bodyText = body;
14678 } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
14679 this._bodyBlob = body;
14680 } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
14681 this._bodyFormData = body;
14682 } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
14683 this._bodyText = body.toString();
14684 } else if (support.arrayBuffer && support.blob && isDataView(body)) {
14685 this._bodyArrayBuffer = bufferClone(body.buffer);
14686 this._bodyInit = new Blob([this._bodyArrayBuffer]);
14687 } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
14688 this._bodyArrayBuffer = bufferClone(body);
14690 this._bodyText = body = Object.prototype.toString.call(body);
14692 if (!this.headers.get("content-type")) {
14693 if (typeof body === "string") {
14694 this.headers.set("content-type", "text/plain;charset=UTF-8");
14695 } else if (this._bodyBlob && this._bodyBlob.type) {
14696 this.headers.set("content-type", this._bodyBlob.type);
14697 } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
14698 this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8");
14702 if (support.blob) {
14703 this.blob = function() {
14704 var rejected = consumed(this);
14708 if (this._bodyBlob) {
14709 return Promise.resolve(this._bodyBlob);
14710 } else if (this._bodyArrayBuffer) {
14711 return Promise.resolve(new Blob([this._bodyArrayBuffer]));
14712 } else if (this._bodyFormData) {
14713 throw new Error("could not read FormData body as blob");
14715 return Promise.resolve(new Blob([this._bodyText]));
14718 this.arrayBuffer = function() {
14719 if (this._bodyArrayBuffer) {
14720 var isConsumed = consumed(this);
14724 if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
14725 return Promise.resolve(
14726 this._bodyArrayBuffer.buffer.slice(
14727 this._bodyArrayBuffer.byteOffset,
14728 this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
14732 return Promise.resolve(this._bodyArrayBuffer);
14735 return this.blob().then(readBlobAsArrayBuffer);
14739 this.text = function() {
14740 var rejected = consumed(this);
14744 if (this._bodyBlob) {
14745 return readBlobAsText(this._bodyBlob);
14746 } else if (this._bodyArrayBuffer) {
14747 return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer));
14748 } else if (this._bodyFormData) {
14749 throw new Error("could not read FormData body as text");
14751 return Promise.resolve(this._bodyText);
14754 if (support.formData) {
14755 this.formData = function() {
14756 return this.text().then(decode);
14759 this.json = function() {
14760 return this.text().then(JSON.parse);
14764 var methods = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
14765 function normalizeMethod(method) {
14766 var upcased = method.toUpperCase();
14767 return methods.indexOf(upcased) > -1 ? upcased : method;
14769 function Request(input, options2) {
14770 if (!(this instanceof Request)) {
14771 throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
14773 options2 = options2 || {};
14774 var body = options2.body;
14775 if (input instanceof Request) {
14776 if (input.bodyUsed) {
14777 throw new TypeError("Already read");
14779 this.url = input.url;
14780 this.credentials = input.credentials;
14781 if (!options2.headers) {
14782 this.headers = new Headers(input.headers);
14784 this.method = input.method;
14785 this.mode = input.mode;
14786 this.signal = input.signal;
14787 if (!body && input._bodyInit != null) {
14788 body = input._bodyInit;
14789 input.bodyUsed = true;
14792 this.url = String(input);
14794 this.credentials = options2.credentials || this.credentials || "same-origin";
14795 if (options2.headers || !this.headers) {
14796 this.headers = new Headers(options2.headers);
14798 this.method = normalizeMethod(options2.method || this.method || "GET");
14799 this.mode = options2.mode || this.mode || null;
14800 this.signal = options2.signal || this.signal;
14801 this.referrer = null;
14802 if ((this.method === "GET" || this.method === "HEAD") && body) {
14803 throw new TypeError("Body not allowed for GET or HEAD requests");
14805 this._initBody(body);
14806 if (this.method === "GET" || this.method === "HEAD") {
14807 if (options2.cache === "no-store" || options2.cache === "no-cache") {
14808 var reParamSearch = /([?&])_=[^&]*/;
14809 if (reParamSearch.test(this.url)) {
14810 this.url = this.url.replace(reParamSearch, "$1_=" + new Date().getTime());
14812 var reQueryString = /\?/;
14813 this.url += (reQueryString.test(this.url) ? "&" : "?") + "_=" + new Date().getTime();
14818 Request.prototype.clone = function() {
14819 return new Request(this, { body: this._bodyInit });
14821 function decode(body) {
14822 var form = new FormData();
14823 body.trim().split("&").forEach(function(bytes) {
14825 var split = bytes.split("=");
14826 var name = split.shift().replace(/\+/g, " ");
14827 var value = split.join("=").replace(/\+/g, " ");
14828 form.append(decodeURIComponent(name), decodeURIComponent(value));
14833 function parseHeaders(rawHeaders) {
14834 var headers = new Headers();
14835 var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, " ");
14836 preProcessedHeaders.split("\r").map(function(header) {
14837 return header.indexOf("\n") === 0 ? header.substr(1, header.length) : header;
14838 }).forEach(function(line) {
14839 var parts = line.split(":");
14840 var key = parts.shift().trim();
14842 var value = parts.join(":").trim();
14843 headers.append(key, value);
14848 Body.call(Request.prototype);
14849 function Response(bodyInit, options2) {
14850 if (!(this instanceof Response)) {
14851 throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
14856 this.type = "default";
14857 this.status = options2.status === void 0 ? 200 : options2.status;
14858 this.ok = this.status >= 200 && this.status < 300;
14859 this.statusText = options2.statusText === void 0 ? "" : "" + options2.statusText;
14860 this.headers = new Headers(options2.headers);
14861 this.url = options2.url || "";
14862 this._initBody(bodyInit);
14864 Body.call(Response.prototype);
14865 Response.prototype.clone = function() {
14866 return new Response(this._bodyInit, {
14867 status: this.status,
14868 statusText: this.statusText,
14869 headers: new Headers(this.headers),
14873 Response.error = function() {
14874 var response = new Response(null, { status: 0, statusText: "" });
14875 response.type = "error";
14878 var redirectStatuses = [301, 302, 303, 307, 308];
14879 Response.redirect = function(url, status) {
14880 if (redirectStatuses.indexOf(status) === -1) {
14881 throw new RangeError("Invalid status code");
14883 return new Response(null, { status, headers: { location: url } });
14885 var DOMException2 = global2.DOMException;
14887 new DOMException2();
14889 DOMException2 = function(message, name) {
14890 this.message = message;
14892 var error = Error(message);
14893 this.stack = error.stack;
14895 DOMException2.prototype = Object.create(Error.prototype);
14896 DOMException2.prototype.constructor = DOMException2;
14898 function fetch2(input, init2) {
14899 return new Promise(function(resolve, reject) {
14900 var request3 = new Request(input, init2);
14901 if (request3.signal && request3.signal.aborted) {
14902 return reject(new DOMException2("Aborted", "AbortError"));
14904 var xhr = new XMLHttpRequest();
14905 function abortXhr() {
14908 xhr.onload = function() {
14910 status: xhr.status,
14911 statusText: xhr.statusText,
14912 headers: parseHeaders(xhr.getAllResponseHeaders() || "")
14914 options2.url = "responseURL" in xhr ? xhr.responseURL : options2.headers.get("X-Request-URL");
14915 var body = "response" in xhr ? xhr.response : xhr.responseText;
14916 setTimeout(function() {
14917 resolve(new Response(body, options2));
14920 xhr.onerror = function() {
14921 setTimeout(function() {
14922 reject(new TypeError("Network request failed"));
14925 xhr.ontimeout = function() {
14926 setTimeout(function() {
14927 reject(new TypeError("Network request failed"));
14930 xhr.onabort = function() {
14931 setTimeout(function() {
14932 reject(new DOMException2("Aborted", "AbortError"));
14935 function fixUrl(url) {
14937 return url === "" && global2.location.href ? global2.location.href : url;
14942 xhr.open(request3.method, fixUrl(request3.url), true);
14943 if (request3.credentials === "include") {
14944 xhr.withCredentials = true;
14945 } else if (request3.credentials === "omit") {
14946 xhr.withCredentials = false;
14948 if ("responseType" in xhr) {
14949 if (support.blob) {
14950 xhr.responseType = "blob";
14951 } else if (support.arrayBuffer && request3.headers.get("Content-Type") && request3.headers.get("Content-Type").indexOf("application/octet-stream") !== -1) {
14952 xhr.responseType = "arraybuffer";
14955 if (init2 && typeof init2.headers === "object" && !(init2.headers instanceof Headers)) {
14956 Object.getOwnPropertyNames(init2.headers).forEach(function(name) {
14957 xhr.setRequestHeader(name, normalizeValue(init2.headers[name]));
14960 request3.headers.forEach(function(value, name) {
14961 xhr.setRequestHeader(name, value);
14964 if (request3.signal) {
14965 request3.signal.addEventListener("abort", abortXhr);
14966 xhr.onreadystatechange = function() {
14967 if (xhr.readyState === 4) {
14968 request3.signal.removeEventListener("abort", abortXhr);
14972 xhr.send(typeof request3._bodyInit === "undefined" ? null : request3._bodyInit);
14975 fetch2.polyfill = true;
14976 if (!global2.fetch) {
14977 global2.fetch = fetch2;
14978 global2.Headers = Headers;
14979 global2.Request = Request;
14980 global2.Response = Response;
14983 // node_modules/abortcontroller-polyfill/dist/polyfill-patch-fetch.js
14984 (function(factory) {
14985 typeof define === "function" && define.amd ? define(factory) : factory();
14988 function _classCallCheck(instance, Constructor) {
14989 if (!(instance instanceof Constructor)) {
14990 throw new TypeError("Cannot call a class as a function");
14993 function _defineProperties(target, props) {
14994 for (var i2 = 0; i2 < props.length; i2++) {
14995 var descriptor = props[i2];
14996 descriptor.enumerable = descriptor.enumerable || false;
14997 descriptor.configurable = true;
14998 if ("value" in descriptor)
14999 descriptor.writable = true;
15000 Object.defineProperty(target, descriptor.key, descriptor);
15003 function _createClass(Constructor, protoProps, staticProps) {
15005 _defineProperties(Constructor.prototype, protoProps);
15007 _defineProperties(Constructor, staticProps);
15008 return Constructor;
15010 function _inherits(subClass, superClass) {
15011 if (typeof superClass !== "function" && superClass !== null) {
15012 throw new TypeError("Super expression must either be null or a function");
15014 subClass.prototype = Object.create(superClass && superClass.prototype, {
15022 _setPrototypeOf(subClass, superClass);
15024 function _getPrototypeOf(o) {
15025 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
15026 return o2.__proto__ || Object.getPrototypeOf(o2);
15028 return _getPrototypeOf(o);
15030 function _setPrototypeOf(o, p) {
15031 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
15035 return _setPrototypeOf(o, p);
15037 function _isNativeReflectConstruct() {
15038 if (typeof Reflect === "undefined" || !Reflect.construct)
15040 if (Reflect.construct.sham)
15042 if (typeof Proxy === "function")
15045 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
15052 function _assertThisInitialized(self2) {
15053 if (self2 === void 0) {
15054 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
15058 function _possibleConstructorReturn(self2, call) {
15059 if (call && (typeof call === "object" || typeof call === "function")) {
15062 return _assertThisInitialized(self2);
15064 function _createSuper(Derived) {
15065 var hasNativeReflectConstruct = _isNativeReflectConstruct();
15066 return function _createSuperInternal() {
15067 var Super = _getPrototypeOf(Derived), result;
15068 if (hasNativeReflectConstruct) {
15069 var NewTarget = _getPrototypeOf(this).constructor;
15070 result = Reflect.construct(Super, arguments, NewTarget);
15072 result = Super.apply(this, arguments);
15074 return _possibleConstructorReturn(this, result);
15077 function _superPropBase(object, property) {
15078 while (!Object.prototype.hasOwnProperty.call(object, property)) {
15079 object = _getPrototypeOf(object);
15080 if (object === null)
15085 function _get(target, property, receiver) {
15086 if (typeof Reflect !== "undefined" && Reflect.get) {
15087 _get = Reflect.get;
15089 _get = function _get2(target2, property2, receiver2) {
15090 var base = _superPropBase(target2, property2);
15093 var desc = Object.getOwnPropertyDescriptor(base, property2);
15095 return desc.get.call(receiver2);
15100 return _get(target, property, receiver || target);
15102 var Emitter = /* @__PURE__ */ function() {
15103 function Emitter2() {
15104 _classCallCheck(this, Emitter2);
15105 Object.defineProperty(this, "listeners", {
15111 _createClass(Emitter2, [{
15112 key: "addEventListener",
15113 value: function addEventListener(type3, callback, options2) {
15114 if (!(type3 in this.listeners)) {
15115 this.listeners[type3] = [];
15117 this.listeners[type3].push({
15123 key: "removeEventListener",
15124 value: function removeEventListener(type3, callback) {
15125 if (!(type3 in this.listeners)) {
15128 var stack = this.listeners[type3];
15129 for (var i2 = 0, l = stack.length; i2 < l; i2++) {
15130 if (stack[i2].callback === callback) {
15131 stack.splice(i2, 1);
15137 key: "dispatchEvent",
15138 value: function dispatchEvent2(event) {
15139 if (!(event.type in this.listeners)) {
15142 var stack = this.listeners[event.type];
15143 var stackToCall = stack.slice();
15144 for (var i2 = 0, l = stackToCall.length; i2 < l; i2++) {
15145 var listener = stackToCall[i2];
15147 listener.callback.call(this, event);
15149 Promise.resolve().then(function() {
15153 if (listener.options && listener.options.once) {
15154 this.removeEventListener(event.type, listener.callback);
15157 return !event.defaultPrevented;
15162 var AbortSignal = /* @__PURE__ */ function(_Emitter) {
15163 _inherits(AbortSignal2, _Emitter);
15164 var _super = _createSuper(AbortSignal2);
15165 function AbortSignal2() {
15167 _classCallCheck(this, AbortSignal2);
15168 _this = _super.call(this);
15169 if (!_this.listeners) {
15170 Emitter.call(_assertThisInitialized(_this));
15172 Object.defineProperty(_assertThisInitialized(_this), "aborted", {
15177 Object.defineProperty(_assertThisInitialized(_this), "onabort", {
15184 _createClass(AbortSignal2, [{
15186 value: function toString2() {
15187 return "[object AbortSignal]";
15190 key: "dispatchEvent",
15191 value: function dispatchEvent2(event) {
15192 if (event.type === "abort") {
15193 this.aborted = true;
15194 if (typeof this.onabort === "function") {
15195 this.onabort.call(this, event);
15198 _get(_getPrototypeOf(AbortSignal2.prototype), "dispatchEvent", this).call(this, event);
15201 return AbortSignal2;
15203 var AbortController2 = /* @__PURE__ */ function() {
15204 function AbortController3() {
15205 _classCallCheck(this, AbortController3);
15206 Object.defineProperty(this, "signal", {
15207 value: new AbortSignal(),
15212 _createClass(AbortController3, [{
15214 value: function abort() {
15217 event = new Event("abort");
15219 if (typeof document !== "undefined") {
15220 if (!document.createEvent) {
15221 event = document.createEventObject();
15222 event.type = "abort";
15224 event = document.createEvent("Event");
15225 event.initEvent("abort", false, false);
15235 this.signal.dispatchEvent(event);
15239 value: function toString2() {
15240 return "[object AbortController]";
15243 return AbortController3;
15245 if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
15246 AbortController2.prototype[Symbol.toStringTag] = "AbortController";
15247 AbortSignal.prototype[Symbol.toStringTag] = "AbortSignal";
15249 function polyfillNeeded(self2) {
15250 if (self2.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
15251 console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill");
15254 return typeof self2.Request === "function" && !self2.Request.prototype.hasOwnProperty("signal") || !self2.AbortController;
15256 function abortableFetchDecorator(patchTargets) {
15257 if ("function" === typeof patchTargets) {
15259 fetch: patchTargets
15262 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;
15263 if (!polyfillNeeded({
15265 Request: NativeRequest,
15266 AbortController: NativeAbortController,
15267 __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL
15274 var Request2 = NativeRequest;
15275 if (Request2 && !Request2.prototype.hasOwnProperty("signal") || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
15276 Request2 = function Request3(input, init2) {
15278 if (init2 && init2.signal) {
15279 signal = init2.signal;
15280 delete init2.signal;
15282 var request3 = new NativeRequest(input, init2);
15284 Object.defineProperty(request3, "signal", {
15287 configurable: true,
15293 Request2.prototype = NativeRequest.prototype;
15295 var realFetch = fetch3;
15296 var abortableFetch = function abortableFetch2(input, init2) {
15297 var signal = Request2 && Request2.prototype.isPrototypeOf(input) ? input.signal : init2 ? init2.signal : void 0;
15301 abortError = new DOMException("Aborted", "AbortError");
15303 abortError = new Error("Aborted");
15304 abortError.name = "AbortError";
15306 if (signal.aborted) {
15307 return Promise.reject(abortError);
15309 var cancellation = new Promise(function(_, reject) {
15310 signal.addEventListener("abort", function() {
15311 return reject(abortError);
15316 if (init2 && init2.signal) {
15317 delete init2.signal;
15319 return Promise.race([cancellation, realFetch(input, init2)]);
15321 return realFetch(input, init2);
15324 fetch: abortableFetch,
15329 if (!polyfillNeeded(self2)) {
15332 if (!self2.fetch) {
15333 console.warn("fetch() is not available, cannot install abortcontroller-polyfill");
15336 var _abortableFetch = abortableFetchDecorator(self2), fetch3 = _abortableFetch.fetch, Request2 = _abortableFetch.Request;
15337 self2.fetch = fetch3;
15338 self2.Request = Request2;
15339 Object.defineProperty(self2, "AbortController", {
15342 configurable: true,
15343 value: AbortController2
15345 Object.defineProperty(self2, "AbortSignal", {
15348 configurable: true,
15351 })(typeof self !== "undefined" ? self : global);
15354 // modules/index.js
15355 var modules_exports = {};
15356 __export(modules_exports, {
15357 LocationManager: () => LocationManager,
15358 QAItem: () => QAItem,
15359 actionAddEntity: () => actionAddEntity,
15360 actionAddMember: () => actionAddMember,
15361 actionAddMidpoint: () => actionAddMidpoint,
15362 actionAddVertex: () => actionAddVertex,
15363 actionChangeMember: () => actionChangeMember,
15364 actionChangePreset: () => actionChangePreset,
15365 actionChangeTags: () => actionChangeTags,
15366 actionCircularize: () => actionCircularize,
15367 actionConnect: () => actionConnect,
15368 actionCopyEntities: () => actionCopyEntities,
15369 actionDeleteMember: () => actionDeleteMember,
15370 actionDeleteMultiple: () => actionDeleteMultiple,
15371 actionDeleteNode: () => actionDeleteNode,
15372 actionDeleteRelation: () => actionDeleteRelation,
15373 actionDeleteWay: () => actionDeleteWay,
15374 actionDiscardTags: () => actionDiscardTags,
15375 actionDisconnect: () => actionDisconnect,
15376 actionExtract: () => actionExtract,
15377 actionJoin: () => actionJoin,
15378 actionMerge: () => actionMerge,
15379 actionMergeNodes: () => actionMergeNodes,
15380 actionMergePolygon: () => actionMergePolygon,
15381 actionMergeRemoteChanges: () => actionMergeRemoteChanges,
15382 actionMove: () => actionMove,
15383 actionMoveMember: () => actionMoveMember,
15384 actionMoveNode: () => actionMoveNode,
15385 actionNoop: () => actionNoop,
15386 actionOrthogonalize: () => actionOrthogonalize,
15387 actionReflect: () => actionReflect,
15388 actionRestrictTurn: () => actionRestrictTurn,
15389 actionReverse: () => actionReverse,
15390 actionRevert: () => actionRevert,
15391 actionRotate: () => actionRotate,
15392 actionScale: () => actionScale,
15393 actionSplit: () => actionSplit,
15394 actionStraightenNodes: () => actionStraightenNodes,
15395 actionStraightenWay: () => actionStraightenWay,
15396 actionUnrestrictTurn: () => actionUnrestrictTurn,
15397 actionUpgradeTags: () => actionUpgradeTags,
15398 behaviorAddWay: () => behaviorAddWay,
15399 behaviorBreathe: () => behaviorBreathe,
15400 behaviorDrag: () => behaviorDrag,
15401 behaviorDraw: () => behaviorDraw,
15402 behaviorDrawWay: () => behaviorDrawWay,
15403 behaviorEdit: () => behaviorEdit,
15404 behaviorHash: () => behaviorHash,
15405 behaviorHover: () => behaviorHover,
15406 behaviorLasso: () => behaviorLasso,
15407 behaviorOperation: () => behaviorOperation,
15408 behaviorPaste: () => behaviorPaste,
15409 behaviorSelect: () => behaviorSelect,
15410 coreContext: () => coreContext,
15411 coreDifference: () => coreDifference,
15412 coreFileFetcher: () => coreFileFetcher,
15413 coreGraph: () => coreGraph,
15414 coreHistory: () => coreHistory,
15415 coreLocalizer: () => coreLocalizer,
15416 coreTree: () => coreTree,
15417 coreUploader: () => coreUploader,
15418 coreValidator: () => coreValidator,
15420 debug: () => debug,
15421 fileFetcher: () => _mainFileFetcher,
15422 geoAngle: () => geoAngle,
15423 geoChooseEdge: () => geoChooseEdge,
15424 geoEdgeEqual: () => geoEdgeEqual,
15425 geoExtent: () => geoExtent,
15426 geoGetSmallestSurroundingRectangle: () => geoGetSmallestSurroundingRectangle,
15427 geoHasLineIntersections: () => geoHasLineIntersections,
15428 geoHasSelfIntersections: () => geoHasSelfIntersections,
15429 geoLatToMeters: () => geoLatToMeters,
15430 geoLineIntersection: () => geoLineIntersection,
15431 geoLonToMeters: () => geoLonToMeters,
15432 geoMetersToLat: () => geoMetersToLat,
15433 geoMetersToLon: () => geoMetersToLon,
15434 geoMetersToOffset: () => geoMetersToOffset,
15435 geoOffsetToMeters: () => geoOffsetToMeters,
15436 geoOrthoCalcScore: () => geoOrthoCalcScore,
15437 geoOrthoCanOrthogonalize: () => geoOrthoCanOrthogonalize,
15438 geoOrthoMaxOffsetAngle: () => geoOrthoMaxOffsetAngle,
15439 geoOrthoNormalizedDotProduct: () => geoOrthoNormalizedDotProduct,
15440 geoPathHasIntersections: () => geoPathHasIntersections,
15441 geoPathIntersections: () => geoPathIntersections,
15442 geoPathLength: () => geoPathLength,
15443 geoPointInPolygon: () => geoPointInPolygon,
15444 geoPolygonContainsPolygon: () => geoPolygonContainsPolygon,
15445 geoPolygonIntersectsPolygon: () => geoPolygonIntersectsPolygon,
15446 geoRawMercator: () => geoRawMercator,
15447 geoRotate: () => geoRotate,
15448 geoScaleToZoom: () => geoScaleToZoom,
15449 geoSphericalClosestNode: () => geoSphericalClosestNode,
15450 geoSphericalDistance: () => geoSphericalDistance,
15451 geoVecAdd: () => geoVecAdd,
15452 geoVecAngle: () => geoVecAngle,
15453 geoVecCross: () => geoVecCross,
15454 geoVecDot: () => geoVecDot,
15455 geoVecEqual: () => geoVecEqual,
15456 geoVecFloor: () => geoVecFloor,
15457 geoVecInterp: () => geoVecInterp,
15458 geoVecLength: () => geoVecLength,
15459 geoVecLengthSquare: () => geoVecLengthSquare,
15460 geoVecNormalize: () => geoVecNormalize,
15461 geoVecNormalizedDot: () => geoVecNormalizedDot,
15462 geoVecProject: () => geoVecProject,
15463 geoVecScale: () => geoVecScale,
15464 geoVecSubtract: () => geoVecSubtract,
15465 geoViewportEdge: () => geoViewportEdge,
15466 geoZoomToScale: () => geoZoomToScale,
15467 localizer: () => _mainLocalizer,
15468 locationManager: () => _sharedLocationManager,
15469 modeAddArea: () => modeAddArea,
15470 modeAddLine: () => modeAddLine,
15471 modeAddNote: () => modeAddNote,
15472 modeAddPoint: () => modeAddPoint,
15473 modeBrowse: () => modeBrowse,
15474 modeDragNode: () => modeDragNode,
15475 modeDragNote: () => modeDragNote,
15476 modeDrawArea: () => modeDrawArea,
15477 modeDrawLine: () => modeDrawLine,
15478 modeMove: () => modeMove,
15479 modeRotate: () => modeRotate,
15480 modeSave: () => modeSave,
15481 modeSelect: () => modeSelect,
15482 modeSelectData: () => modeSelectData,
15483 modeSelectError: () => modeSelectError,
15484 modeSelectNote: () => modeSelectNote,
15485 operationCircularize: () => operationCircularize,
15486 operationContinue: () => operationContinue,
15487 operationCopy: () => operationCopy,
15488 operationDelete: () => operationDelete,
15489 operationDisconnect: () => operationDisconnect,
15490 operationDowngrade: () => operationDowngrade,
15491 operationExtract: () => operationExtract,
15492 operationMerge: () => operationMerge,
15493 operationMove: () => operationMove,
15494 operationOrthogonalize: () => operationOrthogonalize,
15495 operationPaste: () => operationPaste,
15496 operationReflectLong: () => operationReflectLong,
15497 operationReflectShort: () => operationReflectShort,
15498 operationReverse: () => operationReverse,
15499 operationRotate: () => operationRotate,
15500 operationSplit: () => operationSplit,
15501 operationStraighten: () => operationStraighten,
15502 osmAreaKeys: () => osmAreaKeys,
15503 osmChangeset: () => osmChangeset,
15504 osmEntity: () => osmEntity,
15505 osmFlowingWaterwayTagValues: () => osmFlowingWaterwayTagValues,
15506 osmInferRestriction: () => osmInferRestriction,
15507 osmIntersection: () => osmIntersection,
15508 osmIsInterestingTag: () => osmIsInterestingTag,
15509 osmIsOldMultipolygonOuterMember: () => osmIsOldMultipolygonOuterMember,
15510 osmJoinWays: () => osmJoinWays,
15511 osmLanes: () => osmLanes,
15512 osmLifecyclePrefixes: () => osmLifecyclePrefixes,
15513 osmNode: () => osmNode,
15514 osmNodeGeometriesForTags: () => osmNodeGeometriesForTags,
15515 osmNote: () => osmNote,
15516 osmOldMultipolygonOuterMember: () => osmOldMultipolygonOuterMember,
15517 osmOldMultipolygonOuterMemberOfRelation: () => osmOldMultipolygonOuterMemberOfRelation,
15518 osmOneWayTags: () => osmOneWayTags,
15519 osmPavedTags: () => osmPavedTags,
15520 osmPointTags: () => osmPointTags,
15521 osmRailwayTrackTagValues: () => osmRailwayTrackTagValues,
15522 osmRelation: () => osmRelation,
15523 osmRemoveLifecyclePrefix: () => osmRemoveLifecyclePrefix,
15524 osmRoutableHighwayTagValues: () => osmRoutableHighwayTagValues,
15525 osmSetAreaKeys: () => osmSetAreaKeys,
15526 osmSetPointTags: () => osmSetPointTags,
15527 osmSetVertexTags: () => osmSetVertexTags,
15528 osmTagSuggestingArea: () => osmTagSuggestingArea,
15529 osmTurn: () => osmTurn,
15530 osmVertexTags: () => osmVertexTags,
15531 osmWay: () => osmWay,
15532 prefs: () => corePreferences,
15533 presetCategory: () => presetCategory,
15534 presetCollection: () => presetCollection,
15535 presetField: () => presetField,
15536 presetIndex: () => presetIndex,
15537 presetManager: () => _mainPresetIndex,
15538 presetPreset: () => presetPreset,
15539 rendererBackground: () => rendererBackground,
15540 rendererBackgroundSource: () => rendererBackgroundSource,
15541 rendererFeatures: () => rendererFeatures,
15542 rendererMap: () => rendererMap,
15543 rendererPhotos: () => rendererPhotos,
15544 rendererTileLayer: () => rendererTileLayer,
15545 serviceImproveOSM: () => improveOSM_default,
15546 serviceKartaview: () => kartaview_default,
15547 serviceKeepRight: () => keepRight_default,
15548 serviceMapRules: () => maprules_default,
15549 serviceMapillary: () => mapillary_default,
15550 serviceNominatim: () => nominatim_default,
15551 serviceNsi: () => nsi_default,
15552 serviceOsm: () => osm_default,
15553 serviceOsmWikibase: () => osm_wikibase_default,
15554 serviceOsmose: () => osmose_default,
15555 serviceStreetside: () => streetside_default,
15556 serviceTaginfo: () => taginfo_default,
15557 serviceVectorTile: () => vector_tile_default,
15558 serviceWikidata: () => wikidata_default,
15559 serviceWikipedia: () => wikipedia_default,
15560 services: () => services,
15561 svgAreas: () => svgAreas,
15562 svgData: () => svgData,
15563 svgDebug: () => svgDebug,
15564 svgDefs: () => svgDefs,
15565 svgGeolocate: () => svgGeolocate,
15566 svgIcon: () => svgIcon,
15567 svgKartaviewImages: () => svgKartaviewImages,
15568 svgKeepRight: () => svgKeepRight,
15569 svgLabels: () => svgLabels,
15570 svgLayers: () => svgLayers,
15571 svgLines: () => svgLines,
15572 svgMapillaryImages: () => svgMapillaryImages,
15573 svgMapillarySigns: () => svgMapillarySigns,
15574 svgMarkerSegments: () => svgMarkerSegments,
15575 svgMidpoints: () => svgMidpoints,
15576 svgNotes: () => svgNotes,
15577 svgOsm: () => svgOsm,
15578 svgPassiveVertex: () => svgPassiveVertex,
15579 svgPath: () => svgPath,
15580 svgPointTransform: () => svgPointTransform,
15581 svgPoints: () => svgPoints,
15582 svgRelationMemberTags: () => svgRelationMemberTags,
15583 svgSegmentWay: () => svgSegmentWay,
15584 svgStreetside: () => svgStreetside,
15585 svgTagClasses: () => svgTagClasses,
15586 svgTagPattern: () => svgTagPattern,
15587 svgTouch: () => svgTouch,
15588 svgTurns: () => svgTurns,
15589 svgVertices: () => svgVertices,
15591 uiAccount: () => uiAccount,
15592 uiAttribution: () => uiAttribution,
15593 uiChangesetEditor: () => uiChangesetEditor,
15594 uiCmd: () => uiCmd,
15595 uiCombobox: () => uiCombobox,
15596 uiCommit: () => uiCommit,
15597 uiCommitWarnings: () => uiCommitWarnings,
15598 uiConfirm: () => uiConfirm,
15599 uiConflicts: () => uiConflicts,
15600 uiContributors: () => uiContributors,
15601 uiCurtain: () => uiCurtain,
15602 uiDataEditor: () => uiDataEditor,
15603 uiDataHeader: () => uiDataHeader,
15604 uiDisclosure: () => uiDisclosure,
15605 uiEditMenu: () => uiEditMenu,
15606 uiEntityEditor: () => uiEntityEditor,
15607 uiFeatureInfo: () => uiFeatureInfo,
15608 uiFeatureList: () => uiFeatureList,
15609 uiField: () => uiField,
15610 uiFieldAccess: () => uiFieldAccess,
15611 uiFieldAddress: () => uiFieldAddress,
15612 uiFieldCheck: () => uiFieldCheck,
15613 uiFieldColour: () => uiFieldText,
15614 uiFieldCombo: () => uiFieldCombo,
15615 uiFieldCycleway: () => uiFieldCycleway,
15616 uiFieldDefaultCheck: () => uiFieldCheck,
15617 uiFieldEmail: () => uiFieldText,
15618 uiFieldHelp: () => uiFieldHelp,
15619 uiFieldIdentifier: () => uiFieldText,
15620 uiFieldLanes: () => uiFieldLanes,
15621 uiFieldLocalized: () => uiFieldLocalized,
15622 uiFieldManyCombo: () => uiFieldCombo,
15623 uiFieldMultiCombo: () => uiFieldCombo,
15624 uiFieldNetworkCombo: () => uiFieldCombo,
15625 uiFieldNumber: () => uiFieldText,
15626 uiFieldOnewayCheck: () => uiFieldCheck,
15627 uiFieldRadio: () => uiFieldRadio,
15628 uiFieldRestrictions: () => uiFieldRestrictions,
15629 uiFieldRoadheight: () => uiFieldRoadheight,
15630 uiFieldRoadspeed: () => uiFieldRoadspeed,
15631 uiFieldSemiCombo: () => uiFieldCombo,
15632 uiFieldStructureRadio: () => uiFieldRadio,
15633 uiFieldTel: () => uiFieldText,
15634 uiFieldText: () => uiFieldText,
15635 uiFieldTextarea: () => uiFieldTextarea,
15636 uiFieldTypeCombo: () => uiFieldCombo,
15637 uiFieldUrl: () => uiFieldText,
15638 uiFieldWikidata: () => uiFieldWikidata,
15639 uiFieldWikipedia: () => uiFieldWikipedia,
15640 uiFields: () => uiFields,
15641 uiFlash: () => uiFlash,
15642 uiFormFields: () => uiFormFields,
15643 uiFullScreen: () => uiFullScreen,
15644 uiGeolocate: () => uiGeolocate,
15645 uiImproveOsmComments: () => uiImproveOsmComments,
15646 uiImproveOsmDetails: () => uiImproveOsmDetails,
15647 uiImproveOsmEditor: () => uiImproveOsmEditor,
15648 uiImproveOsmHeader: () => uiImproveOsmHeader,
15649 uiInfo: () => uiInfo,
15650 uiInfoPanels: () => uiInfoPanels,
15651 uiInit: () => uiInit,
15652 uiInspector: () => uiInspector,
15653 uiIntro: () => uiIntro,
15654 uiIssuesInfo: () => uiIssuesInfo,
15655 uiKeepRightDetails: () => uiKeepRightDetails,
15656 uiKeepRightEditor: () => uiKeepRightEditor,
15657 uiKeepRightHeader: () => uiKeepRightHeader,
15658 uiLasso: () => uiLasso,
15659 uiLoading: () => uiLoading,
15660 uiMapInMap: () => uiMapInMap,
15661 uiModal: () => uiModal,
15662 uiNoteComments: () => uiNoteComments,
15663 uiNoteEditor: () => uiNoteEditor,
15664 uiNoteHeader: () => uiNoteHeader,
15665 uiNoteReport: () => uiNoteReport,
15666 uiNotice: () => uiNotice,
15667 uiPaneBackground: () => uiPaneBackground,
15668 uiPaneHelp: () => uiPaneHelp,
15669 uiPaneIssues: () => uiPaneIssues,
15670 uiPaneMapData: () => uiPaneMapData,
15671 uiPanePreferences: () => uiPanePreferences,
15672 uiPanelBackground: () => uiPanelBackground,
15673 uiPanelHistory: () => uiPanelHistory,
15674 uiPanelLocation: () => uiPanelLocation,
15675 uiPanelMeasurement: () => uiPanelMeasurement,
15676 uiPopover: () => uiPopover,
15677 uiPresetIcon: () => uiPresetIcon,
15678 uiPresetList: () => uiPresetList,
15679 uiRestore: () => uiRestore,
15680 uiScale: () => uiScale,
15681 uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions,
15682 uiSectionBackgroundList: () => uiSectionBackgroundList,
15683 uiSectionBackgroundOffset: () => uiSectionBackgroundOffset,
15684 uiSectionChanges: () => uiSectionChanges,
15685 uiSectionDataLayers: () => uiSectionDataLayers,
15686 uiSectionEntityIssues: () => uiSectionEntityIssues,
15687 uiSectionFeatureType: () => uiSectionFeatureType,
15688 uiSectionMapFeatures: () => uiSectionMapFeatures,
15689 uiSectionMapStyleOptions: () => uiSectionMapStyleOptions,
15690 uiSectionOverlayList: () => uiSectionOverlayList,
15691 uiSectionPhotoOverlays: () => uiSectionPhotoOverlays,
15692 uiSectionPresetFields: () => uiSectionPresetFields,
15693 uiSectionPrivacy: () => uiSectionPrivacy,
15694 uiSectionRawMemberEditor: () => uiSectionRawMemberEditor,
15695 uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor,
15696 uiSectionRawTagEditor: () => uiSectionRawTagEditor,
15697 uiSectionSelectionList: () => uiSectionSelectionList,
15698 uiSectionValidationIssues: () => uiSectionValidationIssues,
15699 uiSectionValidationOptions: () => uiSectionValidationOptions,
15700 uiSectionValidationRules: () => uiSectionValidationRules,
15701 uiSectionValidationStatus: () => uiSectionValidationStatus,
15702 uiSettingsCustomBackground: () => uiSettingsCustomBackground,
15703 uiSettingsCustomData: () => uiSettingsCustomData,
15704 uiSidebar: () => uiSidebar,
15705 uiSourceSwitch: () => uiSourceSwitch,
15706 uiSpinner: () => uiSpinner,
15707 uiSplash: () => uiSplash,
15708 uiStatus: () => uiStatus,
15709 uiSuccess: () => uiSuccess,
15710 uiTagReference: () => uiTagReference,
15711 uiToggle: () => uiToggle,
15712 uiTooltip: () => uiTooltip,
15713 uiVersion: () => uiVersion,
15714 uiViewOnKeepRight: () => uiViewOnKeepRight,
15715 uiViewOnOSM: () => uiViewOnOSM,
15716 uiZoom: () => uiZoom,
15717 utilAesDecrypt: () => utilAesDecrypt,
15718 utilAesEncrypt: () => utilAesEncrypt,
15719 utilArrayChunk: () => utilArrayChunk,
15720 utilArrayDifference: () => utilArrayDifference,
15721 utilArrayFlatten: () => utilArrayFlatten,
15722 utilArrayGroupBy: () => utilArrayGroupBy,
15723 utilArrayIdentical: () => utilArrayIdentical,
15724 utilArrayIntersection: () => utilArrayIntersection,
15725 utilArrayUnion: () => utilArrayUnion,
15726 utilArrayUniq: () => utilArrayUniq,
15727 utilArrayUniqBy: () => utilArrayUniqBy,
15728 utilAsyncMap: () => utilAsyncMap,
15729 utilCleanTags: () => utilCleanTags,
15730 utilCombinedTags: () => utilCombinedTags,
15731 utilCompareIDs: () => utilCompareIDs,
15732 utilDeepMemberSelector: () => utilDeepMemberSelector,
15733 utilDetect: () => utilDetect,
15734 utilDisplayLabel: () => utilDisplayLabel,
15735 utilDisplayName: () => utilDisplayName,
15736 utilDisplayNameForPath: () => utilDisplayNameForPath,
15737 utilDisplayType: () => utilDisplayType,
15738 utilEditDistance: () => utilEditDistance,
15739 utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
15740 utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
15741 utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
15742 utilEntityRoot: () => utilEntityRoot,
15743 utilEntitySelector: () => utilEntitySelector,
15744 utilFastMouse: () => utilFastMouse,
15745 utilFunctor: () => utilFunctor,
15746 utilGetAllNodes: () => utilGetAllNodes,
15747 utilGetSetValue: () => utilGetSetValue,
15748 utilHashcode: () => utilHashcode,
15749 utilHighlightEntities: () => utilHighlightEntities,
15750 utilKeybinding: () => utilKeybinding,
15751 utilNoAuto: () => utilNoAuto,
15752 utilObjectOmit: () => utilObjectOmit,
15753 utilOldestID: () => utilOldestID,
15754 utilPrefixCSSProperty: () => utilPrefixCSSProperty,
15755 utilPrefixDOMProperty: () => utilPrefixDOMProperty,
15756 utilQsString: () => utilQsString,
15757 utilRebind: () => utilRebind,
15758 utilSafeClassName: () => utilSafeClassName,
15759 utilSessionMutex: () => utilSessionMutex,
15760 utilSetTransform: () => utilSetTransform,
15761 utilStringQs: () => utilStringQs,
15762 utilTagDiff: () => utilTagDiff,
15763 utilTagText: () => utilTagText,
15764 utilTiler: () => utilTiler,
15765 utilTotalExtent: () => utilTotalExtent,
15766 utilTriggerEvent: () => utilTriggerEvent,
15767 utilUnicodeCharsCount: () => utilUnicodeCharsCount,
15768 utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
15769 utilUniqueDomId: () => utilUniqueDomId,
15770 utilWrap: () => utilWrap,
15771 validationAlmostJunction: () => validationAlmostJunction,
15772 validationCloseNodes: () => validationCloseNodes,
15773 validationCrossingWays: () => validationCrossingWays,
15774 validationDisconnectedWay: () => validationDisconnectedWay,
15775 validationFormatting: () => validationFormatting,
15776 validationHelpRequest: () => validationHelpRequest,
15777 validationImpossibleOneway: () => validationImpossibleOneway,
15778 validationIncompatibleSource: () => validationIncompatibleSource,
15779 validationMaprules: () => validationMaprules,
15780 validationMismatchedGeometry: () => validationMismatchedGeometry,
15781 validationMissingRole: () => validationMissingRole,
15782 validationMissingTag: () => validationMissingTag,
15783 validationOutdatedTags: () => validationOutdatedTags,
15784 validationPrivateData: () => validationPrivateData,
15785 validationSuspiciousName: () => validationSuspiciousName,
15786 validationUnsquareWay: () => validationUnsquareWay
15789 // modules/actions/add_entity.js
15790 function actionAddEntity(way) {
15791 return function(graph) {
15792 return graph.replace(way);
15796 // modules/actions/reverse.js
15797 function actionReverse(entityID, options2) {
15798 var ignoreKey = /^.*(_|:)?(description|name|note|website|ref|source|comment|watch|attribution)(_|:)?/;
15799 var numeric = /^([+\-]?)(?=[\d.])/;
15800 var directionKey = /direction$/;
15801 var turn_lanes = /^turn:lanes:?/;
15802 var keyReplacements = [
15803 [/:right$/, ":left"],
15804 [/:left$/, ":right"],
15805 [/:forward$/, ":backward"],
15806 [/:backward$/, ":forward"],
15807 [/:right:/, ":left:"],
15808 [/:left:/, ":right:"],
15809 [/:forward:/, ":backward:"],
15810 [/:backward:/, ":forward:"]
15812 var valueReplacements = {
15817 forward: "backward",
15818 backward: "forward",
15819 forwards: "backward",
15820 backwards: "forward"
15822 var roleReplacements = {
15823 forward: "backward",
15824 backward: "forward",
15825 forwards: "backward",
15826 backwards: "forward"
15828 var onewayReplacements = {
15833 var compassReplacements = {
15851 function reverseKey(key) {
15852 for (var i2 = 0; i2 < keyReplacements.length; ++i2) {
15853 var replacement = keyReplacements[i2];
15854 if (replacement[0].test(key)) {
15855 return key.replace(replacement[0], replacement[1]);
15860 function reverseValue(key, value, includeAbsolute) {
15861 if (ignoreKey.test(key))
15863 if (turn_lanes.test(key)) {
15865 } else if (key === "incline" && numeric.test(value)) {
15866 return value.replace(numeric, function(_, sign2) {
15867 return sign2 === "-" ? "" : "-";
15869 } else if (options2 && options2.reverseOneway && key === "oneway") {
15870 return onewayReplacements[value] || value;
15871 } else if (includeAbsolute && directionKey.test(key)) {
15872 if (compassReplacements[value])
15873 return compassReplacements[value];
15874 var degrees3 = parseFloat(value);
15875 if (typeof degrees3 === "number" && !isNaN(degrees3)) {
15876 if (degrees3 < 180) {
15881 return degrees3.toString();
15884 return valueReplacements[value] || value;
15886 function reverseNodeTags(graph, nodeIDs) {
15887 for (var i2 = 0; i2 < nodeIDs.length; i2++) {
15888 var node = graph.hasEntity(nodeIDs[i2]);
15889 if (!node || !Object.keys(node.tags).length)
15892 for (var key in node.tags) {
15893 tags[reverseKey(key)] = reverseValue(key, node.tags[key], node.id === entityID);
15895 graph = graph.replace(node.update({ tags }));
15899 function reverseWay(graph, way) {
15900 var nodes = way.nodes.slice().reverse();
15903 for (var key in way.tags) {
15904 tags[reverseKey(key)] = reverseValue(key, way.tags[key]);
15906 graph.parentRelations(way).forEach(function(relation) {
15907 relation.members.forEach(function(member, index) {
15908 if (member.id === way.id && (role = roleReplacements[member.role])) {
15909 relation = relation.updateMember({ role }, index);
15910 graph = graph.replace(relation);
15914 return reverseNodeTags(graph, nodes).replace(way.update({ nodes, tags }));
15916 var action = function(graph) {
15917 var entity = graph.entity(entityID);
15918 if (entity.type === "way") {
15919 return reverseWay(graph, entity);
15921 return reverseNodeTags(graph, [entityID]);
15923 action.disabled = function(graph) {
15924 var entity = graph.hasEntity(entityID);
15925 if (!entity || entity.type === "way")
15927 for (var key in entity.tags) {
15928 var value = entity.tags[key];
15929 if (reverseKey(key) !== key || reverseValue(key, value, true) !== value) {
15933 return "nondirectional_node";
15935 action.entityID = function() {
15941 // modules/osm/tags.js
15942 function osmIsInterestingTag(key) {
15943 return key !== "attribution" && key !== "created_by" && key !== "source" && key !== "odbl" && key.indexOf("source:") !== 0 && key.indexOf("source_ref") !== 0 && key.indexOf("tiger:") !== 0;
15945 var osmLifecyclePrefixes = {
15948 construction: true,
15960 function osmRemoveLifecyclePrefix(key) {
15961 const keySegments = key.split(":");
15962 if (keySegments.length === 1)
15964 if (keySegments[0] in osmLifecyclePrefixes) {
15965 return key.slice(keySegments[0].length + 1);
15969 var osmAreaKeys = {};
15970 function osmSetAreaKeys(value) {
15971 osmAreaKeys = value;
15973 var osmAreaKeysExceptions = {
15979 public_transport: {
15994 function osmTagSuggestingArea(tags) {
15995 if (tags.area === "yes")
15996 return { area: "yes" };
15997 if (tags.area === "no")
15999 var returnTags = {};
16000 for (var realKey in tags) {
16001 const key = osmRemoveLifecyclePrefix(realKey);
16002 if (key in osmAreaKeys && !(tags[key] in osmAreaKeys[key])) {
16003 returnTags[realKey] = tags[realKey];
16006 if (key in osmAreaKeysExceptions && tags[key] in osmAreaKeysExceptions[key]) {
16007 returnTags[realKey] = tags[realKey];
16013 var osmLineTags = {};
16014 function osmSetLineTags(value) {
16015 osmLineTags = value;
16017 var osmPointTags = {};
16018 function osmSetPointTags(value) {
16019 osmPointTags = value;
16021 var osmVertexTags = {};
16022 function osmSetVertexTags(value) {
16023 osmVertexTags = value;
16025 function osmNodeGeometriesForTags(nodeTags) {
16026 var geometries = {};
16027 for (var key in nodeTags) {
16028 if (osmPointTags[key] && (osmPointTags[key]["*"] || osmPointTags[key][nodeTags[key]])) {
16029 geometries.point = true;
16031 if (osmVertexTags[key] && (osmVertexTags[key]["*"] || osmVertexTags[key][nodeTags[key]])) {
16032 geometries.vertex = true;
16034 if (geometries.point && geometries.vertex)
16039 var osmOneWayTags = {
16041 "chair_lift": true,
16044 "magic_carpet": true,
16045 "mixed_lift": true,
16059 "goods_conveyor": true,
16060 "piste:halfpipe": true
16068 "separation_lane": true,
16069 "separation_roundabout": true
16078 "tidal_channel": true
16081 var osmPavedTags = {
16087 "concrete:lanes": true,
16088 "concrete:plates": true
16094 var osmSemipavedTags = {
16096 "cobblestone": true,
16097 "cobblestone:flattened": true,
16098 "unhewn_cobblestone": true,
16100 "paving_stones": true,
16105 var osmRightSideIsInsideTags = {
16108 "coastline": "coastline"
16111 "retaining_wall": true,
16113 "guard_rail": true,
16123 var osmRoutableHighwayTagValues = {
16130 motorway_link: true,
16132 primary_link: true,
16133 secondary_link: true,
16134 tertiary_link: true,
16135 unclassified: true,
16139 living_street: true,
16140 bus_guideway: true,
16149 var osmPathHighwayTagValues = {
16158 var osmRailwayTrackTagValues = {
16166 narrow_gauge: true,
16170 var osmFlowingWaterwayTagValues = {
16177 tidal_channel: true
16180 // node_modules/d3-array/src/ascending.js
16181 function ascending(a, b) {
16182 return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
16185 // node_modules/d3-array/src/descending.js
16186 function descending(a, b) {
16187 return a == null || b == null ? NaN : b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
16190 // node_modules/d3-array/src/bisector.js
16191 function bisector(f2) {
16192 let compare1, compare2, delta;
16193 if (f2.length !== 2) {
16194 compare1 = ascending;
16195 compare2 = (d, x) => ascending(f2(d), x);
16196 delta = (d, x) => f2(d) - x;
16198 compare1 = f2 === ascending || f2 === descending ? f2 : zero;
16202 function left(a, x, lo = 0, hi = a.length) {
16204 if (compare1(x, x) !== 0)
16207 const mid = lo + hi >>> 1;
16208 if (compare2(a[mid], x) < 0)
16216 function right(a, x, lo = 0, hi = a.length) {
16218 if (compare1(x, x) !== 0)
16221 const mid = lo + hi >>> 1;
16222 if (compare2(a[mid], x) <= 0)
16230 function center(a, x, lo = 0, hi = a.length) {
16231 const i2 = left(a, x, lo, hi - 1);
16232 return i2 > lo && delta(a[i2 - 1], x) > -delta(a[i2], x) ? i2 - 1 : i2;
16234 return { left, center, right };
16240 // node_modules/d3-array/src/number.js
16241 function number(x) {
16242 return x === null ? NaN : +x;
16244 function* numbers(values, valueof) {
16245 if (valueof === void 0) {
16246 for (let value of values) {
16247 if (value != null && (value = +value) >= value) {
16253 for (let value of values) {
16254 if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
16261 // node_modules/d3-array/src/bisect.js
16262 var ascendingBisect = bisector(ascending);
16263 var bisectRight = ascendingBisect.right;
16264 var bisectLeft = ascendingBisect.left;
16265 var bisectCenter = bisector(number).center;
16266 var bisect_default = bisectRight;
16268 // node_modules/d3-array/src/fsum.js
16269 var Adder = class {
16271 this._partials = new Float64Array(32);
16275 const p = this._partials;
16277 for (let j2 = 0; j2 < this._n && j2 < 32; j2++) {
16278 const y = p[j2], hi = x + y, lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x);
16288 const p = this._partials;
16289 let n2 = this._n, x, y, lo, hi = 0;
16300 if (n2 > 0 && (lo < 0 && p[n2 - 1] < 0 || lo > 0 && p[n2 - 1] > 0)) {
16311 // node_modules/d3-array/src/sort.js
16312 function compareDefined(compare = ascending) {
16313 if (compare === ascending)
16314 return ascendingDefined;
16315 if (typeof compare !== "function")
16316 throw new TypeError("compare is not a function");
16318 const x = compare(a, b);
16321 return (compare(b, b) === 0) - (compare(a, a) === 0);
16324 function ascendingDefined(a, b) {
16325 return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0);
16328 // node_modules/d3-array/src/ticks.js
16329 var e10 = Math.sqrt(50);
16330 var e5 = Math.sqrt(10);
16331 var e2 = Math.sqrt(2);
16332 function ticks(start2, stop, count) {
16333 var reverse, i2 = -1, n2, ticks2, step;
16334 stop = +stop, start2 = +start2, count = +count;
16335 if (start2 === stop && count > 0)
16337 if (reverse = stop < start2)
16338 n2 = start2, start2 = stop, stop = n2;
16339 if ((step = tickIncrement(start2, stop, count)) === 0 || !isFinite(step))
16342 let r0 = Math.round(start2 / step), r1 = Math.round(stop / step);
16343 if (r0 * step < start2)
16345 if (r1 * step > stop)
16347 ticks2 = new Array(n2 = r1 - r0 + 1);
16349 ticks2[i2] = (r0 + i2) * step;
16352 let r0 = Math.round(start2 * step), r1 = Math.round(stop * step);
16353 if (r0 / step < start2)
16355 if (r1 / step > stop)
16357 ticks2 = new Array(n2 = r1 - r0 + 1);
16359 ticks2[i2] = (r0 + i2) / step;
16365 function tickIncrement(start2, stop, count) {
16366 var step = (stop - start2) / Math.max(0, count), power = Math.floor(Math.log(step) / Math.LN10), error = step / Math.pow(10, power);
16367 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);
16369 function tickStep(start2, stop, count) {
16370 var step0 = Math.abs(stop - start2) / Math.max(0, count), step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error = step0 / step1;
16373 else if (error >= e5)
16375 else if (error >= e2)
16377 return stop < start2 ? -step1 : step1;
16380 // node_modules/d3-array/src/max.js
16381 function max(values, valueof) {
16383 if (valueof === void 0) {
16384 for (const value of values) {
16385 if (value != null && (max3 < value || max3 === void 0 && value >= value)) {
16391 for (let value of values) {
16392 if ((value = valueof(value, ++index, values)) != null && (max3 < value || max3 === void 0 && value >= value)) {
16400 // node_modules/d3-array/src/min.js
16401 function min(values, valueof) {
16403 if (valueof === void 0) {
16404 for (const value of values) {
16405 if (value != null && (min3 > value || min3 === void 0 && value >= value)) {
16411 for (let value of values) {
16412 if ((value = valueof(value, ++index, values)) != null && (min3 > value || min3 === void 0 && value >= value)) {
16420 // node_modules/d3-array/src/quickselect.js
16421 function quickselect(array2, k, left = 0, right = array2.length - 1, compare) {
16422 compare = compare === void 0 ? ascendingDefined : compareDefined(compare);
16423 while (right > left) {
16424 if (right - left > 600) {
16425 const n2 = right - left + 1;
16426 const m = k - left + 1;
16427 const z = Math.log(n2);
16428 const s = 0.5 * Math.exp(2 * z / 3);
16429 const sd = 0.5 * Math.sqrt(z * s * (n2 - s) / n2) * (m - n2 / 2 < 0 ? -1 : 1);
16430 const newLeft = Math.max(left, Math.floor(k - m * s / n2 + sd));
16431 const newRight = Math.min(right, Math.floor(k + (n2 - m) * s / n2 + sd));
16432 quickselect(array2, k, newLeft, newRight, compare);
16434 const t = array2[k];
16437 swap(array2, left, k);
16438 if (compare(array2[right], t) > 0)
16439 swap(array2, left, right);
16441 swap(array2, i2, j2), ++i2, --j2;
16442 while (compare(array2[i2], t) < 0)
16444 while (compare(array2[j2], t) > 0)
16447 if (compare(array2[left], t) === 0)
16448 swap(array2, left, j2);
16450 ++j2, swap(array2, j2, right);
16458 function swap(array2, i2, j2) {
16459 const t = array2[i2];
16460 array2[i2] = array2[j2];
16464 // node_modules/d3-array/src/quantile.js
16465 function quantile(values, p, valueof) {
16466 values = Float64Array.from(numbers(values, valueof));
16467 if (!(n2 = values.length))
16469 if ((p = +p) <= 0 || n2 < 2)
16470 return min(values);
16472 return max(values);
16473 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));
16474 return value0 + (value1 - value0) * (i2 - i0);
16477 // node_modules/d3-array/src/median.js
16478 function median(values, valueof) {
16479 return quantile(values, 0.5, valueof);
16482 // node_modules/d3-array/src/merge.js
16483 function* flatten(arrays) {
16484 for (const array2 of arrays) {
16488 function merge(arrays) {
16489 return Array.from(flatten(arrays));
16492 // node_modules/d3-array/src/range.js
16493 function range(start2, stop, step) {
16494 start2 = +start2, stop = +stop, step = (n2 = arguments.length) < 2 ? (stop = start2, start2 = 0, 1) : n2 < 3 ? 1 : +step;
16495 var i2 = -1, n2 = Math.max(0, Math.ceil((stop - start2) / step)) | 0, range3 = new Array(n2);
16496 while (++i2 < n2) {
16497 range3[i2] = start2 + i2 * step;
16502 // node_modules/d3-geo/src/math.js
16503 var epsilon = 1e-6;
16504 var epsilon2 = 1e-12;
16506 var halfPi = pi / 2;
16507 var quarterPi = pi / 4;
16509 var degrees = 180 / pi;
16510 var radians = pi / 180;
16511 var abs = Math.abs;
16512 var atan = Math.atan;
16513 var atan2 = Math.atan2;
16514 var cos = Math.cos;
16515 var exp = Math.exp;
16516 var log = Math.log;
16517 var sin = Math.sin;
16518 var sign = Math.sign || function(x) {
16519 return x > 0 ? 1 : x < 0 ? -1 : 0;
16521 var sqrt = Math.sqrt;
16522 var tan = Math.tan;
16524 return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
16527 return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x);
16530 // node_modules/d3-geo/src/noop.js
16534 // node_modules/d3-geo/src/stream.js
16535 function streamGeometry(geometry, stream) {
16536 if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {
16537 streamGeometryType[geometry.type](geometry, stream);
16540 var streamObjectType = {
16541 Feature: function(object, stream) {
16542 streamGeometry(object.geometry, stream);
16544 FeatureCollection: function(object, stream) {
16545 var features2 = object.features, i2 = -1, n2 = features2.length;
16547 streamGeometry(features2[i2].geometry, stream);
16550 var streamGeometryType = {
16551 Sphere: function(object, stream) {
16554 Point: function(object, stream) {
16555 object = object.coordinates;
16556 stream.point(object[0], object[1], object[2]);
16558 MultiPoint: function(object, stream) {
16559 var coordinates = object.coordinates, i2 = -1, n2 = coordinates.length;
16561 object = coordinates[i2], stream.point(object[0], object[1], object[2]);
16563 LineString: function(object, stream) {
16564 streamLine(object.coordinates, stream, 0);
16566 MultiLineString: function(object, stream) {
16567 var coordinates = object.coordinates, i2 = -1, n2 = coordinates.length;
16569 streamLine(coordinates[i2], stream, 0);
16571 Polygon: function(object, stream) {
16572 streamPolygon(object.coordinates, stream);
16574 MultiPolygon: function(object, stream) {
16575 var coordinates = object.coordinates, i2 = -1, n2 = coordinates.length;
16577 streamPolygon(coordinates[i2], stream);
16579 GeometryCollection: function(object, stream) {
16580 var geometries = object.geometries, i2 = -1, n2 = geometries.length;
16582 streamGeometry(geometries[i2], stream);
16585 function streamLine(coordinates, stream, closed) {
16586 var i2 = -1, n2 = coordinates.length - closed, coordinate;
16587 stream.lineStart();
16589 coordinate = coordinates[i2], stream.point(coordinate[0], coordinate[1], coordinate[2]);
16592 function streamPolygon(coordinates, stream) {
16593 var i2 = -1, n2 = coordinates.length;
16594 stream.polygonStart();
16596 streamLine(coordinates[i2], stream, 1);
16597 stream.polygonEnd();
16599 function stream_default(object, stream) {
16600 if (object && streamObjectType.hasOwnProperty(object.type)) {
16601 streamObjectType[object.type](object, stream);
16603 streamGeometry(object, stream);
16607 // node_modules/d3-geo/src/area.js
16608 var areaRingSum = new Adder();
16609 var areaSum = new Adder();
16619 polygonStart: function() {
16620 areaRingSum = new Adder();
16621 areaStream.lineStart = areaRingStart;
16622 areaStream.lineEnd = areaRingEnd;
16624 polygonEnd: function() {
16625 var areaRing = +areaRingSum;
16626 areaSum.add(areaRing < 0 ? tau + areaRing : areaRing);
16627 this.lineStart = this.lineEnd = this.point = noop;
16629 sphere: function() {
16633 function areaRingStart() {
16634 areaStream.point = areaPointFirst;
16636 function areaRingEnd() {
16637 areaPoint(lambda00, phi00);
16639 function areaPointFirst(lambda, phi) {
16640 areaStream.point = areaPoint;
16641 lambda00 = lambda, phi00 = phi;
16642 lambda *= radians, phi *= radians;
16643 lambda0 = lambda, cosPhi0 = cos(phi = phi / 2 + quarterPi), sinPhi0 = sin(phi);
16645 function areaPoint(lambda, phi) {
16646 lambda *= radians, phi *= radians;
16647 phi = phi / 2 + quarterPi;
16648 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);
16649 areaRingSum.add(atan2(v, u));
16650 lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;
16652 function area_default(object) {
16653 areaSum = new Adder();
16654 stream_default(object, areaStream);
16655 return areaSum * 2;
16658 // node_modules/d3-geo/src/cartesian.js
16659 function spherical(cartesian2) {
16660 return [atan2(cartesian2[1], cartesian2[0]), asin(cartesian2[2])];
16662 function cartesian(spherical2) {
16663 var lambda = spherical2[0], phi = spherical2[1], cosPhi = cos(phi);
16664 return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)];
16666 function cartesianDot(a, b) {
16667 return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
16669 function cartesianCross(a, b) {
16670 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]];
16672 function cartesianAddInPlace(a, b) {
16673 a[0] += b[0], a[1] += b[1], a[2] += b[2];
16675 function cartesianScale(vector, k) {
16676 return [vector[0] * k, vector[1] * k, vector[2] * k];
16678 function cartesianNormalizeInPlace(d) {
16679 var l = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
16680 d[0] /= l, d[1] /= l, d[2] /= l;
16683 // node_modules/d3-geo/src/bounds.js
16695 var boundsStream = {
16696 point: boundsPoint,
16697 lineStart: boundsLineStart,
16698 lineEnd: boundsLineEnd,
16699 polygonStart: function() {
16700 boundsStream.point = boundsRingPoint;
16701 boundsStream.lineStart = boundsRingStart;
16702 boundsStream.lineEnd = boundsRingEnd;
16703 deltaSum = new Adder();
16704 areaStream.polygonStart();
16706 polygonEnd: function() {
16707 areaStream.polygonEnd();
16708 boundsStream.point = boundsPoint;
16709 boundsStream.lineStart = boundsLineStart;
16710 boundsStream.lineEnd = boundsLineEnd;
16711 if (areaRingSum < 0)
16712 lambda02 = -(lambda1 = 180), phi0 = -(phi1 = 90);
16713 else if (deltaSum > epsilon)
16715 else if (deltaSum < -epsilon)
16717 range2[0] = lambda02, range2[1] = lambda1;
16719 sphere: function() {
16720 lambda02 = -(lambda1 = 180), phi0 = -(phi1 = 90);
16723 function boundsPoint(lambda, phi) {
16724 ranges.push(range2 = [lambda02 = lambda, lambda1 = lambda]);
16730 function linePoint(lambda, phi) {
16731 var p = cartesian([lambda * radians, phi * radians]);
16733 var normal = cartesianCross(p0, p), equatorial = [normal[1], -normal[0], 0], inflection = cartesianCross(equatorial, normal);
16734 cartesianNormalizeInPlace(inflection);
16735 inflection = spherical(inflection);
16736 var delta = lambda - lambda2, sign2 = delta > 0 ? 1 : -1, lambdai = inflection[0] * degrees * sign2, phii, antimeridian = abs(delta) > 180;
16737 if (antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {
16738 phii = inflection[1] * degrees;
16741 } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {
16742 phii = -inflection[1] * degrees;
16751 if (antimeridian) {
16752 if (lambda < lambda2) {
16753 if (angle(lambda02, lambda) > angle(lambda02, lambda1))
16756 if (angle(lambda, lambda1) > angle(lambda02, lambda1))
16760 if (lambda1 >= lambda02) {
16761 if (lambda < lambda02)
16763 if (lambda > lambda1)
16766 if (lambda > lambda2) {
16767 if (angle(lambda02, lambda) > angle(lambda02, lambda1))
16770 if (angle(lambda, lambda1) > angle(lambda02, lambda1))
16776 ranges.push(range2 = [lambda02 = lambda, lambda1 = lambda]);
16782 p0 = p, lambda2 = lambda;
16784 function boundsLineStart() {
16785 boundsStream.point = linePoint;
16787 function boundsLineEnd() {
16788 range2[0] = lambda02, range2[1] = lambda1;
16789 boundsStream.point = boundsPoint;
16792 function boundsRingPoint(lambda, phi) {
16794 var delta = lambda - lambda2;
16795 deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta);
16797 lambda002 = lambda, phi002 = phi;
16799 areaStream.point(lambda, phi);
16800 linePoint(lambda, phi);
16802 function boundsRingStart() {
16803 areaStream.lineStart();
16805 function boundsRingEnd() {
16806 boundsRingPoint(lambda002, phi002);
16807 areaStream.lineEnd();
16808 if (abs(deltaSum) > epsilon)
16809 lambda02 = -(lambda1 = 180);
16810 range2[0] = lambda02, range2[1] = lambda1;
16813 function angle(lambda04, lambda12) {
16814 return (lambda12 -= lambda04) < 0 ? lambda12 + 360 : lambda12;
16816 function rangeCompare(a, b) {
16817 return a[0] - b[0];
16819 function rangeContains(range3, x) {
16820 return range3[0] <= range3[1] ? range3[0] <= x && x <= range3[1] : x < range3[0] || range3[1] < x;
16822 function bounds_default(feature3) {
16823 var i2, n2, a, b, merged, deltaMax, delta;
16824 phi1 = lambda1 = -(lambda02 = phi0 = Infinity);
16826 stream_default(feature3, boundsStream);
16827 if (n2 = ranges.length) {
16828 ranges.sort(rangeCompare);
16829 for (i2 = 1, a = ranges[0], merged = [a]; i2 < n2; ++i2) {
16831 if (rangeContains(a, b[0]) || rangeContains(a, b[1])) {
16832 if (angle(a[0], b[1]) > angle(a[0], a[1]))
16834 if (angle(b[0], a[1]) > angle(a[0], a[1]))
16837 merged.push(a = b);
16840 for (deltaMax = -Infinity, n2 = merged.length - 1, i2 = 0, a = merged[n2]; i2 <= n2; a = b, ++i2) {
16842 if ((delta = angle(a[1], b[0])) > deltaMax)
16843 deltaMax = delta, lambda02 = b[0], lambda1 = a[1];
16846 ranges = range2 = null;
16847 return lambda02 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda02, phi0], [lambda1, phi1]];
16850 // node_modules/d3-geo/src/compose.js
16851 function compose_default(a, b) {
16852 function compose(x, y) {
16853 return x = a(x, y), b(x[0], x[1]);
16855 if (a.invert && b.invert)
16856 compose.invert = function(x, y) {
16857 return x = b.invert(x, y), x && a.invert(x[0], x[1]);
16862 // node_modules/d3-geo/src/rotation.js
16863 function rotationIdentity(lambda, phi) {
16864 return [abs(lambda) > pi ? lambda + Math.round(-lambda / tau) * tau : lambda, phi];
16866 rotationIdentity.invert = rotationIdentity;
16867 function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {
16868 return (deltaLambda %= tau) ? deltaPhi || deltaGamma ? compose_default(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity;
16870 function forwardRotationLambda(deltaLambda) {
16871 return function(lambda, phi) {
16872 return lambda += deltaLambda, [lambda > pi ? lambda - tau : lambda < -pi ? lambda + tau : lambda, phi];
16875 function rotationLambda(deltaLambda) {
16876 var rotation = forwardRotationLambda(deltaLambda);
16877 rotation.invert = forwardRotationLambda(-deltaLambda);
16880 function rotationPhiGamma(deltaPhi, deltaGamma) {
16881 var cosDeltaPhi = cos(deltaPhi), sinDeltaPhi = sin(deltaPhi), cosDeltaGamma = cos(deltaGamma), sinDeltaGamma = sin(deltaGamma);
16882 function rotation(lambda, phi) {
16883 var cosPhi = cos(phi), x = cos(lambda) * cosPhi, y = sin(lambda) * cosPhi, z = sin(phi), k = z * cosDeltaPhi + x * sinDeltaPhi;
16885 atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi),
16886 asin(k * cosDeltaGamma + y * sinDeltaGamma)
16889 rotation.invert = function(lambda, phi) {
16890 var cosPhi = cos(phi), x = cos(lambda) * cosPhi, y = sin(lambda) * cosPhi, z = sin(phi), k = z * cosDeltaGamma - y * sinDeltaGamma;
16892 atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi),
16893 asin(k * cosDeltaPhi - x * sinDeltaPhi)
16898 function rotation_default(rotate) {
16899 rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0);
16900 function forward(coordinates) {
16901 coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians);
16902 return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
16904 forward.invert = function(coordinates) {
16905 coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians);
16906 return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
16911 // node_modules/d3-geo/src/circle.js
16912 function circleStream(stream, radius, delta, direction, t0, t1) {
16915 var cosRadius = cos(radius), sinRadius = sin(radius), step = direction * delta;
16917 t0 = radius + direction * tau;
16918 t1 = radius - step / 2;
16920 t0 = circleRadius(cosRadius, t0);
16921 t1 = circleRadius(cosRadius, t1);
16922 if (direction > 0 ? t0 < t1 : t0 > t1)
16923 t0 += direction * tau;
16925 for (var point2, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) {
16926 point2 = spherical([cosRadius, -sinRadius * cos(t), -sinRadius * sin(t)]);
16927 stream.point(point2[0], point2[1]);
16930 function circleRadius(cosRadius, point2) {
16931 point2 = cartesian(point2), point2[0] -= cosRadius;
16932 cartesianNormalizeInPlace(point2);
16933 var radius = acos(-point2[1]);
16934 return ((-point2[2] < 0 ? -radius : radius) + tau - epsilon) % tau;
16937 // node_modules/d3-geo/src/clip/buffer.js
16938 function buffer_default() {
16939 var lines = [], line;
16941 point: function(x, y, m) {
16942 line.push([x, y, m]);
16944 lineStart: function() {
16945 lines.push(line = []);
16948 rejoin: function() {
16949 if (lines.length > 1)
16950 lines.push(lines.pop().concat(lines.shift()));
16952 result: function() {
16953 var result = lines;
16961 // node_modules/d3-geo/src/pointEqual.js
16962 function pointEqual_default(a, b) {
16963 return abs(a[0] - b[0]) < epsilon && abs(a[1] - b[1]) < epsilon;
16966 // node_modules/d3-geo/src/clip/rejoin.js
16967 function Intersection(point2, points, other, entry) {
16973 this.n = this.p = null;
16975 function rejoin_default(segments, compareIntersection2, startInside, interpolate, stream) {
16976 var subject = [], clip = [], i2, n2;
16977 segments.forEach(function(segment) {
16978 if ((n3 = segment.length - 1) <= 0)
16980 var n3, p02 = segment[0], p1 = segment[n3], x;
16981 if (pointEqual_default(p02, p1)) {
16982 if (!p02[2] && !p1[2]) {
16983 stream.lineStart();
16984 for (i2 = 0; i2 < n3; ++i2)
16985 stream.point((p02 = segment[i2])[0], p02[1]);
16989 p1[0] += 2 * epsilon;
16991 subject.push(x = new Intersection(p02, segment, null, true));
16992 clip.push(x.o = new Intersection(p02, null, x, false));
16993 subject.push(x = new Intersection(p1, segment, null, false));
16994 clip.push(x.o = new Intersection(p1, null, x, true));
16996 if (!subject.length)
16998 clip.sort(compareIntersection2);
17001 for (i2 = 0, n2 = clip.length; i2 < n2; ++i2) {
17002 clip[i2].e = startInside = !startInside;
17004 var start2 = subject[0], points, point2;
17006 var current = start2, isSubject = true;
17008 if ((current = current.n) === start2)
17010 points = current.z;
17011 stream.lineStart();
17013 current.v = current.o.v = true;
17016 for (i2 = 0, n2 = points.length; i2 < n2; ++i2)
17017 stream.point((point2 = points[i2])[0], point2[1]);
17019 interpolate(current.x, current.n.x, 1, stream);
17021 current = current.n;
17024 points = current.p.z;
17025 for (i2 = points.length - 1; i2 >= 0; --i2)
17026 stream.point((point2 = points[i2])[0], point2[1]);
17028 interpolate(current.x, current.p.x, -1, stream);
17030 current = current.p;
17032 current = current.o;
17033 points = current.z;
17034 isSubject = !isSubject;
17035 } while (!current.v);
17039 function link(array2) {
17040 if (!(n2 = array2.length))
17042 var n2, i2 = 0, a = array2[0], b;
17043 while (++i2 < n2) {
17044 a.n = b = array2[i2];
17048 a.n = b = array2[0];
17052 // node_modules/d3-geo/src/polygonContains.js
17053 function longitude(point2) {
17054 return abs(point2[0]) <= pi ? point2[0] : sign(point2[0]) * ((abs(point2[0]) + pi) % tau - pi);
17056 function polygonContains_default(polygon2, point2) {
17057 var lambda = longitude(point2), phi = point2[1], sinPhi = sin(phi), normal = [sin(lambda), -cos(lambda), 0], angle2 = 0, winding = 0;
17058 var sum = new Adder();
17060 phi = halfPi + epsilon;
17061 else if (sinPhi === -1)
17062 phi = -halfPi - epsilon;
17063 for (var i2 = 0, n2 = polygon2.length; i2 < n2; ++i2) {
17064 if (!(m = (ring = polygon2[i2]).length))
17066 var ring, m, point0 = ring[m - 1], lambda04 = longitude(point0), phi02 = point0[1] / 2 + quarterPi, sinPhi03 = sin(phi02), cosPhi03 = cos(phi02);
17067 for (var j2 = 0; j2 < m; ++j2, lambda04 = lambda12, sinPhi03 = sinPhi1, cosPhi03 = cosPhi1, point0 = point1) {
17068 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;
17069 sum.add(atan2(k * sign2 * sin(absDelta), cosPhi03 * cosPhi1 + k * cos(absDelta)));
17070 angle2 += antimeridian ? delta + sign2 * tau : delta;
17071 if (antimeridian ^ lambda04 >= lambda ^ lambda12 >= lambda) {
17072 var arc = cartesianCross(cartesian(point0), cartesian(point1));
17073 cartesianNormalizeInPlace(arc);
17074 var intersection = cartesianCross(normal, arc);
17075 cartesianNormalizeInPlace(intersection);
17076 var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]);
17077 if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {
17078 winding += antimeridian ^ delta >= 0 ? 1 : -1;
17083 return (angle2 < -epsilon || angle2 < epsilon && sum < -epsilon2) ^ winding & 1;
17086 // node_modules/d3-geo/src/clip/index.js
17087 function clip_default(pointVisible, clipLine, interpolate, start2) {
17088 return function(sink) {
17089 var line = clipLine(sink), ringBuffer = buffer_default(), ringSink = clipLine(ringBuffer), polygonStarted = false, polygon2, segments, ring;
17094 polygonStart: function() {
17095 clip.point = pointRing;
17096 clip.lineStart = ringStart;
17097 clip.lineEnd = ringEnd;
17101 polygonEnd: function() {
17102 clip.point = point2;
17103 clip.lineStart = lineStart;
17104 clip.lineEnd = lineEnd;
17105 segments = merge(segments);
17106 var startInside = polygonContains_default(polygon2, start2);
17107 if (segments.length) {
17108 if (!polygonStarted)
17109 sink.polygonStart(), polygonStarted = true;
17110 rejoin_default(segments, compareIntersection, startInside, interpolate, sink);
17111 } else if (startInside) {
17112 if (!polygonStarted)
17113 sink.polygonStart(), polygonStarted = true;
17115 interpolate(null, null, 1, sink);
17118 if (polygonStarted)
17119 sink.polygonEnd(), polygonStarted = false;
17120 segments = polygon2 = null;
17122 sphere: function() {
17123 sink.polygonStart();
17125 interpolate(null, null, 1, sink);
17130 function point2(lambda, phi) {
17131 if (pointVisible(lambda, phi))
17132 sink.point(lambda, phi);
17134 function pointLine(lambda, phi) {
17135 line.point(lambda, phi);
17137 function lineStart() {
17138 clip.point = pointLine;
17141 function lineEnd() {
17142 clip.point = point2;
17145 function pointRing(lambda, phi) {
17146 ring.push([lambda, phi]);
17147 ringSink.point(lambda, phi);
17149 function ringStart() {
17150 ringSink.lineStart();
17153 function ringEnd() {
17154 pointRing(ring[0][0], ring[0][1]);
17155 ringSink.lineEnd();
17156 var clean2 = ringSink.clean(), ringSegments = ringBuffer.result(), i2, n2 = ringSegments.length, m, segment, point3;
17158 polygon2.push(ring);
17163 segment = ringSegments[0];
17164 if ((m = segment.length - 1) > 0) {
17165 if (!polygonStarted)
17166 sink.polygonStart(), polygonStarted = true;
17168 for (i2 = 0; i2 < m; ++i2)
17169 sink.point((point3 = segment[i2])[0], point3[1]);
17174 if (n2 > 1 && clean2 & 2)
17175 ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
17176 segments.push(ringSegments.filter(validSegment));
17181 function validSegment(segment) {
17182 return segment.length > 1;
17184 function compareIntersection(a, b) {
17185 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]);
17188 // node_modules/d3-geo/src/clip/antimeridian.js
17189 var antimeridian_default = clip_default(
17193 clipAntimeridianLine,
17194 clipAntimeridianInterpolate,
17197 function clipAntimeridianLine(stream) {
17198 var lambda04 = NaN, phi02 = NaN, sign0 = NaN, clean2;
17200 lineStart: function() {
17201 stream.lineStart();
17204 point: function(lambda12, phi12) {
17205 var sign1 = lambda12 > 0 ? pi : -pi, delta = abs(lambda12 - lambda04);
17206 if (abs(delta - pi) < epsilon) {
17207 stream.point(lambda04, phi02 = (phi02 + phi12) / 2 > 0 ? halfPi : -halfPi);
17208 stream.point(sign0, phi02);
17210 stream.lineStart();
17211 stream.point(sign1, phi02);
17212 stream.point(lambda12, phi02);
17214 } else if (sign0 !== sign1 && delta >= pi) {
17215 if (abs(lambda04 - sign0) < epsilon)
17216 lambda04 -= sign0 * epsilon;
17217 if (abs(lambda12 - sign1) < epsilon)
17218 lambda12 -= sign1 * epsilon;
17219 phi02 = clipAntimeridianIntersect(lambda04, phi02, lambda12, phi12);
17220 stream.point(sign0, phi02);
17222 stream.lineStart();
17223 stream.point(sign1, phi02);
17226 stream.point(lambda04 = lambda12, phi02 = phi12);
17229 lineEnd: function() {
17231 lambda04 = phi02 = NaN;
17233 clean: function() {
17238 function clipAntimeridianIntersect(lambda04, phi02, lambda12, phi12) {
17239 var cosPhi03, cosPhi1, sinLambda0Lambda1 = sin(lambda04 - lambda12);
17240 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;
17242 function clipAntimeridianInterpolate(from, to, direction, stream) {
17244 if (from == null) {
17245 phi = direction * halfPi;
17246 stream.point(-pi, phi);
17247 stream.point(0, phi);
17248 stream.point(pi, phi);
17249 stream.point(pi, 0);
17250 stream.point(pi, -phi);
17251 stream.point(0, -phi);
17252 stream.point(-pi, -phi);
17253 stream.point(-pi, 0);
17254 stream.point(-pi, phi);
17255 } else if (abs(from[0] - to[0]) > epsilon) {
17256 var lambda = from[0] < to[0] ? pi : -pi;
17257 phi = direction * lambda / 2;
17258 stream.point(-lambda, phi);
17259 stream.point(0, phi);
17260 stream.point(lambda, phi);
17262 stream.point(to[0], to[1]);
17266 // node_modules/d3-geo/src/clip/circle.js
17267 function circle_default(radius) {
17268 var cr = cos(radius), delta = 6 * radians, smallRadius = cr > 0, notHemisphere = abs(cr) > epsilon;
17269 function interpolate(from, to, direction, stream) {
17270 circleStream(stream, radius, delta, direction, from, to);
17272 function visible(lambda, phi) {
17273 return cos(lambda) * cos(phi) > cr;
17275 function clipLine(stream) {
17276 var point0, c0, v0, v00, clean2;
17278 lineStart: function() {
17282 point: function(lambda, phi) {
17283 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;
17284 if (!point0 && (v00 = v0 = v))
17285 stream.lineStart();
17287 point2 = intersect2(point0, point1);
17288 if (!point2 || pointEqual_default(point0, point2) || pointEqual_default(point1, point2))
17294 stream.lineStart();
17295 point2 = intersect2(point1, point0);
17296 stream.point(point2[0], point2[1]);
17298 point2 = intersect2(point0, point1);
17299 stream.point(point2[0], point2[1], 2);
17303 } else if (notHemisphere && point0 && smallRadius ^ v) {
17305 if (!(c & c0) && (t = intersect2(point1, point0, true))) {
17308 stream.lineStart();
17309 stream.point(t[0][0], t[0][1]);
17310 stream.point(t[1][0], t[1][1]);
17313 stream.point(t[1][0], t[1][1]);
17315 stream.lineStart();
17316 stream.point(t[0][0], t[0][1], 3);
17320 if (v && (!point0 || !pointEqual_default(point0, point1))) {
17321 stream.point(point1[0], point1[1]);
17323 point0 = point1, v0 = v, c0 = c;
17325 lineEnd: function() {
17330 clean: function() {
17331 return clean2 | (v00 && v0) << 1;
17335 function intersect2(a, b, two) {
17336 var pa = cartesian(a), pb = cartesian(b);
17337 var n1 = [1, 0, 0], n2 = cartesianCross(pa, pb), n2n2 = cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2;
17340 var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n2), A = cartesianScale(n1, c1), B = cartesianScale(n2, c2);
17341 cartesianAddInPlace(A, B);
17342 var u = n1xn2, w = cartesianDot(A, u), uu = cartesianDot(u, u), t2 = w * w - uu * (cartesianDot(A, A) - 1);
17345 var t = sqrt(t2), q = cartesianScale(u, (-w - t) / uu);
17346 cartesianAddInPlace(q, A);
17350 var lambda04 = a[0], lambda12 = b[0], phi02 = a[1], phi12 = b[1], z;
17351 if (lambda12 < lambda04)
17352 z = lambda04, lambda04 = lambda12, lambda12 = z;
17353 var delta2 = lambda12 - lambda04, polar = abs(delta2 - pi) < epsilon, meridian = polar || delta2 < epsilon;
17354 if (!polar && phi12 < phi02)
17355 z = phi02, phi02 = phi12, phi12 = z;
17356 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)) {
17357 var q1 = cartesianScale(u, (-w + t) / uu);
17358 cartesianAddInPlace(q1, A);
17359 return [q, spherical(q1)];
17362 function code(lambda, phi) {
17363 var r = smallRadius ? radius : pi - radius, code2 = 0;
17366 else if (lambda > r)
17374 return clip_default(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]);
17377 // node_modules/d3-geo/src/clip/line.js
17378 function line_default(a, b, x05, y05, x12, y12) {
17379 var ax = a[0], ay = a[1], bx = b[0], by = b[1], t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r;
17389 } else if (dx > 0) {
17404 } else if (dx > 0) {
17419 } else if (dy > 0) {
17434 } else if (dy > 0) {
17441 a[0] = ax + t0 * dx, a[1] = ay + t0 * dy;
17443 b[0] = ax + t1 * dx, b[1] = ay + t1 * dy;
17447 // node_modules/d3-geo/src/clip/rectangle.js
17449 var clipMin = -clipMax;
17450 function clipRectangle(x05, y05, x12, y12) {
17451 function visible(x, y) {
17452 return x05 <= x && x <= x12 && y05 <= y && y <= y12;
17454 function interpolate(from, to, direction, stream) {
17456 if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) {
17458 stream.point(a === 0 || a === 3 ? x05 : x12, a > 1 ? y12 : y05);
17459 while ((a = (a + direction + 4) % 4) !== a1);
17461 stream.point(to[0], to[1]);
17464 function corner(p, direction) {
17465 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;
17467 function compareIntersection2(a, b) {
17468 return comparePoint(a.x, b.x);
17470 function comparePoint(a, b) {
17471 var ca = corner(a, 1), cb = corner(b, 1);
17472 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];
17474 return function(stream) {
17475 var activeStream = stream, bufferStream = buffer_default(), segments, polygon2, ring, x__, y__, v__, x_, y_, v_, first, clean2;
17483 function point2(x, y) {
17485 activeStream.point(x, y);
17487 function polygonInside() {
17489 for (var i2 = 0, n2 = polygon2.length; i2 < n2; ++i2) {
17490 for (var ring2 = polygon2[i2], j2 = 1, m = ring2.length, point3 = ring2[0], a0, a1, b0 = point3[0], b1 = point3[1]; j2 < m; ++j2) {
17491 a0 = b0, a1 = b1, point3 = ring2[j2], b0 = point3[0], b1 = point3[1];
17493 if (b1 > y12 && (b0 - a0) * (y12 - a1) > (b1 - a1) * (x05 - a0))
17496 if (b1 <= y12 && (b0 - a0) * (y12 - a1) < (b1 - a1) * (x05 - a0))
17503 function polygonStart() {
17504 activeStream = bufferStream, segments = [], polygon2 = [], clean2 = true;
17506 function polygonEnd() {
17507 var startInside = polygonInside(), cleanInside = clean2 && startInside, visible2 = (segments = merge(segments)).length;
17508 if (cleanInside || visible2) {
17509 stream.polygonStart();
17511 stream.lineStart();
17512 interpolate(null, null, 1, stream);
17516 rejoin_default(segments, compareIntersection2, startInside, interpolate, stream);
17518 stream.polygonEnd();
17520 activeStream = stream, segments = polygon2 = ring = null;
17522 function lineStart() {
17523 clipStream.point = linePoint2;
17525 polygon2.push(ring = []);
17530 function lineEnd() {
17532 linePoint2(x__, y__);
17534 bufferStream.rejoin();
17535 segments.push(bufferStream.result());
17537 clipStream.point = point2;
17539 activeStream.lineEnd();
17541 function linePoint2(x, y) {
17542 var v = visible(x, y);
17546 x__ = x, y__ = y, v__ = v;
17549 activeStream.lineStart();
17550 activeStream.point(x, y);
17554 activeStream.point(x, y);
17556 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))];
17557 if (line_default(a, b, x05, y05, x12, y12)) {
17559 activeStream.lineStart();
17560 activeStream.point(a[0], a[1]);
17562 activeStream.point(b[0], b[1]);
17564 activeStream.lineEnd();
17567 activeStream.lineStart();
17568 activeStream.point(x, y);
17573 x_ = x, y_ = y, v_ = v;
17579 // node_modules/d3-geo/src/length.js
17584 var lengthStream = {
17587 lineStart: lengthLineStart,
17589 polygonStart: noop,
17592 function lengthLineStart() {
17593 lengthStream.point = lengthPointFirst;
17594 lengthStream.lineEnd = lengthLineEnd;
17596 function lengthLineEnd() {
17597 lengthStream.point = lengthStream.lineEnd = noop;
17599 function lengthPointFirst(lambda, phi) {
17600 lambda *= radians, phi *= radians;
17601 lambda03 = lambda, sinPhi02 = sin(phi), cosPhi02 = cos(phi);
17602 lengthStream.point = lengthPoint;
17604 function lengthPoint(lambda, phi) {
17605 lambda *= radians, phi *= radians;
17606 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;
17607 lengthSum.add(atan2(sqrt(x * x + y * y), z));
17608 lambda03 = lambda, sinPhi02 = sinPhi, cosPhi02 = cosPhi;
17610 function length_default(object) {
17611 lengthSum = new Adder();
17612 stream_default(object, lengthStream);
17616 // node_modules/d3-geo/src/identity.js
17617 var identity_default = (x) => x;
17619 // node_modules/d3-geo/src/path/area.js
17620 var areaSum2 = new Adder();
17621 var areaRingSum2 = new Adder();
17626 var areaStream2 = {
17630 polygonStart: function() {
17631 areaStream2.lineStart = areaRingStart2;
17632 areaStream2.lineEnd = areaRingEnd2;
17634 polygonEnd: function() {
17635 areaStream2.lineStart = areaStream2.lineEnd = areaStream2.point = noop;
17636 areaSum2.add(abs(areaRingSum2));
17637 areaRingSum2 = new Adder();
17639 result: function() {
17640 var area = areaSum2 / 2;
17641 areaSum2 = new Adder();
17645 function areaRingStart2() {
17646 areaStream2.point = areaPointFirst2;
17648 function areaPointFirst2(x, y) {
17649 areaStream2.point = areaPoint2;
17650 x00 = x0 = x, y00 = y0 = y;
17652 function areaPoint2(x, y) {
17653 areaRingSum2.add(y0 * x - x0 * y);
17656 function areaRingEnd2() {
17657 areaPoint2(x00, y00);
17659 var area_default2 = areaStream2;
17661 // node_modules/d3-geo/src/path/bounds.js
17662 var x02 = Infinity;
17666 var boundsStream2 = {
17667 point: boundsPoint2,
17670 polygonStart: noop,
17672 result: function() {
17673 var bounds = [[x02, y02], [x1, y1]];
17674 x1 = y1 = -(y02 = x02 = Infinity);
17678 function boundsPoint2(x, y) {
17688 var bounds_default2 = boundsStream2;
17690 // node_modules/d3-geo/src/path/centroid.js
17704 var centroidStream = {
17705 point: centroidPoint,
17706 lineStart: centroidLineStart,
17707 lineEnd: centroidLineEnd,
17708 polygonStart: function() {
17709 centroidStream.lineStart = centroidRingStart;
17710 centroidStream.lineEnd = centroidRingEnd;
17712 polygonEnd: function() {
17713 centroidStream.point = centroidPoint;
17714 centroidStream.lineStart = centroidLineStart;
17715 centroidStream.lineEnd = centroidLineEnd;
17717 result: function() {
17718 var centroid = Z2 ? [X2 / Z2, Y2 / Z2] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN];
17719 X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0;
17723 function centroidPoint(x, y) {
17728 function centroidLineStart() {
17729 centroidStream.point = centroidPointFirstLine;
17731 function centroidPointFirstLine(x, y) {
17732 centroidStream.point = centroidPointLine;
17733 centroidPoint(x03 = x, y03 = y);
17735 function centroidPointLine(x, y) {
17736 var dx = x - x03, dy = y - y03, z = sqrt(dx * dx + dy * dy);
17737 X1 += z * (x03 + x) / 2;
17738 Y1 += z * (y03 + y) / 2;
17740 centroidPoint(x03 = x, y03 = y);
17742 function centroidLineEnd() {
17743 centroidStream.point = centroidPoint;
17745 function centroidRingStart() {
17746 centroidStream.point = centroidPointFirstRing;
17748 function centroidRingEnd() {
17749 centroidPointRing(x002, y002);
17751 function centroidPointFirstRing(x, y) {
17752 centroidStream.point = centroidPointRing;
17753 centroidPoint(x002 = x03 = x, y002 = y03 = y);
17755 function centroidPointRing(x, y) {
17756 var dx = x - x03, dy = y - y03, z = sqrt(dx * dx + dy * dy);
17757 X1 += z * (x03 + x) / 2;
17758 Y1 += z * (y03 + y) / 2;
17760 z = y03 * x - x03 * y;
17761 X2 += z * (x03 + x);
17762 Y2 += z * (y03 + y);
17764 centroidPoint(x03 = x, y03 = y);
17766 var centroid_default = centroidStream;
17768 // node_modules/d3-geo/src/path/context.js
17769 function PathContext(context) {
17770 this._context = context;
17772 PathContext.prototype = {
17774 pointRadius: function(_) {
17775 return this._radius = _, this;
17777 polygonStart: function() {
17780 polygonEnd: function() {
17783 lineStart: function() {
17786 lineEnd: function() {
17787 if (this._line === 0)
17788 this._context.closePath();
17791 point: function(x, y) {
17792 switch (this._point) {
17794 this._context.moveTo(x, y);
17799 this._context.lineTo(x, y);
17803 this._context.moveTo(x + this._radius, y);
17804 this._context.arc(x, y, this._radius, 0, tau);
17812 // node_modules/d3-geo/src/path/measure.js
17813 var lengthSum2 = new Adder();
17819 var lengthStream2 = {
17821 lineStart: function() {
17822 lengthStream2.point = lengthPointFirst2;
17824 lineEnd: function() {
17826 lengthPoint2(x003, y003);
17827 lengthStream2.point = noop;
17829 polygonStart: function() {
17832 polygonEnd: function() {
17835 result: function() {
17836 var length = +lengthSum2;
17837 lengthSum2 = new Adder();
17841 function lengthPointFirst2(x, y) {
17842 lengthStream2.point = lengthPoint2;
17843 x003 = x04 = x, y003 = y04 = y;
17845 function lengthPoint2(x, y) {
17846 x04 -= x, y04 -= y;
17847 lengthSum2.add(sqrt(x04 * x04 + y04 * y04));
17850 var measure_default = lengthStream2;
17852 // node_modules/d3-geo/src/path/string.js
17853 function PathString() {
17856 PathString.prototype = {
17858 _circle: circle(4.5),
17859 pointRadius: function(_) {
17860 if ((_ = +_) !== this._radius)
17861 this._radius = _, this._circle = null;
17864 polygonStart: function() {
17867 polygonEnd: function() {
17870 lineStart: function() {
17873 lineEnd: function() {
17874 if (this._line === 0)
17875 this._string.push("Z");
17878 point: function(x, y) {
17879 switch (this._point) {
17881 this._string.push("M", x, ",", y);
17886 this._string.push("L", x, ",", y);
17890 if (this._circle == null)
17891 this._circle = circle(this._radius);
17892 this._string.push("M", x, ",", y, this._circle);
17897 result: function() {
17898 if (this._string.length) {
17899 var result = this._string.join("");
17907 function circle(radius) {
17908 return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z";
17911 // node_modules/d3-geo/src/path/index.js
17912 function path_default(projection2, context) {
17913 var pointRadius = 4.5, projectionStream, contextStream;
17914 function path(object) {
17916 if (typeof pointRadius === "function")
17917 contextStream.pointRadius(+pointRadius.apply(this, arguments));
17918 stream_default(object, projectionStream(contextStream));
17920 return contextStream.result();
17922 path.area = function(object) {
17923 stream_default(object, projectionStream(area_default2));
17924 return area_default2.result();
17926 path.measure = function(object) {
17927 stream_default(object, projectionStream(measure_default));
17928 return measure_default.result();
17930 path.bounds = function(object) {
17931 stream_default(object, projectionStream(bounds_default2));
17932 return bounds_default2.result();
17934 path.centroid = function(object) {
17935 stream_default(object, projectionStream(centroid_default));
17936 return centroid_default.result();
17938 path.projection = function(_) {
17939 return arguments.length ? (projectionStream = _ == null ? (projection2 = null, identity_default) : (projection2 = _).stream, path) : projection2;
17941 path.context = function(_) {
17942 if (!arguments.length)
17944 contextStream = _ == null ? (context = null, new PathString()) : new PathContext(context = _);
17945 if (typeof pointRadius !== "function")
17946 contextStream.pointRadius(pointRadius);
17949 path.pointRadius = function(_) {
17950 if (!arguments.length)
17951 return pointRadius;
17952 pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_);
17955 return path.projection(projection2).context(context);
17958 // node_modules/d3-geo/src/transform.js
17959 function transform_default(methods2) {
17961 stream: transformer(methods2)
17964 function transformer(methods2) {
17965 return function(stream) {
17966 var s = new TransformStream();
17967 for (var key in methods2)
17968 s[key] = methods2[key];
17973 function TransformStream() {
17975 TransformStream.prototype = {
17976 constructor: TransformStream,
17977 point: function(x, y) {
17978 this.stream.point(x, y);
17980 sphere: function() {
17981 this.stream.sphere();
17983 lineStart: function() {
17984 this.stream.lineStart();
17986 lineEnd: function() {
17987 this.stream.lineEnd();
17989 polygonStart: function() {
17990 this.stream.polygonStart();
17992 polygonEnd: function() {
17993 this.stream.polygonEnd();
17997 // node_modules/d3-geo/src/projection/fit.js
17998 function fit(projection2, fitBounds, object) {
17999 var clip = projection2.clipExtent && projection2.clipExtent();
18000 projection2.scale(150).translate([0, 0]);
18002 projection2.clipExtent(null);
18003 stream_default(object, projection2.stream(bounds_default2));
18004 fitBounds(bounds_default2.result());
18006 projection2.clipExtent(clip);
18007 return projection2;
18009 function fitExtent(projection2, extent, object) {
18010 return fit(projection2, function(b) {
18011 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;
18012 projection2.scale(150 * k).translate([x, y]);
18015 function fitSize(projection2, size, object) {
18016 return fitExtent(projection2, [[0, 0], size], object);
18018 function fitWidth(projection2, width, object) {
18019 return fit(projection2, function(b) {
18020 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];
18021 projection2.scale(150 * k).translate([x, y]);
18024 function fitHeight(projection2, height, object) {
18025 return fit(projection2, function(b) {
18026 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;
18027 projection2.scale(150 * k).translate([x, y]);
18031 // node_modules/d3-geo/src/projection/resample.js
18033 var cosMinDistance = cos(30 * radians);
18034 function resample_default(project, delta2) {
18035 return +delta2 ? resample(project, delta2) : resampleNone(project);
18037 function resampleNone(project) {
18038 return transformer({
18039 point: function(x, y) {
18041 this.stream.point(x[0], x[1]);
18045 function resample(project, delta2) {
18046 function resampleLineTo(x05, y05, lambda04, a0, b0, c0, x12, y12, lambda12, a1, b1, c1, depth, stream) {
18047 var dx = x12 - x05, dy = y12 - y05, d2 = dx * dx + dy * dy;
18048 if (d2 > 4 * delta2 && depth--) {
18049 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;
18050 if (dz * dz / d2 > delta2 || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {
18051 resampleLineTo(x05, y05, lambda04, a0, b0, c0, x2, y2, lambda22, a /= m, b /= m, c, depth, stream);
18052 stream.point(x2, y2);
18053 resampleLineTo(x2, y2, lambda22, a, b, c, x12, y12, lambda12, a1, b1, c1, depth, stream);
18057 return function(stream) {
18058 var lambda003, x004, y004, a00, b00, c00, lambda04, x05, y05, a0, b0, c0;
18059 var resampleStream = {
18063 polygonStart: function() {
18064 stream.polygonStart();
18065 resampleStream.lineStart = ringStart;
18067 polygonEnd: function() {
18068 stream.polygonEnd();
18069 resampleStream.lineStart = lineStart;
18072 function point2(x, y) {
18074 stream.point(x[0], x[1]);
18076 function lineStart() {
18078 resampleStream.point = linePoint2;
18079 stream.lineStart();
18081 function linePoint2(lambda, phi) {
18082 var c = cartesian([lambda, phi]), p = project(lambda, phi);
18083 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);
18084 stream.point(x05, y05);
18086 function lineEnd() {
18087 resampleStream.point = point2;
18090 function ringStart() {
18092 resampleStream.point = ringPoint;
18093 resampleStream.lineEnd = ringEnd;
18095 function ringPoint(lambda, phi) {
18096 linePoint2(lambda003 = lambda, phi), x004 = x05, y004 = y05, a00 = a0, b00 = b0, c00 = c0;
18097 resampleStream.point = linePoint2;
18099 function ringEnd() {
18100 resampleLineTo(x05, y05, lambda04, a0, b0, c0, x004, y004, lambda003, a00, b00, c00, maxDepth, stream);
18101 resampleStream.lineEnd = lineEnd;
18104 return resampleStream;
18108 // node_modules/d3-geo/src/projection/index.js
18109 var transformRadians = transformer({
18110 point: function(x, y) {
18111 this.stream.point(x * radians, y * radians);
18114 function transformRotate(rotate) {
18115 return transformer({
18116 point: function(x, y) {
18117 var r = rotate(x, y);
18118 return this.stream.point(r[0], r[1]);
18122 function scaleTranslate(k, dx, dy, sx, sy) {
18123 function transform2(x, y) {
18126 return [dx + k * x, dy - k * y];
18128 transform2.invert = function(x, y) {
18129 return [(x - dx) / k * sx, (dy - y) / k * sy];
18133 function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) {
18135 return scaleTranslate(k, dx, dy, sx, sy);
18136 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;
18137 function transform2(x, y) {
18140 return [a * x - b * y + dx, dy - b * x - a * y];
18142 transform2.invert = function(x, y) {
18143 return [sx * (ai * x - bi * y + ci), sy * (fi - bi * x - ai * y)];
18147 function projection(project) {
18148 return projectionMutator(function() {
18152 function projectionMutator(projectAt) {
18153 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;
18154 function projection2(point2) {
18155 return projectRotateTransform(point2[0] * radians, point2[1] * radians);
18157 function invert(point2) {
18158 point2 = projectRotateTransform.invert(point2[0], point2[1]);
18159 return point2 && [point2[0] * degrees, point2[1] * degrees];
18161 projection2.stream = function(stream) {
18162 return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));
18164 projection2.preclip = function(_) {
18165 return arguments.length ? (preclip = _, theta = void 0, reset()) : preclip;
18167 projection2.postclip = function(_) {
18168 return arguments.length ? (postclip = _, x05 = y05 = x12 = y12 = null, reset()) : postclip;
18170 projection2.clipAngle = function(_) {
18171 return arguments.length ? (preclip = +_ ? circle_default(theta = _ * radians) : (theta = null, antimeridian_default), reset()) : theta * degrees;
18173 projection2.clipExtent = function(_) {
18174 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]];
18176 projection2.scale = function(_) {
18177 return arguments.length ? (k = +_, recenter()) : k;
18179 projection2.translate = function(_) {
18180 return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y];
18182 projection2.center = function(_) {
18183 return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];
18185 projection2.rotate = function(_) {
18186 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];
18188 projection2.angle = function(_) {
18189 return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees;
18191 projection2.reflectX = function(_) {
18192 return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0;
18194 projection2.reflectY = function(_) {
18195 return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0;
18197 projection2.precision = function(_) {
18198 return arguments.length ? (projectResample = resample_default(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2);
18200 projection2.fitExtent = function(extent, object) {
18201 return fitExtent(projection2, extent, object);
18203 projection2.fitSize = function(size, object) {
18204 return fitSize(projection2, size, object);
18206 projection2.fitWidth = function(width, object) {
18207 return fitWidth(projection2, width, object);
18209 projection2.fitHeight = function(height, object) {
18210 return fitHeight(projection2, height, object);
18212 function recenter() {
18213 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);
18214 rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);
18215 projectTransform = compose_default(project, transform2);
18216 projectRotateTransform = compose_default(rotate, projectTransform);
18217 projectResample = resample_default(projectTransform, delta2);
18221 cache = cacheStream = null;
18222 return projection2;
18224 return function() {
18225 project = projectAt.apply(this, arguments);
18226 projection2.invert = project.invert && invert;
18231 // node_modules/d3-geo/src/projection/mercator.js
18232 function mercatorRaw(lambda, phi) {
18233 return [lambda, log(tan((halfPi + phi) / 2))];
18235 mercatorRaw.invert = function(x, y) {
18236 return [x, 2 * atan(exp(y)) - halfPi];
18238 function mercator_default() {
18239 return mercatorProjection(mercatorRaw).scale(961 / tau);
18241 function mercatorProjection(project) {
18242 var m = projection(project), center = m.center, scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, x05 = null, y05, x12, y12;
18243 m.scale = function(_) {
18244 return arguments.length ? (scale(_), reclip()) : scale();
18246 m.translate = function(_) {
18247 return arguments.length ? (translate(_), reclip()) : translate();
18249 m.center = function(_) {
18250 return arguments.length ? (center(_), reclip()) : center();
18252 m.clipExtent = function(_) {
18253 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]];
18255 function reclip() {
18256 var k = pi * scale(), t = m(rotation_default(m.rotate()).invert([0, 0]));
18257 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)]]);
18262 // node_modules/d3-geo/src/projection/identity.js
18263 function identity_default2() {
18264 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({
18265 point: function(x, y) {
18266 var p = projection2([x, y]);
18267 this.stream.point(p[0], p[1]);
18269 }), postclip = identity_default, cache, cacheStream;
18273 cache = cacheStream = null;
18274 return projection2;
18276 function projection2(p) {
18277 var x = p[0] * kx, y = p[1] * ky;
18279 var t = y * ca - x * sa;
18280 x = x * ca + y * sa;
18283 return [x + tx, y + ty];
18285 projection2.invert = function(p) {
18286 var x = p[0] - tx, y = p[1] - ty;
18288 var t = y * ca + x * sa;
18289 x = x * ca - y * sa;
18292 return [x / kx, y / ky];
18294 projection2.stream = function(stream) {
18295 return cache && cacheStream === stream ? cache : cache = transform2(postclip(cacheStream = stream));
18297 projection2.postclip = function(_) {
18298 return arguments.length ? (postclip = _, x05 = y05 = x12 = y12 = null, reset()) : postclip;
18300 projection2.clipExtent = function(_) {
18301 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]];
18303 projection2.scale = function(_) {
18304 return arguments.length ? (k = +_, reset()) : k;
18306 projection2.translate = function(_) {
18307 return arguments.length ? (tx = +_[0], ty = +_[1], reset()) : [tx, ty];
18309 projection2.angle = function(_) {
18310 return arguments.length ? (alpha = _ % 360 * radians, sa = sin(alpha), ca = cos(alpha), reset()) : alpha * degrees;
18312 projection2.reflectX = function(_) {
18313 return arguments.length ? (sx = _ ? -1 : 1, reset()) : sx < 0;
18315 projection2.reflectY = function(_) {
18316 return arguments.length ? (sy = _ ? -1 : 1, reset()) : sy < 0;
18318 projection2.fitExtent = function(extent, object) {
18319 return fitExtent(projection2, extent, object);
18321 projection2.fitSize = function(size, object) {
18322 return fitSize(projection2, size, object);
18324 projection2.fitWidth = function(width, object) {
18325 return fitWidth(projection2, width, object);
18327 projection2.fitHeight = function(height, object) {
18328 return fitHeight(projection2, height, object);
18330 return projection2;
18333 // modules/geo/geo.js
18334 var TAU = 2 * Math.PI;
18335 var EQUATORIAL_RADIUS = 6356752314245179e-9;
18336 var POLAR_RADIUS = 6378137;
18337 function geoLatToMeters(dLat) {
18338 return dLat * (TAU * POLAR_RADIUS / 360);
18340 function geoLonToMeters(dLon, atLat) {
18341 return Math.abs(atLat) >= 90 ? 0 : dLon * (TAU * EQUATORIAL_RADIUS / 360) * Math.abs(Math.cos(atLat * (Math.PI / 180)));
18343 function geoMetersToLat(m) {
18344 return m / (TAU * POLAR_RADIUS / 360);
18346 function geoMetersToLon(m, atLat) {
18347 return Math.abs(atLat) >= 90 ? 0 : m / (TAU * EQUATORIAL_RADIUS / 360) / Math.abs(Math.cos(atLat * (Math.PI / 180)));
18349 function geoMetersToOffset(meters, tileSize) {
18350 tileSize = tileSize || 256;
18352 meters[0] * tileSize / (TAU * EQUATORIAL_RADIUS),
18353 -meters[1] * tileSize / (TAU * POLAR_RADIUS)
18356 function geoOffsetToMeters(offset, tileSize) {
18357 tileSize = tileSize || 256;
18359 offset[0] * TAU * EQUATORIAL_RADIUS / tileSize,
18360 -offset[1] * TAU * POLAR_RADIUS / tileSize
18363 function geoSphericalDistance(a, b) {
18364 var x = geoLonToMeters(a[0] - b[0], (a[1] + b[1]) / 2);
18365 var y = geoLatToMeters(a[1] - b[1]);
18366 return Math.sqrt(x * x + y * y);
18368 function geoScaleToZoom(k, tileSize) {
18369 tileSize = tileSize || 256;
18370 var log2ts = Math.log(tileSize) * Math.LOG2E;
18371 return Math.log(k * TAU) / Math.LN2 - log2ts;
18373 function geoZoomToScale(z, tileSize) {
18374 tileSize = tileSize || 256;
18375 return tileSize * Math.pow(2, z) / TAU;
18377 function geoSphericalClosestNode(nodes, point2) {
18378 var minDistance = Infinity, distance;
18380 for (var i2 in nodes) {
18381 distance = geoSphericalDistance(nodes[i2].loc, point2);
18382 if (distance < minDistance) {
18383 minDistance = distance;
18387 if (indexOfMin !== void 0) {
18388 return { index: indexOfMin, distance: minDistance, node: nodes[indexOfMin] };
18394 // modules/geo/extent.js
18395 function geoExtent(min3, max3) {
18396 if (!(this instanceof geoExtent)) {
18397 return new geoExtent(min3, max3);
18398 } else if (min3 instanceof geoExtent) {
18400 } else if (min3 && min3.length === 2 && min3[0].length === 2 && min3[1].length === 2) {
18404 this[0] = min3 || [Infinity, Infinity];
18405 this[1] = max3 || min3 || [-Infinity, -Infinity];
18408 geoExtent.prototype = new Array(2);
18409 Object.assign(geoExtent.prototype, {
18410 equals: function(obj) {
18411 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];
18413 extend: function(obj) {
18414 if (!(obj instanceof geoExtent))
18415 obj = new geoExtent(obj);
18417 [Math.min(obj[0][0], this[0][0]), Math.min(obj[0][1], this[0][1])],
18418 [Math.max(obj[1][0], this[1][0]), Math.max(obj[1][1], this[1][1])]
18421 _extend: function(extent) {
18422 this[0][0] = Math.min(extent[0][0], this[0][0]);
18423 this[0][1] = Math.min(extent[0][1], this[0][1]);
18424 this[1][0] = Math.max(extent[1][0], this[1][0]);
18425 this[1][1] = Math.max(extent[1][1], this[1][1]);
18428 return Math.abs((this[1][0] - this[0][0]) * (this[1][1] - this[0][1]));
18430 center: function() {
18431 return [(this[0][0] + this[1][0]) / 2, (this[0][1] + this[1][1]) / 2];
18433 rectangle: function() {
18434 return [this[0][0], this[0][1], this[1][0], this[1][1]];
18437 return { minX: this[0][0], minY: this[0][1], maxX: this[1][0], maxY: this[1][1] };
18439 polygon: function() {
18441 [this[0][0], this[0][1]],
18442 [this[0][0], this[1][1]],
18443 [this[1][0], this[1][1]],
18444 [this[1][0], this[0][1]],
18445 [this[0][0], this[0][1]]
18448 contains: function(obj) {
18449 if (!(obj instanceof geoExtent))
18450 obj = new geoExtent(obj);
18451 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];
18453 intersects: function(obj) {
18454 if (!(obj instanceof geoExtent))
18455 obj = new geoExtent(obj);
18456 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];
18458 intersection: function(obj) {
18459 if (!this.intersects(obj))
18460 return new geoExtent();
18461 return new geoExtent(
18462 [Math.max(obj[0][0], this[0][0]), Math.max(obj[0][1], this[0][1])],
18463 [Math.min(obj[1][0], this[1][0]), Math.min(obj[1][1], this[1][1])]
18466 percentContainedIn: function(obj) {
18467 if (!(obj instanceof geoExtent))
18468 obj = new geoExtent(obj);
18469 var a1 = this.intersection(obj).area();
18470 var a2 = this.area();
18471 if (a1 === Infinity || a2 === Infinity) {
18473 } else if (a1 === 0 || a2 === 0) {
18474 if (obj.contains(this)) {
18482 padByMeters: function(meters) {
18483 var dLat = geoMetersToLat(meters);
18484 var dLon = geoMetersToLon(meters, this.center()[1]);
18486 [this[0][0] - dLon, this[0][1] - dLat],
18487 [this[1][0] + dLon, this[1][1] + dLat]
18490 toParam: function() {
18491 return this.rectangle().join(",");
18495 // node_modules/d3-polygon/src/area.js
18496 function area_default3(polygon2) {
18497 var i2 = -1, n2 = polygon2.length, a, b = polygon2[n2 - 1], area = 0;
18498 while (++i2 < n2) {
18501 area += a[1] * b[0] - a[0] * b[1];
18506 // node_modules/d3-polygon/src/centroid.js
18507 function centroid_default2(polygon2) {
18508 var i2 = -1, n2 = polygon2.length, x = 0, y = 0, a, b = polygon2[n2 - 1], c, k = 0;
18509 while (++i2 < n2) {
18512 k += c = a[0] * b[1] - b[0] * a[1];
18513 x += (a[0] + b[0]) * c;
18514 y += (a[1] + b[1]) * c;
18516 return k *= 3, [x / k, y / k];
18519 // node_modules/d3-polygon/src/cross.js
18520 function cross_default(a, b, c) {
18521 return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);
18524 // node_modules/d3-polygon/src/hull.js
18525 function lexicographicOrder(a, b) {
18526 return a[0] - b[0] || a[1] - b[1];
18528 function computeUpperHullIndexes(points) {
18529 const n2 = points.length, indexes = [0, 1];
18531 for (i2 = 2; i2 < n2; ++i2) {
18532 while (size > 1 && cross_default(points[indexes[size - 2]], points[indexes[size - 1]], points[i2]) <= 0)
18534 indexes[size++] = i2;
18536 return indexes.slice(0, size);
18538 function hull_default(points) {
18539 if ((n2 = points.length) < 3)
18541 var i2, n2, sortedPoints = new Array(n2), flippedPoints = new Array(n2);
18542 for (i2 = 0; i2 < n2; ++i2)
18543 sortedPoints[i2] = [+points[i2][0], +points[i2][1], i2];
18544 sortedPoints.sort(lexicographicOrder);
18545 for (i2 = 0; i2 < n2; ++i2)
18546 flippedPoints[i2] = [sortedPoints[i2][0], -sortedPoints[i2][1]];
18547 var upperIndexes = computeUpperHullIndexes(sortedPoints), lowerIndexes = computeUpperHullIndexes(flippedPoints);
18548 var skipLeft = lowerIndexes[0] === upperIndexes[0], skipRight = lowerIndexes[lowerIndexes.length - 1] === upperIndexes[upperIndexes.length - 1], hull = [];
18549 for (i2 = upperIndexes.length - 1; i2 >= 0; --i2)
18550 hull.push(points[sortedPoints[upperIndexes[i2]][2]]);
18551 for (i2 = +skipLeft; i2 < lowerIndexes.length - skipRight; ++i2)
18552 hull.push(points[sortedPoints[lowerIndexes[i2]][2]]);
18556 // modules/geo/vector.js
18557 function geoVecEqual(a, b, epsilon3) {
18559 return Math.abs(a[0] - b[0]) <= epsilon3 && Math.abs(a[1] - b[1]) <= epsilon3;
18561 return a[0] === b[0] && a[1] === b[1];
18564 function geoVecAdd(a, b) {
18565 return [a[0] + b[0], a[1] + b[1]];
18567 function geoVecSubtract(a, b) {
18568 return [a[0] - b[0], a[1] - b[1]];
18570 function geoVecScale(a, mag) {
18571 return [a[0] * mag, a[1] * mag];
18573 function geoVecFloor(a) {
18574 return [Math.floor(a[0]), Math.floor(a[1])];
18576 function geoVecInterp(a, b, t) {
18578 a[0] + (b[0] - a[0]) * t,
18579 a[1] + (b[1] - a[1]) * t
18582 function geoVecLength(a, b) {
18583 return Math.sqrt(geoVecLengthSquare(a, b));
18585 function geoVecLengthSquare(a, b) {
18587 var x = a[0] - b[0];
18588 var y = a[1] - b[1];
18589 return x * x + y * y;
18591 function geoVecNormalize(a) {
18592 var length = Math.sqrt(a[0] * a[0] + a[1] * a[1]);
18593 if (length !== 0) {
18594 return geoVecScale(a, 1 / length);
18598 function geoVecAngle(a, b) {
18599 return Math.atan2(b[1] - a[1], b[0] - a[0]);
18601 function geoVecDot(a, b, origin) {
18602 origin = origin || [0, 0];
18603 var p = geoVecSubtract(a, origin);
18604 var q = geoVecSubtract(b, origin);
18605 return p[0] * q[0] + p[1] * q[1];
18607 function geoVecNormalizedDot(a, b, origin) {
18608 origin = origin || [0, 0];
18609 var p = geoVecNormalize(geoVecSubtract(a, origin));
18610 var q = geoVecNormalize(geoVecSubtract(b, origin));
18611 return geoVecDot(p, q);
18613 function geoVecCross(a, b, origin) {
18614 origin = origin || [0, 0];
18615 var p = geoVecSubtract(a, origin);
18616 var q = geoVecSubtract(b, origin);
18617 return p[0] * q[1] - p[1] * q[0];
18619 function geoVecProject(a, points) {
18620 var min3 = Infinity;
18623 for (var i2 = 0; i2 < points.length - 1; i2++) {
18624 var o = points[i2];
18625 var s = geoVecSubtract(points[i2 + 1], o);
18626 var v = geoVecSubtract(a, o);
18627 var proj = geoVecDot(v, s) / geoVecDot(s, s);
18631 } else if (proj > 1) {
18632 p = points[i2 + 1];
18634 p = [o[0] + proj * s[0], o[1] + proj * s[1]];
18636 var dist = geoVecLength(p, a);
18643 if (idx !== void 0) {
18644 return { index: idx, distance: min3, target };
18650 // modules/geo/geom.js
18651 function geoAngle(a, b, projection2) {
18652 return geoVecAngle(projection2(a.loc), projection2(b.loc));
18654 function geoEdgeEqual(a, b) {
18655 return a[0] === b[0] && a[1] === b[1] || a[0] === b[1] && a[1] === b[0];
18657 function geoRotate(points, angle2, around) {
18658 return points.map(function(point2) {
18659 var radial = geoVecSubtract(point2, around);
18661 radial[0] * Math.cos(angle2) - radial[1] * Math.sin(angle2) + around[0],
18662 radial[0] * Math.sin(angle2) + radial[1] * Math.cos(angle2) + around[1]
18666 function geoChooseEdge(nodes, point2, projection2, activeID) {
18667 var dist = geoVecLength;
18668 var points = nodes.map(function(n2) {
18669 return projection2(n2.loc);
18671 var ids = nodes.map(function(n2) {
18674 var min3 = Infinity;
18677 for (var i2 = 0; i2 < points.length - 1; i2++) {
18678 if (ids[i2] === activeID || ids[i2 + 1] === activeID)
18680 var o = points[i2];
18681 var s = geoVecSubtract(points[i2 + 1], o);
18682 var v = geoVecSubtract(point2, o);
18683 var proj = geoVecDot(v, s) / geoVecDot(s, s);
18687 } else if (proj > 1) {
18688 p = points[i2 + 1];
18690 p = [o[0] + proj * s[0], o[1] + proj * s[1]];
18692 var d = dist(p, point2);
18696 loc = projection2.invert(p);
18699 if (idx !== void 0) {
18700 return { index: idx, distance: min3, loc };
18705 function geoHasLineIntersections(activeNodes, inactiveNodes, activeID) {
18707 var inactives = [];
18708 var j2, k, n1, n2, segment;
18709 for (j2 = 0; j2 < activeNodes.length - 1; j2++) {
18710 n1 = activeNodes[j2];
18711 n2 = activeNodes[j2 + 1];
18712 segment = [n1.loc, n2.loc];
18713 if (n1.id === activeID || n2.id === activeID) {
18714 actives.push(segment);
18717 for (j2 = 0; j2 < inactiveNodes.length - 1; j2++) {
18718 n1 = inactiveNodes[j2];
18719 n2 = inactiveNodes[j2 + 1];
18720 segment = [n1.loc, n2.loc];
18721 inactives.push(segment);
18723 for (j2 = 0; j2 < actives.length; j2++) {
18724 for (k = 0; k < inactives.length; k++) {
18725 var p = actives[j2];
18726 var q = inactives[k];
18727 var hit = geoLineIntersection(p, q);
18735 function geoHasSelfIntersections(nodes, activeID) {
18737 var inactives = [];
18739 for (j2 = 0; j2 < nodes.length - 1; j2++) {
18740 var n1 = nodes[j2];
18741 var n2 = nodes[j2 + 1];
18742 var segment = [n1.loc, n2.loc];
18743 if (n1.id === activeID || n2.id === activeID) {
18744 actives.push(segment);
18746 inactives.push(segment);
18749 for (j2 = 0; j2 < actives.length; j2++) {
18750 for (k = 0; k < inactives.length; k++) {
18751 var p = actives[j2];
18752 var q = inactives[k];
18753 if (geoVecEqual(p[1], q[0]) || geoVecEqual(p[0], q[1]) || geoVecEqual(p[0], q[0]) || geoVecEqual(p[1], q[1])) {
18756 var hit = geoLineIntersection(p, q);
18758 var epsilon3 = 1e-8;
18759 if (geoVecEqual(p[1], hit, epsilon3) || geoVecEqual(p[0], hit, epsilon3) || geoVecEqual(q[1], hit, epsilon3) || geoVecEqual(q[0], hit, epsilon3)) {
18769 function geoLineIntersection(a, b) {
18770 var p = [a[0][0], a[0][1]];
18771 var p2 = [a[1][0], a[1][1]];
18772 var q = [b[0][0], b[0][1]];
18773 var q2 = [b[1][0], b[1][1]];
18774 var r = geoVecSubtract(p2, p);
18775 var s = geoVecSubtract(q2, q);
18776 var uNumerator = geoVecCross(geoVecSubtract(q, p), r);
18777 var denominator = geoVecCross(r, s);
18778 if (uNumerator && denominator) {
18779 var u = uNumerator / denominator;
18780 var t = geoVecCross(geoVecSubtract(q, p), s) / denominator;
18781 if (t >= 0 && t <= 1 && u >= 0 && u <= 1) {
18782 return geoVecInterp(p, p2, t);
18787 function geoPathIntersections(path1, path2) {
18788 var intersections = [];
18789 for (var i2 = 0; i2 < path1.length - 1; i2++) {
18790 for (var j2 = 0; j2 < path2.length - 1; j2++) {
18791 var a = [path1[i2], path1[i2 + 1]];
18792 var b = [path2[j2], path2[j2 + 1]];
18793 var hit = geoLineIntersection(a, b);
18795 intersections.push(hit);
18799 return intersections;
18801 function geoPathHasIntersections(path1, path2) {
18802 for (var i2 = 0; i2 < path1.length - 1; i2++) {
18803 for (var j2 = 0; j2 < path2.length - 1; j2++) {
18804 var a = [path1[i2], path1[i2 + 1]];
18805 var b = [path2[j2], path2[j2 + 1]];
18806 var hit = geoLineIntersection(a, b);
18814 function geoPointInPolygon(point2, polygon2) {
18817 var inside = false;
18818 for (var i2 = 0, j2 = polygon2.length - 1; i2 < polygon2.length; j2 = i2++) {
18819 var xi = polygon2[i2][0];
18820 var yi = polygon2[i2][1];
18821 var xj = polygon2[j2][0];
18822 var yj = polygon2[j2][1];
18823 var intersect2 = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
18829 function geoPolygonContainsPolygon(outer, inner) {
18830 return inner.every(function(point2) {
18831 return geoPointInPolygon(point2, outer);
18834 function geoPolygonIntersectsPolygon(outer, inner, checkSegments) {
18835 function testPoints(outer2, inner2) {
18836 return inner2.some(function(point2) {
18837 return geoPointInPolygon(point2, outer2);
18840 return testPoints(outer, inner) || !!checkSegments && geoPathHasIntersections(outer, inner);
18842 function geoGetSmallestSurroundingRectangle(points) {
18843 var hull = hull_default(points);
18844 var centroid = centroid_default2(hull);
18845 var minArea = Infinity;
18846 var ssrExtent = [];
18849 for (var i2 = 0; i2 <= hull.length - 1; i2++) {
18850 var c2 = i2 === hull.length - 1 ? hull[0] : hull[i2 + 1];
18851 var angle2 = Math.atan2(c2[1] - c1[1], c2[0] - c1[0]);
18852 var poly = geoRotate(hull, -angle2, centroid);
18853 var extent = poly.reduce(function(extent2, point2) {
18854 return extent2.extend(geoExtent(point2));
18856 var area = extent.area();
18857 if (area < minArea) {
18859 ssrExtent = extent;
18865 poly: geoRotate(ssrExtent.polygon(), ssrAngle, centroid),
18869 function geoPathLength(path) {
18871 for (var i2 = 0; i2 < path.length - 1; i2++) {
18872 length += geoVecLength(path[i2], path[i2 + 1]);
18876 function geoViewportEdge(point2, dimensions) {
18877 var pad2 = [80, 20, 50, 20];
18880 if (point2[0] > dimensions[0] - pad2[1]) {
18883 if (point2[0] < pad2[3]) {
18886 if (point2[1] > dimensions[1] - pad2[2]) {
18889 if (point2[1] < pad2[0]) {
18899 // node_modules/d3-dispatch/src/dispatch.js
18900 var noop2 = { value: () => {
18902 function dispatch() {
18903 for (var i2 = 0, n2 = arguments.length, _ = {}, t; i2 < n2; ++i2) {
18904 if (!(t = arguments[i2] + "") || t in _ || /[\s.]/.test(t))
18905 throw new Error("illegal type: " + t);
18908 return new Dispatch(_);
18910 function Dispatch(_) {
18913 function parseTypenames(typenames, types) {
18914 return typenames.trim().split(/^|\s+/).map(function(t) {
18915 var name = "", i2 = t.indexOf(".");
18917 name = t.slice(i2 + 1), t = t.slice(0, i2);
18918 if (t && !types.hasOwnProperty(t))
18919 throw new Error("unknown type: " + t);
18920 return { type: t, name };
18923 Dispatch.prototype = dispatch.prototype = {
18924 constructor: Dispatch,
18925 on: function(typename, callback) {
18926 var _ = this._, T = parseTypenames(typename + "", _), t, i2 = -1, n2 = T.length;
18927 if (arguments.length < 2) {
18929 if ((t = (typename = T[i2]).type) && (t = get(_[t], typename.name)))
18933 if (callback != null && typeof callback !== "function")
18934 throw new Error("invalid callback: " + callback);
18935 while (++i2 < n2) {
18936 if (t = (typename = T[i2]).type)
18937 _[t] = set(_[t], typename.name, callback);
18938 else if (callback == null)
18940 _[t] = set(_[t], typename.name, null);
18945 var copy2 = {}, _ = this._;
18947 copy2[t] = _[t].slice();
18948 return new Dispatch(copy2);
18950 call: function(type3, that) {
18951 if ((n2 = arguments.length - 2) > 0)
18952 for (var args = new Array(n2), i2 = 0, n2, t; i2 < n2; ++i2)
18953 args[i2] = arguments[i2 + 2];
18954 if (!this._.hasOwnProperty(type3))
18955 throw new Error("unknown type: " + type3);
18956 for (t = this._[type3], i2 = 0, n2 = t.length; i2 < n2; ++i2)
18957 t[i2].value.apply(that, args);
18959 apply: function(type3, that, args) {
18960 if (!this._.hasOwnProperty(type3))
18961 throw new Error("unknown type: " + type3);
18962 for (var t = this._[type3], i2 = 0, n2 = t.length; i2 < n2; ++i2)
18963 t[i2].value.apply(that, args);
18966 function get(type3, name) {
18967 for (var i2 = 0, n2 = type3.length, c; i2 < n2; ++i2) {
18968 if ((c = type3[i2]).name === name) {
18973 function set(type3, name, callback) {
18974 for (var i2 = 0, n2 = type3.length; i2 < n2; ++i2) {
18975 if (type3[i2].name === name) {
18976 type3[i2] = noop2, type3 = type3.slice(0, i2).concat(type3.slice(i2 + 1));
18980 if (callback != null)
18981 type3.push({ name, value: callback });
18984 var dispatch_default = dispatch;
18986 // node_modules/d3-selection/src/namespaces.js
18987 var xhtml = "http://www.w3.org/1999/xhtml";
18988 var namespaces_default = {
18989 svg: "http://www.w3.org/2000/svg",
18991 xlink: "http://www.w3.org/1999/xlink",
18992 xml: "http://www.w3.org/XML/1998/namespace",
18993 xmlns: "http://www.w3.org/2000/xmlns/"
18996 // node_modules/d3-selection/src/namespace.js
18997 function namespace_default(name) {
18998 var prefix = name += "", i2 = prefix.indexOf(":");
18999 if (i2 >= 0 && (prefix = name.slice(0, i2)) !== "xmlns")
19000 name = name.slice(i2 + 1);
19001 return namespaces_default.hasOwnProperty(prefix) ? { space: namespaces_default[prefix], local: name } : name;
19004 // node_modules/d3-selection/src/creator.js
19005 function creatorInherit(name) {
19006 return function() {
19007 var document2 = this.ownerDocument, uri = this.namespaceURI;
19008 return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name) : document2.createElementNS(uri, name);
19011 function creatorFixed(fullname) {
19012 return function() {
19013 return this.ownerDocument.createElementNS(fullname.space, fullname.local);
19016 function creator_default(name) {
19017 var fullname = namespace_default(name);
19018 return (fullname.local ? creatorFixed : creatorInherit)(fullname);
19021 // node_modules/d3-selection/src/selector.js
19024 function selector_default(selector) {
19025 return selector == null ? none : function() {
19026 return this.querySelector(selector);
19030 // node_modules/d3-selection/src/selection/select.js
19031 function select_default(select) {
19032 if (typeof select !== "function")
19033 select = selector_default(select);
19034 for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
19035 for (var group = groups[j2], n2 = group.length, subgroup = subgroups[j2] = new Array(n2), node, subnode, i2 = 0; i2 < n2; ++i2) {
19036 if ((node = group[i2]) && (subnode = select.call(node, node.__data__, i2, group))) {
19037 if ("__data__" in node)
19038 subnode.__data__ = node.__data__;
19039 subgroup[i2] = subnode;
19043 return new Selection(subgroups, this._parents);
19046 // node_modules/d3-selection/src/array.js
19047 function array(x) {
19048 return x == null ? [] : Array.isArray(x) ? x : Array.from(x);
19051 // node_modules/d3-selection/src/selectorAll.js
19055 function selectorAll_default(selector) {
19056 return selector == null ? empty : function() {
19057 return this.querySelectorAll(selector);
19061 // node_modules/d3-selection/src/selection/selectAll.js
19062 function arrayAll(select) {
19063 return function() {
19064 return array(select.apply(this, arguments));
19067 function selectAll_default(select) {
19068 if (typeof select === "function")
19069 select = arrayAll(select);
19071 select = selectorAll_default(select);
19072 for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j2 = 0; j2 < m; ++j2) {
19073 for (var group = groups[j2], n2 = group.length, node, i2 = 0; i2 < n2; ++i2) {
19074 if (node = group[i2]) {
19075 subgroups.push(select.call(node, node.__data__, i2, group));
19076 parents.push(node);
19080 return new Selection(subgroups, parents);
19083 // node_modules/d3-selection/src/matcher.js
19084 function matcher_default(selector) {
19085 return function() {
19086 return this.matches(selector);
19089 function childMatcher(selector) {
19090 return function(node) {
19091 return node.matches(selector);
19095 // node_modules/d3-selection/src/selection/selectChild.js
19096 var find = Array.prototype.find;
19097 function childFind(match) {
19098 return function() {
19099 return find.call(this.children, match);
19102 function childFirst() {
19103 return this.firstElementChild;
19105 function selectChild_default(match) {
19106 return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match)));
19109 // node_modules/d3-selection/src/selection/selectChildren.js
19110 var filter = Array.prototype.filter;
19111 function children() {
19112 return Array.from(this.children);
19114 function childrenFilter(match) {
19115 return function() {
19116 return filter.call(this.children, match);
19119 function selectChildren_default(match) {
19120 return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match)));
19123 // node_modules/d3-selection/src/selection/filter.js
19124 function filter_default(match) {
19125 if (typeof match !== "function")
19126 match = matcher_default(match);
19127 for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
19128 for (var group = groups[j2], n2 = group.length, subgroup = subgroups[j2] = [], node, i2 = 0; i2 < n2; ++i2) {
19129 if ((node = group[i2]) && match.call(node, node.__data__, i2, group)) {
19130 subgroup.push(node);
19134 return new Selection(subgroups, this._parents);
19137 // node_modules/d3-selection/src/selection/sparse.js
19138 function sparse_default(update) {
19139 return new Array(update.length);
19142 // node_modules/d3-selection/src/selection/enter.js
19143 function enter_default() {
19144 return new Selection(this._enter || this._groups.map(sparse_default), this._parents);
19146 function EnterNode(parent, datum2) {
19147 this.ownerDocument = parent.ownerDocument;
19148 this.namespaceURI = parent.namespaceURI;
19150 this._parent = parent;
19151 this.__data__ = datum2;
19153 EnterNode.prototype = {
19154 constructor: EnterNode,
19155 appendChild: function(child) {
19156 return this._parent.insertBefore(child, this._next);
19158 insertBefore: function(child, next) {
19159 return this._parent.insertBefore(child, next);
19161 querySelector: function(selector) {
19162 return this._parent.querySelector(selector);
19164 querySelectorAll: function(selector) {
19165 return this._parent.querySelectorAll(selector);
19169 // node_modules/d3-selection/src/constant.js
19170 function constant_default(x) {
19171 return function() {
19176 // node_modules/d3-selection/src/selection/data.js
19177 function bindIndex(parent, group, enter, update, exit, data) {
19178 var i2 = 0, node, groupLength = group.length, dataLength = data.length;
19179 for (; i2 < dataLength; ++i2) {
19180 if (node = group[i2]) {
19181 node.__data__ = data[i2];
19184 enter[i2] = new EnterNode(parent, data[i2]);
19187 for (; i2 < groupLength; ++i2) {
19188 if (node = group[i2]) {
19193 function bindKey(parent, group, enter, update, exit, data, key) {
19194 var i2, node, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue;
19195 for (i2 = 0; i2 < groupLength; ++i2) {
19196 if (node = group[i2]) {
19197 keyValues[i2] = keyValue = key.call(node, node.__data__, i2, group) + "";
19198 if (nodeByKeyValue.has(keyValue)) {
19201 nodeByKeyValue.set(keyValue, node);
19205 for (i2 = 0; i2 < dataLength; ++i2) {
19206 keyValue = key.call(parent, data[i2], i2, data) + "";
19207 if (node = nodeByKeyValue.get(keyValue)) {
19209 node.__data__ = data[i2];
19210 nodeByKeyValue.delete(keyValue);
19212 enter[i2] = new EnterNode(parent, data[i2]);
19215 for (i2 = 0; i2 < groupLength; ++i2) {
19216 if ((node = group[i2]) && nodeByKeyValue.get(keyValues[i2]) === node) {
19221 function datum(node) {
19222 return node.__data__;
19224 function data_default(value, key) {
19225 if (!arguments.length)
19226 return Array.from(this, datum);
19227 var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups;
19228 if (typeof value !== "function")
19229 value = constant_default(value);
19230 for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j2 = 0; j2 < m; ++j2) {
19231 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);
19232 bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
19233 for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
19234 if (previous = enterGroup[i0]) {
19237 while (!(next = updateGroup[i1]) && ++i1 < dataLength)
19239 previous._next = next || null;
19243 update = new Selection(update, parents);
19244 update._enter = enter;
19245 update._exit = exit;
19248 function arraylike(data) {
19249 return typeof data === "object" && "length" in data ? data : Array.from(data);
19252 // node_modules/d3-selection/src/selection/exit.js
19253 function exit_default() {
19254 return new Selection(this._exit || this._groups.map(sparse_default), this._parents);
19257 // node_modules/d3-selection/src/selection/join.js
19258 function join_default(onenter, onupdate, onexit) {
19259 var enter = this.enter(), update = this, exit = this.exit();
19260 if (typeof onenter === "function") {
19261 enter = onenter(enter);
19263 enter = enter.selection();
19265 enter = enter.append(onenter + "");
19267 if (onupdate != null) {
19268 update = onupdate(update);
19270 update = update.selection();
19272 if (onexit == null)
19276 return enter && update ? enter.merge(update).order() : update;
19279 // node_modules/d3-selection/src/selection/merge.js
19280 function merge_default(context) {
19281 var selection2 = context.selection ? context.selection() : context;
19282 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) {
19283 for (var group0 = groups0[j2], group1 = groups1[j2], n2 = group0.length, merge3 = merges[j2] = new Array(n2), node, i2 = 0; i2 < n2; ++i2) {
19284 if (node = group0[i2] || group1[i2]) {
19289 for (; j2 < m0; ++j2) {
19290 merges[j2] = groups0[j2];
19292 return new Selection(merges, this._parents);
19295 // node_modules/d3-selection/src/selection/order.js
19296 function order_default() {
19297 for (var groups = this._groups, j2 = -1, m = groups.length; ++j2 < m; ) {
19298 for (var group = groups[j2], i2 = group.length - 1, next = group[i2], node; --i2 >= 0; ) {
19299 if (node = group[i2]) {
19300 if (next && node.compareDocumentPosition(next) ^ 4)
19301 next.parentNode.insertBefore(node, next);
19309 // node_modules/d3-selection/src/selection/sort.js
19310 function sort_default(compare) {
19312 compare = ascending2;
19313 function compareNode(a, b) {
19314 return a && b ? compare(a.__data__, b.__data__) : !a - !b;
19316 for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
19317 for (var group = groups[j2], n2 = group.length, sortgroup = sortgroups[j2] = new Array(n2), node, i2 = 0; i2 < n2; ++i2) {
19318 if (node = group[i2]) {
19319 sortgroup[i2] = node;
19322 sortgroup.sort(compareNode);
19324 return new Selection(sortgroups, this._parents).order();
19326 function ascending2(a, b) {
19327 return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
19330 // node_modules/d3-selection/src/selection/call.js
19331 function call_default() {
19332 var callback = arguments[0];
19333 arguments[0] = this;
19334 callback.apply(null, arguments);
19338 // node_modules/d3-selection/src/selection/nodes.js
19339 function nodes_default() {
19340 return Array.from(this);
19343 // node_modules/d3-selection/src/selection/node.js
19344 function node_default() {
19345 for (var groups = this._groups, j2 = 0, m = groups.length; j2 < m; ++j2) {
19346 for (var group = groups[j2], i2 = 0, n2 = group.length; i2 < n2; ++i2) {
19347 var node = group[i2];
19355 // node_modules/d3-selection/src/selection/size.js
19356 function size_default() {
19358 for (const node of this)
19363 // node_modules/d3-selection/src/selection/empty.js
19364 function empty_default() {
19365 return !this.node();
19368 // node_modules/d3-selection/src/selection/each.js
19369 function each_default(callback) {
19370 for (var groups = this._groups, j2 = 0, m = groups.length; j2 < m; ++j2) {
19371 for (var group = groups[j2], i2 = 0, n2 = group.length, node; i2 < n2; ++i2) {
19372 if (node = group[i2])
19373 callback.call(node, node.__data__, i2, group);
19379 // node_modules/d3-selection/src/selection/attr.js
19380 function attrRemove(name) {
19381 return function() {
19382 this.removeAttribute(name);
19385 function attrRemoveNS(fullname) {
19386 return function() {
19387 this.removeAttributeNS(fullname.space, fullname.local);
19390 function attrConstant(name, value) {
19391 return function() {
19392 this.setAttribute(name, value);
19395 function attrConstantNS(fullname, value) {
19396 return function() {
19397 this.setAttributeNS(fullname.space, fullname.local, value);
19400 function attrFunction(name, value) {
19401 return function() {
19402 var v = value.apply(this, arguments);
19404 this.removeAttribute(name);
19406 this.setAttribute(name, v);
19409 function attrFunctionNS(fullname, value) {
19410 return function() {
19411 var v = value.apply(this, arguments);
19413 this.removeAttributeNS(fullname.space, fullname.local);
19415 this.setAttributeNS(fullname.space, fullname.local, v);
19418 function attr_default(name, value) {
19419 var fullname = namespace_default(name);
19420 if (arguments.length < 2) {
19421 var node = this.node();
19422 return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname);
19424 return this.each((value == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value));
19427 // node_modules/d3-selection/src/window.js
19428 function window_default(node) {
19429 return node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView;
19432 // node_modules/d3-selection/src/selection/style.js
19433 function styleRemove(name) {
19434 return function() {
19435 this.style.removeProperty(name);
19438 function styleConstant(name, value, priority) {
19439 return function() {
19440 this.style.setProperty(name, value, priority);
19443 function styleFunction(name, value, priority) {
19444 return function() {
19445 var v = value.apply(this, arguments);
19447 this.style.removeProperty(name);
19449 this.style.setProperty(name, v, priority);
19452 function style_default(name, value, priority) {
19453 return arguments.length > 1 ? this.each((value == null ? styleRemove : typeof value === "function" ? styleFunction : styleConstant)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name);
19455 function styleValue(node, name) {
19456 return node.style.getPropertyValue(name) || window_default(node).getComputedStyle(node, null).getPropertyValue(name);
19459 // node_modules/d3-selection/src/selection/property.js
19460 function propertyRemove(name) {
19461 return function() {
19465 function propertyConstant(name, value) {
19466 return function() {
19467 this[name] = value;
19470 function propertyFunction(name, value) {
19471 return function() {
19472 var v = value.apply(this, arguments);
19479 function property_default(name, value) {
19480 return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name];
19483 // node_modules/d3-selection/src/selection/classed.js
19484 function classArray(string) {
19485 return string.trim().split(/^|\s+/);
19487 function classList(node) {
19488 return node.classList || new ClassList(node);
19490 function ClassList(node) {
19492 this._names = classArray(node.getAttribute("class") || "");
19494 ClassList.prototype = {
19495 add: function(name) {
19496 var i2 = this._names.indexOf(name);
19498 this._names.push(name);
19499 this._node.setAttribute("class", this._names.join(" "));
19502 remove: function(name) {
19503 var i2 = this._names.indexOf(name);
19505 this._names.splice(i2, 1);
19506 this._node.setAttribute("class", this._names.join(" "));
19509 contains: function(name) {
19510 return this._names.indexOf(name) >= 0;
19513 function classedAdd(node, names) {
19514 var list = classList(node), i2 = -1, n2 = names.length;
19516 list.add(names[i2]);
19518 function classedRemove(node, names) {
19519 var list = classList(node), i2 = -1, n2 = names.length;
19521 list.remove(names[i2]);
19523 function classedTrue(names) {
19524 return function() {
19525 classedAdd(this, names);
19528 function classedFalse(names) {
19529 return function() {
19530 classedRemove(this, names);
19533 function classedFunction(names, value) {
19534 return function() {
19535 (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
19538 function classed_default(name, value) {
19539 var names = classArray(name + "");
19540 if (arguments.length < 2) {
19541 var list = classList(this.node()), i2 = -1, n2 = names.length;
19543 if (!list.contains(names[i2]))
19547 return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value));
19550 // node_modules/d3-selection/src/selection/text.js
19551 function textRemove() {
19552 this.textContent = "";
19554 function textConstant(value) {
19555 return function() {
19556 this.textContent = value;
19559 function textFunction(value) {
19560 return function() {
19561 var v = value.apply(this, arguments);
19562 this.textContent = v == null ? "" : v;
19565 function text_default(value) {
19566 return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent;
19569 // node_modules/d3-selection/src/selection/html.js
19570 function htmlRemove() {
19571 this.innerHTML = "";
19573 function htmlConstant(value) {
19574 return function() {
19575 this.innerHTML = value;
19578 function htmlFunction(value) {
19579 return function() {
19580 var v = value.apply(this, arguments);
19581 this.innerHTML = v == null ? "" : v;
19584 function html_default(value) {
19585 return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML;
19588 // node_modules/d3-selection/src/selection/raise.js
19590 if (this.nextSibling)
19591 this.parentNode.appendChild(this);
19593 function raise_default() {
19594 return this.each(raise);
19597 // node_modules/d3-selection/src/selection/lower.js
19599 if (this.previousSibling)
19600 this.parentNode.insertBefore(this, this.parentNode.firstChild);
19602 function lower_default() {
19603 return this.each(lower);
19606 // node_modules/d3-selection/src/selection/append.js
19607 function append_default(name) {
19608 var create2 = typeof name === "function" ? name : creator_default(name);
19609 return this.select(function() {
19610 return this.appendChild(create2.apply(this, arguments));
19614 // node_modules/d3-selection/src/selection/insert.js
19615 function constantNull() {
19618 function insert_default(name, before) {
19619 var create2 = typeof name === "function" ? name : creator_default(name), select = before == null ? constantNull : typeof before === "function" ? before : selector_default(before);
19620 return this.select(function() {
19621 return this.insertBefore(create2.apply(this, arguments), select.apply(this, arguments) || null);
19625 // node_modules/d3-selection/src/selection/remove.js
19626 function remove() {
19627 var parent = this.parentNode;
19629 parent.removeChild(this);
19631 function remove_default() {
19632 return this.each(remove);
19635 // node_modules/d3-selection/src/selection/clone.js
19636 function selection_cloneShallow() {
19637 var clone = this.cloneNode(false), parent = this.parentNode;
19638 return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
19640 function selection_cloneDeep() {
19641 var clone = this.cloneNode(true), parent = this.parentNode;
19642 return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
19644 function clone_default(deep) {
19645 return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
19648 // node_modules/d3-selection/src/selection/datum.js
19649 function datum_default(value) {
19650 return arguments.length ? this.property("__data__", value) : this.node().__data__;
19653 // node_modules/d3-selection/src/selection/on.js
19654 function contextListener(listener) {
19655 return function(event) {
19656 listener.call(this, event, this.__data__);
19659 function parseTypenames2(typenames) {
19660 return typenames.trim().split(/^|\s+/).map(function(t) {
19661 var name = "", i2 = t.indexOf(".");
19663 name = t.slice(i2 + 1), t = t.slice(0, i2);
19664 return { type: t, name };
19667 function onRemove(typename) {
19668 return function() {
19669 var on = this.__on;
19672 for (var j2 = 0, i2 = -1, m = on.length, o; j2 < m; ++j2) {
19673 if (o = on[j2], (!typename.type || o.type === typename.type) && o.name === typename.name) {
19674 this.removeEventListener(o.type, o.listener, o.options);
19685 function onAdd(typename, value, options2) {
19686 return function() {
19687 var on = this.__on, o, listener = contextListener(value);
19689 for (var j2 = 0, m = on.length; j2 < m; ++j2) {
19690 if ((o = on[j2]).type === typename.type && o.name === typename.name) {
19691 this.removeEventListener(o.type, o.listener, o.options);
19692 this.addEventListener(o.type, o.listener = listener, o.options = options2);
19697 this.addEventListener(typename.type, listener, options2);
19698 o = { type: typename.type, name: typename.name, value, listener, options: options2 };
19705 function on_default(typename, value, options2) {
19706 var typenames = parseTypenames2(typename + ""), i2, n2 = typenames.length, t;
19707 if (arguments.length < 2) {
19708 var on = this.node().__on;
19710 for (var j2 = 0, m = on.length, o; j2 < m; ++j2) {
19711 for (i2 = 0, o = on[j2]; i2 < n2; ++i2) {
19712 if ((t = typenames[i2]).type === o.type && t.name === o.name) {
19719 on = value ? onAdd : onRemove;
19720 for (i2 = 0; i2 < n2; ++i2)
19721 this.each(on(typenames[i2], value, options2));
19725 // node_modules/d3-selection/src/selection/dispatch.js
19726 function dispatchEvent(node, type3, params) {
19727 var window2 = window_default(node), event = window2.CustomEvent;
19728 if (typeof event === "function") {
19729 event = new event(type3, params);
19731 event = window2.document.createEvent("Event");
19733 event.initEvent(type3, params.bubbles, params.cancelable), event.detail = params.detail;
19735 event.initEvent(type3, false, false);
19737 node.dispatchEvent(event);
19739 function dispatchConstant(type3, params) {
19740 return function() {
19741 return dispatchEvent(this, type3, params);
19744 function dispatchFunction(type3, params) {
19745 return function() {
19746 return dispatchEvent(this, type3, params.apply(this, arguments));
19749 function dispatch_default2(type3, params) {
19750 return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type3, params));
19753 // node_modules/d3-selection/src/selection/iterator.js
19754 function* iterator_default() {
19755 for (var groups = this._groups, j2 = 0, m = groups.length; j2 < m; ++j2) {
19756 for (var group = groups[j2], i2 = 0, n2 = group.length, node; i2 < n2; ++i2) {
19757 if (node = group[i2])
19763 // node_modules/d3-selection/src/selection/index.js
19765 function Selection(groups, parents) {
19766 this._groups = groups;
19767 this._parents = parents;
19769 function selection() {
19770 return new Selection([[document.documentElement]], root);
19772 function selection_selection() {
19775 Selection.prototype = selection.prototype = {
19776 constructor: Selection,
19777 select: select_default,
19778 selectAll: selectAll_default,
19779 selectChild: selectChild_default,
19780 selectChildren: selectChildren_default,
19781 filter: filter_default,
19782 data: data_default,
19783 enter: enter_default,
19784 exit: exit_default,
19785 join: join_default,
19786 merge: merge_default,
19787 selection: selection_selection,
19788 order: order_default,
19789 sort: sort_default,
19790 call: call_default,
19791 nodes: nodes_default,
19792 node: node_default,
19793 size: size_default,
19794 empty: empty_default,
19795 each: each_default,
19796 attr: attr_default,
19797 style: style_default,
19798 property: property_default,
19799 classed: classed_default,
19800 text: text_default,
19801 html: html_default,
19802 raise: raise_default,
19803 lower: lower_default,
19804 append: append_default,
19805 insert: insert_default,
19806 remove: remove_default,
19807 clone: clone_default,
19808 datum: datum_default,
19810 dispatch: dispatch_default2,
19811 [Symbol.iterator]: iterator_default
19813 var selection_default = selection;
19815 // node_modules/d3-selection/src/select.js
19816 function select_default2(selector) {
19817 return typeof selector === "string" ? new Selection([[document.querySelector(selector)]], [document.documentElement]) : new Selection([[selector]], root);
19820 // node_modules/d3-selection/src/sourceEvent.js
19821 function sourceEvent_default(event) {
19823 while (sourceEvent = event.sourceEvent)
19824 event = sourceEvent;
19828 // node_modules/d3-selection/src/pointer.js
19829 function pointer_default(event, node) {
19830 event = sourceEvent_default(event);
19831 if (node === void 0)
19832 node = event.currentTarget;
19834 var svg2 = node.ownerSVGElement || node;
19835 if (svg2.createSVGPoint) {
19836 var point2 = svg2.createSVGPoint();
19837 point2.x = event.clientX, point2.y = event.clientY;
19838 point2 = point2.matrixTransform(node.getScreenCTM().inverse());
19839 return [point2.x, point2.y];
19841 if (node.getBoundingClientRect) {
19842 var rect = node.getBoundingClientRect();
19843 return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
19846 return [event.pageX, event.pageY];
19849 // node_modules/d3-selection/src/selectAll.js
19850 function selectAll_default2(selector) {
19851 return typeof selector === "string" ? new Selection([document.querySelectorAll(selector)], [document.documentElement]) : new Selection([array(selector)], root);
19854 // node_modules/d3-drag/src/noevent.js
19855 var nonpassive = { passive: false };
19856 var nonpassivecapture = { capture: true, passive: false };
19857 function nopropagation(event) {
19858 event.stopImmediatePropagation();
19860 function noevent_default(event) {
19861 event.preventDefault();
19862 event.stopImmediatePropagation();
19865 // node_modules/d3-drag/src/nodrag.js
19866 function nodrag_default(view) {
19867 var root3 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", noevent_default, nonpassivecapture);
19868 if ("onselectstart" in root3) {
19869 selection2.on("selectstart.drag", noevent_default, nonpassivecapture);
19871 root3.__noselect = root3.style.MozUserSelect;
19872 root3.style.MozUserSelect = "none";
19875 function yesdrag(view, noclick) {
19876 var root3 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", null);
19878 selection2.on("click.drag", noevent_default, nonpassivecapture);
19879 setTimeout(function() {
19880 selection2.on("click.drag", null);
19883 if ("onselectstart" in root3) {
19884 selection2.on("selectstart.drag", null);
19886 root3.style.MozUserSelect = root3.__noselect;
19887 delete root3.__noselect;
19891 // node_modules/d3-drag/src/constant.js
19892 var constant_default2 = (x) => () => x;
19894 // node_modules/d3-drag/src/event.js
19895 function DragEvent(type3, {
19905 dispatch: dispatch10
19907 Object.defineProperties(this, {
19908 type: { value: type3, enumerable: true, configurable: true },
19909 sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
19910 subject: { value: subject, enumerable: true, configurable: true },
19911 target: { value: target, enumerable: true, configurable: true },
19912 identifier: { value: identifier, enumerable: true, configurable: true },
19913 active: { value: active, enumerable: true, configurable: true },
19914 x: { value: x, enumerable: true, configurable: true },
19915 y: { value: y, enumerable: true, configurable: true },
19916 dx: { value: dx, enumerable: true, configurable: true },
19917 dy: { value: dy, enumerable: true, configurable: true },
19918 _: { value: dispatch10 }
19921 DragEvent.prototype.on = function() {
19922 var value = this._.on.apply(this._, arguments);
19923 return value === this._ ? this : value;
19926 // node_modules/d3-drag/src/drag.js
19927 function defaultFilter(event) {
19928 return !event.ctrlKey && !event.button;
19930 function defaultContainer() {
19931 return this.parentNode;
19933 function defaultSubject(event, d) {
19934 return d == null ? { x: event.x, y: event.y } : d;
19936 function defaultTouchable() {
19937 return navigator.maxTouchPoints || "ontouchstart" in this;
19939 function drag_default() {
19940 var filter2 = defaultFilter, container = defaultContainer, subject = defaultSubject, touchable = defaultTouchable, gestures = {}, listeners = dispatch_default("start", "drag", "end"), active = 0, mousedownx, mousedowny, mousemoving, touchending, clickDistance2 = 0;
19941 function drag(selection2) {
19942 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)");
19944 function mousedowned(event, d) {
19945 if (touchending || !filter2.call(this, event, d))
19947 var gesture = beforestart(this, container.call(this, event, d), event, d, "mouse");
19950 select_default2(event.view).on("mousemove.drag", mousemoved, nonpassivecapture).on("mouseup.drag", mouseupped, nonpassivecapture);
19951 nodrag_default(event.view);
19952 nopropagation(event);
19953 mousemoving = false;
19954 mousedownx = event.clientX;
19955 mousedowny = event.clientY;
19956 gesture("start", event);
19958 function mousemoved(event) {
19959 noevent_default(event);
19960 if (!mousemoving) {
19961 var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;
19962 mousemoving = dx * dx + dy * dy > clickDistance2;
19964 gestures.mouse("drag", event);
19966 function mouseupped(event) {
19967 select_default2(event.view).on("mousemove.drag mouseup.drag", null);
19968 yesdrag(event.view, mousemoving);
19969 noevent_default(event);
19970 gestures.mouse("end", event);
19972 function touchstarted(event, d) {
19973 if (!filter2.call(this, event, d))
19975 var touches = event.changedTouches, c = container.call(this, event, d), n2 = touches.length, i2, gesture;
19976 for (i2 = 0; i2 < n2; ++i2) {
19977 if (gesture = beforestart(this, c, event, d, touches[i2].identifier, touches[i2])) {
19978 nopropagation(event);
19979 gesture("start", event, touches[i2]);
19983 function touchmoved(event) {
19984 var touches = event.changedTouches, n2 = touches.length, i2, gesture;
19985 for (i2 = 0; i2 < n2; ++i2) {
19986 if (gesture = gestures[touches[i2].identifier]) {
19987 noevent_default(event);
19988 gesture("drag", event, touches[i2]);
19992 function touchended(event) {
19993 var touches = event.changedTouches, n2 = touches.length, i2, gesture;
19995 clearTimeout(touchending);
19996 touchending = setTimeout(function() {
19997 touchending = null;
19999 for (i2 = 0; i2 < n2; ++i2) {
20000 if (gesture = gestures[touches[i2].identifier]) {
20001 nopropagation(event);
20002 gesture("end", event, touches[i2]);
20006 function beforestart(that, container2, event, d, identifier, touch) {
20007 var dispatch10 = listeners.copy(), p = pointer_default(touch || event, container2), dx, dy, s;
20008 if ((s = subject.call(that, new DragEvent("beforestart", {
20009 sourceEvent: event,
20017 dispatch: dispatch10
20020 dx = s.x - p[0] || 0;
20021 dy = s.y - p[1] || 0;
20022 return function gesture(type3, event2, touch2) {
20026 gestures[identifier] = gesture, n2 = active++;
20029 delete gestures[identifier], --active;
20031 p = pointer_default(touch2 || event2, container2), n2 = active;
20037 new DragEvent(type3, {
20038 sourceEvent: event2,
20047 dispatch: dispatch10
20053 drag.filter = function(_) {
20054 return arguments.length ? (filter2 = typeof _ === "function" ? _ : constant_default2(!!_), drag) : filter2;
20056 drag.container = function(_) {
20057 return arguments.length ? (container = typeof _ === "function" ? _ : constant_default2(_), drag) : container;
20059 drag.subject = function(_) {
20060 return arguments.length ? (subject = typeof _ === "function" ? _ : constant_default2(_), drag) : subject;
20062 drag.touchable = function(_) {
20063 return arguments.length ? (touchable = typeof _ === "function" ? _ : constant_default2(!!_), drag) : touchable;
20065 drag.on = function() {
20066 var value = listeners.on.apply(listeners, arguments);
20067 return value === listeners ? drag : value;
20069 drag.clickDistance = function(_) {
20070 return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);
20075 // node_modules/d3-color/src/define.js
20076 function define_default(constructor, factory, prototype) {
20077 constructor.prototype = factory.prototype = prototype;
20078 prototype.constructor = constructor;
20080 function extend(parent, definition) {
20081 var prototype = Object.create(parent.prototype);
20082 for (var key in definition)
20083 prototype[key] = definition[key];
20087 // node_modules/d3-color/src/color.js
20091 var brighter = 1 / darker;
20092 var reI = "\\s*([+-]?\\d+)\\s*";
20093 var reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*";
20094 var reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
20095 var reHex = /^#([0-9a-f]{3,8})$/;
20096 var reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`);
20097 var reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`);
20098 var reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`);
20099 var reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`);
20100 var reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`);
20101 var reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
20103 aliceblue: 15792383,
20104 antiquewhite: 16444375,
20106 aquamarine: 8388564,
20111 blanchedalmond: 16772045,
20113 blueviolet: 9055202,
20115 burlywood: 14596231,
20116 cadetblue: 6266528,
20117 chartreuse: 8388352,
20118 chocolate: 13789470,
20120 cornflowerblue: 6591981,
20121 cornsilk: 16775388,
20126 darkgoldenrod: 12092939,
20127 darkgray: 11119017,
20129 darkgrey: 11119017,
20130 darkkhaki: 12433259,
20131 darkmagenta: 9109643,
20132 darkolivegreen: 5597999,
20133 darkorange: 16747520,
20134 darkorchid: 10040012,
20136 darksalmon: 15308410,
20137 darkseagreen: 9419919,
20138 darkslateblue: 4734347,
20139 darkslategray: 3100495,
20140 darkslategrey: 3100495,
20141 darkturquoise: 52945,
20142 darkviolet: 9699539,
20143 deeppink: 16716947,
20144 deepskyblue: 49151,
20147 dodgerblue: 2003199,
20148 firebrick: 11674146,
20149 floralwhite: 16775920,
20150 forestgreen: 2263842,
20152 gainsboro: 14474460,
20153 ghostwhite: 16316671,
20155 goldenrod: 14329120,
20158 greenyellow: 11403055,
20160 honeydew: 15794160,
20162 indianred: 13458524,
20166 lavender: 15132410,
20167 lavenderblush: 16773365,
20168 lawngreen: 8190976,
20169 lemonchiffon: 16775885,
20170 lightblue: 11393254,
20171 lightcoral: 15761536,
20172 lightcyan: 14745599,
20173 lightgoldenrodyellow: 16448210,
20174 lightgray: 13882323,
20175 lightgreen: 9498256,
20176 lightgrey: 13882323,
20177 lightpink: 16758465,
20178 lightsalmon: 16752762,
20179 lightseagreen: 2142890,
20180 lightskyblue: 8900346,
20181 lightslategray: 7833753,
20182 lightslategrey: 7833753,
20183 lightsteelblue: 11584734,
20184 lightyellow: 16777184,
20186 limegreen: 3329330,
20190 mediumaquamarine: 6737322,
20192 mediumorchid: 12211667,
20193 mediumpurple: 9662683,
20194 mediumseagreen: 3978097,
20195 mediumslateblue: 8087790,
20196 mediumspringgreen: 64154,
20197 mediumturquoise: 4772300,
20198 mediumvioletred: 13047173,
20199 midnightblue: 1644912,
20200 mintcream: 16121850,
20201 mistyrose: 16770273,
20202 moccasin: 16770229,
20203 navajowhite: 16768685,
20207 olivedrab: 7048739,
20209 orangered: 16729344,
20211 palegoldenrod: 15657130,
20212 palegreen: 10025880,
20213 paleturquoise: 11529966,
20214 palevioletred: 14381203,
20215 papayawhip: 16773077,
20216 peachpuff: 16767673,
20220 powderblue: 11591910,
20222 rebeccapurple: 6697881,
20224 rosybrown: 12357519,
20225 royalblue: 4286945,
20226 saddlebrown: 9127187,
20228 sandybrown: 16032864,
20230 seashell: 16774638,
20234 slateblue: 6970061,
20235 slategray: 7372944,
20236 slategrey: 7372944,
20238 springgreen: 65407,
20239 steelblue: 4620980,
20244 turquoise: 4251856,
20248 whitesmoke: 16119285,
20250 yellowgreen: 10145074
20252 define_default(Color, color, {
20254 return Object.assign(new this.constructor(), this, channels);
20257 return this.rgb().displayable();
20259 hex: color_formatHex,
20260 formatHex: color_formatHex,
20261 formatHex8: color_formatHex8,
20262 formatHsl: color_formatHsl,
20263 formatRgb: color_formatRgb,
20264 toString: color_formatRgb
20266 function color_formatHex() {
20267 return this.rgb().formatHex();
20269 function color_formatHex8() {
20270 return this.rgb().formatHex8();
20272 function color_formatHsl() {
20273 return hslConvert(this).formatHsl();
20275 function color_formatRgb() {
20276 return this.rgb().formatRgb();
20278 function color(format2) {
20280 format2 = (format2 + "").trim().toLowerCase();
20281 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;
20283 function rgbn(n2) {
20284 return new Rgb(n2 >> 16 & 255, n2 >> 8 & 255, n2 & 255, 1);
20286 function rgba(r, g, b, a) {
20289 return new Rgb(r, g, b, a);
20291 function rgbConvert(o) {
20292 if (!(o instanceof Color))
20297 return new Rgb(o.r, o.g, o.b, o.opacity);
20299 function rgb(r, g, b, opacity) {
20300 return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
20302 function Rgb(r, g, b, opacity) {
20306 this.opacity = +opacity;
20308 define_default(Rgb, rgb, extend(Color, {
20310 k = k == null ? brighter : Math.pow(brighter, k);
20311 return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
20314 k = k == null ? darker : Math.pow(darker, k);
20315 return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
20321 return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
20324 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);
20326 hex: rgb_formatHex,
20327 formatHex: rgb_formatHex,
20328 formatHex8: rgb_formatHex8,
20329 formatRgb: rgb_formatRgb,
20330 toString: rgb_formatRgb
20332 function rgb_formatHex() {
20333 return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
20335 function rgb_formatHex8() {
20336 return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
20338 function rgb_formatRgb() {
20339 const a = clampa(this.opacity);
20340 return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
20342 function clampa(opacity) {
20343 return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
20345 function clampi(value) {
20346 return Math.max(0, Math.min(255, Math.round(value) || 0));
20348 function hex(value) {
20349 value = clampi(value);
20350 return (value < 16 ? "0" : "") + value.toString(16);
20352 function hsla(h, s, l, a) {
20355 else if (l <= 0 || l >= 1)
20359 return new Hsl(h, s, l, a);
20361 function hslConvert(o) {
20362 if (o instanceof Hsl)
20363 return new Hsl(o.h, o.s, o.l, o.opacity);
20364 if (!(o instanceof Color))
20368 if (o instanceof Hsl)
20371 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;
20374 h = (g - b) / s + (g < b) * 6;
20375 else if (g === max3)
20376 h = (b - r) / s + 2;
20378 h = (r - g) / s + 4;
20379 s /= l < 0.5 ? max3 + min3 : 2 - max3 - min3;
20382 s = l > 0 && l < 1 ? 0 : h;
20384 return new Hsl(h, s, l, o.opacity);
20386 function hsl(h, s, l, opacity) {
20387 return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
20389 function Hsl(h, s, l, opacity) {
20393 this.opacity = +opacity;
20395 define_default(Hsl, hsl, extend(Color, {
20397 k = k == null ? brighter : Math.pow(brighter, k);
20398 return new Hsl(this.h, this.s, this.l * k, this.opacity);
20401 k = k == null ? darker : Math.pow(darker, k);
20402 return new Hsl(this.h, this.s, this.l * k, this.opacity);
20405 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;
20407 hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
20408 hsl2rgb(h, m1, m2),
20409 hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
20414 return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
20417 return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
20420 const a = clampa(this.opacity);
20421 return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
20424 function clamph(value) {
20425 value = (value || 0) % 360;
20426 return value < 0 ? value + 360 : value;
20428 function clampt(value) {
20429 return Math.max(0, Math.min(1, value || 0));
20431 function hsl2rgb(h, m1, m2) {
20432 return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
20435 // node_modules/d3-interpolate/src/basis.js
20436 function basis(t1, v0, v1, v2, v3) {
20437 var t2 = t1 * t1, t3 = t2 * t1;
20438 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;
20440 function basis_default(values) {
20441 var n2 = values.length - 1;
20442 return function(t) {
20443 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;
20444 return basis((t - i2 / n2) * n2, v0, v1, v2, v3);
20448 // node_modules/d3-interpolate/src/basisClosed.js
20449 function basisClosed_default(values) {
20450 var n2 = values.length;
20451 return function(t) {
20452 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];
20453 return basis((t - i2 / n2) * n2, v0, v1, v2, v3);
20457 // node_modules/d3-interpolate/src/constant.js
20458 var constant_default3 = (x) => () => x;
20460 // node_modules/d3-interpolate/src/color.js
20461 function linear(a, d) {
20462 return function(t) {
20466 function exponential(a, b, y) {
20467 return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
20468 return Math.pow(a + t * b, y);
20471 function gamma(y) {
20472 return (y = +y) === 1 ? nogamma : function(a, b) {
20473 return b - a ? exponential(a, b, y) : constant_default3(isNaN(a) ? b : a);
20476 function nogamma(a, b) {
20478 return d ? linear(a, d) : constant_default3(isNaN(a) ? b : a);
20481 // node_modules/d3-interpolate/src/rgb.js
20482 var rgb_default = function rgbGamma(y) {
20483 var color2 = gamma(y);
20484 function rgb2(start2, end) {
20485 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);
20486 return function(t) {
20490 start2.opacity = opacity(t);
20491 return start2 + "";
20494 rgb2.gamma = rgbGamma;
20497 function rgbSpline(spline) {
20498 return function(colors) {
20499 var n2 = colors.length, r = new Array(n2), g = new Array(n2), b = new Array(n2), i2, color2;
20500 for (i2 = 0; i2 < n2; ++i2) {
20501 color2 = rgb(colors[i2]);
20502 r[i2] = color2.r || 0;
20503 g[i2] = color2.g || 0;
20504 b[i2] = color2.b || 0;
20509 color2.opacity = 1;
20510 return function(t) {
20514 return color2 + "";
20518 var rgbBasis = rgbSpline(basis_default);
20519 var rgbBasisClosed = rgbSpline(basisClosed_default);
20521 // node_modules/d3-interpolate/src/numberArray.js
20522 function numberArray_default(a, b) {
20525 var n2 = a ? Math.min(b.length, a.length) : 0, c = b.slice(), i2;
20526 return function(t) {
20527 for (i2 = 0; i2 < n2; ++i2)
20528 c[i2] = a[i2] * (1 - t) + b[i2] * t;
20532 function isNumberArray(x) {
20533 return ArrayBuffer.isView(x) && !(x instanceof DataView);
20536 // node_modules/d3-interpolate/src/array.js
20537 function genericArray(a, b) {
20538 var nb = b ? b.length : 0, na = a ? Math.min(nb, a.length) : 0, x = new Array(na), c = new Array(nb), i2;
20539 for (i2 = 0; i2 < na; ++i2)
20540 x[i2] = value_default(a[i2], b[i2]);
20541 for (; i2 < nb; ++i2)
20543 return function(t) {
20544 for (i2 = 0; i2 < na; ++i2)
20550 // node_modules/d3-interpolate/src/date.js
20551 function date_default(a, b) {
20552 var d = new Date();
20553 return a = +a, b = +b, function(t) {
20554 return d.setTime(a * (1 - t) + b * t), d;
20558 // node_modules/d3-interpolate/src/number.js
20559 function number_default(a, b) {
20560 return a = +a, b = +b, function(t) {
20561 return a * (1 - t) + b * t;
20565 // node_modules/d3-interpolate/src/object.js
20566 function object_default(a, b) {
20567 var i2 = {}, c = {}, k;
20568 if (a === null || typeof a !== "object")
20570 if (b === null || typeof b !== "object")
20574 i2[k] = value_default(a[k], b[k]);
20579 return function(t) {
20586 // node_modules/d3-interpolate/src/string.js
20587 var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
20588 var reB = new RegExp(reA.source, "g");
20589 function zero2(b) {
20590 return function() {
20595 return function(t) {
20599 function string_default(a, b) {
20600 var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i2 = -1, s = [], q = [];
20601 a = a + "", b = b + "";
20602 while ((am = reA.exec(a)) && (bm = reB.exec(b))) {
20603 if ((bs = bm.index) > bi) {
20604 bs = b.slice(bi, bs);
20610 if ((am = am[0]) === (bm = bm[0])) {
20617 q.push({ i: i2, x: number_default(am, bm) });
20619 bi = reB.lastIndex;
20621 if (bi < b.length) {
20628 return s.length < 2 ? q[0] ? one(q[0].x) : zero2(b) : (b = q.length, function(t) {
20629 for (var i3 = 0, o; i3 < b; ++i3)
20630 s[(o = q[i3]).i] = o.x(t);
20635 // node_modules/d3-interpolate/src/value.js
20636 function value_default(a, b) {
20637 var t = typeof b, c;
20638 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);
20641 // node_modules/d3-interpolate/src/round.js
20642 function round_default(a, b) {
20643 return a = +a, b = +b, function(t) {
20644 return Math.round(a * (1 - t) + b * t);
20648 // node_modules/d3-interpolate/src/transform/decompose.js
20649 var degrees2 = 180 / Math.PI;
20658 function decompose_default(a, b, c, d, e, f2) {
20659 var scaleX, scaleY, skewX;
20660 if (scaleX = Math.sqrt(a * a + b * b))
20661 a /= scaleX, b /= scaleX;
20662 if (skewX = a * c + b * d)
20663 c -= a * skewX, d -= b * skewX;
20664 if (scaleY = Math.sqrt(c * c + d * d))
20665 c /= scaleY, d /= scaleY, skewX /= scaleY;
20667 a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
20671 rotate: Math.atan2(b, a) * degrees2,
20672 skewX: Math.atan(skewX) * degrees2,
20678 // node_modules/d3-interpolate/src/transform/parse.js
20680 function parseCss(value) {
20681 const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
20682 return m.isIdentity ? identity : decompose_default(m.a, m.b, m.c, m.d, m.e, m.f);
20684 function parseSvg(value) {
20688 svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
20689 svgNode.setAttribute("transform", value);
20690 if (!(value = svgNode.transform.baseVal.consolidate()))
20692 value = value.matrix;
20693 return decompose_default(value.a, value.b, value.c, value.d, value.e, value.f);
20696 // node_modules/d3-interpolate/src/transform/index.js
20697 function interpolateTransform(parse, pxComma, pxParen, degParen) {
20699 return s.length ? s.pop() + " " : "";
20701 function translate(xa, ya, xb, yb, s, q) {
20702 if (xa !== xb || ya !== yb) {
20703 var i2 = s.push("translate(", null, pxComma, null, pxParen);
20704 q.push({ i: i2 - 4, x: number_default(xa, xb) }, { i: i2 - 2, x: number_default(ya, yb) });
20705 } else if (xb || yb) {
20706 s.push("translate(" + xb + pxComma + yb + pxParen);
20709 function rotate(a, b, s, q) {
20713 else if (b - a > 180)
20715 q.push({ i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: number_default(a, b) });
20717 s.push(pop(s) + "rotate(" + b + degParen);
20720 function skewX(a, b, s, q) {
20722 q.push({ i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: number_default(a, b) });
20724 s.push(pop(s) + "skewX(" + b + degParen);
20727 function scale(xa, ya, xb, yb, s, q) {
20728 if (xa !== xb || ya !== yb) {
20729 var i2 = s.push(pop(s) + "scale(", null, ",", null, ")");
20730 q.push({ i: i2 - 4, x: number_default(xa, xb) }, { i: i2 - 2, x: number_default(ya, yb) });
20731 } else if (xb !== 1 || yb !== 1) {
20732 s.push(pop(s) + "scale(" + xb + "," + yb + ")");
20735 return function(a, b) {
20736 var s = [], q = [];
20737 a = parse(a), b = parse(b);
20738 translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
20739 rotate(a.rotate, b.rotate, s, q);
20740 skewX(a.skewX, b.skewX, s, q);
20741 scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
20743 return function(t) {
20744 var i2 = -1, n2 = q.length, o;
20746 s[(o = q[i2]).i] = o.x(t);
20751 var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
20752 var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
20754 // node_modules/d3-interpolate/src/zoom.js
20755 var epsilon22 = 1e-12;
20757 return ((x = Math.exp(x)) + 1 / x) / 2;
20760 return ((x = Math.exp(x)) - 1 / x) / 2;
20763 return ((x = Math.exp(2 * x)) - 1) / (x + 1);
20765 var zoom_default = function zoomRho(rho, rho2, rho4) {
20766 function zoom(p02, p1) {
20767 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;
20768 if (d2 < epsilon22) {
20769 S = Math.log(w1 / w0) / rho;
20774 w0 * Math.exp(rho * t * S)
20778 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);
20779 S = (r1 - r0) / rho;
20781 var s = t * S, coshr0 = cosh(r0), u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
20785 w0 * coshr0 / cosh(rho * s + r0)
20789 i2.duration = S * 1e3 * rho / Math.SQRT2;
20792 zoom.rho = function(_) {
20793 var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2;
20794 return zoomRho(_1, _2, _4);
20797 }(Math.SQRT2, 2, 4);
20799 // node_modules/d3-interpolate/src/quantize.js
20800 function quantize_default(interpolator, n2) {
20801 var samples = new Array(n2);
20802 for (var i2 = 0; i2 < n2; ++i2)
20803 samples[i2] = interpolator(i2 / (n2 - 1));
20807 // node_modules/d3-timer/src/timer.js
20811 var pokeDelay = 1e3;
20817 var clock = typeof performance === "object" && performance.now ? performance : Date;
20818 var setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f2) {
20819 setTimeout(f2, 17);
20822 return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
20824 function clearNow() {
20828 this._call = this._time = this._next = null;
20830 Timer.prototype = timer.prototype = {
20831 constructor: Timer,
20832 restart: function(callback, delay, time) {
20833 if (typeof callback !== "function")
20834 throw new TypeError("callback is not a function");
20835 time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
20836 if (!this._next && taskTail !== this) {
20838 taskTail._next = this;
20843 this._call = callback;
20850 this._time = Infinity;
20855 function timer(callback, delay, time) {
20856 var t = new Timer();
20857 t.restart(callback, delay, time);
20860 function timerFlush() {
20863 var t = taskHead, e;
20865 if ((e = clockNow - t._time) >= 0)
20866 t._call.call(void 0, e);
20872 clockNow = (clockLast = clock.now()) + clockSkew;
20873 frame = timeout = 0;
20883 var now3 = clock.now(), delay = now3 - clockLast;
20884 if (delay > pokeDelay)
20885 clockSkew -= delay, clockLast = now3;
20888 var t0, t1 = taskHead, t2, time = Infinity;
20891 if (time > t1._time)
20893 t0 = t1, t1 = t1._next;
20895 t2 = t1._next, t1._next = null;
20896 t1 = t0 ? t0._next = t2 : taskHead = t2;
20902 function sleep(time) {
20906 timeout = clearTimeout(timeout);
20907 var delay = time - clockNow;
20909 if (time < Infinity)
20910 timeout = setTimeout(wake, time - clock.now() - clockSkew);
20912 interval = clearInterval(interval);
20915 clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
20916 frame = 1, setFrame(wake);
20920 // node_modules/d3-timer/src/timeout.js
20921 function timeout_default(callback, delay, time) {
20922 var t = new Timer();
20923 delay = delay == null ? 0 : +delay;
20924 t.restart((elapsed) => {
20926 callback(elapsed + delay);
20931 // node_modules/d3-transition/src/transition/schedule.js
20932 var emptyOn = dispatch_default("start", "end", "cancel", "interrupt");
20933 var emptyTween = [];
20941 function schedule_default(node, name, id2, index, group, timing) {
20942 var schedules = node.__transition;
20944 node.__transition = {};
20945 else if (id2 in schedules)
20947 create(node, id2, {
20954 delay: timing.delay,
20955 duration: timing.duration,
20961 function init(node, id2) {
20962 var schedule = get2(node, id2);
20963 if (schedule.state > CREATED)
20964 throw new Error("too late; already scheduled");
20967 function set2(node, id2) {
20968 var schedule = get2(node, id2);
20969 if (schedule.state > STARTED)
20970 throw new Error("too late; already running");
20973 function get2(node, id2) {
20974 var schedule = node.__transition;
20975 if (!schedule || !(schedule = schedule[id2]))
20976 throw new Error("transition not found");
20979 function create(node, id2, self2) {
20980 var schedules = node.__transition, tween;
20981 schedules[id2] = self2;
20982 self2.timer = timer(schedule, 0, self2.time);
20983 function schedule(elapsed) {
20984 self2.state = SCHEDULED;
20985 self2.timer.restart(start2, self2.delay, self2.time);
20986 if (self2.delay <= elapsed)
20987 start2(elapsed - self2.delay);
20989 function start2(elapsed) {
20991 if (self2.state !== SCHEDULED)
20993 for (i2 in schedules) {
20995 if (o.name !== self2.name)
20997 if (o.state === STARTED)
20998 return timeout_default(start2);
20999 if (o.state === RUNNING) {
21002 o.on.call("interrupt", node, node.__data__, o.index, o.group);
21003 delete schedules[i2];
21004 } else if (+i2 < id2) {
21007 o.on.call("cancel", node, node.__data__, o.index, o.group);
21008 delete schedules[i2];
21011 timeout_default(function() {
21012 if (self2.state === STARTED) {
21013 self2.state = RUNNING;
21014 self2.timer.restart(tick, self2.delay, self2.time);
21018 self2.state = STARTING;
21019 self2.on.call("start", node, node.__data__, self2.index, self2.group);
21020 if (self2.state !== STARTING)
21022 self2.state = STARTED;
21023 tween = new Array(n2 = self2.tween.length);
21024 for (i2 = 0, j2 = -1; i2 < n2; ++i2) {
21025 if (o = self2.tween[i2].value.call(node, node.__data__, self2.index, self2.group)) {
21029 tween.length = j2 + 1;
21031 function tick(elapsed) {
21032 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;
21033 while (++i2 < n2) {
21034 tween[i2].call(node, t);
21036 if (self2.state === ENDING) {
21037 self2.on.call("end", node, node.__data__, self2.index, self2.group);
21042 self2.state = ENDED;
21043 self2.timer.stop();
21044 delete schedules[id2];
21045 for (var i2 in schedules)
21047 delete node.__transition;
21051 // node_modules/d3-transition/src/interrupt.js
21052 function interrupt_default(node, name) {
21053 var schedules = node.__transition, schedule, active, empty2 = true, i2;
21056 name = name == null ? null : name + "";
21057 for (i2 in schedules) {
21058 if ((schedule = schedules[i2]).name !== name) {
21062 active = schedule.state > STARTING && schedule.state < ENDING;
21063 schedule.state = ENDED;
21064 schedule.timer.stop();
21065 schedule.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule.index, schedule.group);
21066 delete schedules[i2];
21069 delete node.__transition;
21072 // node_modules/d3-transition/src/selection/interrupt.js
21073 function interrupt_default2(name) {
21074 return this.each(function() {
21075 interrupt_default(this, name);
21079 // node_modules/d3-transition/src/transition/tween.js
21080 function tweenRemove(id2, name) {
21081 var tween0, tween1;
21082 return function() {
21083 var schedule = set2(this, id2), tween = schedule.tween;
21084 if (tween !== tween0) {
21085 tween1 = tween0 = tween;
21086 for (var i2 = 0, n2 = tween1.length; i2 < n2; ++i2) {
21087 if (tween1[i2].name === name) {
21088 tween1 = tween1.slice();
21089 tween1.splice(i2, 1);
21094 schedule.tween = tween1;
21097 function tweenFunction(id2, name, value) {
21098 var tween0, tween1;
21099 if (typeof value !== "function")
21101 return function() {
21102 var schedule = set2(this, id2), tween = schedule.tween;
21103 if (tween !== tween0) {
21104 tween1 = (tween0 = tween).slice();
21105 for (var t = { name, value }, i2 = 0, n2 = tween1.length; i2 < n2; ++i2) {
21106 if (tween1[i2].name === name) {
21114 schedule.tween = tween1;
21117 function tween_default(name, value) {
21118 var id2 = this._id;
21120 if (arguments.length < 2) {
21121 var tween = get2(this.node(), id2).tween;
21122 for (var i2 = 0, n2 = tween.length, t; i2 < n2; ++i2) {
21123 if ((t = tween[i2]).name === name) {
21129 return this.each((value == null ? tweenRemove : tweenFunction)(id2, name, value));
21131 function tweenValue(transition2, name, value) {
21132 var id2 = transition2._id;
21133 transition2.each(function() {
21134 var schedule = set2(this, id2);
21135 (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
21137 return function(node) {
21138 return get2(node, id2).value[name];
21142 // node_modules/d3-transition/src/transition/interpolate.js
21143 function interpolate_default(a, b) {
21145 return (typeof b === "number" ? number_default : b instanceof color ? rgb_default : (c = color(b)) ? (b = c, rgb_default) : string_default)(a, b);
21148 // node_modules/d3-transition/src/transition/attr.js
21149 function attrRemove2(name) {
21150 return function() {
21151 this.removeAttribute(name);
21154 function attrRemoveNS2(fullname) {
21155 return function() {
21156 this.removeAttributeNS(fullname.space, fullname.local);
21159 function attrConstant2(name, interpolate, value1) {
21160 var string00, string1 = value1 + "", interpolate0;
21161 return function() {
21162 var string0 = this.getAttribute(name);
21163 return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
21166 function attrConstantNS2(fullname, interpolate, value1) {
21167 var string00, string1 = value1 + "", interpolate0;
21168 return function() {
21169 var string0 = this.getAttributeNS(fullname.space, fullname.local);
21170 return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
21173 function attrFunction2(name, interpolate, value) {
21174 var string00, string10, interpolate0;
21175 return function() {
21176 var string0, value1 = value(this), string1;
21177 if (value1 == null)
21178 return void this.removeAttribute(name);
21179 string0 = this.getAttribute(name);
21180 string1 = value1 + "";
21181 return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
21184 function attrFunctionNS2(fullname, interpolate, value) {
21185 var string00, string10, interpolate0;
21186 return function() {
21187 var string0, value1 = value(this), string1;
21188 if (value1 == null)
21189 return void this.removeAttributeNS(fullname.space, fullname.local);
21190 string0 = this.getAttributeNS(fullname.space, fullname.local);
21191 string1 = value1 + "";
21192 return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
21195 function attr_default2(name, value) {
21196 var fullname = namespace_default(name), i2 = fullname === "transform" ? interpolateTransformSvg : interpolate_default;
21197 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));
21200 // node_modules/d3-transition/src/transition/attrTween.js
21201 function attrInterpolate(name, i2) {
21202 return function(t) {
21203 this.setAttribute(name, i2.call(this, t));
21206 function attrInterpolateNS(fullname, i2) {
21207 return function(t) {
21208 this.setAttributeNS(fullname.space, fullname.local, i2.call(this, t));
21211 function attrTweenNS(fullname, value) {
21214 var i2 = value.apply(this, arguments);
21216 t0 = (i0 = i2) && attrInterpolateNS(fullname, i2);
21219 tween._value = value;
21222 function attrTween(name, value) {
21225 var i2 = value.apply(this, arguments);
21227 t0 = (i0 = i2) && attrInterpolate(name, i2);
21230 tween._value = value;
21233 function attrTween_default(name, value) {
21234 var key = "attr." + name;
21235 if (arguments.length < 2)
21236 return (key = this.tween(key)) && key._value;
21238 return this.tween(key, null);
21239 if (typeof value !== "function")
21241 var fullname = namespace_default(name);
21242 return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
21245 // node_modules/d3-transition/src/transition/delay.js
21246 function delayFunction(id2, value) {
21247 return function() {
21248 init(this, id2).delay = +value.apply(this, arguments);
21251 function delayConstant(id2, value) {
21252 return value = +value, function() {
21253 init(this, id2).delay = value;
21256 function delay_default(value) {
21257 var id2 = this._id;
21258 return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id2, value)) : get2(this.node(), id2).delay;
21261 // node_modules/d3-transition/src/transition/duration.js
21262 function durationFunction(id2, value) {
21263 return function() {
21264 set2(this, id2).duration = +value.apply(this, arguments);
21267 function durationConstant(id2, value) {
21268 return value = +value, function() {
21269 set2(this, id2).duration = value;
21272 function duration_default(value) {
21273 var id2 = this._id;
21274 return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id2, value)) : get2(this.node(), id2).duration;
21277 // node_modules/d3-transition/src/transition/ease.js
21278 function easeConstant(id2, value) {
21279 if (typeof value !== "function")
21281 return function() {
21282 set2(this, id2).ease = value;
21285 function ease_default(value) {
21286 var id2 = this._id;
21287 return arguments.length ? this.each(easeConstant(id2, value)) : get2(this.node(), id2).ease;
21290 // node_modules/d3-transition/src/transition/easeVarying.js
21291 function easeVarying(id2, value) {
21292 return function() {
21293 var v = value.apply(this, arguments);
21294 if (typeof v !== "function")
21296 set2(this, id2).ease = v;
21299 function easeVarying_default(value) {
21300 if (typeof value !== "function")
21302 return this.each(easeVarying(this._id, value));
21305 // node_modules/d3-transition/src/transition/filter.js
21306 function filter_default2(match) {
21307 if (typeof match !== "function")
21308 match = matcher_default(match);
21309 for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
21310 for (var group = groups[j2], n2 = group.length, subgroup = subgroups[j2] = [], node, i2 = 0; i2 < n2; ++i2) {
21311 if ((node = group[i2]) && match.call(node, node.__data__, i2, group)) {
21312 subgroup.push(node);
21316 return new Transition(subgroups, this._parents, this._name, this._id);
21319 // node_modules/d3-transition/src/transition/merge.js
21320 function merge_default2(transition2) {
21321 if (transition2._id !== this._id)
21323 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) {
21324 for (var group0 = groups0[j2], group1 = groups1[j2], n2 = group0.length, merge3 = merges[j2] = new Array(n2), node, i2 = 0; i2 < n2; ++i2) {
21325 if (node = group0[i2] || group1[i2]) {
21330 for (; j2 < m0; ++j2) {
21331 merges[j2] = groups0[j2];
21333 return new Transition(merges, this._parents, this._name, this._id);
21336 // node_modules/d3-transition/src/transition/on.js
21337 function start(name) {
21338 return (name + "").trim().split(/^|\s+/).every(function(t) {
21339 var i2 = t.indexOf(".");
21341 t = t.slice(0, i2);
21342 return !t || t === "start";
21345 function onFunction(id2, name, listener) {
21346 var on0, on1, sit = start(name) ? init : set2;
21347 return function() {
21348 var schedule = sit(this, id2), on = schedule.on;
21350 (on1 = (on0 = on).copy()).on(name, listener);
21354 function on_default2(name, listener) {
21355 var id2 = this._id;
21356 return arguments.length < 2 ? get2(this.node(), id2).on.on(name) : this.each(onFunction(id2, name, listener));
21359 // node_modules/d3-transition/src/transition/remove.js
21360 function removeFunction(id2) {
21361 return function() {
21362 var parent = this.parentNode;
21363 for (var i2 in this.__transition)
21367 parent.removeChild(this);
21370 function remove_default2() {
21371 return this.on("end.remove", removeFunction(this._id));
21374 // node_modules/d3-transition/src/transition/select.js
21375 function select_default3(select) {
21376 var name = this._name, id2 = this._id;
21377 if (typeof select !== "function")
21378 select = selector_default(select);
21379 for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
21380 for (var group = groups[j2], n2 = group.length, subgroup = subgroups[j2] = new Array(n2), node, subnode, i2 = 0; i2 < n2; ++i2) {
21381 if ((node = group[i2]) && (subnode = select.call(node, node.__data__, i2, group))) {
21382 if ("__data__" in node)
21383 subnode.__data__ = node.__data__;
21384 subgroup[i2] = subnode;
21385 schedule_default(subgroup[i2], name, id2, i2, subgroup, get2(node, id2));
21389 return new Transition(subgroups, this._parents, name, id2);
21392 // node_modules/d3-transition/src/transition/selectAll.js
21393 function selectAll_default3(select) {
21394 var name = this._name, id2 = this._id;
21395 if (typeof select !== "function")
21396 select = selectorAll_default(select);
21397 for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j2 = 0; j2 < m; ++j2) {
21398 for (var group = groups[j2], n2 = group.length, node, i2 = 0; i2 < n2; ++i2) {
21399 if (node = group[i2]) {
21400 for (var children2 = select.call(node, node.__data__, i2, group), child, inherit2 = get2(node, id2), k = 0, l = children2.length; k < l; ++k) {
21401 if (child = children2[k]) {
21402 schedule_default(child, name, id2, k, children2, inherit2);
21405 subgroups.push(children2);
21406 parents.push(node);
21410 return new Transition(subgroups, parents, name, id2);
21413 // node_modules/d3-transition/src/transition/selection.js
21414 var Selection2 = selection_default.prototype.constructor;
21415 function selection_default2() {
21416 return new Selection2(this._groups, this._parents);
21419 // node_modules/d3-transition/src/transition/style.js
21420 function styleNull(name, interpolate) {
21421 var string00, string10, interpolate0;
21422 return function() {
21423 var string0 = styleValue(this, name), string1 = (this.style.removeProperty(name), styleValue(this, name));
21424 return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : interpolate0 = interpolate(string00 = string0, string10 = string1);
21427 function styleRemove2(name) {
21428 return function() {
21429 this.style.removeProperty(name);
21432 function styleConstant2(name, interpolate, value1) {
21433 var string00, string1 = value1 + "", interpolate0;
21434 return function() {
21435 var string0 = styleValue(this, name);
21436 return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
21439 function styleFunction2(name, interpolate, value) {
21440 var string00, string10, interpolate0;
21441 return function() {
21442 var string0 = styleValue(this, name), value1 = value(this), string1 = value1 + "";
21443 if (value1 == null)
21444 string1 = value1 = (this.style.removeProperty(name), styleValue(this, name));
21445 return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
21448 function styleMaybeRemove(id2, name) {
21449 var on0, on1, listener0, key = "style." + name, event = "end." + key, remove2;
21450 return function() {
21451 var schedule = set2(this, id2), on = schedule.on, listener = schedule.value[key] == null ? remove2 || (remove2 = styleRemove2(name)) : void 0;
21452 if (on !== on0 || listener0 !== listener)
21453 (on1 = (on0 = on).copy()).on(event, listener0 = listener);
21457 function style_default2(name, value, priority) {
21458 var i2 = (name += "") === "transform" ? interpolateTransformCss : interpolate_default;
21459 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);
21462 // node_modules/d3-transition/src/transition/styleTween.js
21463 function styleInterpolate(name, i2, priority) {
21464 return function(t) {
21465 this.style.setProperty(name, i2.call(this, t), priority);
21468 function styleTween(name, value, priority) {
21471 var i2 = value.apply(this, arguments);
21473 t = (i0 = i2) && styleInterpolate(name, i2, priority);
21476 tween._value = value;
21479 function styleTween_default(name, value, priority) {
21480 var key = "style." + (name += "");
21481 if (arguments.length < 2)
21482 return (key = this.tween(key)) && key._value;
21484 return this.tween(key, null);
21485 if (typeof value !== "function")
21487 return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
21490 // node_modules/d3-transition/src/transition/text.js
21491 function textConstant2(value) {
21492 return function() {
21493 this.textContent = value;
21496 function textFunction2(value) {
21497 return function() {
21498 var value1 = value(this);
21499 this.textContent = value1 == null ? "" : value1;
21502 function text_default2(value) {
21503 return this.tween("text", typeof value === "function" ? textFunction2(tweenValue(this, "text", value)) : textConstant2(value == null ? "" : value + ""));
21506 // node_modules/d3-transition/src/transition/textTween.js
21507 function textInterpolate(i2) {
21508 return function(t) {
21509 this.textContent = i2.call(this, t);
21512 function textTween(value) {
21515 var i2 = value.apply(this, arguments);
21517 t0 = (i0 = i2) && textInterpolate(i2);
21520 tween._value = value;
21523 function textTween_default(value) {
21525 if (arguments.length < 1)
21526 return (key = this.tween(key)) && key._value;
21528 return this.tween(key, null);
21529 if (typeof value !== "function")
21531 return this.tween(key, textTween(value));
21534 // node_modules/d3-transition/src/transition/transition.js
21535 function transition_default() {
21536 var name = this._name, id0 = this._id, id1 = newId();
21537 for (var groups = this._groups, m = groups.length, j2 = 0; j2 < m; ++j2) {
21538 for (var group = groups[j2], n2 = group.length, node, i2 = 0; i2 < n2; ++i2) {
21539 if (node = group[i2]) {
21540 var inherit2 = get2(node, id0);
21541 schedule_default(node, name, id1, i2, group, {
21542 time: inherit2.time + inherit2.delay + inherit2.duration,
21544 duration: inherit2.duration,
21545 ease: inherit2.ease
21550 return new Transition(groups, this._parents, name, id1);
21553 // node_modules/d3-transition/src/transition/end.js
21554 function end_default() {
21555 var on0, on1, that = this, id2 = that._id, size = that.size();
21556 return new Promise(function(resolve, reject) {
21557 var cancel = { value: reject }, end = { value: function() {
21561 that.each(function() {
21562 var schedule = set2(this, id2), on = schedule.on;
21564 on1 = (on0 = on).copy();
21565 on1._.cancel.push(cancel);
21566 on1._.interrupt.push(cancel);
21567 on1._.end.push(end);
21576 // node_modules/d3-transition/src/transition/index.js
21578 function Transition(groups, parents, name, id2) {
21579 this._groups = groups;
21580 this._parents = parents;
21584 function transition(name) {
21585 return selection_default().transition(name);
21590 var selection_prototype = selection_default.prototype;
21591 Transition.prototype = transition.prototype = {
21592 constructor: Transition,
21593 select: select_default3,
21594 selectAll: selectAll_default3,
21595 selectChild: selection_prototype.selectChild,
21596 selectChildren: selection_prototype.selectChildren,
21597 filter: filter_default2,
21598 merge: merge_default2,
21599 selection: selection_default2,
21600 transition: transition_default,
21601 call: selection_prototype.call,
21602 nodes: selection_prototype.nodes,
21603 node: selection_prototype.node,
21604 size: selection_prototype.size,
21605 empty: selection_prototype.empty,
21606 each: selection_prototype.each,
21608 attr: attr_default2,
21609 attrTween: attrTween_default,
21610 style: style_default2,
21611 styleTween: styleTween_default,
21612 text: text_default2,
21613 textTween: textTween_default,
21614 remove: remove_default2,
21615 tween: tween_default,
21616 delay: delay_default,
21617 duration: duration_default,
21618 ease: ease_default,
21619 easeVarying: easeVarying_default,
21621 [Symbol.iterator]: selection_prototype[Symbol.iterator]
21624 // node_modules/d3-ease/src/linear.js
21625 var linear2 = (t) => +t;
21627 // node_modules/d3-ease/src/cubic.js
21628 function cubicInOut(t) {
21629 return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
21632 // node_modules/d3-transition/src/selection/transition.js
21633 var defaultTiming = {
21639 function inherit(node, id2) {
21641 while (!(timing = node.__transition) || !(timing = timing[id2])) {
21642 if (!(node = node.parentNode)) {
21643 throw new Error(`transition ${id2} not found`);
21648 function transition_default2(name) {
21650 if (name instanceof Transition) {
21651 id2 = name._id, name = name._name;
21653 id2 = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
21655 for (var groups = this._groups, m = groups.length, j2 = 0; j2 < m; ++j2) {
21656 for (var group = groups[j2], n2 = group.length, node, i2 = 0; i2 < n2; ++i2) {
21657 if (node = group[i2]) {
21658 schedule_default(node, name, id2, i2, group, timing || inherit(node, id2));
21662 return new Transition(groups, this._parents, name, id2);
21665 // node_modules/d3-transition/src/selection/index.js
21666 selection_default.prototype.interrupt = interrupt_default2;
21667 selection_default.prototype.transition = transition_default2;
21669 // node_modules/d3-zoom/src/constant.js
21670 var constant_default4 = (x) => () => x;
21672 // node_modules/d3-zoom/src/event.js
21673 function ZoomEvent(type3, {
21676 transform: transform2,
21677 dispatch: dispatch10
21679 Object.defineProperties(this, {
21680 type: { value: type3, enumerable: true, configurable: true },
21681 sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
21682 target: { value: target, enumerable: true, configurable: true },
21683 transform: { value: transform2, enumerable: true, configurable: true },
21684 _: { value: dispatch10 }
21688 // node_modules/d3-zoom/src/transform.js
21689 function Transform(k, x, y) {
21694 Transform.prototype = {
21695 constructor: Transform,
21696 scale: function(k) {
21697 return k === 1 ? this : new Transform(this.k * k, this.x, this.y);
21699 translate: function(x, y) {
21700 return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);
21702 apply: function(point2) {
21703 return [point2[0] * this.k + this.x, point2[1] * this.k + this.y];
21705 applyX: function(x) {
21706 return x * this.k + this.x;
21708 applyY: function(y) {
21709 return y * this.k + this.y;
21711 invert: function(location) {
21712 return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
21714 invertX: function(x) {
21715 return (x - this.x) / this.k;
21717 invertY: function(y) {
21718 return (y - this.y) / this.k;
21720 rescaleX: function(x) {
21721 return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));
21723 rescaleY: function(y) {
21724 return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));
21726 toString: function() {
21727 return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
21730 var identity2 = new Transform(1, 0, 0);
21731 transform.prototype = Transform.prototype;
21732 function transform(node) {
21733 while (!node.__zoom)
21734 if (!(node = node.parentNode))
21736 return node.__zoom;
21739 // node_modules/d3-zoom/src/noevent.js
21740 function nopropagation2(event) {
21741 event.stopImmediatePropagation();
21743 function noevent_default2(event) {
21744 event.preventDefault();
21745 event.stopImmediatePropagation();
21748 // node_modules/d3-zoom/src/zoom.js
21749 function defaultFilter2(event) {
21750 return (!event.ctrlKey || event.type === "wheel") && !event.button;
21752 function defaultExtent() {
21754 if (e instanceof SVGElement) {
21755 e = e.ownerSVGElement || e;
21756 if (e.hasAttribute("viewBox")) {
21757 e = e.viewBox.baseVal;
21758 return [[e.x, e.y], [e.x + e.width, e.y + e.height]];
21760 return [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]];
21762 return [[0, 0], [e.clientWidth, e.clientHeight]];
21764 function defaultTransform() {
21765 return this.__zoom || identity2;
21767 function defaultWheelDelta(event) {
21768 return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 2e-3) * (event.ctrlKey ? 10 : 1);
21770 function defaultTouchable2() {
21771 return navigator.maxTouchPoints || "ontouchstart" in this;
21773 function defaultConstrain(transform2, extent, translateExtent) {
21774 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];
21775 return transform2.translate(
21776 dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
21777 dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
21780 function zoom_default2() {
21781 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;
21782 function zoom(selection2) {
21783 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)");
21785 zoom.transform = function(collection, transform2, point2, event) {
21786 var selection2 = collection.selection ? collection.selection() : collection;
21787 selection2.property("__zoom", defaultTransform);
21788 if (collection !== selection2) {
21789 schedule(collection, transform2, point2, event);
21791 selection2.interrupt().each(function() {
21792 gesture(this, arguments).event(event).start().zoom(null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end();
21796 zoom.scaleBy = function(selection2, k, p, event) {
21797 zoom.scaleTo(selection2, function() {
21798 var k0 = this.__zoom.k, k1 = typeof k === "function" ? k.apply(this, arguments) : k;
21802 zoom.scaleTo = function(selection2, k, p, event) {
21803 zoom.transform(selection2, function() {
21804 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;
21805 return constrain(translate(scale(t0, k1), p02, p1), e, translateExtent);
21808 zoom.translateBy = function(selection2, x, y, event) {
21809 zoom.transform(selection2, function() {
21810 return constrain(this.__zoom.translate(
21811 typeof x === "function" ? x.apply(this, arguments) : x,
21812 typeof y === "function" ? y.apply(this, arguments) : y
21813 ), extent.apply(this, arguments), translateExtent);
21816 zoom.translateTo = function(selection2, x, y, p, event) {
21817 zoom.transform(selection2, function() {
21818 var e = extent.apply(this, arguments), t = this.__zoom, p02 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p;
21819 return constrain(identity2.translate(p02[0], p02[1]).scale(t.k).translate(
21820 typeof x === "function" ? -x.apply(this, arguments) : -x,
21821 typeof y === "function" ? -y.apply(this, arguments) : -y
21822 ), e, translateExtent);
21825 function scale(transform2, k) {
21826 k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));
21827 return k === transform2.k ? transform2 : new Transform(k, transform2.x, transform2.y);
21829 function translate(transform2, p02, p1) {
21830 var x = p02[0] - p1[0] * transform2.k, y = p02[1] - p1[1] * transform2.k;
21831 return x === transform2.x && y === transform2.y ? transform2 : new Transform(transform2.k, x, y);
21833 function centroid(extent2) {
21834 return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
21836 function schedule(transition2, transform2, point2, event) {
21837 transition2.on("start.zoom", function() {
21838 gesture(this, arguments).event(event).start();
21839 }).on("interrupt.zoom end.zoom", function() {
21840 gesture(this, arguments).event(event).end();
21841 }).tween("zoom", function() {
21842 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));
21843 return function(t) {
21847 var l = i2(t), k = w / l[2];
21848 t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k);
21854 function gesture(that, args, clean2) {
21855 return !clean2 && that.__zooming || new Gesture(that, args);
21857 function Gesture(that, args) {
21861 this.sourceEvent = null;
21862 this.extent = extent.apply(that, args);
21865 Gesture.prototype = {
21866 event: function(event) {
21868 this.sourceEvent = event;
21871 start: function() {
21872 if (++this.active === 1) {
21873 this.that.__zooming = this;
21874 this.emit("start");
21878 zoom: function(key, transform2) {
21879 if (this.mouse && key !== "mouse")
21880 this.mouse[1] = transform2.invert(this.mouse[0]);
21881 if (this.touch0 && key !== "touch")
21882 this.touch0[1] = transform2.invert(this.touch0[0]);
21883 if (this.touch1 && key !== "touch")
21884 this.touch1[1] = transform2.invert(this.touch1[0]);
21885 this.that.__zoom = transform2;
21890 if (--this.active === 0) {
21891 delete this.that.__zooming;
21896 emit: function(type3) {
21897 var d = select_default2(this.that).datum();
21901 new ZoomEvent(type3, {
21902 sourceEvent: this.sourceEvent,
21905 transform: this.that.__zoom,
21906 dispatch: listeners
21912 function wheeled(event, ...args) {
21913 if (!filter2.apply(this, arguments))
21915 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);
21917 if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {
21918 g.mouse[1] = t.invert(g.mouse[0] = p);
21920 clearTimeout(g.wheel);
21921 } else if (t.k === k)
21924 g.mouse = [p, t.invert(p)];
21925 interrupt_default(this);
21928 noevent_default2(event);
21929 g.wheel = setTimeout(wheelidled, wheelDelay);
21930 g.zoom("mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
21931 function wheelidled() {
21936 function mousedowned(event, ...args) {
21937 if (touchending || !filter2.apply(this, arguments))
21939 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;
21940 nodrag_default(event.view);
21941 nopropagation2(event);
21942 g.mouse = [p, this.__zoom.invert(p)];
21943 interrupt_default(this);
21945 function mousemoved(event2) {
21946 noevent_default2(event2);
21948 var dx = event2.clientX - x05, dy = event2.clientY - y05;
21949 g.moved = dx * dx + dy * dy > clickDistance2;
21951 g.event(event2).zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] = pointer_default(event2, currentTarget), g.mouse[1]), g.extent, translateExtent));
21953 function mouseupped(event2) {
21954 v.on("mousemove.zoom mouseup.zoom", null);
21955 yesdrag(event2.view, g.moved);
21956 noevent_default2(event2);
21957 g.event(event2).end();
21960 function dblclicked(event, ...args) {
21961 if (!filter2.apply(this, arguments))
21963 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);
21964 noevent_default2(event);
21966 select_default2(this).transition().duration(duration).call(schedule, t1, p02, event);
21968 select_default2(this).call(zoom.transform, t1, p02, event);
21970 function touchstarted(event, ...args) {
21971 if (!filter2.apply(this, arguments))
21973 var touches = event.touches, n2 = touches.length, g = gesture(this, args, event.changedTouches.length === n2).event(event), started, i2, t, p;
21974 nopropagation2(event);
21975 for (i2 = 0; i2 < n2; ++i2) {
21976 t = touches[i2], p = pointer_default(t, this);
21977 p = [p, this.__zoom.invert(p), t.identifier];
21979 g.touch0 = p, started = true, g.taps = 1 + !!touchstarting;
21980 else if (!g.touch1 && g.touch0[2] !== p[2])
21981 g.touch1 = p, g.taps = 0;
21984 touchstarting = clearTimeout(touchstarting);
21987 touchfirst = p[0], touchstarting = setTimeout(function() {
21988 touchstarting = null;
21990 interrupt_default(this);
21994 function touchmoved(event, ...args) {
21995 if (!this.__zooming)
21997 var g = gesture(this, args).event(event), touches = event.changedTouches, n2 = touches.length, i2, t, p, l;
21998 noevent_default2(event);
21999 for (i2 = 0; i2 < n2; ++i2) {
22000 t = touches[i2], p = pointer_default(t, this);
22001 if (g.touch0 && g.touch0[2] === t.identifier)
22003 else if (g.touch1 && g.touch1[2] === t.identifier)
22008 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;
22009 t = scale(t, Math.sqrt(dp / dl));
22010 p = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
22011 l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
22012 } else if (g.touch0)
22013 p = g.touch0[0], l = g.touch0[1];
22016 g.zoom("touch", constrain(translate(t, p, l), g.extent, translateExtent));
22018 function touchended(event, ...args) {
22019 if (!this.__zooming)
22021 var g = gesture(this, args).event(event), touches = event.changedTouches, n2 = touches.length, i2, t;
22022 nopropagation2(event);
22024 clearTimeout(touchending);
22025 touchending = setTimeout(function() {
22026 touchending = null;
22028 for (i2 = 0; i2 < n2; ++i2) {
22030 if (g.touch0 && g.touch0[2] === t.identifier)
22032 else if (g.touch1 && g.touch1[2] === t.identifier)
22035 if (g.touch1 && !g.touch0)
22036 g.touch0 = g.touch1, delete g.touch1;
22038 g.touch0[1] = this.__zoom.invert(g.touch0[0]);
22041 if (g.taps === 2) {
22042 t = pointer_default(t, this);
22043 if (Math.hypot(touchfirst[0] - t[0], touchfirst[1] - t[1]) < tapDistance) {
22044 var p = select_default2(this).on("dblclick.zoom");
22046 p.apply(this, arguments);
22051 zoom.wheelDelta = function(_) {
22052 return arguments.length ? (wheelDelta = typeof _ === "function" ? _ : constant_default4(+_), zoom) : wheelDelta;
22054 zoom.filter = function(_) {
22055 return arguments.length ? (filter2 = typeof _ === "function" ? _ : constant_default4(!!_), zoom) : filter2;
22057 zoom.touchable = function(_) {
22058 return arguments.length ? (touchable = typeof _ === "function" ? _ : constant_default4(!!_), zoom) : touchable;
22060 zoom.extent = function(_) {
22061 return arguments.length ? (extent = typeof _ === "function" ? _ : constant_default4([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
22063 zoom.scaleExtent = function(_) {
22064 return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];
22066 zoom.translateExtent = function(_) {
22067 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]]];
22069 zoom.constrain = function(_) {
22070 return arguments.length ? (constrain = _, zoom) : constrain;
22072 zoom.duration = function(_) {
22073 return arguments.length ? (duration = +_, zoom) : duration;
22075 zoom.interpolate = function(_) {
22076 return arguments.length ? (interpolate = _, zoom) : interpolate;
22078 zoom.on = function() {
22079 var value = listeners.on.apply(listeners, arguments);
22080 return value === listeners ? zoom : value;
22082 zoom.clickDistance = function(_) {
22083 return arguments.length ? (clickDistance2 = (_ = +_) * _, zoom) : Math.sqrt(clickDistance2);
22085 zoom.tapDistance = function(_) {
22086 return arguments.length ? (tapDistance = +_, zoom) : tapDistance;
22091 // modules/geo/raw_mercator.js
22092 function geoRawMercator() {
22093 var project = mercatorRaw;
22094 var k = 512 / Math.PI;
22097 var clipExtent = [[0, 0], [0, 0]];
22098 function projection2(point2) {
22099 point2 = project(point2[0] * Math.PI / 180, point2[1] * Math.PI / 180);
22100 return [point2[0] * k + x, y - point2[1] * k];
22102 projection2.invert = function(point2) {
22103 point2 = project.invert((point2[0] - x) / k, (y - point2[1]) / k);
22104 return point2 && [point2[0] * 180 / Math.PI, point2[1] * 180 / Math.PI];
22106 projection2.scale = function(_) {
22107 if (!arguments.length)
22110 return projection2;
22112 projection2.translate = function(_) {
22113 if (!arguments.length)
22117 return projection2;
22119 projection2.clipExtent = function(_) {
22120 if (!arguments.length)
22123 return projection2;
22125 projection2.transform = function(obj) {
22126 if (!arguments.length)
22127 return identity2.translate(x, y).scale(k);
22131 return projection2;
22133 projection2.stream = transform_default({
22134 point: function(x2, y2) {
22135 var vec = projection2([x2, y2]);
22136 this.stream.point(vec[0], vec[1]);
22139 return projection2;
22142 // modules/geo/ortho.js
22143 function geoOrthoNormalizedDotProduct(a, b, origin) {
22144 if (geoVecEqual(origin, a) || geoVecEqual(origin, b)) {
22147 return geoVecNormalizedDot(a, b, origin);
22149 function geoOrthoFilterDotProduct(dotp, epsilon3, lowerThreshold, upperThreshold, allowStraightAngles) {
22150 var val = Math.abs(dotp);
22151 if (val < epsilon3) {
22153 } else if (allowStraightAngles && Math.abs(val - 1) < epsilon3) {
22155 } else if (val < lowerThreshold || val > upperThreshold) {
22161 function geoOrthoCalcScore(points, isClosed, epsilon3, threshold) {
22163 var first = isClosed ? 0 : 1;
22164 var last = isClosed ? points.length : points.length - 1;
22165 var coords = points.map(function(p) {
22168 var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
22169 var upperThreshold = Math.cos(threshold * Math.PI / 180);
22170 for (var i2 = first; i2 < last; i2++) {
22171 var a = coords[(i2 - 1 + coords.length) % coords.length];
22172 var origin = coords[i2];
22173 var b = coords[(i2 + 1) % coords.length];
22174 var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a, b, origin), epsilon3, lowerThreshold, upperThreshold);
22177 score = score + 2 * Math.min(Math.abs(dotp - 1), Math.min(Math.abs(dotp), Math.abs(dotp + 1)));
22181 function geoOrthoMaxOffsetAngle(coords, isClosed, lessThan) {
22182 var max3 = -Infinity;
22183 var first = isClosed ? 0 : 1;
22184 var last = isClosed ? coords.length : coords.length - 1;
22185 for (var i2 = first; i2 < last; i2++) {
22186 var a = coords[(i2 - 1 + coords.length) % coords.length];
22187 var origin = coords[i2];
22188 var b = coords[(i2 + 1) % coords.length];
22189 var normalizedDotP = geoOrthoNormalizedDotProduct(a, b, origin);
22190 var angle2 = Math.acos(Math.abs(normalizedDotP)) * 180 / Math.PI;
22192 angle2 = 90 - angle2;
22193 if (angle2 >= lessThan)
22198 if (max3 === -Infinity)
22202 function geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles) {
22204 var first = isClosed ? 0 : 1;
22205 var last = isClosed ? coords.length : coords.length - 1;
22206 var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
22207 var upperThreshold = Math.cos(threshold * Math.PI / 180);
22208 for (var i2 = first; i2 < last; i2++) {
22209 var a = coords[(i2 - 1 + coords.length) % coords.length];
22210 var origin = coords[i2];
22211 var b = coords[(i2 + 1) % coords.length];
22212 var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a, b, origin), epsilon3, lowerThreshold, upperThreshold, allowStraightAngles);
22215 if (Math.abs(dotp) > 0)
22222 // modules/util/array.js
22223 function utilArrayIdentical(a, b) {
22227 if (i2 !== b.length)
22230 if (a[i2] !== b[i2])
22235 function utilArrayDifference(a, b) {
22236 var other = new Set(b);
22237 return Array.from(new Set(a)).filter(function(v) {
22238 return !other.has(v);
22241 function utilArrayIntersection(a, b) {
22242 var other = new Set(b);
22243 return Array.from(new Set(a)).filter(function(v) {
22244 return other.has(v);
22247 function utilArrayUnion(a, b) {
22248 var result = new Set(a);
22249 b.forEach(function(v) {
22252 return Array.from(result);
22254 function utilArrayUniq(a) {
22255 return Array.from(new Set(a));
22257 function utilArrayChunk(a, chunkSize) {
22258 if (!chunkSize || chunkSize < 0)
22259 return [a.slice()];
22260 var result = new Array(Math.ceil(a.length / chunkSize));
22261 return Array.from(result, function(item, i2) {
22262 return a.slice(i2 * chunkSize, i2 * chunkSize + chunkSize);
22265 function utilArrayFlatten(a) {
22266 return a.reduce(function(acc, val) {
22267 return acc.concat(val);
22270 function utilArrayGroupBy(a, key) {
22271 return a.reduce(function(acc, item) {
22272 var group = typeof key === "function" ? key(item) : item[key];
22273 (acc[group] = acc[group] || []).push(item);
22277 function utilArrayUniqBy(a, key) {
22278 var seen = /* @__PURE__ */ new Set();
22279 return a.reduce(function(acc, item) {
22280 var val = typeof key === "function" ? key(item) : item[key];
22281 if (val && !seen.has(val)) {
22289 // modules/util/util.js
22290 var import_diacritics = __toESM(require_diacritics());
22292 // modules/util/svg_paths_rtl_fix.js
22293 var import_alif_toolkit = __toESM(require_lib());
22294 var rtlRegex = /[\u0590-\u05FF\u0600-\u06FF\u0750-\u07BF\u08A0–\u08BF]/;
22295 function fixRTLTextForSvg(inputText) {
22296 var ret = "", rtlBuffer = [];
22297 var arabicRegex = /[\u0600-\u06FF]/g;
22298 var arabicDiacritics = /[\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06ED]/g;
22299 var arabicMath = /[\u0660-\u066C\u06F0-\u06F9]+/g;
22300 var thaanaVowel = /[\u07A6-\u07B0]/;
22301 var hebrewSign = /[\u0591-\u05bd\u05bf\u05c1-\u05c5\u05c7]/;
22302 if (arabicRegex.test(inputText)) {
22303 inputText = (0, import_alif_toolkit.WordShaper)(inputText);
22305 for (var n2 = 0; n2 < inputText.length; n2++) {
22306 var c = inputText[n2];
22307 if (arabicMath.test(c)) {
22308 ret += rtlBuffer.reverse().join("");
22311 if (rtlBuffer.length && arabicMath.test(rtlBuffer[rtlBuffer.length - 1])) {
22312 ret += rtlBuffer.reverse().join("");
22315 if ((thaanaVowel.test(c) || hebrewSign.test(c) || arabicDiacritics.test(c)) && rtlBuffer.length) {
22316 rtlBuffer[rtlBuffer.length - 1] += c;
22317 } else if (rtlRegex.test(c) || c.charCodeAt(0) >= 64336 && c.charCodeAt(0) <= 65023 || c.charCodeAt(0) >= 65136 && c.charCodeAt(0) <= 65279) {
22319 } else if (c === " " && rtlBuffer.length) {
22320 rtlBuffer = [rtlBuffer.reverse().join("") + " "];
22322 ret += rtlBuffer.reverse().join("") + c;
22327 ret += rtlBuffer.reverse().join("");
22331 // modules/core/preferences.js
22334 _storage = localStorage;
22337 _storage = _storage || (() => {
22340 getItem: (k) => s[k],
22341 setItem: (k, v) => s[k] = v,
22342 removeItem: (k) => delete s[k]
22345 var _listeners = {};
22346 function corePreferences(k, v) {
22349 return _storage.getItem(k);
22350 else if (v === null)
22351 _storage.removeItem(k);
22353 _storage.setItem(k, v);
22354 if (_listeners[k]) {
22355 _listeners[k].forEach((handler) => handler(v));
22359 if (typeof console !== "undefined") {
22360 console.error("localStorage quota exceeded");
22365 corePreferences.onChange = function(k, handler) {
22366 _listeners[k] = _listeners[k] || [];
22367 _listeners[k].push(handler);
22370 // modules/core/file_fetcher.js
22371 var import_vparse = __toESM(require_vparse());
22374 var presetsCdnUrl = "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@{presets_version}/";
22375 var ociCdnUrl = "https://cdn.jsdelivr.net/npm/osm-community-index@{version}/";
22376 var wmfSitematrixCdnUrl = "https://cdn.jsdelivr.net/npm/wmf-sitematrix@{version}/";
22377 var nsiCdnUrl = "https://cdn.jsdelivr.net/npm/name-suggestion-index@{version}/";
22378 var osmApiConnections = [
22380 url: "https://www.openstreetmap.org",
22381 client_id: "0tmNTmd0Jo1dQp4AUmMBLtGiD9YpMuXzHefitcuVStc",
22382 client_secret: "BTlNrNxIPitHdL4sP2clHw5KLoee9aKkA7dQbc0Bj7Q"
22385 url: "https://api06.dev.openstreetmap.org",
22386 client_id: "Ee1wWJ6UlpERbF6BfTNOpwn0R8k_06mvMXdDUkeHMgw",
22387 client_secret: "OnfWFC-JkZNHyYdr_viNn_h_RTZXRslKcUxllOXqf5g"
22390 var taginfoApiUrl = "https://taginfo.openstreetmap.org/api/4/";
22391 var nominatimApiUrl = "https://nominatim.openstreetmap.org/";
22394 var package_default = {
22397 description: "A friendly editor for OpenStreetMap",
22398 main: "dist/iD.min.js",
22399 repository: "github:openstreetmap/iD",
22400 homepage: "https://github.com/openstreetmap/iD",
22401 bugs: "https://github.com/openstreetmap/iD/issues",
22408 all: "run-s clean build dist",
22409 build: "run-s build:css build:data build:js",
22410 "build:css": "node scripts/build_css.js",
22411 "build:data": "shx mkdir -p dist/data && node scripts/build_data.js",
22412 "build:stats": "esbuild-visualizer --metadata dist/esbuild.json --exclude *.png --filename docs/statistics.html",
22413 "build:js": "node config/esbuild.config.mjs",
22414 "build:js:watch": "node config/esbuild.config.mjs --watch",
22415 clean: "shx rm -f dist/esbuild.json dist/*.js dist/*.map dist/*.css dist/img/*.svg",
22416 dist: "run-p dist:**",
22417 "dist:mapillary": "shx mkdir -p dist/mapillary-js && shx cp -R node_modules/mapillary-js/dist/* dist/mapillary-js/",
22418 "dist:pannellum": "shx mkdir -p dist/pannellum-streetside && shx cp -R node_modules/pannellum/build/* dist/pannellum-streetside/",
22419 "dist:min": "node config/esbuild.config.min.mjs",
22420 "dist:svg:iD": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "iD-%s" --symbol-sprite dist/img/iD-sprite.svg "svg/iD-sprite/**/*.svg"',
22421 "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',
22422 "dist:svg:fa": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/fa-sprite.svg svg/fontawesome/*.svg",
22423 "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',
22424 "dist:svg:mapillary:signs": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/mapillary-sprite.svg node_modules/mapillary_sprite_source/package_signs/*.svg",
22425 "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",
22426 "dist:svg:temaki": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "temaki-%s" --symbol-sprite dist/img/temaki-sprite.svg node_modules/@ideditor/temaki/icons/*.svg',
22427 imagery: "node scripts/update_imagery.js",
22428 lint: "eslint scripts test/spec modules",
22429 "lint:fix": "eslint scripts test/spec modules --fix",
22430 start: "run-s build:js start:server",
22431 "start:watch": "run-p build:js:watch start:server",
22432 "start:server": "node scripts/server.js",
22433 test: "npm-run-all -s lint build test:spec",
22434 "test:spec": "karma start config/karma.conf.js",
22435 translations: "node scripts/update_locales.js"
22438 "@ideditor/country-coder": "~5.0.3",
22439 "@ideditor/location-conflation": "~1.0.2",
22440 "@mapbox/geojson-area": "^0.2.2",
22441 "@mapbox/sexagesimal": "1.2.0",
22442 "@mapbox/vector-tile": "^1.3.1",
22443 "@tmcw/togeojson": "^5.2.1",
22444 "@turf/bbox": "^6.0.0",
22445 "@turf/bbox-clip": "^6.0.0",
22446 "abortcontroller-polyfill": "^1.4.0",
22447 "aes-js": "^3.1.2",
22448 "alif-toolkit": "^1.2.9",
22449 "core-js-bundle": "^3.19.0",
22450 diacritics: "1.3.0",
22451 "fast-deep-equal": "~3.1.1",
22452 "fast-json-stable-stringify": "2.1.0",
22453 "lodash-es": "~4.17.15",
22455 "node-diff3": "~3.1.0",
22456 "osm-auth": "~2.0.0",
22457 pannellum: "2.5.6",
22459 "polygon-clipping": "~0.15.1",
22461 "whatwg-fetch": "^3.4.1",
22462 "which-polygon": "2.2.0"
22465 "@fortawesome/fontawesome-svg-core": "~6.2.0",
22466 "@fortawesome/free-brands-svg-icons": "~6.2.0",
22467 "@fortawesome/free-regular-svg-icons": "~6.2.0",
22468 "@fortawesome/free-solid-svg-icons": "~6.2.0",
22469 "@ideditor/temaki": "~5.2.0",
22470 "@mapbox/maki": "^8.0.0",
22471 "@openstreetmap/id-tagging-schema": "^5.0.1",
22472 autoprefixer: "^10.0.1",
22476 "cldr-core": "^41.0.0",
22477 "cldr-localenames-full": "^41.0.0",
22478 "concat-files": "^0.1.1",
22480 "editor-layer-index": "github:osmlab/editor-layer-index#gh-pages",
22481 esbuild: "^0.15.7",
22482 "esbuild-visualizer": "^0.3.1",
22484 "fetch-mock": "^9.11.0",
22488 "js-yaml": "^4.0.0",
22489 "json-stringify-pretty-compact": "^3.0.0",
22491 "karma-chrome-launcher": "^3.1.0",
22492 "karma-coverage": "2.1.1",
22493 "karma-mocha": "^2.0.1",
22494 "karma-remap-istanbul": "^0.6.0",
22495 mapillary_sprite_source: "^1.8.0",
22496 "mapillary-js": "4.1.1",
22497 minimist: "^1.2.3",
22499 "name-suggestion-index": "~6.0",
22500 "node-fetch": "^2.6.1",
22501 "npm-run-all": "^4.0.0",
22502 "osm-community-index": "~5.3.0",
22504 "postcss-selector-prepend": "^0.5.0",
22508 "sinon-chai": "^3.7.0",
22510 "static-server": "^2.2.1",
22511 "svg-sprite": "2.0.1",
22518 "> 0.2%, last 6 major versions, Firefox ESR, maintained node versions"
22522 // modules/core/file_fetcher.js
22523 var _mainFileFetcher = coreFileFetcher();
22524 function coreFileFetcher() {
22525 const ociVersion = package_default.dependencies["osm-community-index"] || package_default.devDependencies["osm-community-index"];
22526 const v = (0, import_vparse.default)(ociVersion);
22527 const ociVersionMinor = `${v.major}.${v.minor}`;
22528 const presetsVersion = package_default.devDependencies["@openstreetmap/id-tagging-schema"];
22530 let _inflight4 = {};
22532 "address_formats": "data/address_formats.min.json",
22533 "imagery": "data/imagery.min.json",
22534 "intro_graph": "data/intro_graph.min.json",
22535 "keepRight": "data/keepRight.min.json",
22536 "languages": "data/languages.min.json",
22537 "locales": "locales/index.min.json",
22538 "phone_formats": "data/phone_formats.min.json",
22539 "qa_data": "data/qa_data.min.json",
22540 "shortcuts": "data/shortcuts.min.json",
22541 "territory_languages": "data/territory_languages.min.json",
22542 "oci_defaults": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/defaults.min.json",
22543 "oci_features": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/featureCollection.min.json",
22544 "oci_resources": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/resources.min.json",
22545 "presets_package": presetsCdnUrl.replace("{presets_version}", presetsVersion) + "package.json",
22546 "deprecated": presetsCdnUrl + "dist/deprecated.min.json",
22547 "discarded": presetsCdnUrl + "dist/discarded.min.json",
22548 "preset_categories": presetsCdnUrl + "dist/preset_categories.min.json",
22549 "preset_defaults": presetsCdnUrl + "dist/preset_defaults.min.json",
22550 "preset_fields": presetsCdnUrl + "dist/fields.min.json",
22551 "preset_presets": presetsCdnUrl + "dist/presets.min.json",
22552 "wmf_sitematrix": wmfSitematrixCdnUrl.replace("{version}", "0.1") + "wikipedia.min.json"
22554 let _cachedData = {};
22555 _this.cache = () => _cachedData;
22556 _this.get = (which) => {
22557 if (_cachedData[which]) {
22558 return Promise.resolve(_cachedData[which]);
22560 const file = _fileMap[which];
22561 const url = file && _this.asset(file);
22563 return Promise.reject(`Unknown data file for "${which}"`);
22565 if (url.includes("{presets_version}")) {
22566 return _this.get("presets_package").then((result) => {
22567 const presetsVersion2 = result.version;
22568 return getUrl(url.replace("{presets_version}", presetsVersion2), which);
22571 return getUrl(url);
22574 function getUrl(url, which) {
22575 let prom = _inflight4[url];
22577 _inflight4[url] = prom = fetch(url).then((response) => {
22578 if (!response.ok || !response.json) {
22579 throw new Error(response.status + " " + response.statusText);
22581 if (response.status === 204 || response.status === 205)
22583 return response.json();
22584 }).then((result) => {
22585 delete _inflight4[url];
22587 throw new Error(`No data loaded for "${which}"`);
22589 _cachedData[which] = result;
22591 }).catch((err) => {
22592 delete _inflight4[url];
22598 _this.fileMap = function(val) {
22599 if (!arguments.length)
22604 let _assetPath = "";
22605 _this.assetPath = function(val) {
22606 if (!arguments.length)
22611 let _assetMap = {};
22612 _this.assetMap = function(val) {
22613 if (!arguments.length)
22618 _this.asset = (val) => {
22619 if (/^http(s)?:\/\//i.test(val))
22621 const filename = _assetPath + val;
22622 return _assetMap[filename] || filename;
22627 // node_modules/@ideditor/country-coder/dist/country-coder.mjs
22628 var import_which_polygon = __toESM(require_which_polygon(), 1);
22629 var type = "FeatureCollection";
22631 { 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]]]] } },
22632 { 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]]]] } },
22633 { 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]]]] } },
22634 { 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]]]] } },
22635 { 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]]]] } },
22636 { 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]]]] } },
22637 { 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]]]] } },
22638 { 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]]]] } },
22639 { 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]]]] } },
22640 { 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]]]] } },
22641 { 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]]]] } },
22642 { 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]]]] } },
22643 { 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]]]] } },
22644 { 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]]]] } },
22645 { 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]]]] } },
22646 { 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]]]] } },
22647 { 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]]]] } },
22648 { 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]]]] } },
22649 { 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]]]] } },
22650 { type: "Feature", properties: { wikidata: "Q12837", nameEn: "Iberia", level: "sharedLandform" }, geometry: null },
22651 { 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]]]] } },
22652 { 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]]]] } },
22653 { type: "Feature", properties: { wikidata: "Q22890", nameEn: "Ireland", level: "sharedLandform" }, geometry: null },
22654 { type: "Feature", properties: { wikidata: "Q23666", nameEn: "Great Britain", country: "GB", level: "sharedLandform" }, geometry: null },
22655 { 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]]]] } },
22656 { 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]]]] } },
22657 { 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]]]] } },
22658 { 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]]]] } },
22659 { 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]]]] } },
22660 { 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]]]] } },
22661 { 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]]]] } },
22662 { 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]]]] } },
22663 { 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]]]] } },
22664 { 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]]]] } },
22665 { 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]]]] } },
22666 { 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]]]] } },
22667 { type: "Feature", properties: { wikidata: "Q35657", nameEn: "US States", country: "US", level: "subcountryGroup" }, geometry: null },
22668 { type: "Feature", properties: { wikidata: "Q36117", nameEn: "Borneo", level: "sharedLandform" }, geometry: null },
22669 { 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]]]] } },
22670 { type: "Feature", properties: { wikidata: "Q37362", nameEn: "Akrotiri and Dhekelia", aliases: ["SBA"], country: "GB" }, geometry: null },
22671 { 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]]]] } },
22672 { 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]]]] } },
22673 { 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]]]] } },
22674 { 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]]]] } },
22675 { 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]]]] } },
22676 { 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]]]] } },
22677 { type: "Feature", properties: { wikidata: "Q46395", nameEn: "British Overseas Territories", aliases: ["BOTS", "UKOTS"], country: "GB", level: "subcountryGroup" }, geometry: null },
22678 { 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]]]] } },
22679 { 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]]]] } },
22680 { 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]]]] } },
22681 { 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]]]] } },
22682 { type: "Feature", properties: { wikidata: "Q105472", nameEn: "Macaronesia", level: "sharedLandform" }, geometry: null },
22683 { 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]]]] } },
22684 { 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]]]] } },
22685 { 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]]]] } },
22686 { 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]]]] } },
22687 { 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]]]] } },
22688 { 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]]]] } },
22689 { 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]]]] } },
22690 { 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]]]] } },
22691 { 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]]]] } },
22692 { 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]]]] } },
22693 { type: "Feature", properties: { wikidata: "Q153732", nameEn: "Mariana Islands", level: "sharedLandform" }, geometry: null },
22694 { 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]]]] } },
22695 { 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]]]] } },
22696 { type: "Feature", properties: { wikidata: "Q185086", nameEn: "Crown Dependencies", country: "GB", level: "subcountryGroup" }, geometry: null },
22697 { 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]]]] } },
22698 { type: "Feature", properties: { wikidata: "Q191011", nameEn: "Plazas de soberan\xEDa", country: "ES" }, geometry: null },
22699 { 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]]]] } },
22700 { 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]]]] } },
22701 { 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]]]] } },
22702 { 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]]]] } },
22703 { 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]]]] } },
22704 { type: "Feature", properties: { wikidata: "Q644636", nameEn: "Cyprus", level: "sharedLandform" }, geometry: null },
22705 { type: "Feature", properties: { wikidata: "Q851132", nameEn: "New Zealand Outlying Islands", country: "NZ", level: "subcountryGroup" }, geometry: null },
22706 { 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]]]] } },
22707 { 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]]]] } },
22708 { 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]]]] } },
22709 { 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]]]] } },
22710 { type: "Feature", properties: { wikidata: "Q1352230", nameEn: "US Territories", country: "US", level: "subcountryGroup" }, geometry: null },
22711 { type: "Feature", properties: { wikidata: "Q1451600", nameEn: "Overseas Countries and Territories of the EU", aliases: ["OCT"], level: "subunion" }, geometry: null },
22712 { 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]]]] } },
22713 { 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]]]] } },
22714 { 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]]]] } },
22715 { 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]]]] } },
22716 { 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]]]] } },
22717 { 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]]]] } },
22718 { 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]]]] } },
22719 { 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]]]] } },
22720 { type: "Feature", properties: { wikidata: "Q2914565", nameEn: "Autonomous Regions of Portugal", country: "PT", level: "subcountryGroup" }, geometry: null },
22721 { 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]]]] } },
22722 { 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]]]] } },
22723 { type: "Feature", properties: { wikidata: "Q3320166", nameEn: "Outermost Regions of the EU", aliases: ["OMR"], level: "subunion" }, geometry: null },
22724 { type: "Feature", properties: { wikidata: "Q3336843", nameEn: "Countries of the United Kingdom", aliases: ["GB-UKM"], country: "GB", level: "subcountryGroup" }, geometry: null },
22725 { 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]]]] } },
22726 { 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]]]] } },
22727 { 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]]]] } },
22728 { 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]]]] } },
22729 { 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]]]] } },
22730 { 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]]]] } },
22731 { type: "Feature", properties: { m49: "001", wikidata: "Q2", nameEn: "World", aliases: ["Earth", "Planet"], level: "world" }, geometry: null },
22732 { type: "Feature", properties: { m49: "002", wikidata: "Q15", nameEn: "Africa", level: "region" }, geometry: null },
22733 { type: "Feature", properties: { m49: "003", wikidata: "Q49", nameEn: "North America", level: "subregion" }, geometry: null },
22734 { type: "Feature", properties: { m49: "005", wikidata: "Q18", nameEn: "South America", level: "intermediateRegion" }, geometry: null },
22735 { type: "Feature", properties: { m49: "009", wikidata: "Q538", nameEn: "Oceania", level: "region" }, geometry: null },
22736 { type: "Feature", properties: { m49: "011", wikidata: "Q4412", nameEn: "Western Africa", level: "intermediateRegion" }, geometry: null },
22737 { type: "Feature", properties: { m49: "013", wikidata: "Q27611", nameEn: "Central America", level: "intermediateRegion" }, geometry: null },
22738 { type: "Feature", properties: { m49: "014", wikidata: "Q27407", nameEn: "Eastern Africa", level: "intermediateRegion" }, geometry: null },
22739 { type: "Feature", properties: { m49: "015", wikidata: "Q27381", nameEn: "Northern Africa", level: "subregion" }, geometry: null },
22740 { type: "Feature", properties: { m49: "017", wikidata: "Q27433", nameEn: "Middle Africa", level: "intermediateRegion" }, geometry: null },
22741 { type: "Feature", properties: { m49: "018", wikidata: "Q27394", nameEn: "Southern Africa", level: "intermediateRegion" }, geometry: null },
22742 { type: "Feature", properties: { m49: "019", wikidata: "Q828", nameEn: "Americas", level: "region" }, geometry: null },
22743 { type: "Feature", properties: { m49: "021", wikidata: "Q2017699", nameEn: "Northern America", level: "subregion" }, geometry: null },
22744 { type: "Feature", properties: { m49: "029", wikidata: "Q664609", nameEn: "Caribbean", level: "intermediateRegion" }, geometry: null },
22745 { type: "Feature", properties: { m49: "030", wikidata: "Q27231", nameEn: "Eastern Asia", level: "subregion" }, geometry: null },
22746 { type: "Feature", properties: { m49: "034", wikidata: "Q771405", nameEn: "Southern Asia", level: "subregion" }, geometry: null },
22747 { type: "Feature", properties: { m49: "035", wikidata: "Q11708", nameEn: "South-eastern Asia", level: "subregion" }, geometry: null },
22748 { type: "Feature", properties: { m49: "039", wikidata: "Q27449", nameEn: "Southern Europe", level: "subregion" }, geometry: null },
22749 { type: "Feature", properties: { m49: "053", wikidata: "Q45256", nameEn: "Australia and New Zealand", aliases: ["Australasia"], level: "subregion" }, geometry: null },
22750 { type: "Feature", properties: { m49: "054", wikidata: "Q37394", nameEn: "Melanesia", level: "subregion" }, geometry: null },
22751 { type: "Feature", properties: { m49: "057", wikidata: "Q3359409", nameEn: "Micronesia", level: "subregion" }, geometry: null },
22752 { type: "Feature", properties: { m49: "061", wikidata: "Q35942", nameEn: "Polynesia", level: "subregion" }, geometry: null },
22753 { type: "Feature", properties: { m49: "142", wikidata: "Q48", nameEn: "Asia", level: "region" }, geometry: null },
22754 { type: "Feature", properties: { m49: "143", wikidata: "Q27275", nameEn: "Central Asia", level: "subregion" }, geometry: null },
22755 { type: "Feature", properties: { m49: "145", wikidata: "Q27293", nameEn: "Western Asia", level: "subregion" }, geometry: null },
22756 { type: "Feature", properties: { m49: "150", wikidata: "Q46", nameEn: "Europe", level: "region" }, geometry: null },
22757 { type: "Feature", properties: { m49: "151", wikidata: "Q27468", nameEn: "Eastern Europe", level: "subregion" }, geometry: null },
22758 { type: "Feature", properties: { m49: "154", wikidata: "Q27479", nameEn: "Northern Europe", level: "subregion" }, geometry: null },
22759 { type: "Feature", properties: { m49: "155", wikidata: "Q27496", nameEn: "Western Europe", level: "subregion" }, geometry: null },
22760 { type: "Feature", properties: { m49: "202", wikidata: "Q132959", nameEn: "Sub-Saharan Africa", level: "subregion" }, geometry: null },
22761 { type: "Feature", properties: { m49: "419", wikidata: "Q72829598", nameEn: "Latin America and the Caribbean", level: "subregion" }, geometry: null },
22762 { 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]]]] } },
22763 { type: "Feature", properties: { m49: "830", wikidata: "Q42314", nameEn: "Channel Islands", level: "intermediateRegion" }, geometry: null },
22764 { 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]]]] } },
22765 { 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]]]] } },
22766 { 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]]]] } },
22767 { 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]]]] } },
22768 { 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]]]] } },
22769 { 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]]]] } },
22770 { 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]]]] } },
22771 { 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]]]] } },
22772 { 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]]]] } },
22773 { 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]]]] } },
22774 { 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]]]] } },
22775 { 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]]]] } },
22776 { 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]]]] } },
22777 { type: "Feature", properties: { iso1A2: "AU", iso1A3: "AUS", iso1N3: "036", wikidata: "Q408", nameEn: "Australia" }, geometry: null },
22778 { 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]]]] } },
22779 { 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]]]] } },
22780 { 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]]]] } },
22781 { 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]]]] } },
22782 { 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]]]] } },
22783 { 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]]]] } },
22784 { 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]]]] } },
22785 { 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]]]] } },
22786 { 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]]]] } },
22787 { 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]]]] } },
22788 { 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]]]] } },
22789 { 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]]]] } },
22790 { 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]]]] } },
22791 { 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]]]] } },
22792 { 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]]]] } },
22793 { 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]]]] } },
22794 { type: "Feature", properties: { iso1A2: "BQ", iso1A3: "BES", iso1N3: "535", wikidata: "Q27561", nameEn: "Caribbean Netherlands", country: "NL" }, geometry: null },
22795 { 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]]]] } },
22796 { 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]]]] } },
22797 { 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]]]] } },
22798 { 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]]]] } },
22799 { 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]]]] } },
22800 { 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]]]] } },
22801 { 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]]]] } },
22802 { 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]]]] } },
22803 { 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]]]] } },
22804 { 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]]]] } },
22805 { 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]]]] } },
22806 { 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]]]] } },
22807 { type: "Feature", properties: { iso1A2: "CH", iso1A3: "CHE", iso1N3: "756", wikidata: "Q39", nameEn: "Switzerland", groups: ["155", "150", "UN"], callingCodes: ["41"] }, geometry: { type: "MultiPolygon", coordinates: [[[[8.72809, 47.69282], [8.72617, 47.69651], [8.73671, 47.7169], [8.70543, 47.73121], [8.74251, 47.75168], [8.71778, 47.76571], [8.68985, 47.75686], [8.68022, 47.78599], [8.65292, 47.80066], [8.64425, 47.76398], [8.62408, 47.7626], [8.61657, 47.79998], [8.56415, 47.80633], [8.56814, 47.78001], [8.48868, 47.77215], [8.45771, 47.7493], [8.44807, 47.72426], [8.40569, 47.69855], [8.4211, 47.68407], [8.40473, 47.67499], [8.41346, 47.66676], [8.42264, 47.66667], [8.44711, 47.65379], [8.4667, 47.65747], [8.46605, 47.64103], [8.49656, 47.64709], [8.5322, 47.64687], [8.52801, 47.66059], [8.56141, 47.67088], [8.57683, 47.66158], [8.6052, 47.67258], [8.61113, 47.66332], [8.62884, 47.65098], [8.62049, 47.63757], [8.60412, 47.63735], [8.61471, 47.64514], [8.60701, 47.65271], [8.59545, 47.64298], [8.60348, 47.61204], [8.57586, 47.59537], [8.55756, 47.62394], [8.51686, 47.63476], [8.50747, 47.61897], [8.45578, 47.60121], [8.46637, 47.58389], [8.48949, 47.588], [8.49431, 47.58107], [8.43235, 47.56617], [8.39477, 47.57826], [8.38273, 47.56608], [8.32735, 47.57133], [8.30277, 47.58607], [8.29524, 47.5919], [8.29722, 47.60603], [8.2824, 47.61225], [8.26313, 47.6103], [8.25863, 47.61571], [8.23809, 47.61204], [8.22577, 47.60385], [8.22011, 47.6181], [8.20617, 47.62141], [8.19378, 47.61636], [8.1652, 47.5945], [8.14947, 47.59558], [8.13823, 47.59147], [8.13662, 47.58432], [8.11543, 47.5841], [8.10395, 47.57918], [8.10002, 47.56504], [8.08557, 47.55768], [8.06663, 47.56374], [8.04383, 47.55443], [8.02136, 47.55096], [8.00113, 47.55616], [7.97581, 47.55493], [7.95682, 47.55789], [7.94494, 47.54511], [7.91251, 47.55031], [7.90673, 47.57674], [7.88664, 47.58854], [7.84412, 47.5841], [7.81901, 47.58798], [7.79486, 47.55691], [7.75261, 47.54599], [7.71961, 47.54219], [7.69642, 47.53297], [7.68101, 47.53232], [7.6656, 47.53752], [7.66174, 47.54554], [7.65083, 47.54662], [7.63338, 47.56256], [7.67655, 47.56435], [7.68904, 47.57133], [7.67115, 47.5871], [7.68486, 47.59601], [7.69385, 47.60099], [7.68229, 47.59905], [7.67395, 47.59212], [7.64599, 47.59695], [7.64213, 47.5944], [7.64309, 47.59151], [7.61929, 47.57683], [7.60459, 47.57869], [7.60523, 47.58519], [7.58945, 47.59017], [7.58386, 47.57536], [7.56684, 47.57785], [7.56548, 47.57617], [7.55689, 47.57232], [7.55652, 47.56779], [7.53634, 47.55553], [7.52831, 47.55347], [7.51723, 47.54578], [7.50873, 47.54546], [7.49691, 47.53821], [7.50588, 47.52856], [7.51904, 47.53515], [7.53199, 47.5284], [7.5229, 47.51644], [7.49804, 47.51798], [7.51076, 47.49651], [7.47534, 47.47932], [7.43356, 47.49712], [7.42923, 47.48628], [7.4583, 47.47216], [7.4462, 47.46264], [7.43088, 47.45846], [7.40308, 47.43638], [7.35603, 47.43432], [7.33526, 47.44186], [7.24669, 47.4205], [7.17026, 47.44312], [7.19583, 47.49455], [7.16249, 47.49025], [7.12781, 47.50371], [7.07425, 47.48863], [7.0231, 47.50522], [6.98425, 47.49432], [7.0024, 47.45264], [6.93953, 47.43388], [6.93744, 47.40714], [6.88542, 47.37262], [6.87959, 47.35335], [7.03125, 47.36996], [7.0564, 47.35134], [7.05305, 47.33304], [6.94316, 47.28747], [6.95108, 47.26428], [6.9508, 47.24338], [6.8489, 47.15933], [6.76788, 47.1208], [6.68823, 47.06616], [6.71531, 47.0494], [6.43341, 46.92703], [6.46456, 46.88865], [6.43216, 46.80336], [6.45209, 46.77502], [6.38351, 46.73171], [6.27135, 46.68251], [6.11084, 46.57649], [6.1567, 46.54402], [6.07269, 46.46244], [6.08427, 46.44305], [6.06407, 46.41676], [6.09926, 46.40768], [6.15016, 46.3778], [6.15985, 46.37721], [6.16987, 46.36759], [6.15738, 46.3491], [6.13876, 46.33844], [6.1198, 46.31157], [6.11697, 46.29547], [6.1013, 46.28512], [6.11926, 46.2634], [6.12446, 46.25059], [6.10071, 46.23772], [6.08563, 46.24651], [6.07072, 46.24085], [6.0633, 46.24583], [6.05029, 46.23518], [6.04602, 46.23127], [6.03342, 46.2383], [6.02461, 46.23313], [5.97542, 46.21525], [5.96515, 46.19638], [5.99573, 46.18587], [5.98846, 46.17046], [5.98188, 46.17392], [5.97508, 46.15863], [5.9641, 46.14412], [5.95781, 46.12925], [5.97893, 46.13303], [5.9871, 46.14499], [6.01791, 46.14228], [6.03614, 46.13712], [6.04564, 46.14031], [6.05203, 46.15191], [6.07491, 46.14879], [6.09199, 46.15191], [6.09926, 46.14373], [6.13397, 46.1406], [6.15305, 46.15194], [6.18116, 46.16187], [6.18871, 46.16644], [6.18707, 46.17999], [6.19552, 46.18401], [6.19807, 46.18369], [6.20539, 46.19163], [6.21114, 46.1927], [6.21273, 46.19409], [6.21603, 46.19507], [6.21844, 46.19837], [6.22222, 46.19888], [6.22175, 46.20045], [6.23544, 46.20714], [6.23913, 46.20511], [6.24821, 46.20531], [6.26007, 46.21165], [6.27694, 46.21566], [6.29663, 46.22688], [6.31041, 46.24417], [6.29474, 46.26221], [6.26749, 46.24745], [6.24952, 46.26255], [6.23775, 46.27822], [6.25137, 46.29014], [6.24826, 46.30175], [6.21981, 46.31304], [6.25432, 46.3632], [6.53358, 46.45431], [6.82312, 46.42661], [6.8024, 46.39171], [6.77152, 46.34784], [6.86052, 46.28512], [6.78968, 46.14058], [6.89321, 46.12548], [6.87868, 46.03855], [6.93862, 46.06502], [7.00946, 45.9944], [7.04151, 45.92435], [7.10685, 45.85653], [7.56343, 45.97421], [7.85949, 45.91485], [7.9049, 45.99945], [7.98881, 45.99867], [8.02906, 46.10331], [8.11383, 46.11577], [8.16866, 46.17817], [8.08814, 46.26692], [8.31162, 46.38044], [8.30648, 46.41587], [8.42464, 46.46367], [8.46317, 46.43712], [8.45032, 46.26869], [8.62242, 46.12112], [8.75697, 46.10395], [8.80778, 46.10085], [8.85617, 46.0748], [8.79414, 46.00913], [8.78585, 45.98973], [8.79362, 45.99207], [8.8319, 45.9879], [8.85121, 45.97239], [8.86688, 45.96135], [8.88904, 45.95465], [8.93649, 45.86775], [8.94372, 45.86587], [8.93504, 45.86245], [8.91129, 45.8388], [8.94737, 45.84285], [8.9621, 45.83707], [8.99663, 45.83466], [9.00324, 45.82055], [9.0298, 45.82127], [9.03279, 45.82865], [9.03793, 45.83548], [9.03505, 45.83976], [9.04059, 45.8464], [9.04546, 45.84968], [9.06642, 45.8761], [9.09065, 45.89906], [8.99257, 45.9698], [9.01618, 46.04928], [9.24503, 46.23616], [9.29226, 46.32717], [9.25502, 46.43743], [9.28136, 46.49685], [9.36128, 46.5081], [9.40487, 46.46621], [9.45936, 46.50873], [9.46117, 46.37481], [9.57015, 46.2958], [9.71273, 46.29266], [9.73086, 46.35071], [9.95249, 46.38045], [10.07055, 46.21668], [10.14439, 46.22992], [10.17862, 46.25626], [10.10506, 46.3372], [10.165, 46.41051], [10.03715, 46.44479], [10.10307, 46.61003], [10.23674, 46.63484], [10.25309, 46.57432], [10.46136, 46.53164], [10.49375, 46.62049], [10.44686, 46.64162], [10.40475, 46.63671], [10.38659, 46.67847], [10.47197, 46.85698], [10.48376, 46.93891], [10.36933, 47.00212], [10.30031, 46.92093], [10.24128, 46.93147], [10.22675, 46.86942], [10.10715, 46.84296], [9.98058, 46.91434], [9.88266, 46.93343], [9.87935, 47.01337], [9.60717, 47.06091], [9.55721, 47.04762], [9.54041, 47.06495], [9.47548, 47.05257], [9.47139, 47.06402], [9.51362, 47.08505], [9.52089, 47.10019], [9.51044, 47.13727], [9.48774, 47.17402], [9.4891, 47.19346], [9.50318, 47.22153], [9.52406, 47.24959], [9.53116, 47.27029], [9.54773, 47.2809], [9.55857, 47.29919], [9.58513, 47.31334], [9.59978, 47.34671], [9.62476, 47.36639], [9.65427, 47.36824], [9.66243, 47.37136], [9.6711, 47.37824], [9.67445, 47.38429], [9.67334, 47.39191], [9.6629, 47.39591], [9.65136, 47.40504], [9.65043, 47.41937], [9.6446, 47.43233], [9.64483, 47.43842], [9.65863, 47.44847], [9.65728, 47.45383], [9.6423, 47.45599], [9.62475, 47.45685], [9.62158, 47.45858], [9.60841, 47.47178], [9.60484, 47.46358], [9.60205, 47.46165], [9.59482, 47.46305], [9.58208, 47.48344], [9.56312, 47.49495], [9.55125, 47.53629], [9.25619, 47.65939], [9.18203, 47.65598], [9.17593, 47.65399], [9.1755, 47.65584], [9.1705, 47.65513], [9.15181, 47.66904], [9.13845, 47.66389], [9.09891, 47.67801], [9.02093, 47.6868], [8.94093, 47.65596], [8.89946, 47.64769], [8.87625, 47.65441], [8.87383, 47.67045], [8.85065, 47.68209], [8.86989, 47.70504], [8.82002, 47.71458], [8.80663, 47.73821], [8.77309, 47.72059], [8.76965, 47.7075], [8.79966, 47.70222], [8.79511, 47.67462], [8.75856, 47.68969], [8.72809, 47.69282]], [[8.95861, 45.96485], [8.96668, 45.98436], [8.97741, 45.98317], [8.97604, 45.96151], [8.95861, 45.96485]], [[8.70847, 47.68904], [8.68985, 47.69552], [8.66837, 47.68437], [8.65769, 47.68928], [8.67508, 47.6979], [8.66416, 47.71367], [8.70237, 47.71453], [8.71773, 47.69088], [8.70847, 47.68904]]]] } },
22808 { 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]]]] } },
22809 { 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]]]] } },
22810 { 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]]]] } },
22811 { 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]]]] } },
22812 { type: "Feature", properties: { iso1A2: "CN", iso1A3: "CHN", iso1N3: "156", wikidata: "Q148", nameEn: "People's Republic of China" }, geometry: null },
22813 { 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]]]] } },
22814 { 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]]]] } },
22815 { 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]]]] } },
22816 { 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]]]] } },
22817 { 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]]]] } },
22818 { 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]]]] } },
22819 { 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]]]] } },
22820 { 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]]]] } },
22821 { 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]]]] } },
22822 { 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]]]] } },
22823 { 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]]]] } },
22824 { 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]]]] } },
22825 { type: "Feature", properties: { iso1A2: "DK", iso1A3: "DNK", iso1N3: "208", wikidata: "Q756617", nameEn: "Kingdom of Denmark" }, geometry: null },
22826 { 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]]]] } },
22827 { 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]]]] } },
22828 { 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]]]] } },
22829 { type: "Feature", properties: { iso1A2: "EA", wikidata: "Q28868874", nameEn: "Ceuta, Melilla", country: "ES", level: "territory", isoStatus: "excRes" }, geometry: null },
22830 { type: "Feature", properties: { iso1A2: "EC", iso1A3: "ECU", iso1N3: "218", wikidata: "Q736", nameEn: "Ecuador" }, geometry: null },
22831 { 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]]]] } },
22832 { 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]]]] } },
22833 { 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]]]] } },
22834 { 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]]]] } },
22835 { type: "Feature", properties: { iso1A2: "ES", iso1A3: "ESP", iso1N3: "724", wikidata: "Q29", nameEn: "Spain" }, geometry: null },
22836 { 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]]]] } },
22837 { type: "Feature", properties: { iso1A2: "EU", iso1A3: "EUE", wikidata: "Q458", nameEn: "European Union", level: "union", isoStatus: "excRes" }, geometry: null },
22838 { type: "Feature", properties: { iso1A2: "FI", iso1A3: "FIN", iso1N3: "246", wikidata: "Q33", nameEn: "Finland", aliases: ["SF"] }, geometry: null },
22839 { 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]]]] } },
22840 { 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]]]] } },
22841 { 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]]]] } },
22842 { 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]]]] } },
22843 { type: "Feature", properties: { iso1A2: "FR", iso1A3: "FRA", iso1N3: "250", wikidata: "Q142", nameEn: "France" }, geometry: null },
22844 { 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]]]] } },
22845 { 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]]]] } },
22846 { type: "Feature", properties: { iso1A2: "GB", iso1A3: "GBR", iso1N3: "826", wikidata: "Q145", ccTLD: ".uk", nameEn: "United Kingdom", aliases: ["UK"] }, geometry: null },
22847 { 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]]]] } },
22848 { 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]]]] } },
22849 { 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]]]] } },
22850 { type: "Feature", properties: { iso1A2: "GG", iso1A3: "GGY", iso1N3: "831", wikidata: "Q25230", nameEn: "Bailiwick of Guernsey", country: "GB" }, geometry: null },
22851 { 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]]]] } },
22852 { 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]]]] } },
22853 { 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]]]] } },
22854 { 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]]]] } },
22855 { 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]]]] } },
22856 { 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]]]] } },
22857 { 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]]]] } },
22858 { 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]]]] } },
22859 { 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]]]] } },
22860 { 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]]]] } },
22861 { 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]]]] } },
22862 { 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]]]] } },
22863 { 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]]]] } },
22864 { 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]]]] } },
22865 { 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]]]] } },
22866 { 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]]]] } },
22867 { 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]]]] } },
22868 { 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]]]] } },
22869 { 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]]]] } },
22870 { 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]]]] } },
22871 { type: "Feature", properties: { iso1A2: "ID", iso1A3: "IDN", iso1N3: "360", wikidata: "Q252", nameEn: "Indonesia", aliases: ["RI"] }, geometry: null },
22872 { type: "Feature", properties: { iso1A2: "IE", iso1A3: "IRL", iso1N3: "372", wikidata: "Q27", nameEn: "Republic of Ireland", groups: ["EU", "Q22890", "154", "150", "UN"], driveSide: "left", callingCodes: ["353"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-6.26218, 54.09785], [-6.29003, 54.11278], [-6.32694, 54.09337], [-6.36279, 54.11248], [-6.36605, 54.07234], [-6.47849, 54.06947], [-6.62842, 54.03503], [-6.66264, 54.0666], [-6.6382, 54.17071], [-6.70175, 54.20218], [-6.74575, 54.18788], [-6.81583, 54.22791], [-6.85179, 54.29176], [-6.87775, 54.34682], [-7.02034, 54.4212], [-7.19145, 54.31296], [-7.14908, 54.22732], [-7.25012, 54.20063], [-7.26316, 54.13863], [-7.29493, 54.12013], [-7.29687, 54.1354], [-7.28017, 54.16714], [-7.29157, 54.17191], [-7.34005, 54.14698], [-7.30553, 54.11869], [-7.32834, 54.11475], [-7.44567, 54.1539], [-7.4799, 54.12239], [-7.55812, 54.12239], [-7.69501, 54.20731], [-7.81397, 54.20159], [-7.8596, 54.21779], [-7.87101, 54.29299], [-8.04555, 54.36292], [-8.179, 54.46763], [-8.04538, 54.48941], [-7.99812, 54.54427], [-7.8596, 54.53671], [-7.70315, 54.62077], [-7.93293, 54.66603], [-7.83352, 54.73854], [-7.75041, 54.7103], [-7.64449, 54.75265], [-7.54671, 54.74606], [-7.54508, 54.79401], [-7.47626, 54.83084], [-7.4473, 54.87003], [-7.44404, 54.9403], [-7.40004, 54.94498], [-7.4033, 55.00391], [-7.34464, 55.04688], [-7.2471, 55.06933], [-6.34755, 55.49206], [-7.75229, 55.93854], [-22.01468, 48.19557], [-6.03913, 51.13217], [-5.37267, 53.63269], [-6.26218, 54.09785]]]] } },
22873 { 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]]]] } },
22874 { 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]]]] } },
22875 { type: "Feature", properties: { iso1A2: "IN", iso1A3: "IND", iso1N3: "356", wikidata: "Q668", nameEn: "India" }, geometry: null },
22876 { type: "Feature", properties: { iso1A2: "IO", iso1A3: "IOT", iso1N3: "086", wikidata: "Q43448", nameEn: "British Indian Ocean Territory", country: "GB" }, geometry: null },
22877 { 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]]]] } },
22878 { 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]]]] } },
22879 { 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]]]] } },
22880 { 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]]]] } },
22881 { 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]]]] } },
22882 { 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]]]] } },
22883 { 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]]]] } },
22884 { 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]]]] } },
22885 { 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]]]] } },
22886 { 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]]]] } },
22887 { 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]]]] } },
22888 { 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]]]] } },
22889 { 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]]]] } },
22890 { 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]]]] } },
22891 { 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]]]] } },
22892 { 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]]]] } },
22893 { 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]]]] } },
22894 { 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]]]] } },
22895 { 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]]]] } },
22896 { 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]]]] } },
22897 { 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]]]] } },
22898 { 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]]]] } },
22899 { 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]]]] } },
22900 { 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]]]] } },
22901 { 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]]]] } },
22902 { 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]]]] } },
22903 { 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]]]] } },
22904 { 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]]]] } },
22905 { 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]]]] } },
22906 { 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]]]] } },
22907 { 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]]]] } },
22908 { 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]]]] } },
22909 { 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]]]] } },
22910 { 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]]]] } },
22911 { 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]]]] } },
22912 { 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]]]] } },
22913 { 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]]]] } },
22914 { 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]]]] } },
22915 { 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]]]] } },
22916 { 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]]]] } },
22917 { 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]]]] } },
22918 { 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]]]] } },
22919 { 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]]]] } },
22920 { 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]]]] } },
22921 { 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]]]] } },
22922 { 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]]]] } },
22923 { 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]]]] } },
22924 { 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]]]] } },
22925 { 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]]]] } },
22926 { 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]]]] } },
22927 { 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]]]] } },
22928 { type: "Feature", properties: { iso1A2: "MY", iso1A3: "MYS", iso1N3: "458", wikidata: "Q833", nameEn: "Malaysia" }, geometry: null },
22929 { 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]]]] } },
22930 { 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]]]] } },
22931 { 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]]]] } },
22932 { 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]]]] } },
22933 { 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]]]] } },
22934 { 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]]]] } },
22935 { 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]]]] } },
22936 { type: "Feature", properties: { iso1A2: "NL", iso1A3: "NLD", iso1N3: "528", wikidata: "Q29999", nameEn: "Kingdom of the Netherlands" }, geometry: null },
22937 { type: "Feature", properties: { iso1A2: "NO", iso1A3: "NOR", iso1N3: "578", wikidata: "Q20", nameEn: "Norway" }, geometry: null },
22938 { 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]]]] } },
22939 { 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]]]] } },
22940 { 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]]]] } },
22941 { type: "Feature", properties: { iso1A2: "NZ", iso1A3: "NZL", iso1N3: "554", wikidata: "Q664", nameEn: "New Zealand" }, geometry: null },
22942 { 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]]]] } },
22943 { 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]]]] } },
22944 { 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]]]] } },
22945 { 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]]]] } },
22946 { 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]]]] } },
22947 { 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]]]] } },
22948 { 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]]]] } },
22949 { 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]]]] } },
22950 { 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]]]] } },
22951 { 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]]]] } },
22952 { 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]]]] } },
22953 { type: "Feature", properties: { iso1A2: "PS", iso1A3: "PSE", iso1N3: "275", wikidata: "Q219060", nameEn: "Palestine" }, geometry: null },
22954 { type: "Feature", properties: { iso1A2: "PT", iso1A3: "PRT", iso1N3: "620", wikidata: "Q45", nameEn: "Portugal" }, geometry: null },
22955 { 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]]]] } },
22956 { 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]]]] } },
22957 { 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]]]] } },
22958 { 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]]]] } },
22959 { 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]]]] } },
22960 { 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]]]] } },
22961 { type: "Feature", properties: { iso1A2: "RU", iso1A3: "RUS", iso1N3: "643", wikidata: "Q159", nameEn: "Russia" }, geometry: null },
22962 { 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]]]] } },
22963 { 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]]]] } },
22964 { 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]]]] } },
22965 { 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]]]] } },
22966 { 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]]]] } },
22967 { 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]]]] } },
22968 { 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]]]] } },
22969 { type: "Feature", properties: { iso1A2: "SH", iso1A3: "SHN", iso1N3: "654", wikidata: "Q192184", nameEn: "Saint Helena, Ascension and Tristan da Cunha", country: "GB" }, geometry: null },
22970 { 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]]]] } },
22971 { type: "Feature", properties: { iso1A2: "SJ", iso1A3: "SJM", iso1N3: "744", wikidata: "Q842829", nameEn: "Svalbard and Jan Mayen", country: "NO" }, geometry: null },
22972 { 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]]]] } },
22973 { 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]]]] } },
22974 { 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]]]] } },
22975 { 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]]]] } },
22976 { 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]]]] } },
22977 { 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]]]] } },
22978 { 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]]]] } },
22979 { 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]]]] } },
22980 { 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]]]] } },
22981 { 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]]]] } },
22982 { 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]]]] } },
22983 { 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]]]] } },
22984 { 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]]]] } },
22985 { 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]]]] } },
22986 { 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]]]] } },
22987 { type: "Feature", properties: { iso1A2: "TF", iso1A3: "ATF", iso1N3: "260", wikidata: "Q129003", nameEn: "French Southern Territories", country: "FR", groups: ["EU", "UN"] }, geometry: null },
22988 { 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]]]] } },
22989 { 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]]]] } },
22990 { 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]]]] } },
22991 { 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]]]] } },
22992 { 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]]]] } },
22993 { 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]]]] } },
22994 { 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]]]] } },
22995 { 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]]]] } },
22996 { 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]]]] } },
22997 { 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]]]] } },
22998 { 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]]]] } },
22999 { 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]]]] } },
23000 { 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]]]] } },
23001 { 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]]]] } },
23002 { 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]]]] } },
23003 { type: "Feature", properties: { iso1A2: "UM", iso1A3: "UMI", iso1N3: "581", wikidata: "Q16645", nameEn: "United States Minor Outlying Islands", country: "US" }, geometry: null },
23004 { type: "Feature", properties: { iso1A2: "UN", wikidata: "Q1065", nameEn: "United Nations", level: "unitedNations", isoStatus: "excRes" }, geometry: null },
23005 { type: "Feature", properties: { iso1A2: "US", iso1A3: "USA", iso1N3: "840", wikidata: "Q30", nameEn: "United States of America" }, geometry: null },
23006 { 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]]]] } },
23007 { 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]]]] } },
23008 { 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]]]] } },
23009 { 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]]]] } },
23010 { 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]]]] } },
23011 { 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]]]] } },
23012 { 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]]]] } },
23013 { 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]]]] } },
23014 { 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]]]] } },
23015 { 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]]]] } },
23016 { 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]]]] } },
23017 { 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]]]] } },
23018 { 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]]]] } },
23019 { 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]]]] } },
23020 { 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]]]] } },
23021 { 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]]]] } },
23022 { 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]]]] } }
23024 var borders_default = { type, features };
23025 var borders = borders_default;
23026 var whichPolygonGetter = {};
23027 var featuresByCode = {};
23028 var idFilterRegex = /(?=(?!^(and|the|of|el|la|de)$))(\b(and|the|of|el|la|de)\b)|[-_ .,'()&[\]/]/gi;
23029 function canonicalID(id2) {
23030 const s = id2 || "";
23031 if (s.charAt(0) === ".") {
23032 return s.toUpperCase();
23034 return s.replace(idFilterRegex, "").toUpperCase();
23043 "intermediateRegion",
23051 loadDerivedDataAndCaches(borders);
23052 function loadDerivedDataAndCaches(borders2) {
23053 const identifierProps = ["iso1A2", "iso1A3", "m49", "wikidata", "emojiFlag", "ccTLD", "nameEn"];
23054 let geometryFeatures = [];
23055 borders2.features.forEach((feature22) => {
23056 feature22.properties.id = feature22.properties.iso1A2 || feature22.properties.m49 || feature22.properties.wikidata;
23057 loadM49(feature22);
23058 loadTLD(feature22);
23059 loadIsoStatus(feature22);
23060 loadLevel(feature22);
23061 loadGroups(feature22);
23062 loadFlag(feature22);
23063 cacheFeatureByIDs(feature22);
23064 if (feature22.geometry)
23065 geometryFeatures.push(feature22);
23067 borders2.features.forEach((feature22) => {
23068 feature22.properties.groups = feature22.properties.groups.map((groupID) => {
23069 return featuresByCode[groupID].properties.id;
23071 loadMembersForGroupsOf(feature22);
23073 borders2.features.forEach((feature22) => {
23074 loadRoadSpeedUnit(feature22);
23075 loadRoadHeightUnit(feature22);
23076 loadDriveSide(feature22);
23077 loadCallingCodes(feature22);
23078 loadGroupGroups(feature22);
23080 borders2.features.forEach((feature22) => {
23081 feature22.properties.groups.sort((groupID1, groupID2) => {
23082 return levels.indexOf(featuresByCode[groupID1].properties.level) - levels.indexOf(featuresByCode[groupID2].properties.level);
23084 if (feature22.properties.members)
23085 feature22.properties.members.sort((id1, id2) => {
23086 const diff = levels.indexOf(featuresByCode[id1].properties.level) - levels.indexOf(featuresByCode[id2].properties.level);
23088 return borders2.features.indexOf(featuresByCode[id1]) - borders2.features.indexOf(featuresByCode[id2]);
23093 const geometryOnlyCollection = {
23094 type: "FeatureCollection",
23095 features: geometryFeatures
23097 whichPolygonGetter = (0, import_which_polygon.default)(geometryOnlyCollection);
23098 function loadGroups(feature22) {
23099 const props = feature22.properties;
23100 if (!props.groups) {
23103 if (feature22.geometry && props.country) {
23104 props.groups.push(props.country);
23106 if (props.m49 !== "001") {
23107 props.groups.push("001");
23110 function loadM49(feature22) {
23111 const props = feature22.properties;
23112 if (!props.m49 && props.iso1N3) {
23113 props.m49 = props.iso1N3;
23116 function loadTLD(feature22) {
23117 const props = feature22.properties;
23118 if (props.level === "unitedNations")
23120 if (!props.ccTLD && props.iso1A2) {
23121 props.ccTLD = "." + props.iso1A2.toLowerCase();
23124 function loadIsoStatus(feature22) {
23125 const props = feature22.properties;
23126 if (!props.isoStatus && props.iso1A2) {
23127 props.isoStatus = "official";
23130 function loadLevel(feature22) {
23131 const props = feature22.properties;
23134 if (!props.country) {
23135 props.level = "country";
23136 } else if (!props.iso1A2 || props.isoStatus === "official") {
23137 props.level = "territory";
23139 props.level = "subterritory";
23142 function loadGroupGroups(feature22) {
23143 const props = feature22.properties;
23144 if (feature22.geometry || !props.members)
23146 const featureLevelIndex = levels.indexOf(props.level);
23147 let sharedGroups = [];
23148 props.members.forEach((memberID, index) => {
23149 const member = featuresByCode[memberID];
23150 const memberGroups = member.properties.groups.filter((groupID) => {
23151 return groupID !== feature22.properties.id && featureLevelIndex < levels.indexOf(featuresByCode[groupID].properties.level);
23154 sharedGroups = memberGroups;
23156 sharedGroups = sharedGroups.filter((groupID) => memberGroups.indexOf(groupID) !== -1);
23159 props.groups = props.groups.concat(sharedGroups.filter((groupID) => props.groups.indexOf(groupID) === -1));
23160 sharedGroups.forEach((groupID) => {
23161 const groupFeature = featuresByCode[groupID];
23162 if (groupFeature.properties.members.indexOf(props.id) === -1) {
23163 groupFeature.properties.members.push(props.id);
23167 function loadRoadSpeedUnit(feature22) {
23168 const props = feature22.properties;
23169 if (feature22.geometry) {
23170 if (!props.roadSpeedUnit)
23171 props.roadSpeedUnit = "km/h";
23172 } else if (props.members) {
23173 const vals = Array.from(new Set(props.members.map((id2) => {
23174 const member = featuresByCode[id2];
23175 if (member.geometry)
23176 return member.properties.roadSpeedUnit || "km/h";
23177 }).filter(Boolean)));
23178 if (vals.length === 1)
23179 props.roadSpeedUnit = vals[0];
23182 function loadRoadHeightUnit(feature22) {
23183 const props = feature22.properties;
23184 if (feature22.geometry) {
23185 if (!props.roadHeightUnit)
23186 props.roadHeightUnit = "m";
23187 } else if (props.members) {
23188 const vals = Array.from(new Set(props.members.map((id2) => {
23189 const member = featuresByCode[id2];
23190 if (member.geometry)
23191 return member.properties.roadHeightUnit || "m";
23192 }).filter(Boolean)));
23193 if (vals.length === 1)
23194 props.roadHeightUnit = vals[0];
23197 function loadDriveSide(feature22) {
23198 const props = feature22.properties;
23199 if (feature22.geometry) {
23200 if (!props.driveSide)
23201 props.driveSide = "right";
23202 } else if (props.members) {
23203 const vals = Array.from(new Set(props.members.map((id2) => {
23204 const member = featuresByCode[id2];
23205 if (member.geometry)
23206 return member.properties.driveSide || "right";
23207 }).filter(Boolean)));
23208 if (vals.length === 1)
23209 props.driveSide = vals[0];
23212 function loadCallingCodes(feature22) {
23213 const props = feature22.properties;
23214 if (!feature22.geometry && props.members) {
23215 props.callingCodes = Array.from(new Set(props.members.reduce((array2, id2) => {
23216 const member = featuresByCode[id2];
23217 if (member.geometry && member.properties.callingCodes) {
23218 return array2.concat(member.properties.callingCodes);
23224 function loadFlag(feature22) {
23225 if (!feature22.properties.iso1A2)
23227 const flag = feature22.properties.iso1A2.replace(/./g, function(char) {
23228 return String.fromCodePoint(char.charCodeAt(0) + 127397);
23230 feature22.properties.emojiFlag = flag;
23232 function loadMembersForGroupsOf(feature22) {
23233 feature22.properties.groups.forEach((groupID) => {
23234 const groupFeature = featuresByCode[groupID];
23235 if (!groupFeature.properties.members) {
23236 groupFeature.properties.members = [];
23238 groupFeature.properties.members.push(feature22.properties.id);
23241 function cacheFeatureByIDs(feature22) {
23243 identifierProps.forEach((prop) => {
23244 const id2 = feature22.properties[prop];
23248 (feature22.properties.aliases || []).forEach((alias) => {
23251 ids.forEach((id2) => {
23252 let cid = canonicalID(id2);
23253 featuresByCode[cid] = feature22;
23257 function locArray(loc) {
23258 if (Array.isArray(loc)) {
23260 } else if (loc.coordinates) {
23261 return loc.coordinates;
23263 return loc.geometry.coordinates;
23265 function smallestFeature(loc) {
23266 const query = locArray(loc);
23267 const featureProperties = whichPolygonGetter(query);
23268 if (!featureProperties)
23270 return featuresByCode[featureProperties.id];
23272 function countryFeature(loc) {
23273 const feature22 = smallestFeature(loc);
23276 const countryCode = feature22.properties.country || feature22.properties.iso1A2;
23277 return featuresByCode[countryCode] || null;
23279 var defaultOpts = {
23284 function featureForLoc(loc, opts) {
23285 const targetLevel = opts.level || "country";
23286 const maxLevel = opts.maxLevel || "world";
23287 const withProp = opts.withProp;
23288 const targetLevelIndex = levels.indexOf(targetLevel);
23289 if (targetLevelIndex === -1)
23291 const maxLevelIndex = levels.indexOf(maxLevel);
23292 if (maxLevelIndex === -1)
23294 if (maxLevelIndex < targetLevelIndex)
23296 if (targetLevel === "country") {
23297 const fastFeature = countryFeature(loc);
23299 if (!withProp || fastFeature.properties[withProp]) {
23300 return fastFeature;
23304 const features2 = featuresContaining(loc);
23305 const match = features2.find((feature22) => {
23306 let levelIndex = levels.indexOf(feature22.properties.level);
23307 if (feature22.properties.level === targetLevel || levelIndex > targetLevelIndex && levelIndex <= maxLevelIndex) {
23308 if (!withProp || feature22.properties[withProp]) {
23314 return match || null;
23316 function featureForID(id2) {
23318 if (typeof id2 === "number") {
23319 stringID = id2.toString();
23320 if (stringID.length === 1) {
23321 stringID = "00" + stringID;
23322 } else if (stringID.length === 2) {
23323 stringID = "0" + stringID;
23326 stringID = canonicalID(id2);
23328 return featuresByCode[stringID] || null;
23330 function smallestFeaturesForBbox(bbox2) {
23331 return whichPolygonGetter.bbox(bbox2).map((props) => featuresByCode[props.id]);
23333 function smallestOrMatchingFeature(query) {
23334 if (typeof query === "object") {
23335 return smallestFeature(query);
23337 return featureForID(query);
23339 function feature(query, opts = defaultOpts) {
23340 if (typeof query === "object") {
23341 return featureForLoc(query, opts);
23343 return featureForID(query);
23345 function iso1A2Code(query, opts = defaultOpts) {
23346 opts.withProp = "iso1A2";
23347 const match = feature(query, opts);
23350 return match.properties.iso1A2 || null;
23352 function featuresContaining(query, strict) {
23353 let matchingFeatures;
23354 if (Array.isArray(query) && query.length === 4) {
23355 matchingFeatures = smallestFeaturesForBbox(query);
23357 const smallestOrMatching = smallestOrMatchingFeature(query);
23358 matchingFeatures = smallestOrMatching ? [smallestOrMatching] : [];
23360 if (!matchingFeatures.length)
23362 let returnFeatures;
23363 if (!strict || typeof query === "object") {
23364 returnFeatures = matchingFeatures.slice();
23366 returnFeatures = [];
23368 matchingFeatures.forEach((feature22) => {
23369 const properties = feature22.properties;
23370 properties.groups.forEach((groupID) => {
23371 const groupFeature = featuresByCode[groupID];
23372 if (returnFeatures.indexOf(groupFeature) === -1) {
23373 returnFeatures.push(groupFeature);
23377 return returnFeatures;
23379 function featuresIn(id2, strict) {
23380 const feature22 = featureForID(id2);
23383 let features2 = [];
23385 features2.push(feature22);
23387 const properties = feature22.properties;
23388 (properties.members || []).forEach((memberID) => {
23389 features2.push(featuresByCode[memberID]);
23393 function aggregateFeature(id2) {
23394 const features2 = featuresIn(id2, false);
23395 if (features2.length === 0)
23397 let aggregateCoordinates = [];
23398 features2.forEach((feature22) => {
23399 if (feature22.geometry && feature22.geometry.type === "MultiPolygon" && feature22.geometry.coordinates) {
23400 aggregateCoordinates = aggregateCoordinates.concat(feature22.geometry.coordinates);
23405 properties: features2[0].properties,
23407 type: "MultiPolygon",
23408 coordinates: aggregateCoordinates
23412 function roadSpeedUnit(query) {
23413 const feature22 = smallestOrMatchingFeature(query);
23414 return feature22 && feature22.properties.roadSpeedUnit || null;
23416 function roadHeightUnit(query) {
23417 const feature22 = smallestOrMatchingFeature(query);
23418 return feature22 && feature22.properties.roadHeightUnit || null;
23421 // node_modules/@ideditor/location-conflation/index.mjs
23422 var import_geojson_area = __toESM(require_geojson_area(), 1);
23423 var import_circle_to_polygon = __toESM(require_circle_to_polygon(), 1);
23424 var import_polygon_clipping = __toESM(require_polygon_clipping_umd(), 1);
23425 var import_geojson_precision = __toESM(require_geojson_precision(), 1);
23426 var import_json_stringify_pretty_compact = __toESM(require_json_stringify_pretty_compact(), 1);
23427 var location_conflation_default = class {
23430 this._strict = true;
23431 if (fc && fc.type === "FeatureCollection" && Array.isArray(fc.features)) {
23432 fc.features.forEach((feature3) => {
23433 feature3.properties = feature3.properties || {};
23434 let props = feature3.properties;
23435 let id2 = feature3.id || props.id;
23436 if (!id2 || !/^\S+\.geojson$/i.test(id2))
23438 id2 = id2.toLowerCase();
23442 const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
23443 props.area = Number(area.toFixed(2));
23445 this._cache[id2] = feature3;
23448 let world = _cloneDeep(feature("Q2"));
23451 coordinates: [[[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]]]
23454 world.properties.id = "Q2";
23455 world.properties.area = import_geojson_area.default.geometry(world.geometry) / 1e6;
23456 this._cache.Q2 = world;
23458 validateLocation(location) {
23459 if (Array.isArray(location) && (location.length === 2 || location.length === 3)) {
23460 const lon = location[0];
23461 const lat = location[1];
23462 const radius = location[2];
23463 if (Number.isFinite(lon) && lon >= -180 && lon <= 180 && Number.isFinite(lat) && lat >= -90 && lat <= 90 && (location.length === 2 || Number.isFinite(radius) && radius > 0)) {
23464 const id2 = "[" + location.toString() + "]";
23465 return { type: "point", location, id: id2 };
23467 } else if (typeof location === "string" && /^\S+\.geojson$/i.test(location)) {
23468 const id2 = location.toLowerCase();
23469 if (this._cache[id2]) {
23470 return { type: "geojson", location, id: id2 };
23472 } else if (typeof location === "string" || typeof location === "number") {
23473 const feature3 = feature(location);
23475 const id2 = feature3.properties.wikidata;
23476 return { type: "countrycoder", location, id: id2 };
23479 if (this._strict) {
23480 throw new Error(`validateLocation: Invalid location: "${location}".`);
23485 resolveLocation(location) {
23486 const valid = this.validateLocation(location);
23489 const id2 = valid.id;
23490 if (this._cache[id2]) {
23491 return Object.assign(valid, { feature: this._cache[id2] });
23493 if (valid.type === "point") {
23494 const lon = location[0];
23495 const lat = location[1];
23496 const radius = location[2] || 25;
23498 const PRECISION = 3;
23499 const area = Math.PI * radius * radius;
23500 const feature3 = this._cache[id2] = (0, import_geojson_precision.default)({
23503 properties: { id: id2, area: Number(area.toFixed(2)) },
23504 geometry: (0, import_circle_to_polygon.default)([lon, lat], radius * 1e3, EDGES)
23506 return Object.assign(valid, { feature: feature3 });
23507 } else if (valid.type === "geojson") {
23508 } else if (valid.type === "countrycoder") {
23509 let feature3 = _cloneDeep(feature(id2));
23510 let props = feature3.properties;
23511 if (Array.isArray(props.members)) {
23512 let aggregate = aggregateFeature(id2);
23513 aggregate.geometry.coordinates = _clip([aggregate], "UNION").geometry.coordinates;
23514 feature3.geometry = aggregate.geometry;
23517 const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
23518 props.area = Number(area.toFixed(2));
23522 this._cache[id2] = feature3;
23523 return Object.assign(valid, { feature: feature3 });
23525 if (this._strict) {
23526 throw new Error(`resolveLocation: Couldn't resolve location "${location}".`);
23531 validateLocationSet(locationSet) {
23532 locationSet = locationSet || {};
23533 const validator = this.validateLocation.bind(this);
23534 let include = (locationSet.include || []).map(validator).filter(Boolean);
23535 let exclude = (locationSet.exclude || []).map(validator).filter(Boolean);
23536 if (!include.length) {
23537 if (this._strict) {
23538 throw new Error(`validateLocationSet: LocationSet includes nothing.`);
23540 locationSet.include = ["Q2"];
23541 include = [{ type: "countrycoder", location: "Q2", id: "Q2" }];
23544 include.sort(_sortLocations);
23545 let id2 = "+[" + include.map((d) => d.id).join(",") + "]";
23546 if (exclude.length) {
23547 exclude.sort(_sortLocations);
23548 id2 += "-[" + exclude.map((d) => d.id).join(",") + "]";
23550 return { type: "locationset", locationSet, id: id2 };
23552 resolveLocationSet(locationSet) {
23553 locationSet = locationSet || {};
23554 const valid = this.validateLocationSet(locationSet);
23557 const id2 = valid.id;
23558 if (this._cache[id2]) {
23559 return Object.assign(valid, { feature: this._cache[id2] });
23561 const resolver = this.resolveLocation.bind(this);
23562 const includes = (locationSet.include || []).map(resolver).filter(Boolean);
23563 const excludes = (locationSet.exclude || []).map(resolver).filter(Boolean);
23564 if (includes.length === 1 && excludes.length === 0) {
23565 return Object.assign(valid, { feature: includes[0].feature });
23567 const includeGeoJSON = _clip(includes.map((d) => d.feature), "UNION");
23568 const excludeGeoJSON = _clip(excludes.map((d) => d.feature), "UNION");
23569 let resultGeoJSON = excludeGeoJSON ? _clip([includeGeoJSON, excludeGeoJSON], "DIFFERENCE") : includeGeoJSON;
23570 const area = import_geojson_area.default.geometry(resultGeoJSON.geometry) / 1e6;
23571 resultGeoJSON.id = id2;
23572 resultGeoJSON.properties = { id: id2, area: Number(area.toFixed(2)) };
23573 this._cache[id2] = resultGeoJSON;
23574 return Object.assign(valid, { feature: resultGeoJSON });
23577 if (val === void 0) {
23578 return this._strict;
23580 this._strict = val;
23585 return this._cache;
23587 stringify(obj, options2) {
23588 return (0, import_json_stringify_pretty_compact.default)(obj, options2);
23591 function _clip(features2, which) {
23592 if (!Array.isArray(features2) || !features2.length)
23594 const fn = { UNION: import_polygon_clipping.default.union, DIFFERENCE: import_polygon_clipping.default.difference }[which];
23595 const args = features2.map((feature3) => feature3.geometry.coordinates);
23596 const coords = fn.apply(null, args);
23601 type: whichType(coords),
23602 coordinates: coords
23605 function whichType(coords2) {
23606 const a = Array.isArray(coords2);
23607 const b = a && Array.isArray(coords2[0]);
23608 const c = b && Array.isArray(coords2[0][0]);
23609 const d = c && Array.isArray(coords2[0][0][0]);
23610 return d ? "MultiPolygon" : "Polygon";
23613 function _cloneDeep(obj) {
23614 return JSON.parse(JSON.stringify(obj));
23616 function _sortLocations(a, b) {
23617 const rank = { countrycoder: 1, geojson: 2, point: 3 };
23618 const aRank = rank[a.type];
23619 const bRank = rank[b.type];
23620 return aRank > bRank ? 1 : aRank < bRank ? -1 : a.id.localeCompare(b.id);
23623 // modules/core/LocationManager.js
23624 var import_which_polygon2 = __toESM(require_which_polygon());
23625 var import_geojson_area2 = __toESM(require_geojson_area());
23626 var _loco = new location_conflation_default();
23627 var LocationManager = class {
23630 this._resolved = /* @__PURE__ */ new Map();
23631 this._knownLocationSets = /* @__PURE__ */ new Map();
23632 this._locationIncludedIn = /* @__PURE__ */ new Map();
23633 this._locationExcludedIn = /* @__PURE__ */ new Map();
23634 const world = { locationSet: { include: ["Q2"] } };
23635 this._resolveLocationSet(world);
23636 this._rebuildIndex();
23638 _validateLocationSet(obj) {
23639 if (obj.locationSetID)
23642 let locationSet = obj.locationSet;
23643 if (!locationSet) {
23644 throw new Error("object missing locationSet property");
23646 if (!locationSet.include) {
23647 locationSet.include = ["Q2"];
23649 const locationSetID = _loco.validateLocationSet(locationSet).id;
23650 obj.locationSetID = locationSetID;
23651 if (this._knownLocationSets.has(locationSetID))
23654 (locationSet.include || []).forEach((location) => {
23655 const locationID = _loco.validateLocation(location).id;
23656 let geojson = this._resolved.get(locationID);
23658 geojson = _loco.resolveLocation(location).feature;
23659 this._resolved.set(locationID, geojson);
23661 area += geojson.properties.area;
23662 let s = this._locationIncludedIn.get(locationID);
23664 s = /* @__PURE__ */ new Set();
23665 this._locationIncludedIn.set(locationID, s);
23667 s.add(locationSetID);
23669 (locationSet.exclude || []).forEach((location) => {
23670 const locationID = _loco.validateLocation(location).id;
23671 let geojson = this._resolved.get(locationID);
23673 geojson = _loco.resolveLocation(location).feature;
23674 this._resolved.set(locationID, geojson);
23676 area -= geojson.properties.area;
23677 let s = this._locationExcludedIn.get(locationID);
23679 s = /* @__PURE__ */ new Set();
23680 this._locationExcludedIn.set(locationID, s);
23682 s.add(locationSetID);
23684 this._knownLocationSets.set(locationSetID, area);
23686 obj.locationSet = { include: ["Q2"] };
23687 obj.locationSetID = "+[Q2]";
23690 _resolveLocationSet(obj) {
23691 this._validateLocationSet(obj);
23692 if (this._resolved.has(obj.locationSetID))
23695 const result = _loco.resolveLocationSet(obj.locationSet);
23696 const locationSetID = result.id;
23697 obj.locationSetID = locationSetID;
23698 if (!result.feature.geometry.coordinates.length || !result.feature.properties.area) {
23699 throw new Error(`locationSet ${locationSetID} resolves to an empty feature.`);
23701 let geojson = JSON.parse(JSON.stringify(result.feature));
23702 geojson.id = locationSetID;
23703 geojson.properties.id = locationSetID;
23704 this._resolved.set(locationSetID, geojson);
23706 obj.locationSet = { include: ["Q2"] };
23707 obj.locationSetID = "+[Q2]";
23711 this._wp = (0, import_which_polygon2.default)({ features: [...this._resolved.values()] });
23713 mergeCustomGeoJSON(fc) {
23714 if (!fc || fc.type !== "FeatureCollection" || !Array.isArray(fc.features))
23716 fc.features.forEach((feature3) => {
23717 feature3.properties = feature3.properties || {};
23718 let props = feature3.properties;
23719 let id2 = feature3.id || props.id;
23720 if (!id2 || !/^\S+\.geojson$/i.test(id2))
23722 id2 = id2.toLowerCase();
23726 const area = import_geojson_area2.default.geometry(feature3.geometry) / 1e6;
23727 props.area = Number(area.toFixed(2));
23729 _loco._cache[id2] = feature3;
23732 mergeLocationSets(objects) {
23733 if (!Array.isArray(objects))
23734 return Promise.reject("nothing to do");
23735 objects.forEach((obj) => this._validateLocationSet(obj));
23736 this._rebuildIndex();
23737 return Promise.resolve(objects);
23739 locationSetID(locationSet) {
23742 locationSetID = _loco.validateLocationSet(locationSet).id;
23744 locationSetID = "+[Q2]";
23746 return locationSetID;
23748 feature(locationSetID = "+[Q2]") {
23749 const feature3 = this._resolved.get(locationSetID);
23750 return feature3 || this._resolved.get("+[Q2]");
23752 locationSetsAt(loc) {
23754 const hits = this._wp(loc, true) || [];
23756 hits.forEach((prop) => {
23757 if (prop.id[0] !== "+")
23759 const locationSetID = prop.id;
23760 const area = thiz._knownLocationSets.get(locationSetID);
23762 result[locationSetID] = area;
23765 hits.forEach((prop) => {
23766 if (prop.id[0] === "+")
23768 const locationID = prop.id;
23769 const included = thiz._locationIncludedIn.get(locationID);
23770 (included || []).forEach((locationSetID) => {
23771 const area = thiz._knownLocationSets.get(locationSetID);
23773 result[locationSetID] = area;
23777 hits.forEach((prop) => {
23778 if (prop.id[0] === "+")
23780 const locationID = prop.id;
23781 const excluded = thiz._locationExcludedIn.get(locationID);
23782 (excluded || []).forEach((locationSetID) => {
23783 delete result[locationSetID];
23792 var _sharedLocationManager = new LocationManager();
23794 // node_modules/lodash-es/_freeGlobal.js
23795 var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
23796 var freeGlobal_default = freeGlobal;
23798 // node_modules/lodash-es/_root.js
23799 var freeSelf = typeof self == "object" && self && self.Object === Object && self;
23800 var root2 = freeGlobal_default || freeSelf || Function("return this")();
23801 var root_default = root2;
23803 // node_modules/lodash-es/_Symbol.js
23804 var Symbol2 = root_default.Symbol;
23805 var Symbol_default = Symbol2;
23807 // node_modules/lodash-es/_getRawTag.js
23808 var objectProto = Object.prototype;
23809 var hasOwnProperty = objectProto.hasOwnProperty;
23810 var nativeObjectToString = objectProto.toString;
23811 var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
23812 function getRawTag(value) {
23813 var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
23815 value[symToStringTag] = void 0;
23816 var unmasked = true;
23819 var result = nativeObjectToString.call(value);
23822 value[symToStringTag] = tag;
23824 delete value[symToStringTag];
23829 var getRawTag_default = getRawTag;
23831 // node_modules/lodash-es/_objectToString.js
23832 var objectProto2 = Object.prototype;
23833 var nativeObjectToString2 = objectProto2.toString;
23834 function objectToString(value) {
23835 return nativeObjectToString2.call(value);
23837 var objectToString_default = objectToString;
23839 // node_modules/lodash-es/_baseGetTag.js
23840 var nullTag = "[object Null]";
23841 var undefinedTag = "[object Undefined]";
23842 var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
23843 function baseGetTag(value) {
23844 if (value == null) {
23845 return value === void 0 ? undefinedTag : nullTag;
23847 return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value);
23849 var baseGetTag_default = baseGetTag;
23851 // node_modules/lodash-es/isObjectLike.js
23852 function isObjectLike(value) {
23853 return value != null && typeof value == "object";
23855 var isObjectLike_default = isObjectLike;
23857 // node_modules/lodash-es/isSymbol.js
23858 var symbolTag = "[object Symbol]";
23859 function isSymbol(value) {
23860 return typeof value == "symbol" || isObjectLike_default(value) && baseGetTag_default(value) == symbolTag;
23862 var isSymbol_default = isSymbol;
23864 // node_modules/lodash-es/_arrayMap.js
23865 function arrayMap(array2, iteratee) {
23866 var index = -1, length = array2 == null ? 0 : array2.length, result = Array(length);
23867 while (++index < length) {
23868 result[index] = iteratee(array2[index], index, array2);
23872 var arrayMap_default = arrayMap;
23874 // node_modules/lodash-es/isArray.js
23875 var isArray = Array.isArray;
23876 var isArray_default = isArray;
23878 // node_modules/lodash-es/_baseToString.js
23879 var INFINITY = 1 / 0;
23880 var symbolProto = Symbol_default ? Symbol_default.prototype : void 0;
23881 var symbolToString = symbolProto ? symbolProto.toString : void 0;
23882 function baseToString(value) {
23883 if (typeof value == "string") {
23886 if (isArray_default(value)) {
23887 return arrayMap_default(value, baseToString) + "";
23889 if (isSymbol_default(value)) {
23890 return symbolToString ? symbolToString.call(value) : "";
23892 var result = value + "";
23893 return result == "0" && 1 / value == -INFINITY ? "-0" : result;
23895 var baseToString_default = baseToString;
23897 // node_modules/lodash-es/_trimmedEndIndex.js
23898 var reWhitespace = /\s/;
23899 function trimmedEndIndex(string) {
23900 var index = string.length;
23901 while (index-- && reWhitespace.test(string.charAt(index))) {
23905 var trimmedEndIndex_default = trimmedEndIndex;
23907 // node_modules/lodash-es/_baseTrim.js
23908 var reTrimStart = /^\s+/;
23909 function baseTrim(string) {
23910 return string ? string.slice(0, trimmedEndIndex_default(string) + 1).replace(reTrimStart, "") : string;
23912 var baseTrim_default = baseTrim;
23914 // node_modules/lodash-es/isObject.js
23915 function isObject(value) {
23916 var type3 = typeof value;
23917 return value != null && (type3 == "object" || type3 == "function");
23919 var isObject_default = isObject;
23921 // node_modules/lodash-es/toNumber.js
23923 var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
23924 var reIsBinary = /^0b[01]+$/i;
23925 var reIsOctal = /^0o[0-7]+$/i;
23926 var freeParseInt = parseInt;
23927 function toNumber(value) {
23928 if (typeof value == "number") {
23931 if (isSymbol_default(value)) {
23934 if (isObject_default(value)) {
23935 var other = typeof value.valueOf == "function" ? value.valueOf() : value;
23936 value = isObject_default(other) ? other + "" : other;
23938 if (typeof value != "string") {
23939 return value === 0 ? value : +value;
23941 value = baseTrim_default(value);
23942 var isBinary = reIsBinary.test(value);
23943 return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
23945 var toNumber_default = toNumber;
23947 // node_modules/lodash-es/toString.js
23948 function toString(value) {
23949 return value == null ? "" : baseToString_default(value);
23951 var toString_default = toString;
23953 // node_modules/lodash-es/_basePropertyOf.js
23954 function basePropertyOf(object) {
23955 return function(key) {
23956 return object == null ? void 0 : object[key];
23959 var basePropertyOf_default = basePropertyOf;
23961 // node_modules/lodash-es/now.js
23962 var now2 = function() {
23963 return root_default.Date.now();
23965 var now_default = now2;
23967 // node_modules/lodash-es/debounce.js
23968 var FUNC_ERROR_TEXT = "Expected a function";
23969 var nativeMax = Math.max;
23970 var nativeMin = Math.min;
23971 function debounce(func, wait, options2) {
23972 var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
23973 if (typeof func != "function") {
23974 throw new TypeError(FUNC_ERROR_TEXT);
23976 wait = toNumber_default(wait) || 0;
23977 if (isObject_default(options2)) {
23978 leading = !!options2.leading;
23979 maxing = "maxWait" in options2;
23980 maxWait = maxing ? nativeMax(toNumber_default(options2.maxWait) || 0, wait) : maxWait;
23981 trailing = "trailing" in options2 ? !!options2.trailing : trailing;
23983 function invokeFunc(time) {
23984 var args = lastArgs, thisArg = lastThis;
23985 lastArgs = lastThis = void 0;
23986 lastInvokeTime = time;
23987 result = func.apply(thisArg, args);
23990 function leadingEdge(time) {
23991 lastInvokeTime = time;
23992 timerId = setTimeout(timerExpired, wait);
23993 return leading ? invokeFunc(time) : result;
23995 function remainingWait(time) {
23996 var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
23997 return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
23999 function shouldInvoke(time) {
24000 var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
24001 return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
24003 function timerExpired() {
24004 var time = now_default();
24005 if (shouldInvoke(time)) {
24006 return trailingEdge(time);
24008 timerId = setTimeout(timerExpired, remainingWait(time));
24010 function trailingEdge(time) {
24012 if (trailing && lastArgs) {
24013 return invokeFunc(time);
24015 lastArgs = lastThis = void 0;
24018 function cancel() {
24019 if (timerId !== void 0) {
24020 clearTimeout(timerId);
24022 lastInvokeTime = 0;
24023 lastArgs = lastCallTime = lastThis = timerId = void 0;
24026 return timerId === void 0 ? result : trailingEdge(now_default());
24028 function debounced() {
24029 var time = now_default(), isInvoking = shouldInvoke(time);
24030 lastArgs = arguments;
24032 lastCallTime = time;
24034 if (timerId === void 0) {
24035 return leadingEdge(lastCallTime);
24038 clearTimeout(timerId);
24039 timerId = setTimeout(timerExpired, wait);
24040 return invokeFunc(lastCallTime);
24043 if (timerId === void 0) {
24044 timerId = setTimeout(timerExpired, wait);
24048 debounced.cancel = cancel;
24049 debounced.flush = flush;
24052 var debounce_default = debounce;
24054 // node_modules/lodash-es/_escapeHtmlChar.js
24055 var htmlEscapes = {
24062 var escapeHtmlChar = basePropertyOf_default(htmlEscapes);
24063 var escapeHtmlChar_default = escapeHtmlChar;
24065 // node_modules/lodash-es/escape.js
24066 var reUnescapedHtml = /[&<>"']/g;
24067 var reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
24068 function escape2(string) {
24069 string = toString_default(string);
24070 return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar_default) : string;
24072 var escape_default = escape2;
24074 // node_modules/lodash-es/throttle.js
24075 var FUNC_ERROR_TEXT2 = "Expected a function";
24076 function throttle(func, wait, options2) {
24077 var leading = true, trailing = true;
24078 if (typeof func != "function") {
24079 throw new TypeError(FUNC_ERROR_TEXT2);
24081 if (isObject_default(options2)) {
24082 leading = "leading" in options2 ? !!options2.leading : leading;
24083 trailing = "trailing" in options2 ? !!options2.trailing : trailing;
24085 return debounce_default(func, wait, {
24086 "leading": leading,
24088 "trailing": trailing
24091 var throttle_default = throttle;
24093 // node_modules/lodash-es/_unescapeHtmlChar.js
24094 var htmlUnescapes = {
24101 var unescapeHtmlChar = basePropertyOf_default(htmlUnescapes);
24102 var unescapeHtmlChar_default = unescapeHtmlChar;
24104 // node_modules/lodash-es/unescape.js
24105 var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
24106 var reHasEscapedHtml = RegExp(reEscapedHtml.source);
24107 function unescape2(string) {
24108 string = toString_default(string);
24109 return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar_default) : string;
24111 var unescape_default = unescape2;
24113 // modules/util/detect.js
24115 function utilDetect(refresh2) {
24116 if (_detected && !refresh2)
24119 const ua = navigator.userAgent;
24121 m = ua.match(/(edge)\/?\s*(\.?\d+(\.\d+)*)/i);
24123 _detected.browser = m[1];
24124 _detected.version = m[2];
24126 if (!_detected.browser) {
24127 m = ua.match(/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/i);
24129 _detected.browser = "msie";
24130 _detected.version = m[1];
24133 if (!_detected.browser) {
24134 m = ua.match(/(opr)\/?\s*(\.?\d+(\.\d+)*)/i);
24136 _detected.browser = "Opera";
24137 _detected.version = m[2];
24140 if (!_detected.browser) {
24141 m = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
24143 _detected.browser = m[1];
24144 _detected.version = m[2];
24145 m = ua.match(/version\/([\.\d]+)/i);
24147 _detected.version = m[1];
24150 if (!_detected.browser) {
24151 _detected.browser = navigator.appName;
24152 _detected.version = navigator.appVersion;
24154 _detected.version = _detected.version.split(/\W/).slice(0, 2).join(".");
24155 _detected.opera = _detected.browser.toLowerCase() === "opera" && parseFloat(_detected.version) < 15;
24156 if (_detected.browser.toLowerCase() === "msie") {
24157 _detected.ie = true;
24158 _detected.browser = "Internet Explorer";
24159 _detected.support = false;
24161 _detected.ie = false;
24162 _detected.support = true;
24164 _detected.filedrop = window.FileReader && "ondrop" in window;
24165 if (/Win/.test(ua)) {
24166 _detected.os = "win";
24167 _detected.platform = "Windows";
24168 } else if (/Mac/.test(ua)) {
24169 _detected.os = "mac";
24170 _detected.platform = "Macintosh";
24171 } else if (/X11/.test(ua) || /Linux/.test(ua)) {
24172 _detected.os = "linux";
24173 _detected.platform = "Linux";
24175 _detected.os = "win";
24176 _detected.platform = "Unknown";
24178 _detected.isMobileWebKit = (/\b(iPad|iPhone|iPod)\b/.test(ua) || navigator.platform === "MacIntel" && "maxTouchPoints" in navigator && navigator.maxTouchPoints > 1) && /WebKit/.test(ua) && !/Edge/.test(ua) && !window.MSStream;
24179 _detected.browserLocales = Array.from(new Set(
24180 [navigator.language].concat(navigator.languages || []).concat([
24181 navigator.userLanguage
24184 const loc = window.top.location;
24185 let origin = loc.origin;
24187 origin = loc.protocol + "//" + loc.hostname + (loc.port ? ":" + loc.port : "");
24189 _detected.host = origin + loc.pathname;
24193 // modules/util/aes.js
24194 var import_aes_js = __toESM(require_aes_js());
24195 var DEFAULT_128 = [250, 157, 60, 79, 142, 134, 229, 129, 138, 126, 210, 129, 29, 71, 160, 208];
24196 function utilAesEncrypt(text2, key) {
24197 key = key || DEFAULT_128;
24198 const textBytes = import_aes_js.default.utils.utf8.toBytes(text2);
24199 const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
24200 const encryptedBytes = aesCtr.encrypt(textBytes);
24201 const encryptedHex = import_aes_js.default.utils.hex.fromBytes(encryptedBytes);
24202 return encryptedHex;
24204 function utilAesDecrypt(encryptedHex, key) {
24205 key = key || DEFAULT_128;
24206 const encryptedBytes = import_aes_js.default.utils.hex.toBytes(encryptedHex);
24207 const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
24208 const decryptedBytes = aesCtr.decrypt(encryptedBytes);
24209 const text2 = import_aes_js.default.utils.utf8.fromBytes(decryptedBytes);
24213 // modules/util/clean_tags.js
24214 function utilCleanTags(tags) {
24216 for (var k in tags) {
24220 if (v !== void 0) {
24221 out[k] = cleanValue(k, v);
24225 function cleanValue(k2, v2) {
24226 function keepSpaces(k3) {
24227 return /_hours|_times|:conditional$/.test(k3);
24229 function skip(k3) {
24230 return /^(description|note|fixme)$/.test(k3);
24234 var cleaned = v2.split(";").map(function(s) {
24236 }).join(keepSpaces(k2) ? "; " : ";");
24237 if (k2.indexOf("website") !== -1 || k2.indexOf("email") !== -1 || cleaned.indexOf("http") === 0) {
24238 cleaned = cleaned.replace(/[\u200B-\u200F\uFEFF]/g, "");
24244 // modules/util/get_set_value.js
24245 function utilGetSetValue(selection2, value) {
24246 function d3_selection_value(value2) {
24247 function valueNull() {
24250 function valueConstant() {
24251 if (this.value !== value2) {
24252 this.value = value2;
24255 function valueFunction() {
24256 var x = value2.apply(this, arguments);
24257 if (x === null || x === void 0) {
24259 } else if (this.value !== x) {
24263 return value2 === null || value2 === void 0 ? valueNull : typeof value2 === "function" ? valueFunction : valueConstant;
24265 if (arguments.length === 1) {
24266 return selection2.property("value");
24268 return selection2.each(d3_selection_value(value));
24271 // modules/util/keybinding.js
24272 function utilKeybinding(namespace) {
24273 var _keybindings = {};
24274 function testBindings(d3_event, isCapturing) {
24275 var didMatch = false;
24276 var bindings = Object.keys(_keybindings).map(function(id2) {
24277 return _keybindings[id2];
24280 for (i2 = 0; i2 < bindings.length; i2++) {
24281 binding = bindings[i2];
24282 if (!binding.event.modifiers.shiftKey)
24284 if (!!binding.capture !== isCapturing)
24286 if (matches(d3_event, binding, true)) {
24287 binding.callback(d3_event);
24294 for (i2 = 0; i2 < bindings.length; i2++) {
24295 binding = bindings[i2];
24296 if (binding.event.modifiers.shiftKey)
24298 if (!!binding.capture !== isCapturing)
24300 if (matches(d3_event, binding, false)) {
24301 binding.callback(d3_event);
24305 function matches(d3_event2, binding2, testShift) {
24306 var event = d3_event2;
24307 var isMatch = false;
24308 var tryKeyCode = true;
24309 if (event.key !== void 0) {
24310 tryKeyCode = event.key.charCodeAt(0) > 127;
24312 if (binding2.event.key === void 0) {
24314 } else if (Array.isArray(binding2.event.key)) {
24315 if (binding2.event.key.map(function(s) {
24316 return s.toLowerCase();
24317 }).indexOf(event.key.toLowerCase()) === -1) {
24321 if (event.key.toLowerCase() !== binding2.event.key.toLowerCase()) {
24326 if (!isMatch && (tryKeyCode || binding2.event.modifiers.altKey)) {
24327 isMatch = event.keyCode === binding2.event.keyCode;
24331 if (!(event.ctrlKey && event.altKey)) {
24332 if (event.ctrlKey !== binding2.event.modifiers.ctrlKey)
24334 if (event.altKey !== binding2.event.modifiers.altKey)
24337 if (event.metaKey !== binding2.event.modifiers.metaKey)
24339 if (testShift && event.shiftKey !== binding2.event.modifiers.shiftKey)
24344 function capture(d3_event) {
24345 testBindings(d3_event, true);
24347 function bubble(d3_event) {
24348 var tagName = select_default2(d3_event.target).node().tagName;
24349 if (tagName === "INPUT" || tagName === "SELECT" || tagName === "TEXTAREA") {
24352 testBindings(d3_event, false);
24354 function keybinding(selection2) {
24355 selection2 = selection2 || select_default2(document);
24356 selection2.on("keydown.capture." + namespace, capture, true);
24357 selection2.on("keydown.bubble." + namespace, bubble, false);
24360 keybinding.unbind = function(selection2) {
24362 selection2 = selection2 || select_default2(document);
24363 selection2.on("keydown.capture." + namespace, null);
24364 selection2.on("keydown.bubble." + namespace, null);
24367 keybinding.clear = function() {
24371 keybinding.off = function(codes, capture2) {
24372 var arr = utilArrayUniq([].concat(codes));
24373 for (var i2 = 0; i2 < arr.length; i2++) {
24374 var id2 = arr[i2] + (capture2 ? "-capture" : "-bubble");
24375 delete _keybindings[id2];
24379 keybinding.on = function(codes, callback, capture2) {
24380 if (typeof callback !== "function") {
24381 return keybinding.off(codes, capture2);
24383 var arr = utilArrayUniq([].concat(codes));
24384 for (var i2 = 0; i2 < arr.length; i2++) {
24385 var id2 = arr[i2] + (capture2 ? "-capture" : "-bubble");
24401 if (_keybindings[id2]) {
24402 console.warn('warning: duplicate keybinding for "' + id2 + '"');
24404 _keybindings[id2] = binding;
24405 var matches = arr[i2].toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g);
24406 for (var j2 = 0; j2 < matches.length; j2++) {
24407 if (matches[j2] === "++")
24409 if (matches[j2] in utilKeybinding.modifierCodes) {
24410 var prop = utilKeybinding.modifierProperties[utilKeybinding.modifierCodes[matches[j2]]];
24411 binding.event.modifiers[prop] = true;
24413 binding.event.key = utilKeybinding.keys[matches[j2]] || matches[j2];
24414 if (matches[j2] in utilKeybinding.keyCodes) {
24415 binding.event.keyCode = utilKeybinding.keyCodes[matches[j2]];
24424 utilKeybinding.modifierCodes = {
24438 utilKeybinding.modifierProperties = {
24444 utilKeybinding.plusKeys = ["plus", "ffplus", "=", "ffequals", "\u2260", "\xB1"];
24445 utilKeybinding.minusKeys = ["_", "-", "ffminus", "dash", "\u2013", "\u2014"];
24446 utilKeybinding.keys = {
24447 "\u232B": "Backspace",
24448 backspace: "Backspace",
24459 "pause-break": "Pause",
24460 "\u21EA": "CapsLock",
24462 "caps-lock": "CapsLock",
24463 "\u238B": ["Escape", "Esc"],
24464 escape: ["Escape", "Esc"],
24465 esc: ["Escape", "Esc"],
24466 space: [" ", "Spacebar"],
24467 "\u2196": "PageUp",
24469 "page-up": "PageUp",
24470 "\u2198": "PageDown",
24471 pgdown: "PageDown",
24472 "page-down": "PageDown",
24479 "\u2326": ["Delete", "Del"],
24480 del: ["Delete", "Del"],
24481 "delete": ["Delete", "Del"],
24482 "\u2190": ["ArrowLeft", "Left"],
24483 left: ["ArrowLeft", "Left"],
24484 "arrow-left": ["ArrowLeft", "Left"],
24485 "\u2191": ["ArrowUp", "Up"],
24486 up: ["ArrowUp", "Up"],
24487 "arrow-up": ["ArrowUp", "Up"],
24488 "\u2192": ["ArrowRight", "Right"],
24489 right: ["ArrowRight", "Right"],
24490 "arrow-right": ["ArrowRight", "Right"],
24491 "\u2193": ["ArrowDown", "Down"],
24492 down: ["ArrowDown", "Down"],
24493 "arrow-down": ["ArrowDown", "Down"],
24494 "*": ["*", "Multiply"],
24495 star: ["*", "Multiply"],
24496 asterisk: ["*", "Multiply"],
24497 multiply: ["*", "Multiply"],
24499 "plus": ["+", "Add"],
24500 "-": ["-", "Subtract"],
24501 subtract: ["-", "Subtract"],
24502 "dash": ["-", "Subtract"],
24509 "forward-slash": "/",
24512 "open-bracket": "[",
24513 "back-slash": "\\",
24514 "close-bracket": "]",
24553 utilKeybinding.keyCodes = {
24625 "forward-slash": 191,
24630 "open-bracket": 219,
24634 "close-bracket": 221,
24641 while (++i < 106) {
24642 utilKeybinding.keyCodes["num-" + n] = i;
24648 utilKeybinding.keyCodes[n] = i;
24653 while (++i < 136) {
24654 utilKeybinding.keyCodes["f" + n] = i;
24659 utilKeybinding.keyCodes[String.fromCharCode(i).toLowerCase()] = i;
24662 // modules/util/object.js
24663 function utilObjectOmit(obj, omitKeys) {
24664 return Object.keys(obj).reduce(function(result, key) {
24665 if (omitKeys.indexOf(key) === -1) {
24666 result[key] = obj[key];
24672 // modules/util/rebind.js
24673 function utilRebind(target, source) {
24674 var i2 = 1, n2 = arguments.length, method;
24675 while (++i2 < n2) {
24676 target[method = arguments[i2]] = d3_rebind(target, source, source[method]);
24680 function d3_rebind(target, source, method) {
24681 return function() {
24682 var value = method.apply(source, arguments);
24683 return value === source ? target : value;
24687 // modules/util/session_mutex.js
24688 function utilSessionMutex(name) {
24692 var expires = new Date();
24693 expires.setSeconds(expires.getSeconds() + 5);
24694 document.cookie = name + "=1; expires=" + expires.toUTCString() + "; sameSite=strict";
24696 mutex.lock = function() {
24699 var cookie = document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + name + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1");
24703 intervalID = window.setInterval(renew, 4e3);
24706 mutex.unlock = function() {
24709 document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; sameSite=strict";
24710 clearInterval(intervalID);
24713 mutex.locked = function() {
24714 return !!intervalID;
24719 // modules/util/tiler.js
24720 function utilTiler() {
24721 var _size = [256, 256];
24723 var _tileSize = 256;
24724 var _zoomExtent = [0, 20];
24725 var _translate = [_size[0] / 2, _size[1] / 2];
24727 var _skipNullIsland = false;
24728 function clamp3(num, min3, max3) {
24729 return Math.max(min3, Math.min(num, max3));
24731 function nearNullIsland(tile) {
24736 var center = Math.pow(2, z - 1);
24737 var width = Math.pow(2, z - 6);
24738 var min3 = center - width / 2;
24739 var max3 = center + width / 2 - 1;
24740 return x >= min3 && x <= max3 && y >= min3 && y <= max3;
24744 function tiler8() {
24745 var z = geoScaleToZoom(_scale / (2 * Math.PI), _tileSize);
24746 var z0 = clamp3(Math.round(z), _zoomExtent[0], _zoomExtent[1]);
24748 var tileMax = Math.pow(2, z0) - 1;
24749 var log2ts = Math.log(_tileSize) * Math.LOG2E;
24750 var k = Math.pow(2, z - z0 + log2ts);
24752 (_translate[0] - _scale / 2) / k,
24753 (_translate[1] - _scale / 2) / k
24756 clamp3(Math.floor(-origin[0]) - _margin, tileMin, tileMax + 1),
24757 clamp3(Math.ceil(_size[0] / k - origin[0]) + _margin, tileMin, tileMax + 1)
24760 clamp3(Math.floor(-origin[1]) - _margin, tileMin, tileMax + 1),
24761 clamp3(Math.ceil(_size[1] / k - origin[1]) + _margin, tileMin, tileMax + 1)
24764 for (var i2 = 0; i2 < rows.length; i2++) {
24766 for (var j2 = 0; j2 < cols.length; j2++) {
24768 if (i2 >= _margin && i2 <= rows.length - _margin && j2 >= _margin && j2 <= cols.length - _margin) {
24769 tiles.unshift([x, y, z0]);
24771 tiles.push([x, y, z0]);
24775 tiles.translate = origin;
24779 tiler8.getTiles = function(projection2) {
24781 projection2.scale() * Math.PI - projection2.translate()[0],
24782 projection2.scale() * Math.PI - projection2.translate()[1]
24784 this.size(projection2.clipExtent()[1]).scale(projection2.scale() * 2 * Math.PI).translate(projection2.translate());
24785 var tiles = tiler8();
24786 var ts = tiles.scale;
24787 return tiles.map(function(tile) {
24788 if (_skipNullIsland && nearNullIsland(tile)) {
24791 var x = tile[0] * ts - origin[0];
24792 var y = tile[1] * ts - origin[1];
24794 id: tile.toString(),
24797 projection2.invert([x, y + ts]),
24798 projection2.invert([x + ts, y])
24801 }).filter(Boolean);
24803 tiler8.getGeoJSON = function(projection2) {
24804 var features2 = tiler8.getTiles(projection2).map(function(tile) {
24813 coordinates: [tile.extent.polygon()]
24818 type: "FeatureCollection",
24819 features: features2
24822 tiler8.tileSize = function(val) {
24823 if (!arguments.length)
24828 tiler8.zoomExtent = function(val) {
24829 if (!arguments.length)
24830 return _zoomExtent;
24834 tiler8.size = function(val) {
24835 if (!arguments.length)
24840 tiler8.scale = function(val) {
24841 if (!arguments.length)
24846 tiler8.translate = function(val) {
24847 if (!arguments.length)
24852 tiler8.margin = function(val) {
24853 if (!arguments.length)
24858 tiler8.skipNullIsland = function(val) {
24859 if (!arguments.length)
24860 return _skipNullIsland;
24861 _skipNullIsland = val;
24867 // modules/util/trigger_event.js
24868 function utilTriggerEvent(target, type3) {
24869 target.each(function() {
24870 var evt = document.createEvent("HTMLEvents");
24871 evt.initEvent(type3, true, true);
24872 this.dispatchEvent(evt);
24876 // modules/core/localizer.js
24877 var _mainLocalizer = coreLocalizer();
24878 var _t = _mainLocalizer.t;
24879 function coreLocalizer() {
24880 let localizer = {};
24881 let _dataLanguages = {};
24882 let _dataLocales = {};
24883 let _localeStrings = {};
24884 let _localeCode = "en-US";
24885 let _localeCodes = ["en-US", "en"];
24886 let _languageCode = "en";
24887 let _textDirection = "ltr";
24888 let _usesMetric = false;
24889 let _languageNames = {};
24890 let _scriptNames = {};
24891 localizer.localeCode = () => _localeCode;
24892 localizer.localeCodes = () => _localeCodes;
24893 localizer.languageCode = () => _languageCode;
24894 localizer.textDirection = () => _textDirection;
24895 localizer.usesMetric = () => _usesMetric;
24896 localizer.languageNames = () => _languageNames;
24897 localizer.scriptNames = () => _scriptNames;
24898 let _preferredLocaleCodes = [];
24899 localizer.preferredLocaleCodes = function(codes) {
24900 if (!arguments.length)
24901 return _preferredLocaleCodes;
24902 if (typeof codes === "string") {
24903 _preferredLocaleCodes = codes.split(/,|;| /gi).filter(Boolean);
24905 _preferredLocaleCodes = codes;
24910 localizer.ensureLoaded = () => {
24912 return _loadPromise;
24913 let filesToFetch = [
24917 const localeDirs = {
24918 general: "locales",
24919 tagging: presetsCdnUrl + "dist/translations"
24921 let fileMap = _mainFileFetcher.fileMap();
24922 for (let scopeId in localeDirs) {
24923 const key = `locales_index_${scopeId}`;
24924 if (!fileMap[key]) {
24925 fileMap[key] = localeDirs[scopeId] + "/index.min.json";
24927 filesToFetch.push(key);
24929 return _loadPromise = Promise.all(filesToFetch.map((key) => _mainFileFetcher.get(key))).then((results) => {
24930 _dataLanguages = results[0];
24931 _dataLocales = results[1];
24932 let indexes = results.slice(2);
24933 let requestedLocales = (_preferredLocaleCodes || []).concat(utilDetect().browserLocales).concat(["en"]);
24934 _localeCodes = localesToUseFrom(requestedLocales);
24935 _localeCode = _localeCodes[0];
24936 let loadStringsPromises = [];
24937 indexes.forEach((index, i2) => {
24938 const fullCoverageIndex = _localeCodes.findIndex(function(locale2) {
24939 return index[locale2] && index[locale2].pct === 1;
24941 _localeCodes.slice(0, fullCoverageIndex + 1).forEach(function(code) {
24942 let scopeId = Object.keys(localeDirs)[i2];
24943 let directory = Object.values(localeDirs)[i2];
24945 loadStringsPromises.push(localizer.loadLocale(code, scopeId, directory));
24948 return Promise.all(loadStringsPromises);
24950 updateForCurrentLocale();
24951 }).catch((err) => console.error(err));
24953 function localesToUseFrom(requestedLocales) {
24954 let supportedLocales = _dataLocales;
24956 for (let i2 in requestedLocales) {
24957 let locale2 = requestedLocales[i2];
24958 if (supportedLocales[locale2])
24959 toUse.push(locale2);
24960 if (locale2.includes("-")) {
24961 let langPart = locale2.split("-")[0];
24962 if (supportedLocales[langPart])
24963 toUse.push(langPart);
24966 return utilArrayUniq(toUse);
24968 function updateForCurrentLocale() {
24971 _languageCode = _localeCode.split("-")[0];
24972 const currentData = _dataLocales[_localeCode] || _dataLocales[_languageCode];
24973 const hash = utilStringQs(window.location.hash);
24974 if (hash.rtl === "true") {
24975 _textDirection = "rtl";
24976 } else if (hash.rtl === "false") {
24977 _textDirection = "ltr";
24979 _textDirection = currentData && currentData.rtl ? "rtl" : "ltr";
24981 let locale2 = _localeCode;
24982 if (locale2.toLowerCase() === "en-us")
24984 _languageNames = _localeStrings.general[locale2].languageNames;
24985 _scriptNames = _localeStrings.general[locale2].scriptNames;
24986 _usesMetric = _localeCode.slice(-3).toLowerCase() !== "-us";
24988 localizer.loadLocale = (locale2, scopeId, directory) => {
24989 if (locale2.toLowerCase() === "en-us")
24991 if (_localeStrings[scopeId] && _localeStrings[scopeId][locale2]) {
24992 return Promise.resolve(locale2);
24994 let fileMap = _mainFileFetcher.fileMap();
24995 const key = `locale_${scopeId}_${locale2}`;
24996 if (!fileMap[key]) {
24997 fileMap[key] = `${directory}/${locale2}.min.json`;
24999 return _mainFileFetcher.get(key).then((d) => {
25000 if (!_localeStrings[scopeId])
25001 _localeStrings[scopeId] = {};
25002 _localeStrings[scopeId][locale2] = d[locale2];
25006 localizer.pluralRule = function(number3) {
25007 return pluralRule(number3, _localeCode);
25009 function pluralRule(number3, localeCode) {
25010 const rules = "Intl" in window && Intl.PluralRules && new Intl.PluralRules(localeCode);
25012 return rules.select(number3);
25018 localizer.tInfo = function(origStringId, replacements, locale2) {
25019 let stringId = origStringId.trim();
25020 let scopeId = "general";
25021 if (stringId[0] === "_") {
25022 let split = stringId.split(".");
25023 scopeId = split[0].slice(1);
25024 stringId = split.slice(1).join(".");
25026 locale2 = locale2 || _localeCode;
25027 let path = stringId.split(".").map((s) => s.replace(/<TX_DOT>/g, ".")).reverse();
25028 let stringsKey = locale2;
25029 if (stringsKey.toLowerCase() === "en-us")
25031 let result = _localeStrings && _localeStrings[scopeId] && _localeStrings[scopeId][stringsKey];
25032 while (result !== void 0 && path.length) {
25033 result = result[path.pop()];
25035 if (result !== void 0) {
25036 if (replacements) {
25037 if (typeof result === "object" && Object.keys(result).length) {
25038 const number3 = Object.values(replacements).find(function(value) {
25039 return typeof value === "number";
25041 if (number3 !== void 0) {
25042 const rule = pluralRule(number3, locale2);
25043 if (result[rule]) {
25044 result = result[rule];
25046 result = Object.values(result)[0];
25050 if (typeof result === "string") {
25051 for (let key in replacements) {
25052 let value = replacements[key];
25053 if (typeof value === "number") {
25054 if (value.toLocaleString) {
25055 value = value.toLocaleString(locale2, {
25058 minimumFractionDigits: 0
25061 value = value.toString();
25064 const token = `{${key}}`;
25065 const regex = new RegExp(token, "g");
25066 result = result.replace(regex, value);
25070 if (typeof result === "string") {
25077 let index = _localeCodes.indexOf(locale2);
25078 if (index >= 0 && index < _localeCodes.length - 1) {
25079 let fallback = _localeCodes[index + 1];
25080 return localizer.tInfo(origStringId, replacements, fallback);
25082 if (replacements && "default" in replacements) {
25084 text: replacements.default,
25088 const missing = `Missing ${locale2} translation: ${origStringId}`;
25089 if (typeof console !== "undefined")
25090 console.error(missing);
25096 localizer.hasTextForStringId = function(stringId) {
25097 return !!localizer.tInfo(stringId, { default: "nothing found" }).locale;
25099 localizer.t = function(stringId, replacements, locale2) {
25100 return localizer.tInfo(stringId, replacements, locale2).text;
25102 localizer.t.html = function(stringId, replacements, locale2) {
25103 replacements = Object.assign({}, replacements);
25104 for (var k in replacements) {
25105 if (typeof replacements[k] === "string") {
25106 replacements[k] = escape_default(replacements[k]);
25108 if (typeof replacements[k] === "object" && typeof replacements[k].html === "string") {
25109 replacements[k] = replacements[k].html;
25112 const info = localizer.tInfo(stringId, replacements, locale2);
25114 return `<span class="localized-text" lang="${info.locale || "und"}">${info.text}</span>`;
25119 localizer.t.append = function(stringId, replacements, locale2) {
25120 const ret = function(selection2) {
25121 const info = localizer.tInfo(stringId, replacements, locale2);
25122 return selection2.append("span").attr("class", "localized-text").attr("lang", info.locale || "und").text((replacements && replacements.prefix || "") + info.text + (replacements && replacements.suffix || ""));
25124 ret.stringId = stringId;
25127 localizer.languageName = (code, options2) => {
25128 if (_languageNames[code]) {
25129 return _languageNames[code];
25131 if (options2 && options2.localOnly)
25133 const langInfo = _dataLanguages[code];
25135 if (langInfo.nativeName) {
25136 return localizer.t("translate.language_and_code", { language: langInfo.nativeName, code });
25137 } else if (langInfo.base && langInfo.script) {
25138 const base = langInfo.base;
25139 if (_languageNames[base]) {
25140 const scriptCode = langInfo.script;
25141 const script = _scriptNames[scriptCode] || scriptCode;
25142 return localizer.t("translate.language_and_code", { language: _languageNames[base], code: script });
25143 } else if (_dataLanguages[base] && _dataLanguages[base].nativeName) {
25144 return localizer.t("translate.language_and_code", { language: _dataLanguages[base].nativeName, code });
25153 // modules/presets/collection.js
25154 function presetCollection(collection) {
25155 const MAXRESULTS = 50;
25158 _this.collection = collection;
25159 _this.item = (id2) => {
25162 const found = _this.collection.find((d) => d.id === id2);
25164 _memo[id2] = found;
25167 _this.index = (id2) => _this.collection.findIndex((d) => d.id === id2);
25168 _this.matchGeometry = (geometry) => {
25169 return presetCollection(
25170 _this.collection.filter((d) => d.matchGeometry(geometry))
25173 _this.matchAllGeometry = (geometries) => {
25174 return presetCollection(
25175 _this.collection.filter((d) => d && d.matchAllGeometry(geometries))
25178 _this.matchAnyGeometry = (geometries) => {
25179 return presetCollection(
25180 _this.collection.filter((d) => geometries.some((geom) => d.matchGeometry(geom)))
25183 _this.fallback = (geometry) => {
25184 let id2 = geometry;
25185 if (id2 === "vertex")
25187 return _this.item(id2);
25189 _this.search = (value, geometry, loc) => {
25192 value = value.toLowerCase().trim();
25193 function leading(a) {
25194 const index = a.indexOf(value);
25195 return index === 0 || a[index - 1] === " ";
25197 function leadingStrict(a) {
25198 const index = a.indexOf(value);
25199 return index === 0;
25201 function sortPresets(nameProp, aliasesProp) {
25202 return function sortNames(a, b) {
25203 let aCompare = a[nameProp]();
25204 let bCompare = b[nameProp]();
25206 const findMatchingAlias = (strings) => {
25207 if (strings.some((s) => s === value)) {
25208 return strings.find((s) => s === value);
25210 return strings.filter((s) => s.includes(value)).sort((a2, b2) => a2.length - b2.length)[0];
25213 aCompare = findMatchingAlias([aCompare].concat(a[aliasesProp]()));
25214 bCompare = findMatchingAlias([bCompare].concat(b[aliasesProp]()));
25216 if (value === aCompare)
25218 if (value === bCompare)
25220 let i2 = b.originalScore - a.originalScore;
25223 i2 = aCompare.indexOf(value) - bCompare.indexOf(value);
25226 return aCompare.length - bCompare.length;
25229 let pool = _this.collection;
25230 if (Array.isArray(loc)) {
25231 const validHere = _sharedLocationManager.locationSetsAt(loc);
25232 pool = pool.filter((a) => !a.locationSetID || validHere[a.locationSetID]);
25234 const searchable = pool.filter((a) => a.searchable !== false && a.suggestion !== true);
25235 const suggestions = pool.filter((a) => a.suggestion === true);
25236 const leadingNames = searchable.filter((a) => leading(a.searchName()) || a.searchAliases().some(leading)).sort(sortPresets("searchName", "searchAliases"));
25237 const leadingSuggestions = suggestions.filter((a) => leadingStrict(a.searchName())).sort(sortPresets("searchName"));
25238 const leadingNamesStripped = searchable.filter((a) => leading(a.searchNameStripped()) || a.searchAliasesStripped().some(leading)).sort(sortPresets("searchNameStripped", "searchAliasesStripped"));
25239 const leadingSuggestionsStripped = suggestions.filter((a) => leadingStrict(a.searchNameStripped())).sort(sortPresets("searchNameStripped"));
25240 const leadingTerms = searchable.filter((a) => (a.terms() || []).some(leading));
25241 const leadingSuggestionTerms = suggestions.filter((a) => (a.terms() || []).some(leading));
25242 const leadingTagValues = searchable.filter((a) => Object.values(a.tags || {}).filter((val) => val !== "*").some(leading));
25243 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);
25244 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);
25245 const similarTerms = searchable.filter((a) => {
25246 return (a.terms() || []).some((b) => {
25247 return utilEditDistance(value, b) + Math.min(value.length - b.length, 0) < 3;
25250 let leadingTagKeyValues = [];
25251 if (value.includes("=")) {
25252 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]))));
25254 let results = leadingNames.concat(
25255 leadingSuggestions,
25256 leadingNamesStripped,
25257 leadingSuggestionsStripped,
25259 leadingSuggestionTerms,
25262 similarSuggestions,
25264 leadingTagKeyValues
25265 ).slice(0, MAXRESULTS - 1);
25267 if (typeof geometry === "string") {
25268 results.push(_this.fallback(geometry));
25270 geometry.forEach((geom) => results.push(_this.fallback(geom)));
25273 return presetCollection(utilArrayUniq(results));
25278 // modules/presets/category.js
25279 function presetCategory(categoryID, category, allPresets) {
25280 let _this = Object.assign({}, category);
25282 let _searchNameStripped;
25283 _this.id = categoryID;
25284 _this.members = presetCollection(
25285 (category.members || []).map((presetID) => allPresets[presetID]).filter(Boolean)
25287 _this.geometry = _this.members.collection.reduce((acc, preset) => {
25288 for (let i2 in preset.geometry) {
25289 const geometry = preset.geometry[i2];
25290 if (acc.indexOf(geometry) === -1) {
25291 acc.push(geometry);
25296 _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
25297 _this.matchAllGeometry = (geometries) => _this.members.collection.some((preset) => preset.matchAllGeometry(geometries));
25298 _this.matchScore = () => -1;
25299 _this.name = () => _t(`_tagging.presets.categories.${categoryID}.name`, { "default": categoryID });
25300 _this.nameLabel = () => _t.append(`_tagging.presets.categories.${categoryID}.name`, { "default": categoryID });
25301 _this.terms = () => [];
25302 _this.searchName = () => {
25303 if (!_searchName) {
25304 _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
25306 return _searchName;
25308 _this.searchNameStripped = () => {
25309 if (!_searchNameStripped) {
25310 _searchNameStripped = _this.searchName();
25311 if (_searchNameStripped.normalize)
25312 _searchNameStripped = _searchNameStripped.normalize("NFD");
25313 _searchNameStripped = _searchNameStripped.replace(/[\u0300-\u036f]/g, "");
25315 return _searchNameStripped;
25317 _this.searchAliases = () => [];
25318 _this.searchAliasesStripped = () => [];
25322 // modules/presets/field.js
25323 function presetField(fieldID, field, allFields) {
25324 allFields = allFields || {};
25325 let _this = Object.assign({}, field);
25326 _this.id = fieldID;
25327 _this.safeid = utilSafeClassName(fieldID);
25328 _this.matchGeometry = (geom) => !_this.geometry || _this.geometry.indexOf(geom) !== -1;
25329 _this.matchAllGeometry = (geometries) => {
25330 return !_this.geometry || geometries.every((geom) => _this.geometry.indexOf(geom) !== -1);
25332 _this.t = (scope, options2) => _t(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
25333 _this.t.html = (scope, options2) => _t.html(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
25334 _this.t.append = (scope, options2) => _t.append(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
25335 _this.hasTextForStringId = (scope) => _mainLocalizer.hasTextForStringId(`_tagging.presets.fields.${fieldID}.${scope}`);
25336 _this.resolveReference = (which) => {
25337 const referenceRegex = /^\{(.*)\}$/;
25338 const match = (field[which] || "").match(referenceRegex);
25340 const field2 = allFields[match[1]];
25344 console.error(`Unable to resolve referenced field: ${match[1]}`);
25348 _this.title = () => _this.overrideLabel || _this.resolveReference("label").t("label", { "default": fieldID });
25349 _this.label = () => _this.overrideLabel ? (selection2) => selection2.text(_this.overrideLabel) : _this.resolveReference("label").t.append("label", { "default": fieldID });
25350 _this.placeholder = () => _this.resolveReference("placeholder").t("placeholder", { "default": "" });
25351 _this.originalTerms = (_this.terms || []).join();
25352 _this.terms = () => _this.resolveReference("label").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
25353 _this.increment = _this.type === "number" ? _this.increment || 1 : void 0;
25357 // modules/presets/preset.js
25358 function presetPreset(presetID, preset, addable, allFields, allPresets) {
25359 allFields = allFields || {};
25360 allPresets = allPresets || {};
25361 let _this = Object.assign({}, preset);
25362 let _addable = addable || false;
25363 let _resolvedFields;
25364 let _resolvedMoreFields;
25366 let _searchNameStripped;
25367 let _searchAliases;
25368 let _searchAliasesStripped;
25369 const referenceRegex = /^\{(.*)\}$/;
25370 _this.id = presetID;
25371 _this.safeid = utilSafeClassName(presetID);
25372 _this.originalTerms = (_this.terms || []).join();
25373 _this.originalName = _this.name || "";
25374 _this.originalAliases = (_this.aliases || []).join("\n");
25375 _this.originalScore = _this.matchScore || 1;
25376 _this.originalReference = _this.reference || {};
25377 _this.originalFields = _this.fields || [];
25378 _this.originalMoreFields = _this.moreFields || [];
25379 _this.fields = () => _resolvedFields || (_resolvedFields = resolveFields("fields"));
25380 _this.moreFields = () => _resolvedMoreFields || (_resolvedMoreFields = resolveFields("moreFields"));
25381 _this.resetFields = () => _resolvedFields = _resolvedMoreFields = null;
25382 _this.tags = _this.tags || {};
25383 _this.addTags = _this.addTags || _this.tags;
25384 _this.removeTags = _this.removeTags || _this.addTags;
25385 _this.geometry = _this.geometry || [];
25386 _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
25387 _this.matchAllGeometry = (geoms) => geoms.every(_this.matchGeometry);
25388 _this.matchScore = (entityTags) => {
25389 const tags = _this.tags;
25392 for (let k in tags) {
25394 if (entityTags[k] === tags[k]) {
25395 score += _this.originalScore;
25396 } else if (tags[k] === "*" && k in entityTags) {
25397 score += _this.originalScore / 2;
25402 const addTags = _this.addTags;
25403 for (let k in addTags) {
25404 if (!seen[k] && entityTags[k] === addTags[k]) {
25405 score += _this.originalScore;
25408 if (_this.searchable === false) {
25413 _this.t = (scope, options2) => {
25414 const textID = `_tagging.presets.presets.${presetID}.${scope}`;
25415 return _t(textID, options2);
25417 _this.t.append = (scope, options2) => {
25418 const textID = `_tagging.presets.presets.${presetID}.${scope}`;
25419 return _t.append(textID, options2);
25421 function resolveReference(which) {
25422 const match = (_this[which] || "").match(referenceRegex);
25424 const preset2 = allPresets[match[1]];
25428 console.error(`Unable to resolve referenced preset: ${match[1]}`);
25432 _this.name = () => {
25433 return resolveReference("originalName").t("name", { "default": _this.originalName || presetID });
25435 _this.nameLabel = () => {
25436 return resolveReference("originalName").t.append("name", { "default": _this.originalName || presetID });
25438 _this.subtitle = () => {
25439 if (_this.suggestion) {
25440 let path = presetID.split("/");
25442 return _t("_tagging.presets.presets." + path.join("/") + ".name");
25446 _this.subtitleLabel = () => {
25447 if (_this.suggestion) {
25448 let path = presetID.split("/");
25450 return _t.append("_tagging.presets.presets." + path.join("/") + ".name");
25454 _this.aliases = () => {
25455 return resolveReference("originalName").t("aliases", { "default": _this.originalAliases }).trim().split(/\s*[\r\n]+\s*/);
25457 _this.terms = () => {
25458 return resolveReference("originalName").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
25460 _this.searchName = () => {
25461 if (!_searchName) {
25462 _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
25464 return _searchName;
25466 _this.searchNameStripped = () => {
25467 if (!_searchNameStripped) {
25468 _searchNameStripped = stripDiacritics(_this.searchName());
25470 return _searchNameStripped;
25472 _this.searchAliases = () => {
25473 if (!_searchAliases) {
25474 _searchAliases = _this.aliases().map((alias) => alias.toLowerCase());
25476 return _searchAliases;
25478 _this.searchAliasesStripped = () => {
25479 if (!_searchAliasesStripped) {
25480 _searchAliasesStripped = _this.searchAliases();
25481 _searchAliasesStripped = _searchAliasesStripped.map(stripDiacritics);
25483 return _searchAliasesStripped;
25485 _this.isFallback = () => {
25486 const tagCount = Object.keys(_this.tags).length;
25487 return tagCount === 0 || tagCount === 1 && _this.tags.hasOwnProperty("area");
25489 _this.addable = function(val) {
25490 if (!arguments.length)
25495 _this.reference = () => {
25496 const qid = _this.tags.wikidata || _this.tags["flag:wikidata"] || _this.tags["brand:wikidata"] || _this.tags["network:wikidata"] || _this.tags["operator:wikidata"];
25500 let key = _this.originalReference.key || Object.keys(utilObjectOmit(_this.tags, "name"))[0];
25501 let value = _this.originalReference.value || _this.tags[key];
25502 if (value === "*") {
25505 return { key, value };
25508 _this.unsetTags = (tags, geometry, ignoringKeys, skipFieldDefaults) => {
25509 let removeTags = ignoringKeys ? utilObjectOmit(_this.removeTags, ignoringKeys) : _this.removeTags;
25510 tags = utilObjectOmit(tags, Object.keys(removeTags));
25511 if (geometry && !skipFieldDefaults) {
25512 _this.fields().forEach((field) => {
25513 if (field.matchGeometry(geometry) && field.key && field.default === tags[field.key] && (!ignoringKeys || ignoringKeys.indexOf(field.key) === -1)) {
25514 delete tags[field.key];
25521 _this.setTags = (tags, geometry, skipFieldDefaults) => {
25522 const addTags = _this.addTags;
25523 tags = Object.assign({}, tags);
25524 for (let k in addTags) {
25525 if (addTags[k] === "*") {
25526 if (_this.tags[k] || !tags[k]) {
25530 tags[k] = addTags[k];
25533 if (!addTags.hasOwnProperty("area")) {
25535 if (geometry === "area") {
25536 let needsAreaTag = true;
25537 for (let k in addTags) {
25538 if (_this.geometry.indexOf("line") === -1 && k in osmAreaKeys || k in osmAreaKeysExceptions && addTags[k] in osmAreaKeysExceptions[k]) {
25539 needsAreaTag = false;
25543 if (needsAreaTag) {
25548 if (geometry && !skipFieldDefaults) {
25549 _this.fields().forEach((field) => {
25550 if (field.matchGeometry(geometry) && field.key && !tags[field.key] && field.default) {
25551 tags[field.key] = field.default;
25557 function resolveFields(which) {
25558 const fieldIDs = which === "fields" ? _this.originalFields : _this.originalMoreFields;
25560 fieldIDs.forEach((fieldID) => {
25561 const match = fieldID.match(referenceRegex);
25562 if (match !== null) {
25563 resolved = resolved.concat(inheritFields(match[1], which));
25564 } else if (allFields[fieldID]) {
25565 resolved.push(allFields[fieldID]);
25567 console.log(`Cannot resolve "${fieldID}" found in ${_this.id}.${which}`);
25570 if (!resolved.length) {
25571 const endIndex = _this.id.lastIndexOf("/");
25572 const parentID = endIndex && _this.id.substring(0, endIndex);
25574 resolved = inheritFields(parentID, which);
25577 return utilArrayUniq(resolved);
25578 function inheritFields(presetID2, which2) {
25579 const parent = allPresets[presetID2];
25582 if (which2 === "fields") {
25583 return parent.fields().filter(shouldInherit);
25584 } else if (which2 === "moreFields") {
25585 return parent.moreFields();
25590 function shouldInherit(f2) {
25591 if (f2.key && _this.tags[f2.key] !== void 0 && f2.type !== "multiCombo" && f2.type !== "semiCombo" && f2.type !== "manyCombo" && f2.type !== "check")
25596 function stripDiacritics(s) {
25598 s = s.normalize("NFD");
25599 s = s.replace(/[\u0300-\u036f]/g, "");
25605 // modules/presets/index.js
25606 var _mainPresetIndex = presetIndex();
25607 function presetIndex() {
25608 const dispatch10 = dispatch_default("favoritePreset", "recentsChange");
25609 const MAXRECENTS = 30;
25610 const POINT = presetPreset("point", { name: "Point", tags: {}, geometry: ["point", "vertex"], matchScore: 0.1 });
25611 const LINE = presetPreset("line", { name: "Line", tags: {}, geometry: ["line"], matchScore: 0.1 });
25612 const AREA = presetPreset("area", { name: "Area", tags: { area: "yes" }, geometry: ["area"], matchScore: 0.1 });
25613 const RELATION = presetPreset("relation", { name: "Relation", tags: {}, geometry: ["relation"], matchScore: 0.1 });
25614 let _this = presetCollection([POINT, LINE, AREA, RELATION]);
25615 let _presets = { point: POINT, line: LINE, area: AREA, relation: RELATION };
25617 point: presetCollection([POINT]),
25618 vertex: presetCollection([POINT]),
25619 line: presetCollection([LINE]),
25620 area: presetCollection([AREA]),
25621 relation: presetCollection([RELATION])
25624 let _categories = {};
25625 let _universal = [];
25626 let _addablePresetIDs = null;
25629 let _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
25631 _this.ensureLoaded = () => {
25633 return _loadPromise;
25634 return _loadPromise = Promise.all([
25635 _mainFileFetcher.get("preset_categories"),
25636 _mainFileFetcher.get("preset_defaults"),
25637 _mainFileFetcher.get("preset_presets"),
25638 _mainFileFetcher.get("preset_fields")
25639 ]).then((vals) => {
25641 categories: vals[0],
25646 osmSetAreaKeys(_this.areaKeys());
25647 osmSetLineTags(_this.lineTags());
25648 osmSetPointTags(_this.pointTags());
25649 osmSetVertexTags(_this.vertexTags());
25652 _this.merge = (d) => {
25653 let newLocationSets = [];
25655 Object.keys(d.fields).forEach((fieldID) => {
25656 let f2 = d.fields[fieldID];
25658 f2 = presetField(fieldID, f2, _fields);
25659 if (f2.locationSet)
25660 newLocationSets.push(f2);
25661 _fields[fieldID] = f2;
25663 delete _fields[fieldID];
25668 Object.keys(d.presets).forEach((presetID) => {
25669 let p = d.presets[presetID];
25671 const isAddable = !_addablePresetIDs || _addablePresetIDs.has(presetID);
25672 p = presetPreset(presetID, p, isAddable, _fields, _presets);
25674 newLocationSets.push(p);
25675 _presets[presetID] = p;
25677 const existing = _presets[presetID];
25678 if (existing && !existing.isFallback()) {
25679 delete _presets[presetID];
25684 if (d.categories) {
25685 Object.keys(d.categories).forEach((categoryID) => {
25686 let c = d.categories[categoryID];
25688 c = presetCategory(categoryID, c, _presets);
25690 newLocationSets.push(c);
25691 _categories[categoryID] = c;
25693 delete _categories[categoryID];
25697 _this.collection = Object.values(_presets).concat(Object.values(_categories));
25699 Object.keys(d.defaults).forEach((geometry) => {
25700 const def = d.defaults[geometry];
25701 if (Array.isArray(def)) {
25702 _defaults[geometry] = presetCollection(
25703 def.map((id2) => _presets[id2] || _categories[id2]).filter(Boolean)
25706 delete _defaults[geometry];
25710 _universal = Object.values(_fields).filter((field) => field.universal);
25711 Object.values(_presets).forEach((preset) => preset.resetFields());
25712 _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
25713 _this.collection.forEach((preset) => {
25714 (preset.geometry || []).forEach((geometry) => {
25715 let g = _geometryIndex[geometry];
25716 for (let key in preset.tags) {
25717 g[key] = g[key] || {};
25718 let value = preset.tags[key];
25719 (g[key][value] = g[key][value] || []).push(preset);
25723 if (d.featureCollection && Array.isArray(d.featureCollection.features)) {
25724 _sharedLocationManager.mergeCustomGeoJSON(d.featureCollection);
25726 if (newLocationSets.length) {
25727 _sharedLocationManager.mergeLocationSets(newLocationSets);
25731 _this.match = (entity, resolver) => {
25732 return resolver.transient(entity, "presetMatch", () => {
25733 let geometry = entity.geometry(resolver);
25734 if (geometry === "vertex" && entity.isOnAddressLine(resolver)) {
25735 geometry = "point";
25737 const entityExtent = entity.extent(resolver);
25738 return _this.matchTags(entity.tags, geometry, entityExtent.center());
25741 _this.matchTags = (tags, geometry, loc) => {
25742 const keyIndex = _geometryIndex[geometry];
25743 let bestScore = -1;
25745 let matchCandidates = [];
25746 for (let k in tags) {
25747 let indexMatches = [];
25748 let valueIndex = keyIndex[k];
25751 let keyValueMatches = valueIndex[tags[k]];
25752 if (keyValueMatches)
25753 indexMatches.push(...keyValueMatches);
25754 let keyStarMatches = valueIndex["*"];
25755 if (keyStarMatches)
25756 indexMatches.push(...keyStarMatches);
25757 if (indexMatches.length === 0)
25759 for (let i2 = 0; i2 < indexMatches.length; i2++) {
25760 const candidate = indexMatches[i2];
25761 const score = candidate.matchScore(tags);
25762 if (score === -1) {
25765 matchCandidates.push({ score, candidate });
25766 if (score > bestScore) {
25768 bestMatch = candidate;
25772 if (bestMatch && bestMatch.locationSetID && bestMatch.locationSetID !== "+[Q2]" && Array.isArray(loc)) {
25773 const validHere = _sharedLocationManager.locationSetsAt(loc);
25774 if (!validHere[bestMatch.locationSetID]) {
25775 matchCandidates.sort((a, b) => a.score < b.score ? 1 : -1);
25776 for (let i2 = 0; i2 < matchCandidates.length; i2++) {
25777 const candidateScore = matchCandidates[i2];
25778 if (!candidateScore.candidate.locationSetID || validHere[candidateScore.candidate.locationSetID]) {
25779 bestMatch = candidateScore.candidate;
25780 bestScore = candidateScore.score;
25786 if (!bestMatch || bestMatch.isFallback()) {
25787 for (let k in tags) {
25788 if (/^addr:/.test(k) && keyIndex["addr:*"] && keyIndex["addr:*"]["*"]) {
25789 bestMatch = keyIndex["addr:*"]["*"][0];
25794 return bestMatch || _this.fallback(geometry);
25796 _this.allowsVertex = (entity, resolver) => {
25797 if (entity.type !== "node")
25799 if (Object.keys(entity.tags).length === 0)
25801 return resolver.transient(entity, "vertexMatch", () => {
25802 if (entity.isOnAddressLine(resolver))
25804 const geometries = osmNodeGeometriesForTags(entity.tags);
25805 if (geometries.vertex)
25807 if (geometries.point)
25812 _this.areaKeys = () => {
25822 const presets = _this.collection.filter((p) => !p.suggestion && !p.replacement);
25823 presets.forEach((p) => {
25824 const keys = p.tags && Object.keys(p.tags);
25825 const key = keys && keys.length && keys[0];
25830 if (p.geometry.indexOf("area") !== -1) {
25831 areaKeys[key] = areaKeys[key] || {};
25834 presets.forEach((p) => {
25836 for (key in p.addTags) {
25837 const value = p.addTags[key];
25838 if (key in areaKeys && p.geometry.indexOf("line") !== -1 && value !== "*") {
25839 areaKeys[key][value] = true;
25845 _this.lineTags = () => {
25846 return _this.collection.filter((lineTags, d) => {
25847 if (d.suggestion || d.replacement || d.searchable === false)
25849 const keys = d.tags && Object.keys(d.tags);
25850 const key = keys && keys.length && keys[0];
25853 if (d.geometry.indexOf("line") !== -1) {
25854 lineTags[key] = lineTags[key] || [];
25855 lineTags[key].push(d.tags);
25860 _this.pointTags = () => {
25861 return _this.collection.reduce((pointTags, d) => {
25862 if (d.suggestion || d.replacement || d.searchable === false)
25864 const keys = d.tags && Object.keys(d.tags);
25865 const key = keys && keys.length && keys[0];
25868 if (d.geometry.indexOf("point") !== -1) {
25869 pointTags[key] = pointTags[key] || {};
25870 pointTags[key][d.tags[key]] = true;
25875 _this.vertexTags = () => {
25876 return _this.collection.reduce((vertexTags, d) => {
25877 if (d.suggestion || d.replacement || d.searchable === false)
25879 const keys = d.tags && Object.keys(d.tags);
25880 const key = keys && keys.length && keys[0];
25883 if (d.geometry.indexOf("vertex") !== -1) {
25884 vertexTags[key] = vertexTags[key] || {};
25885 vertexTags[key][d.tags[key]] = true;
25890 _this.field = (id2) => _fields[id2];
25891 _this.universal = () => _universal;
25892 _this.defaults = (geometry, n2, startWithRecents, loc, extraPresets) => {
25894 if (startWithRecents) {
25895 recents = _this.recent().matchGeometry(geometry).collection.slice(0, 4);
25898 if (_addablePresetIDs) {
25899 defaults2 = Array.from(_addablePresetIDs).map(function(id2) {
25900 var preset = _this.item(id2);
25901 if (preset && preset.matchGeometry(geometry))
25904 }).filter(Boolean);
25906 defaults2 = _defaults[geometry].collection.concat(_this.fallback(geometry));
25908 let result = presetCollection(
25909 utilArrayUniq(recents.concat(defaults2).concat(extraPresets || [])).slice(0, n2 - 1)
25911 if (Array.isArray(loc)) {
25912 const validHere = _sharedLocationManager.locationSetsAt(loc);
25913 result.collection = result.collection.filter((a) => !a.locationSetID || validHere[a.locationSetID]);
25917 _this.addablePresetIDs = function(val) {
25918 if (!arguments.length)
25919 return _addablePresetIDs;
25920 if (Array.isArray(val))
25921 val = new Set(val);
25922 _addablePresetIDs = val;
25923 if (_addablePresetIDs) {
25924 _this.collection.forEach((p) => {
25926 p.addable(_addablePresetIDs.has(p.id));
25929 _this.collection.forEach((p) => {
25936 _this.recent = () => {
25937 return presetCollection(
25938 utilArrayUniq(_this.getRecents().map((d) => d.preset).filter((d) => d.searchable !== false))
25941 function RibbonItem(preset, source) {
25943 item.preset = preset;
25944 item.source = source;
25945 item.isFavorite = () => item.source === "favorite";
25946 item.isRecent = () => item.source === "recent";
25947 item.matches = (preset2) => item.preset.id === preset2.id;
25948 item.minified = () => ({ pID: item.preset.id });
25951 function ribbonItemForMinified(d, source) {
25953 const preset = _this.item(d.pID);
25956 return RibbonItem(preset, source);
25960 _this.getGenericRibbonItems = () => {
25961 return ["point", "line", "area"].map((id2) => RibbonItem(_this.item(id2), "generic"));
25963 _this.getAddable = () => {
25964 if (!_addablePresetIDs)
25966 return _addablePresetIDs.map((id2) => {
25967 const preset = _this.item(id2);
25969 return RibbonItem(preset, "addable");
25971 }).filter(Boolean);
25973 function setRecents(items) {
25975 const minifiedItems = items.map((d) => d.minified());
25976 corePreferences("preset_recents", JSON.stringify(minifiedItems));
25977 dispatch10.call("recentsChange");
25979 _this.getRecents = () => {
25981 _recents = (JSON.parse(corePreferences("preset_recents")) || []).reduce((acc, d) => {
25982 let item = ribbonItemForMinified(d, "recent");
25983 if (item && item.preset.addable())
25990 _this.addRecent = (preset, besidePreset, after) => {
25991 const recents = _this.getRecents();
25992 const beforeItem = _this.recentMatching(besidePreset);
25993 let toIndex = recents.indexOf(beforeItem);
25996 const newItem = RibbonItem(preset, "recent");
25997 recents.splice(toIndex, 0, newItem);
25998 setRecents(recents);
26000 _this.removeRecent = (preset) => {
26001 const item = _this.recentMatching(preset);
26003 let items = _this.getRecents();
26004 items.splice(items.indexOf(item), 1);
26008 _this.recentMatching = (preset) => {
26009 const items = _this.getRecents();
26010 for (let i2 in items) {
26011 if (items[i2].matches(preset)) {
26017 _this.moveItem = (items, fromIndex, toIndex) => {
26018 if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= items.length || toIndex >= items.length)
26020 items.splice(toIndex, 0, items.splice(fromIndex, 1)[0]);
26023 _this.moveRecent = (item, beforeItem) => {
26024 const recents = _this.getRecents();
26025 const fromIndex = recents.indexOf(item);
26026 const toIndex = recents.indexOf(beforeItem);
26027 const items = _this.moveItem(recents, fromIndex, toIndex);
26031 _this.setMostRecent = (preset) => {
26032 if (preset.searchable === false)
26034 let items = _this.getRecents();
26035 let item = _this.recentMatching(preset);
26037 items.splice(items.indexOf(item), 1);
26039 item = RibbonItem(preset, "recent");
26041 while (items.length >= MAXRECENTS) {
26044 items.unshift(item);
26047 function setFavorites(items) {
26048 _favorites = items;
26049 const minifiedItems = items.map((d) => d.minified());
26050 corePreferences("preset_favorites", JSON.stringify(minifiedItems));
26051 dispatch10.call("favoritePreset");
26053 _this.addFavorite = (preset, besidePreset, after) => {
26054 const favorites = _this.getFavorites();
26055 const beforeItem = _this.favoriteMatching(besidePreset);
26056 let toIndex = favorites.indexOf(beforeItem);
26059 const newItem = RibbonItem(preset, "favorite");
26060 favorites.splice(toIndex, 0, newItem);
26061 setFavorites(favorites);
26063 _this.toggleFavorite = (preset) => {
26064 const favs = _this.getFavorites();
26065 const favorite = _this.favoriteMatching(preset);
26067 favs.splice(favs.indexOf(favorite), 1);
26069 if (favs.length === 10) {
26072 favs.push(RibbonItem(preset, "favorite"));
26074 setFavorites(favs);
26076 _this.removeFavorite = (preset) => {
26077 const item = _this.favoriteMatching(preset);
26079 const items = _this.getFavorites();
26080 items.splice(items.indexOf(item), 1);
26081 setFavorites(items);
26084 _this.getFavorites = () => {
26086 let rawFavorites = JSON.parse(corePreferences("preset_favorites"));
26087 if (!rawFavorites) {
26089 corePreferences("preset_favorites", JSON.stringify(rawFavorites));
26091 _favorites = rawFavorites.reduce((output, d) => {
26092 const item = ribbonItemForMinified(d, "favorite");
26093 if (item && item.preset.addable())
26100 _this.favoriteMatching = (preset) => {
26101 const favs = _this.getFavorites();
26102 for (let index in favs) {
26103 if (favs[index].matches(preset)) {
26104 return favs[index];
26109 return utilRebind(_this, dispatch10, "on");
26112 // modules/util/util.js
26113 function utilTagText(entity) {
26114 var obj = entity && entity.tags || {};
26115 return Object.keys(obj).map(function(k) {
26116 return k + "=" + obj[k];
26119 function utilTotalExtent(array2, graph) {
26120 var extent = geoExtent();
26122 for (var i2 = 0; i2 < array2.length; i2++) {
26124 entity = typeof val === "string" ? graph.hasEntity(val) : val;
26126 extent._extend(entity.extent(graph));
26131 function utilTagDiff(oldTags, newTags) {
26133 var keys = utilArrayUnion(Object.keys(oldTags), Object.keys(newTags)).sort();
26134 keys.forEach(function(k) {
26135 var oldVal = oldTags[k];
26136 var newVal = newTags[k];
26137 if ((oldVal || oldVal === "") && (newVal === void 0 || newVal !== oldVal)) {
26143 display: "- " + k + "=" + oldVal
26146 if ((newVal || newVal === "") && (oldVal === void 0 || newVal !== oldVal)) {
26152 display: "+ " + k + "=" + newVal
26158 function utilEntitySelector(ids) {
26159 return ids.length ? "." + ids.join(",.") : "nothing";
26161 function utilEntityOrMemberSelector(ids, graph) {
26162 var seen = new Set(ids);
26163 ids.forEach(collectShallowDescendants);
26164 return utilEntitySelector(Array.from(seen));
26165 function collectShallowDescendants(id2) {
26166 var entity = graph.hasEntity(id2);
26167 if (!entity || entity.type !== "relation")
26169 entity.members.map(function(member) {
26171 }).forEach(function(id3) {
26176 function utilEntityOrDeepMemberSelector(ids, graph) {
26177 return utilEntitySelector(utilEntityAndDeepMemberIDs(ids, graph));
26179 function utilEntityAndDeepMemberIDs(ids, graph) {
26180 var seen = /* @__PURE__ */ new Set();
26181 ids.forEach(collectDeepDescendants);
26182 return Array.from(seen);
26183 function collectDeepDescendants(id2) {
26187 var entity = graph.hasEntity(id2);
26188 if (!entity || entity.type !== "relation")
26190 entity.members.map(function(member) {
26192 }).forEach(collectDeepDescendants);
26195 function utilDeepMemberSelector(ids, graph, skipMultipolgonMembers) {
26196 var idsSet = new Set(ids);
26197 var seen = /* @__PURE__ */ new Set();
26198 var returners = /* @__PURE__ */ new Set();
26199 ids.forEach(collectDeepDescendants);
26200 return utilEntitySelector(Array.from(returners));
26201 function collectDeepDescendants(id2) {
26205 if (!idsSet.has(id2)) {
26206 returners.add(id2);
26208 var entity = graph.hasEntity(id2);
26209 if (!entity || entity.type !== "relation")
26211 if (skipMultipolgonMembers && entity.isMultipolygon())
26213 entity.members.map(function(member) {
26215 }).forEach(collectDeepDescendants);
26218 function utilHighlightEntities(ids, highlighted, context) {
26219 context.surface().selectAll(utilEntityOrDeepMemberSelector(ids, context.graph())).classed("highlighted", highlighted);
26221 function utilGetAllNodes(ids, graph) {
26222 var seen = /* @__PURE__ */ new Set();
26223 var nodes = /* @__PURE__ */ new Set();
26224 ids.forEach(collectNodes);
26225 return Array.from(nodes);
26226 function collectNodes(id2) {
26230 var entity = graph.hasEntity(id2);
26233 if (entity.type === "node") {
26235 } else if (entity.type === "way") {
26236 entity.nodes.forEach(collectNodes);
26238 entity.members.map(function(member) {
26240 }).forEach(collectNodes);
26244 function utilDisplayName(entity) {
26245 var localizedNameKey = "name:" + _mainLocalizer.languageCode().toLowerCase();
26246 var name = entity.tags[localizedNameKey] || entity.tags.name || "";
26250 direction: entity.tags.direction,
26251 from: entity.tags.from,
26252 network: entity.tags.cycle_network || entity.tags.network,
26253 ref: entity.tags.ref,
26254 to: entity.tags.to,
26255 via: entity.tags.via
26257 var keyComponents = [];
26258 if (tags.network) {
26259 keyComponents.push("network");
26262 keyComponents.push("ref");
26264 if (entity.tags.route) {
26265 if (tags.direction) {
26266 keyComponents.push("direction");
26267 } else if (tags.from && tags.to) {
26268 keyComponents.push("from");
26269 keyComponents.push("to");
26271 keyComponents.push("via");
26275 if (keyComponents.length) {
26276 name = _t("inspector.display_name." + keyComponents.join("_"), tags);
26280 function utilDisplayNameForPath(entity) {
26281 var name = utilDisplayName(entity);
26282 var isFirefox = utilDetect().browser.toLowerCase().indexOf("firefox") > -1;
26283 var isNewChromium = Number(utilDetect().version.split(".")[0]) >= 96;
26284 if (!isFirefox && !isNewChromium && name && rtlRegex.test(name)) {
26285 name = fixRTLTextForSvg(name);
26289 function utilDisplayType(id2) {
26291 n: _t("inspector.node"),
26292 w: _t("inspector.way"),
26293 r: _t("inspector.relation")
26296 function utilDisplayLabel(entity, graphOrGeometry, verbose) {
26298 var displayName = utilDisplayName(entity);
26299 var preset = typeof graphOrGeometry === "string" ? _mainPresetIndex.matchTags(entity.tags, graphOrGeometry) : _mainPresetIndex.match(entity, graphOrGeometry);
26300 var presetName = preset && (preset.suggestion ? preset.subtitle() : preset.name());
26302 result = [presetName, displayName].filter(Boolean).join(" ");
26304 result = displayName || presetName;
26306 return result || utilDisplayType(entity.id);
26308 function utilEntityRoot(entityType) {
26315 function utilCombinedTags(entityIDs, graph) {
26317 var tagCounts = {};
26318 var allKeys = /* @__PURE__ */ new Set();
26319 var entities = entityIDs.map(function(entityID) {
26320 return graph.hasEntity(entityID);
26321 }).filter(Boolean);
26322 entities.forEach(function(entity) {
26323 var keys = Object.keys(entity.tags).filter(Boolean);
26324 keys.forEach(function(key2) {
26328 entities.forEach(function(entity) {
26329 allKeys.forEach(function(key2) {
26330 var value = entity.tags[key2];
26331 if (!tags.hasOwnProperty(key2)) {
26332 tags[key2] = value;
26334 if (!Array.isArray(tags[key2])) {
26335 if (tags[key2] !== value) {
26336 tags[key2] = [tags[key2], value];
26339 if (tags[key2].indexOf(value) === -1) {
26340 tags[key2].push(value);
26344 var tagHash = key2 + "=" + value;
26345 if (!tagCounts[tagHash])
26346 tagCounts[tagHash] = 0;
26347 tagCounts[tagHash] += 1;
26350 for (var key in tags) {
26351 if (!Array.isArray(tags[key]))
26353 tags[key] = tags[key].sort(function(val12, val2) {
26355 var count2 = tagCounts[key2 + "=" + val2];
26356 var count1 = tagCounts[key2 + "=" + val12];
26357 if (count2 !== count1) {
26358 return count2 - count1;
26360 if (val2 && val12) {
26361 return val12.localeCompare(val2);
26363 return val12 ? 1 : -1;
26368 function utilStringQs(str2) {
26370 while (i2 < str2.length && (str2[i2] === "?" || str2[i2] === "#"))
26372 str2 = str2.slice(i2);
26373 return str2.split("&").reduce(function(obj, pair2) {
26374 var parts = pair2.split("=");
26375 if (parts.length === 2) {
26376 obj[parts[0]] = null === parts[1] ? "" : decodeURIComponent(parts[1]);
26381 function utilQsString(obj, noencode) {
26382 function softEncode(s) {
26383 return encodeURIComponent(s).replace(/(%2F|%3A|%2C|%7B|%7D)/g, decodeURIComponent);
26385 return Object.keys(obj).sort().map(function(key) {
26386 return encodeURIComponent(key) + "=" + (noencode ? softEncode(obj[key]) : encodeURIComponent(obj[key]));
26389 function utilPrefixDOMProperty(property) {
26390 var prefixes2 = ["webkit", "ms", "moz", "o"];
26392 var n2 = prefixes2.length;
26393 var s = document.body;
26396 property = property.slice(0, 1).toUpperCase() + property.slice(1);
26397 while (++i2 < n2) {
26398 if (prefixes2[i2] + property in s) {
26399 return prefixes2[i2] + property;
26404 function utilPrefixCSSProperty(property) {
26405 var prefixes2 = ["webkit", "ms", "Moz", "O"];
26407 var n2 = prefixes2.length;
26408 var s = document.body.style;
26409 if (property.toLowerCase() in s) {
26410 return property.toLowerCase();
26412 while (++i2 < n2) {
26413 if (prefixes2[i2] + property in s) {
26414 return "-" + prefixes2[i2].toLowerCase() + property.replace(/([A-Z])/g, "-$1").toLowerCase();
26419 var transformProperty;
26420 function utilSetTransform(el, x, y, scale) {
26421 var prop = transformProperty = transformProperty || utilPrefixCSSProperty("Transform");
26422 var translate = utilDetect().opera ? "translate(" + x + "px," + y + "px)" : "translate3d(" + x + "px," + y + "px,0)";
26423 return el.style(prop, translate + (scale ? " scale(" + scale + ")" : ""));
26425 function utilEditDistance(a, b) {
26426 a = (0, import_diacritics.remove)(a.toLowerCase());
26427 b = (0, import_diacritics.remove)(b.toLowerCase());
26428 if (a.length === 0)
26430 if (b.length === 0)
26434 for (i2 = 0; i2 <= b.length; i2++) {
26437 for (j2 = 0; j2 <= a.length; j2++) {
26438 matrix[0][j2] = j2;
26440 for (i2 = 1; i2 <= b.length; i2++) {
26441 for (j2 = 1; j2 <= a.length; j2++) {
26442 if (b.charAt(i2 - 1) === a.charAt(j2 - 1)) {
26443 matrix[i2][j2] = matrix[i2 - 1][j2 - 1];
26445 matrix[i2][j2] = Math.min(
26446 matrix[i2 - 1][j2 - 1] + 1,
26448 matrix[i2][j2 - 1] + 1,
26449 matrix[i2 - 1][j2] + 1
26455 return matrix[b.length][a.length];
26457 function utilFastMouse(container) {
26458 var rect = container.getBoundingClientRect();
26459 var rectLeft = rect.left;
26460 var rectTop = rect.top;
26461 var clientLeft = +container.clientLeft;
26462 var clientTop = +container.clientTop;
26463 return function(e) {
26465 e.clientX - rectLeft - clientLeft,
26466 e.clientY - rectTop - clientTop
26470 function utilAsyncMap(inputs, func, callback) {
26471 var remaining = inputs.length;
26474 inputs.forEach(function(d, i2) {
26475 func(d, function done(err, data) {
26477 results[i2] = data;
26480 callback(errors, results);
26484 function utilWrap(index, length) {
26486 index += Math.ceil(-index / length) * length;
26488 return index % length;
26490 function utilFunctor(value) {
26491 if (typeof value === "function")
26493 return function() {
26497 function utilNoAuto(selection2) {
26498 var isText = selection2.size() && selection2.node().tagName.toLowerCase() === "textarea";
26499 return selection2.attr("autocomplete", "new-password").attr("autocorrect", "off").attr("autocapitalize", "off").attr("spellcheck", isText ? "true" : "false");
26501 function utilHashcode(str2) {
26503 if (str2.length === 0) {
26506 for (var i2 = 0; i2 < str2.length; i2++) {
26507 var char = str2.charCodeAt(i2);
26508 hash = (hash << 5) - hash + char;
26509 hash = hash & hash;
26513 function utilSafeClassName(str2) {
26514 return str2.toLowerCase().replace(/[^a-z0-9]+/g, "_");
26516 function utilUniqueDomId(val) {
26517 return "ideditor-" + utilSafeClassName(val.toString()) + "-" + new Date().getTime().toString();
26519 function utilUnicodeCharsCount(str2) {
26520 return Array.from(str2).length;
26522 function utilUnicodeCharsTruncated(str2, limit) {
26523 return Array.from(str2).slice(0, limit).join("");
26525 function toNumericID(id2) {
26526 var match = id2.match(/^[cnwr](-?\d+)$/);
26528 return parseInt(match[1], 10);
26532 function compareNumericIDs(left, right) {
26533 if (isNaN(left) && isNaN(right))
26539 if (Math.sign(left) !== Math.sign(right))
26540 return -Math.sign(left);
26541 if (Math.sign(left) < 0)
26542 return Math.sign(right - left);
26543 return Math.sign(left - right);
26545 function utilCompareIDs(left, right) {
26546 return compareNumericIDs(toNumericID(left), toNumericID(right));
26548 function utilOldestID(ids) {
26549 if (ids.length === 0) {
26552 var oldestIDIndex = 0;
26553 var oldestID = toNumericID(ids[0]);
26554 for (var i2 = 1; i2 < ids.length; i2++) {
26555 var num = toNumericID(ids[i2]);
26556 if (compareNumericIDs(oldestID, num) === 1) {
26557 oldestIDIndex = i2;
26561 return ids[oldestIDIndex];
26564 // modules/osm/entity.js
26565 function osmEntity(attrs) {
26566 if (this instanceof osmEntity)
26568 if (attrs && attrs.type) {
26569 return osmEntity[attrs.type].apply(this, arguments);
26570 } else if (attrs && attrs.id) {
26571 return osmEntity[osmEntity.id.type(attrs.id)].apply(this, arguments);
26573 return new osmEntity().initialize(arguments);
26575 osmEntity.id = function(type3) {
26576 return osmEntity.id.fromOSM(type3, osmEntity.id.next[type3]--);
26578 osmEntity.id.next = {
26584 osmEntity.id.fromOSM = function(type3, id2) {
26585 return type3[0] + id2;
26587 osmEntity.id.toOSM = function(id2) {
26588 var match = id2.match(/^[cnwr](-?\d+)$/);
26594 osmEntity.id.type = function(id2) {
26595 return { "c": "changeset", "n": "node", "w": "way", "r": "relation" }[id2[0]];
26597 osmEntity.key = function(entity) {
26598 return entity.id + "v" + (entity.v || 0);
26600 var _deprecatedTagValuesByKey;
26601 osmEntity.deprecatedTagValuesByKey = function(dataDeprecated) {
26602 if (!_deprecatedTagValuesByKey) {
26603 _deprecatedTagValuesByKey = {};
26604 dataDeprecated.forEach(function(d) {
26605 var oldKeys = Object.keys(d.old);
26606 if (oldKeys.length === 1) {
26607 var oldKey = oldKeys[0];
26608 var oldValue = d.old[oldKey];
26609 if (oldValue !== "*") {
26610 if (!_deprecatedTagValuesByKey[oldKey]) {
26611 _deprecatedTagValuesByKey[oldKey] = [oldValue];
26613 _deprecatedTagValuesByKey[oldKey].push(oldValue);
26619 return _deprecatedTagValuesByKey;
26621 osmEntity.prototype = {
26623 initialize: function(sources) {
26624 for (var i2 = 0; i2 < sources.length; ++i2) {
26625 var source = sources[i2];
26626 for (var prop in source) {
26627 if (Object.prototype.hasOwnProperty.call(source, prop)) {
26628 if (source[prop] === void 0) {
26631 this[prop] = source[prop];
26636 if (!this.id && this.type) {
26637 this.id = osmEntity.id(this.type);
26639 if (!this.hasOwnProperty("visible")) {
26640 this.visible = true;
26643 Object.freeze(this);
26644 Object.freeze(this.tags);
26646 Object.freeze(this.loc);
26648 Object.freeze(this.nodes);
26650 Object.freeze(this.members);
26654 copy: function(resolver, copies) {
26655 if (copies[this.id])
26656 return copies[this.id];
26657 var copy2 = osmEntity(this, { id: void 0, user: void 0, version: void 0 });
26658 copies[this.id] = copy2;
26661 osmId: function() {
26662 return osmEntity.id.toOSM(this.id);
26664 isNew: function() {
26665 var osmId = osmEntity.id.toOSM(this.id);
26666 return osmId.length === 0 || osmId[0] === "-";
26668 update: function(attrs) {
26669 return osmEntity(this, attrs, { v: 1 + (this.v || 0) });
26671 mergeTags: function(tags) {
26672 var merged = Object.assign({}, this.tags);
26673 var changed = false;
26674 for (var k in tags) {
26675 var t1 = merged[k];
26680 } else if (t1 !== t2) {
26682 merged[k] = utilUnicodeCharsTruncated(
26683 utilArrayUnion(t1.split(/;\s*/), t2.split(/;\s*/)).join(";"),
26688 return changed ? this.update({ tags: merged }) : this;
26690 intersects: function(extent, resolver) {
26691 return this.extent(resolver).intersects(extent);
26693 hasNonGeometryTags: function() {
26694 return Object.keys(this.tags).some(function(k) {
26695 return k !== "area";
26698 hasParentRelations: function(resolver) {
26699 return resolver.parentRelations(this).length > 0;
26701 hasInterestingTags: function() {
26702 return Object.keys(this.tags).some(osmIsInterestingTag);
26704 isHighwayIntersection: function() {
26707 isDegenerate: function() {
26710 deprecatedTags: function(dataDeprecated) {
26711 var tags = this.tags;
26712 if (Object.keys(tags).length === 0)
26714 var deprecated = [];
26715 dataDeprecated.forEach(function(d) {
26716 var oldKeys = Object.keys(d.old);
26718 var hasExistingValues = Object.keys(d.replace).some(function(replaceKey) {
26719 if (!tags[replaceKey] || d.old[replaceKey])
26721 var replaceValue = d.replace[replaceKey];
26722 if (replaceValue === "*")
26724 if (replaceValue === tags[replaceKey])
26728 if (hasExistingValues)
26731 var matchesDeprecatedTags = oldKeys.every(function(oldKey) {
26734 if (d.old[oldKey] === "*")
26736 if (d.old[oldKey] === tags[oldKey])
26738 var vals = tags[oldKey].split(";").filter(Boolean);
26739 if (vals.length === 0) {
26741 } else if (vals.length > 1) {
26742 return vals.indexOf(d.old[oldKey]) !== -1;
26744 if (tags[oldKey] === d.old[oldKey]) {
26745 if (d.replace && d.old[oldKey] === d.replace[oldKey]) {
26746 var replaceKeys = Object.keys(d.replace);
26747 return !replaceKeys.every(function(replaceKey) {
26748 return tags[replaceKey] === d.replace[replaceKey];
26757 if (matchesDeprecatedTags) {
26758 deprecated.push(d);
26765 // modules/osm/lanes.js
26766 function osmLanes(entity) {
26767 if (entity.type !== "way")
26769 if (!entity.tags.highway)
26771 var tags = entity.tags;
26772 var isOneWay = entity.isOneWay();
26773 var laneCount = getLaneCount(tags, isOneWay);
26774 var maxspeed = parseMaxspeed(tags);
26775 var laneDirections = parseLaneDirections(tags, isOneWay, laneCount);
26776 var forward = laneDirections.forward;
26777 var backward = laneDirections.backward;
26778 var bothways = laneDirections.bothways;
26779 var turnLanes = {};
26780 turnLanes.unspecified = parseTurnLanes(tags["turn:lanes"]);
26781 turnLanes.forward = parseTurnLanes(tags["turn:lanes:forward"]);
26782 turnLanes.backward = parseTurnLanes(tags["turn:lanes:backward"]);
26783 var maxspeedLanes = {};
26784 maxspeedLanes.unspecified = parseMaxspeedLanes(tags["maxspeed:lanes"], maxspeed);
26785 maxspeedLanes.forward = parseMaxspeedLanes(tags["maxspeed:lanes:forward"], maxspeed);
26786 maxspeedLanes.backward = parseMaxspeedLanes(tags["maxspeed:lanes:backward"], maxspeed);
26788 psvLanes.unspecified = parseMiscLanes(tags["psv:lanes"]);
26789 psvLanes.forward = parseMiscLanes(tags["psv:lanes:forward"]);
26790 psvLanes.backward = parseMiscLanes(tags["psv:lanes:backward"]);
26792 busLanes.unspecified = parseMiscLanes(tags["bus:lanes"]);
26793 busLanes.forward = parseMiscLanes(tags["bus:lanes:forward"]);
26794 busLanes.backward = parseMiscLanes(tags["bus:lanes:backward"]);
26795 var taxiLanes = {};
26796 taxiLanes.unspecified = parseMiscLanes(tags["taxi:lanes"]);
26797 taxiLanes.forward = parseMiscLanes(tags["taxi:lanes:forward"]);
26798 taxiLanes.backward = parseMiscLanes(tags["taxi:lanes:backward"]);
26800 hovLanes.unspecified = parseMiscLanes(tags["hov:lanes"]);
26801 hovLanes.forward = parseMiscLanes(tags["hov:lanes:forward"]);
26802 hovLanes.backward = parseMiscLanes(tags["hov:lanes:backward"]);
26804 hgvLanes.unspecified = parseMiscLanes(tags["hgv:lanes"]);
26805 hgvLanes.forward = parseMiscLanes(tags["hgv:lanes:forward"]);
26806 hgvLanes.backward = parseMiscLanes(tags["hgv:lanes:backward"]);
26807 var bicyclewayLanes = {};
26808 bicyclewayLanes.unspecified = parseBicycleWay(tags["bicycleway:lanes"]);
26809 bicyclewayLanes.forward = parseBicycleWay(tags["bicycleway:lanes:forward"]);
26810 bicyclewayLanes.backward = parseBicycleWay(tags["bicycleway:lanes:backward"]);
26816 mapToLanesObj(lanesObj, turnLanes, "turnLane");
26817 mapToLanesObj(lanesObj, maxspeedLanes, "maxspeed");
26818 mapToLanesObj(lanesObj, psvLanes, "psv");
26819 mapToLanesObj(lanesObj, busLanes, "bus");
26820 mapToLanesObj(lanesObj, taxiLanes, "taxi");
26821 mapToLanesObj(lanesObj, hovLanes, "hov");
26822 mapToLanesObj(lanesObj, hgvLanes, "hgv");
26823 mapToLanesObj(lanesObj, bicyclewayLanes, "bicycleway");
26844 function getLaneCount(tags, isOneWay) {
26847 count = parseInt(tags.lanes, 10);
26852 switch (tags.highway) {
26855 count = isOneWay ? 2 : 4;
26858 count = isOneWay ? 1 : 2;
26863 function parseMaxspeed(tags) {
26864 var maxspeed = tags.maxspeed;
26867 var maxspeedRegex = /^([0-9][\.0-9]+?)(?:[ ]?(?:km\/h|kmh|kph|mph|knots))?$/;
26868 if (!maxspeedRegex.test(maxspeed))
26870 return parseInt(maxspeed, 10);
26872 function parseLaneDirections(tags, isOneWay, laneCount) {
26873 var forward = parseInt(tags["lanes:forward"], 10);
26874 var backward = parseInt(tags["lanes:backward"], 10);
26875 var bothways = parseInt(tags["lanes:both_ways"], 10) > 0 ? 1 : 0;
26876 if (parseInt(tags.oneway, 10) === -1) {
26879 backward = laneCount;
26880 } else if (isOneWay) {
26881 forward = laneCount;
26884 } else if (isNaN(forward) && isNaN(backward)) {
26885 backward = Math.floor((laneCount - bothways) / 2);
26886 forward = laneCount - bothways - backward;
26887 } else if (isNaN(forward)) {
26888 if (backward > laneCount - bothways) {
26889 backward = laneCount - bothways;
26891 forward = laneCount - bothways - backward;
26892 } else if (isNaN(backward)) {
26893 if (forward > laneCount - bothways) {
26894 forward = laneCount - bothways;
26896 backward = laneCount - bothways - forward;
26904 function parseTurnLanes(tag) {
26907 var validValues = [
26920 return tag.split("|").map(function(s) {
26923 return s.split(";").map(function(d) {
26924 return validValues.indexOf(d) === -1 ? "unknown" : d;
26928 function parseMaxspeedLanes(tag, maxspeed) {
26931 return tag.split("|").map(function(s) {
26934 var m = parseInt(s, 10);
26935 if (s === "" || m === maxspeed)
26937 return isNaN(m) ? "unknown" : m;
26940 function parseMiscLanes(tag) {
26943 var validValues = [
26948 return tag.split("|").map(function(s) {
26951 return validValues.indexOf(s) === -1 ? "unknown" : s;
26954 function parseBicycleWay(tag) {
26957 var validValues = [
26963 return tag.split("|").map(function(s) {
26966 return validValues.indexOf(s) === -1 ? "unknown" : s;
26969 function mapToLanesObj(lanesObj, data, key) {
26970 if (data.forward) {
26971 data.forward.forEach(function(l, i2) {
26972 if (!lanesObj.forward[i2])
26973 lanesObj.forward[i2] = {};
26974 lanesObj.forward[i2][key] = l;
26977 if (data.backward) {
26978 data.backward.forEach(function(l, i2) {
26979 if (!lanesObj.backward[i2])
26980 lanesObj.backward[i2] = {};
26981 lanesObj.backward[i2][key] = l;
26984 if (data.unspecified) {
26985 data.unspecified.forEach(function(l, i2) {
26986 if (!lanesObj.unspecified[i2])
26987 lanesObj.unspecified[i2] = {};
26988 lanesObj.unspecified[i2][key] = l;
26993 // modules/osm/way.js
26994 function osmWay() {
26995 if (!(this instanceof osmWay)) {
26996 return new osmWay().initialize(arguments);
26997 } else if (arguments.length) {
26998 this.initialize(arguments);
27001 osmEntity.way = osmWay;
27002 osmWay.prototype = Object.create(osmEntity.prototype);
27003 Object.assign(osmWay.prototype, {
27006 copy: function(resolver, copies) {
27007 if (copies[this.id])
27008 return copies[this.id];
27009 var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
27010 var nodes = this.nodes.map(function(id2) {
27011 return resolver.entity(id2).copy(resolver, copies).id;
27013 copy2 = copy2.update({ nodes });
27014 copies[this.id] = copy2;
27017 extent: function(resolver) {
27018 return resolver.transient(this, "extent", function() {
27019 var extent = geoExtent();
27020 for (var i2 = 0; i2 < this.nodes.length; i2++) {
27021 var node = resolver.hasEntity(this.nodes[i2]);
27023 extent._extend(node.extent());
27029 first: function() {
27030 return this.nodes[0];
27033 return this.nodes[this.nodes.length - 1];
27035 contains: function(node) {
27036 return this.nodes.indexOf(node) >= 0;
27038 affix: function(node) {
27039 if (this.nodes[0] === node)
27041 if (this.nodes[this.nodes.length - 1] === node)
27044 layer: function() {
27045 if (isFinite(this.tags.layer)) {
27046 return Math.max(-10, Math.min(+this.tags.layer, 10));
27048 if (this.tags.covered === "yes")
27050 if (this.tags.location === "overground")
27052 if (this.tags.location === "underground")
27054 if (this.tags.location === "underwater")
27056 if (this.tags.power === "line")
27058 if (this.tags.power === "minor_line")
27060 if (this.tags.aerialway)
27062 if (this.tags.bridge)
27064 if (this.tags.cutting)
27066 if (this.tags.tunnel)
27068 if (this.tags.waterway)
27070 if (this.tags.man_made === "pipeline")
27072 if (this.tags.boundary)
27076 impliedLineWidthMeters: function() {
27077 var averageWidths = {
27126 for (var key in averageWidths) {
27127 if (this.tags[key] && averageWidths[key][this.tags[key]]) {
27128 var width = averageWidths[key][this.tags[key]];
27129 if (key === "highway") {
27130 var laneCount = this.tags.lanes && parseInt(this.tags.lanes, 10);
27132 laneCount = this.isOneWay() ? 1 : 2;
27133 return width * laneCount;
27140 isOneWay: function() {
27145 "reversible": true,
27146 "alternating": true,
27150 if (values[this.tags.oneway] !== void 0) {
27151 return values[this.tags.oneway];
27153 for (var key in this.tags) {
27154 if (key in osmOneWayTags && this.tags[key] in osmOneWayTags[key]) {
27160 sidednessIdentifier: function() {
27161 for (var key in this.tags) {
27162 var value = this.tags[key];
27163 if (key in osmRightSideIsInsideTags && value in osmRightSideIsInsideTags[key]) {
27164 if (osmRightSideIsInsideTags[key][value] === true) {
27167 return osmRightSideIsInsideTags[key][value];
27173 isSided: function() {
27174 if (this.tags.two_sided === "yes") {
27177 return this.sidednessIdentifier() !== null;
27179 lanes: function() {
27180 return osmLanes(this);
27182 isClosed: function() {
27183 return this.nodes.length > 1 && this.first() === this.last();
27185 isConvex: function(resolver) {
27186 if (!this.isClosed() || this.isDegenerate())
27188 var nodes = utilArrayUniq(resolver.childNodes(this));
27189 var coords = nodes.map(function(n2) {
27194 for (var i2 = 0; i2 < coords.length; i2++) {
27195 var o = coords[(i2 + 1) % coords.length];
27196 var a = coords[i2];
27197 var b = coords[(i2 + 2) % coords.length];
27198 var res = geoVecCross(a, b, o);
27199 curr = res > 0 ? 1 : res < 0 ? -1 : 0;
27202 } else if (prev && curr !== prev) {
27209 tagSuggestingArea: function() {
27210 return osmTagSuggestingArea(this.tags);
27212 isArea: function() {
27213 if (this.tags.area === "yes")
27215 if (!this.isClosed() || this.tags.area === "no")
27217 return this.tagSuggestingArea() !== null;
27219 isDegenerate: function() {
27220 return new Set(this.nodes).size < (this.isArea() ? 3 : 2);
27222 areAdjacent: function(n1, n2) {
27223 for (var i2 = 0; i2 < this.nodes.length; i2++) {
27224 if (this.nodes[i2] === n1) {
27225 if (this.nodes[i2 - 1] === n2)
27227 if (this.nodes[i2 + 1] === n2)
27233 geometry: function(graph) {
27234 return graph.transient(this, "geometry", function() {
27235 return this.isArea() ? "area" : "line";
27238 segments: function(graph) {
27239 function segmentExtent(graph2) {
27240 var n1 = graph2.hasEntity(this.nodes[0]);
27241 var n2 = graph2.hasEntity(this.nodes[1]);
27242 return n1 && n2 && geoExtent([
27244 Math.min(n1.loc[0], n2.loc[0]),
27245 Math.min(n1.loc[1], n2.loc[1])
27248 Math.max(n1.loc[0], n2.loc[0]),
27249 Math.max(n1.loc[1], n2.loc[1])
27253 return graph.transient(this, "segments", function() {
27255 for (var i2 = 0; i2 < this.nodes.length - 1; i2++) {
27257 id: this.id + "-" + i2,
27260 nodes: [this.nodes[i2], this.nodes[i2 + 1]],
27261 extent: segmentExtent
27267 close: function() {
27268 if (this.isClosed() || !this.nodes.length)
27270 var nodes = this.nodes.slice();
27271 nodes = nodes.filter(noRepeatNodes);
27272 nodes.push(nodes[0]);
27273 return this.update({ nodes });
27275 unclose: function() {
27276 if (!this.isClosed())
27278 var nodes = this.nodes.slice();
27279 var connector = this.first();
27280 var i2 = nodes.length - 1;
27281 while (i2 > 0 && nodes.length > 1 && nodes[i2] === connector) {
27282 nodes.splice(i2, 1);
27283 i2 = nodes.length - 1;
27285 nodes = nodes.filter(noRepeatNodes);
27286 return this.update({ nodes });
27288 addNode: function(id2, index) {
27289 var nodes = this.nodes.slice();
27290 var isClosed = this.isClosed();
27291 var max3 = isClosed ? nodes.length - 1 : nodes.length;
27292 if (index === void 0) {
27295 if (index < 0 || index > max3) {
27296 throw new RangeError("index " + index + " out of range 0.." + max3);
27299 var connector = this.first();
27301 while (i2 < nodes.length && nodes.length > 2 && nodes[i2] === connector) {
27302 nodes.splice(i2, 1);
27306 i2 = nodes.length - 1;
27307 while (i2 > 0 && nodes.length > 1 && nodes[i2] === connector) {
27308 nodes.splice(i2, 1);
27311 i2 = nodes.length - 1;
27314 nodes.splice(index, 0, id2);
27315 nodes = nodes.filter(noRepeatNodes);
27316 if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
27317 nodes.push(nodes[0]);
27319 return this.update({ nodes });
27321 updateNode: function(id2, index) {
27322 var nodes = this.nodes.slice();
27323 var isClosed = this.isClosed();
27324 var max3 = nodes.length - 1;
27325 if (index === void 0 || index < 0 || index > max3) {
27326 throw new RangeError("index " + index + " out of range 0.." + max3);
27329 var connector = this.first();
27331 while (i2 < nodes.length && nodes.length > 2 && nodes[i2] === connector) {
27332 nodes.splice(i2, 1);
27336 i2 = nodes.length - 1;
27337 while (i2 > 0 && nodes.length > 1 && nodes[i2] === connector) {
27338 nodes.splice(i2, 1);
27341 i2 = nodes.length - 1;
27344 nodes.splice(index, 1, id2);
27345 nodes = nodes.filter(noRepeatNodes);
27346 if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
27347 nodes.push(nodes[0]);
27349 return this.update({ nodes });
27351 replaceNode: function(needleID, replacementID) {
27352 var nodes = this.nodes.slice();
27353 var isClosed = this.isClosed();
27354 for (var i2 = 0; i2 < nodes.length; i2++) {
27355 if (nodes[i2] === needleID) {
27356 nodes[i2] = replacementID;
27359 nodes = nodes.filter(noRepeatNodes);
27360 if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
27361 nodes.push(nodes[0]);
27363 return this.update({ nodes });
27365 removeNode: function(id2) {
27366 var nodes = this.nodes.slice();
27367 var isClosed = this.isClosed();
27368 nodes = nodes.filter(function(node) {
27369 return node !== id2;
27370 }).filter(noRepeatNodes);
27371 if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
27372 nodes.push(nodes[0]);
27374 return this.update({ nodes });
27376 asJXON: function(changeset_id) {
27379 "@id": this.osmId(),
27380 "@version": this.version || 0,
27381 nd: this.nodes.map(function(id2) {
27382 return { keyAttributes: { ref: osmEntity.id.toOSM(id2) } };
27384 tag: Object.keys(this.tags).map(function(k) {
27385 return { keyAttributes: { k, v: this.tags[k] } };
27389 if (changeset_id) {
27390 r.way["@changeset"] = changeset_id;
27394 asGeoJSON: function(resolver) {
27395 return resolver.transient(this, "GeoJSON", function() {
27396 var coordinates = resolver.childNodes(this).map(function(n2) {
27399 if (this.isArea() && this.isClosed()) {
27402 coordinates: [coordinates]
27406 type: "LineString",
27412 area: function(resolver) {
27413 return resolver.transient(this, "area", function() {
27414 var nodes = resolver.childNodes(this);
27417 coordinates: [nodes.map(function(n2) {
27421 if (!this.isClosed() && nodes.length) {
27422 json.coordinates[0].push(nodes[0].loc);
27424 var area = area_default(json);
27425 if (area > 2 * Math.PI) {
27426 json.coordinates[0] = json.coordinates[0].reverse();
27427 area = area_default(json);
27429 return isNaN(area) ? 0 : area;
27433 function noRepeatNodes(node, i2, arr) {
27434 return i2 === 0 || node !== arr[i2 - 1];
27437 // modules/osm/multipolygon.js
27438 function osmOldMultipolygonOuterMemberOfRelation(entity, graph) {
27439 if (entity.type !== "relation" || !entity.isMultipolygon() || Object.keys(entity.tags).filter(osmIsInterestingTag).length > 1) {
27443 for (var memberIndex in entity.members) {
27444 var member = entity.members[memberIndex];
27445 if (!member.role || member.role === "outer") {
27448 if (member.type !== "way")
27450 if (!graph.hasEntity(member.id))
27452 outerMember = graph.entity(member.id);
27453 if (Object.keys(outerMember.tags).filter(osmIsInterestingTag).length === 0) {
27458 return outerMember;
27460 function osmIsOldMultipolygonOuterMember(entity, graph) {
27461 if (entity.type !== "way" || Object.keys(entity.tags).filter(osmIsInterestingTag).length === 0) {
27464 var parents = graph.parentRelations(entity);
27465 if (parents.length !== 1)
27467 var parent = parents[0];
27468 if (!parent.isMultipolygon() || Object.keys(parent.tags).filter(osmIsInterestingTag).length > 1) {
27471 var members = parent.members, member;
27472 for (var i2 = 0; i2 < members.length; i2++) {
27473 member = members[i2];
27474 if (member.id === entity.id && member.role && member.role !== "outer") {
27477 if (member.id !== entity.id && (!member.role || member.role === "outer")) {
27483 function osmOldMultipolygonOuterMember(entity, graph) {
27484 if (entity.type !== "way")
27486 var parents = graph.parentRelations(entity);
27487 if (parents.length !== 1)
27489 var parent = parents[0];
27490 if (!parent.isMultipolygon() || Object.keys(parent.tags).filter(osmIsInterestingTag).length > 1) {
27493 var members = parent.members, member, outerMember;
27494 for (var i2 = 0; i2 < members.length; i2++) {
27495 member = members[i2];
27496 if (!member.role || member.role === "outer") {
27499 outerMember = member;
27504 var outerEntity = graph.hasEntity(outerMember.id);
27505 if (!outerEntity || !Object.keys(outerEntity.tags).filter(osmIsInterestingTag).length) {
27508 return outerEntity;
27510 function osmJoinWays(toJoin, graph) {
27511 function resolve(member) {
27512 return graph.childNodes(graph.entity(member.id));
27514 function reverse(item2) {
27515 var action = actionReverse(item2.id, { reverseOneway: true });
27516 sequences.actions.push(action);
27517 return item2 instanceof osmWay ? action(graph).entity(item2.id) : item2;
27519 toJoin = toJoin.filter(function(member) {
27520 return member.type === "way" && graph.hasEntity(member.id);
27523 var joinAsMembers = true;
27524 for (i2 = 0; i2 < toJoin.length; i2++) {
27525 if (toJoin[i2] instanceof osmWay) {
27526 joinAsMembers = false;
27530 var sequences = [];
27531 sequences.actions = [];
27532 while (toJoin.length) {
27533 var item = toJoin.shift();
27534 var currWays = [item];
27535 var currNodes = resolve(item).slice();
27536 while (toJoin.length) {
27537 var start2 = currNodes[0];
27538 var end = currNodes[currNodes.length - 1];
27541 for (i2 = 0; i2 < toJoin.length; i2++) {
27543 nodes = resolve(item);
27544 if (joinAsMembers && currWays.length === 1 && nodes[0] !== end && nodes[nodes.length - 1] !== end && (nodes[nodes.length - 1] === start2 || nodes[0] === start2)) {
27545 currWays[0] = reverse(currWays[0]);
27546 currNodes.reverse();
27547 start2 = currNodes[0];
27548 end = currNodes[currNodes.length - 1];
27550 if (nodes[0] === end) {
27551 fn = currNodes.push;
27552 nodes = nodes.slice(1);
27554 } else if (nodes[nodes.length - 1] === end) {
27555 fn = currNodes.push;
27556 nodes = nodes.slice(0, -1).reverse();
27557 item = reverse(item);
27559 } else if (nodes[nodes.length - 1] === start2) {
27560 fn = currNodes.unshift;
27561 nodes = nodes.slice(0, -1);
27563 } else if (nodes[0] === start2) {
27564 fn = currNodes.unshift;
27565 nodes = nodes.slice(1).reverse();
27566 item = reverse(item);
27575 fn.apply(currWays, [item]);
27576 fn.apply(currNodes, nodes);
27577 toJoin.splice(i2, 1);
27579 currWays.nodes = currNodes;
27580 sequences.push(currWays);
27585 // modules/actions/add_member.js
27586 function actionAddMember(relationId, member, memberIndex, insertPair) {
27587 return function action(graph) {
27588 var relation = graph.entity(relationId);
27589 var isPTv2 = /stop|platform/.test(member.role);
27590 if ((isNaN(memberIndex) || insertPair) && member.type === "way" && !isPTv2) {
27591 graph = addWayMember(relation, graph);
27593 if (isPTv2 && isNaN(memberIndex)) {
27596 graph = graph.replace(relation.addMember(member, memberIndex));
27600 function addWayMember(relation, graph) {
27601 var groups, tempWay, insertPairIsReversed, item, i2, j2, k;
27602 var PTv2members = [];
27604 for (i2 = 0; i2 < relation.members.length; i2++) {
27605 var m = relation.members[i2];
27606 if (/stop|platform/.test(m.role)) {
27607 PTv2members.push(m);
27612 relation = relation.update({ members });
27614 tempWay = osmWay({ id: "wTemp", nodes: insertPair.nodes });
27615 graph = graph.replace(tempWay);
27616 var tempMember = { id: tempWay.id, type: "way", role: member.role };
27617 var tempRelation = relation.replaceMember({ id: insertPair.originalID }, tempMember, true);
27618 groups = utilArrayGroupBy(tempRelation.members, "type");
27619 groups.way = groups.way || [];
27620 var originalWay = graph.entity(insertPair.originalID);
27621 var insertedWay = graph.entity(insertPair.insertedID);
27622 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];
27624 groups = utilArrayGroupBy(relation.members, "type");
27625 groups.way = groups.way || [];
27626 groups.way.push(member);
27628 members = withIndex(groups.way);
27629 var joined = osmJoinWays(members, graph);
27630 for (i2 = 0; i2 < joined.length; i2++) {
27631 var segment = joined[i2];
27632 var nodes = segment.nodes.slice();
27633 var startIndex = segment[0].index;
27634 for (j2 = 0; j2 < members.length; j2++) {
27635 if (members[j2].index === startIndex) {
27639 for (k = 0; k < segment.length; k++) {
27641 var way = graph.entity(item.id);
27642 if (tempWay && item.id === tempWay.id) {
27643 var reverse = nodes[0].id !== insertPair.nodes[0] ^ insertPairIsReversed;
27646 { id: insertPair.insertedID, type: "way", role: item.role },
27647 { id: insertPair.originalID, type: "way", role: item.role }
27651 { id: insertPair.originalID, type: "way", role: item.role },
27652 { id: insertPair.insertedID, type: "way", role: item.role }
27657 if (j2 + k >= members.length || item.index !== members[j2 + k].index) {
27658 moveMember(members, item.index, j2 + k);
27661 nodes.splice(0, way.nodes.length - 1);
27665 graph = graph.remove(tempWay);
27667 var wayMembers = [];
27668 for (i2 = 0; i2 < members.length; i2++) {
27669 item = members[i2];
27670 if (item.index === -1)
27673 wayMembers.push(item.pair[0]);
27674 wayMembers.push(item.pair[1]);
27676 wayMembers.push(utilObjectOmit(item, ["index"]));
27679 var newMembers = PTv2members.concat(groups.node || [], wayMembers, groups.relation || []);
27680 return graph.replace(relation.update({ members: newMembers }));
27681 function moveMember(arr, findIndex, toIndex) {
27683 for (i3 = 0; i3 < arr.length; i3++) {
27684 if (arr[i3].index === findIndex) {
27688 var item2 = Object.assign({}, arr[i3]);
27689 arr[i3].index = -1;
27690 item2.index = toIndex;
27691 arr.splice(toIndex, 0, item2);
27693 function withIndex(arr) {
27694 var result = new Array(arr.length);
27695 for (var i3 = 0; i3 < arr.length; i3++) {
27696 result[i3] = Object.assign({}, arr[i3]);
27697 result[i3].index = i3;
27704 // modules/actions/add_midpoint.js
27705 function actionAddMidpoint(midpoint, node) {
27706 return function(graph) {
27707 graph = graph.replace(node.move(midpoint.loc));
27708 var parents = utilArrayIntersection(
27709 graph.parentWays(graph.entity(midpoint.edge[0])),
27710 graph.parentWays(graph.entity(midpoint.edge[1]))
27712 parents.forEach(function(way) {
27713 for (var i2 = 0; i2 < way.nodes.length - 1; i2++) {
27714 if (geoEdgeEqual([way.nodes[i2], way.nodes[i2 + 1]], midpoint.edge)) {
27715 graph = graph.replace(graph.entity(way.id).addNode(node.id, i2 + 1));
27724 // modules/actions/add_vertex.js
27725 function actionAddVertex(wayId, nodeId, index) {
27726 return function(graph) {
27727 return graph.replace(graph.entity(wayId).addNode(nodeId, index));
27731 // modules/actions/change_member.js
27732 function actionChangeMember(relationId, member, memberIndex) {
27733 return function(graph) {
27734 return graph.replace(graph.entity(relationId).updateMember(member, memberIndex));
27738 // modules/actions/change_preset.js
27739 function actionChangePreset(entityID, oldPreset, newPreset, skipFieldDefaults) {
27740 return function action(graph) {
27741 var entity = graph.entity(entityID);
27742 var geometry = entity.geometry(graph);
27743 var tags = entity.tags;
27747 if (newPreset.addTags) {
27748 preserveKeys = preserveKeys.concat(Object.keys(newPreset.addTags));
27750 newPreset.fields().concat(newPreset.moreFields()).filter((f2) => f2.matchGeometry(geometry)).map((f2) => f2.key).filter(Boolean).forEach((key) => preserveKeys.push(key));
27753 tags = oldPreset.unsetTags(tags, geometry, preserveKeys);
27755 tags = newPreset.setTags(tags, geometry, skipFieldDefaults);
27756 return graph.replace(entity.update({ tags }));
27760 // modules/actions/change_tags.js
27761 function actionChangeTags(entityId, tags) {
27762 return function(graph) {
27763 var entity = graph.entity(entityId);
27764 return graph.replace(entity.update({ tags }));
27768 // modules/osm/node.js
27772 northnortheast: 22,
27780 eastsoutheast: 112,
27784 southsoutheast: 157,
27788 southsouthwest: 202,
27792 westsouthwest: 247,
27796 westnorthwest: 292,
27800 northnorthwest: 337,
27803 function osmNode() {
27804 if (!(this instanceof osmNode)) {
27805 return new osmNode().initialize(arguments);
27806 } else if (arguments.length) {
27807 this.initialize(arguments);
27810 osmEntity.node = osmNode;
27811 osmNode.prototype = Object.create(osmEntity.prototype);
27812 Object.assign(osmNode.prototype, {
27815 extent: function() {
27816 return new geoExtent(this.loc);
27818 geometry: function(graph) {
27819 return graph.transient(this, "geometry", function() {
27820 return graph.isPoi(this) ? "point" : "vertex";
27823 move: function(loc) {
27824 return this.update({ loc });
27826 isDegenerate: function() {
27827 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);
27829 directions: function(resolver, projection2) {
27832 if (this.isHighwayIntersection(resolver) && (this.tags.stop || "").toLowerCase() === "all") {
27835 val = (this.tags.direction || "").toLowerCase();
27836 var re2 = /:direction$/i;
27837 var keys = Object.keys(this.tags);
27838 for (i2 = 0; i2 < keys.length; i2++) {
27839 if (re2.test(keys[i2])) {
27840 val = this.tags[keys[i2]].toLowerCase();
27847 var values = val.split(";");
27849 values.forEach(function(v) {
27850 if (cardinal[v] !== void 0) {
27853 if (v !== "" && !isNaN(+v)) {
27857 var lookBackward = this.tags["traffic_sign:backward"] || v === "backward" || v === "both" || v === "all";
27858 var lookForward = this.tags["traffic_sign:forward"] || v === "forward" || v === "both" || v === "all";
27859 if (!lookForward && !lookBackward)
27862 resolver.parentWays(this).forEach(function(parent) {
27863 var nodes = parent.nodes;
27864 for (i2 = 0; i2 < nodes.length; i2++) {
27865 if (nodes[i2] === this.id) {
27866 if (lookForward && i2 > 0) {
27867 nodeIds[nodes[i2 - 1]] = true;
27869 if (lookBackward && i2 < nodes.length - 1) {
27870 nodeIds[nodes[i2 + 1]] = true;
27875 Object.keys(nodeIds).forEach(function(nodeId) {
27877 geoAngle(this, resolver.entity(nodeId), projection2) * (180 / Math.PI) + 90
27881 return utilArrayUniq(results);
27883 isCrossing: function() {
27884 return this.tags.highway === "crossing" || this.tags.railway && this.tags.railway.indexOf("crossing") !== -1;
27886 isEndpoint: function(resolver) {
27887 return resolver.transient(this, "isEndpoint", function() {
27889 return resolver.parentWays(this).filter(function(parent) {
27890 return !parent.isClosed() && !!parent.affix(id2);
27894 isConnected: function(resolver) {
27895 return resolver.transient(this, "isConnected", function() {
27896 var parents = resolver.parentWays(this);
27897 if (parents.length > 1) {
27898 for (var i2 in parents) {
27899 if (parents[i2].geometry(resolver) === "line" && parents[i2].hasInterestingTags())
27902 } else if (parents.length === 1) {
27903 var way = parents[0];
27904 var nodes = way.nodes.slice();
27905 if (way.isClosed()) {
27908 return nodes.indexOf(this.id) !== nodes.lastIndexOf(this.id);
27913 parentIntersectionWays: function(resolver) {
27914 return resolver.transient(this, "parentIntersectionWays", function() {
27915 return resolver.parentWays(this).filter(function(parent) {
27916 return (parent.tags.highway || parent.tags.waterway || parent.tags.railway || parent.tags.aeroway) && parent.geometry(resolver) === "line";
27920 isIntersection: function(resolver) {
27921 return this.parentIntersectionWays(resolver).length > 1;
27923 isHighwayIntersection: function(resolver) {
27924 return resolver.transient(this, "isHighwayIntersection", function() {
27925 return resolver.parentWays(this).filter(function(parent) {
27926 return parent.tags.highway && parent.geometry(resolver) === "line";
27930 isOnAddressLine: function(resolver) {
27931 return resolver.transient(this, "isOnAddressLine", function() {
27932 return resolver.parentWays(this).filter(function(parent) {
27933 return parent.tags.hasOwnProperty("addr:interpolation") && parent.geometry(resolver) === "line";
27937 asJXON: function(changeset_id) {
27940 "@id": this.osmId(),
27941 "@lon": this.loc[0],
27942 "@lat": this.loc[1],
27943 "@version": this.version || 0,
27944 tag: Object.keys(this.tags).map(function(k) {
27945 return { keyAttributes: { k, v: this.tags[k] } };
27950 r.node["@changeset"] = changeset_id;
27953 asGeoJSON: function() {
27956 coordinates: this.loc
27961 // modules/actions/circularize.js
27962 function actionCircularize(wayId, projection2, maxAngle) {
27963 maxAngle = (maxAngle || 20) * Math.PI / 180;
27964 var action = function(graph, t) {
27965 if (t === null || !isFinite(t))
27967 t = Math.min(Math.max(+t, 0), 1);
27968 var way = graph.entity(wayId);
27969 var origNodes = {};
27970 graph.childNodes(way).forEach(function(node2) {
27971 if (!origNodes[node2.id])
27972 origNodes[node2.id] = node2;
27974 if (!way.isConvex(graph)) {
27975 graph = action.makeConvex(graph);
27977 var nodes = utilArrayUniq(graph.childNodes(way));
27978 var keyNodes = nodes.filter(function(n2) {
27979 return graph.parentWays(n2).length !== 1;
27981 var points = nodes.map(function(n2) {
27982 return projection2(n2.loc);
27984 var keyPoints = keyNodes.map(function(n2) {
27985 return projection2(n2.loc);
27987 var centroid = points.length === 2 ? geoVecInterp(points[0], points[1], 0.5) : centroid_default2(points);
27988 var radius = median(points, function(p) {
27989 return geoVecLength(centroid, p);
27991 var sign2 = area_default3(points) > 0 ? 1 : -1;
27992 var ids, i2, j2, k;
27993 if (!keyNodes.length) {
27994 keyNodes = [nodes[0]];
27995 keyPoints = [points[0]];
27997 if (keyNodes.length === 1) {
27998 var index = nodes.indexOf(keyNodes[0]);
27999 var oppositeIndex = Math.floor((index + nodes.length / 2) % nodes.length);
28000 keyNodes.push(nodes[oppositeIndex]);
28001 keyPoints.push(points[oppositeIndex]);
28003 for (i2 = 0; i2 < keyPoints.length; i2++) {
28004 var nextKeyNodeIndex = (i2 + 1) % keyNodes.length;
28005 var startNode = keyNodes[i2];
28006 var endNode = keyNodes[nextKeyNodeIndex];
28007 var startNodeIndex = nodes.indexOf(startNode);
28008 var endNodeIndex = nodes.indexOf(endNode);
28009 var numberNewPoints = -1;
28010 var indexRange = endNodeIndex - startNodeIndex;
28011 var nearNodes = {};
28012 var inBetweenNodes = [];
28013 var startAngle, endAngle, totalAngle, eachAngle;
28014 var angle2, loc, node, origNode;
28015 if (indexRange < 0) {
28016 indexRange += nodes.length;
28018 var distance = geoVecLength(centroid, keyPoints[i2]) || 1e-4;
28020 centroid[0] + (keyPoints[i2][0] - centroid[0]) / distance * radius,
28021 centroid[1] + (keyPoints[i2][1] - centroid[1]) / distance * radius
28023 loc = projection2.invert(keyPoints[i2]);
28024 node = keyNodes[i2];
28025 origNode = origNodes[node.id];
28026 node = node.move(geoVecInterp(origNode.loc, loc, t));
28027 graph = graph.replace(node);
28028 startAngle = Math.atan2(keyPoints[i2][1] - centroid[1], keyPoints[i2][0] - centroid[0]);
28029 endAngle = Math.atan2(keyPoints[nextKeyNodeIndex][1] - centroid[1], keyPoints[nextKeyNodeIndex][0] - centroid[0]);
28030 totalAngle = endAngle - startAngle;
28031 if (totalAngle * sign2 > 0) {
28032 totalAngle = -sign2 * (2 * Math.PI - Math.abs(totalAngle));
28036 eachAngle = totalAngle / (indexRange + numberNewPoints);
28037 } while (Math.abs(eachAngle) > maxAngle);
28038 for (j2 = 1; j2 < indexRange; j2++) {
28039 angle2 = startAngle + j2 * eachAngle;
28040 loc = projection2.invert([
28041 centroid[0] + Math.cos(angle2) * radius,
28042 centroid[1] + Math.sin(angle2) * radius
28044 node = nodes[(j2 + startNodeIndex) % nodes.length];
28045 origNode = origNodes[node.id];
28046 nearNodes[node.id] = angle2;
28047 node = node.move(geoVecInterp(origNode.loc, loc, t));
28048 graph = graph.replace(node);
28050 for (j2 = 0; j2 < numberNewPoints; j2++) {
28051 angle2 = startAngle + (indexRange + j2) * eachAngle;
28052 loc = projection2.invert([
28053 centroid[0] + Math.cos(angle2) * radius,
28054 centroid[1] + Math.sin(angle2) * radius
28056 var min3 = Infinity;
28057 for (var nodeId in nearNodes) {
28058 var nearAngle = nearNodes[nodeId];
28059 var dist = Math.abs(nearAngle - angle2);
28062 origNode = origNodes[nodeId];
28065 node = osmNode({ loc: geoVecInterp(origNode.loc, loc, t) });
28066 graph = graph.replace(node);
28067 nodes.splice(endNodeIndex + j2, 0, node);
28068 inBetweenNodes.push(node.id);
28070 if (indexRange === 1 && inBetweenNodes.length) {
28071 var startIndex1 = way.nodes.lastIndexOf(startNode.id);
28072 var endIndex1 = way.nodes.lastIndexOf(endNode.id);
28073 var wayDirection1 = endIndex1 - startIndex1;
28074 if (wayDirection1 < -1) {
28077 var parentWays = graph.parentWays(keyNodes[i2]);
28078 for (j2 = 0; j2 < parentWays.length; j2++) {
28079 var sharedWay = parentWays[j2];
28080 if (sharedWay === way)
28082 if (sharedWay.areAdjacent(startNode.id, endNode.id)) {
28083 var startIndex2 = sharedWay.nodes.lastIndexOf(startNode.id);
28084 var endIndex2 = sharedWay.nodes.lastIndexOf(endNode.id);
28085 var wayDirection2 = endIndex2 - startIndex2;
28086 var insertAt = endIndex2;
28087 if (wayDirection2 < -1) {
28090 if (wayDirection1 !== wayDirection2) {
28091 inBetweenNodes.reverse();
28092 insertAt = startIndex2;
28094 for (k = 0; k < inBetweenNodes.length; k++) {
28095 sharedWay = sharedWay.addNode(inBetweenNodes[k], insertAt + k);
28097 graph = graph.replace(sharedWay);
28102 ids = nodes.map(function(n2) {
28106 way = way.update({ nodes: ids });
28107 graph = graph.replace(way);
28110 action.makeConvex = function(graph) {
28111 var way = graph.entity(wayId);
28112 var nodes = utilArrayUniq(graph.childNodes(way));
28113 var points = nodes.map(function(n2) {
28114 return projection2(n2.loc);
28116 var sign2 = area_default3(points) > 0 ? 1 : -1;
28117 var hull = hull_default(points);
28119 if (sign2 === -1) {
28123 for (i2 = 0; i2 < hull.length - 1; i2++) {
28124 var startIndex = points.indexOf(hull[i2]);
28125 var endIndex = points.indexOf(hull[i2 + 1]);
28126 var indexRange = endIndex - startIndex;
28127 if (indexRange < 0) {
28128 indexRange += nodes.length;
28130 for (j2 = 1; j2 < indexRange; j2++) {
28131 var point2 = geoVecInterp(hull[i2], hull[i2 + 1], j2 / indexRange);
28132 var node = nodes[(j2 + startIndex) % nodes.length].move(projection2.invert(point2));
28133 graph = graph.replace(node);
28138 action.disabled = function(graph) {
28139 if (!graph.entity(wayId).isClosed()) {
28140 return "not_closed";
28142 var way = graph.entity(wayId);
28143 var nodes = utilArrayUniq(graph.childNodes(way));
28144 var points = nodes.map(function(n2) {
28145 return projection2(n2.loc);
28147 var hull = hull_default(points);
28148 var epsilonAngle = Math.PI / 180;
28149 if (hull.length !== points.length || hull.length < 3) {
28152 var centroid = centroid_default2(points);
28153 var radius = geoVecLengthSquare(centroid, points[0]);
28154 var i2, actualPoint;
28155 for (i2 = 0; i2 < hull.length; i2++) {
28156 actualPoint = hull[i2];
28157 var actualDist = geoVecLengthSquare(actualPoint, centroid);
28158 var diff = Math.abs(actualDist - radius);
28159 if (diff > 0.05 * radius) {
28163 for (i2 = 0; i2 < hull.length; i2++) {
28164 actualPoint = hull[i2];
28165 var nextPoint = hull[(i2 + 1) % hull.length];
28166 var startAngle = Math.atan2(actualPoint[1] - centroid[1], actualPoint[0] - centroid[0]);
28167 var endAngle = Math.atan2(nextPoint[1] - centroid[1], nextPoint[0] - centroid[0]);
28168 var angle2 = endAngle - startAngle;
28172 if (angle2 > Math.PI) {
28173 angle2 = 2 * Math.PI - angle2;
28175 if (angle2 > maxAngle + epsilonAngle) {
28179 return "already_circular";
28181 action.transitionable = true;
28185 // modules/actions/delete_way.js
28186 function actionDeleteWay(wayID) {
28187 function canDeleteNode(node, graph) {
28188 if (graph.parentWays(node).length || graph.parentRelations(node).length)
28190 var geometries = osmNodeGeometriesForTags(node.tags);
28191 if (geometries.point)
28193 if (geometries.vertex)
28195 return !node.hasInterestingTags();
28197 var action = function(graph) {
28198 var way = graph.entity(wayID);
28199 graph.parentRelations(way).forEach(function(parent) {
28200 parent = parent.removeMembersWithID(wayID);
28201 graph = graph.replace(parent);
28202 if (parent.isDegenerate()) {
28203 graph = actionDeleteRelation(parent.id)(graph);
28206 new Set(way.nodes).forEach(function(nodeID) {
28207 graph = graph.replace(way.removeNode(nodeID));
28208 var node = graph.entity(nodeID);
28209 if (canDeleteNode(node, graph)) {
28210 graph = graph.remove(node);
28213 return graph.remove(way);
28218 // modules/actions/delete_multiple.js
28219 function actionDeleteMultiple(ids) {
28221 way: actionDeleteWay,
28222 node: actionDeleteNode,
28223 relation: actionDeleteRelation
28225 var action = function(graph) {
28226 ids.forEach(function(id2) {
28227 if (graph.hasEntity(id2)) {
28228 graph = actions[graph.entity(id2).type](id2)(graph);
28236 // modules/actions/delete_relation.js
28237 function actionDeleteRelation(relationID, allowUntaggedMembers) {
28238 function canDeleteEntity(entity, graph) {
28239 return !graph.parentWays(entity).length && !graph.parentRelations(entity).length && (!entity.hasInterestingTags() && !allowUntaggedMembers);
28241 var action = function(graph) {
28242 var relation = graph.entity(relationID);
28243 graph.parentRelations(relation).forEach(function(parent) {
28244 parent = parent.removeMembersWithID(relationID);
28245 graph = graph.replace(parent);
28246 if (parent.isDegenerate()) {
28247 graph = actionDeleteRelation(parent.id)(graph);
28250 var memberIDs = utilArrayUniq(relation.members.map(function(m) {
28253 memberIDs.forEach(function(memberID) {
28254 graph = graph.replace(relation.removeMembersWithID(memberID));
28255 var entity = graph.entity(memberID);
28256 if (canDeleteEntity(entity, graph)) {
28257 graph = actionDeleteMultiple([memberID])(graph);
28260 return graph.remove(relation);
28265 // modules/actions/delete_node.js
28266 function actionDeleteNode(nodeId) {
28267 var action = function(graph) {
28268 var node = graph.entity(nodeId);
28269 graph.parentWays(node).forEach(function(parent) {
28270 parent = parent.removeNode(nodeId);
28271 graph = graph.replace(parent);
28272 if (parent.isDegenerate()) {
28273 graph = actionDeleteWay(parent.id)(graph);
28276 graph.parentRelations(node).forEach(function(parent) {
28277 parent = parent.removeMembersWithID(nodeId);
28278 graph = graph.replace(parent);
28279 if (parent.isDegenerate()) {
28280 graph = actionDeleteRelation(parent.id)(graph);
28283 return graph.remove(node);
28288 // modules/actions/connect.js
28289 function actionConnect(nodeIDs) {
28290 var action = function(graph) {
28296 var interestingIDs = [];
28297 for (i2 = 0; i2 < nodeIDs.length; i2++) {
28298 node = graph.entity(nodeIDs[i2]);
28299 if (node.hasInterestingTags()) {
28300 if (!node.isNew()) {
28301 interestingIDs.push(node.id);
28305 survivor = graph.entity(utilOldestID(interestingIDs.length > 0 ? interestingIDs : nodeIDs));
28306 for (i2 = 0; i2 < nodeIDs.length; i2++) {
28307 node = graph.entity(nodeIDs[i2]);
28308 if (node.id === survivor.id)
28310 parents = graph.parentWays(node);
28311 for (j2 = 0; j2 < parents.length; j2++) {
28312 graph = graph.replace(parents[j2].replaceNode(node.id, survivor.id));
28314 parents = graph.parentRelations(node);
28315 for (j2 = 0; j2 < parents.length; j2++) {
28316 graph = graph.replace(parents[j2].replaceMember(node, survivor));
28318 survivor = survivor.mergeTags(node.tags);
28319 graph = actionDeleteNode(node.id)(graph);
28321 graph = graph.replace(survivor);
28322 parents = graph.parentWays(survivor);
28323 for (i2 = 0; i2 < parents.length; i2++) {
28324 if (parents[i2].isDegenerate()) {
28325 graph = actionDeleteWay(parents[i2].id)(graph);
28330 action.disabled = function(graph) {
28332 var restrictionIDs = [];
28335 var relations, relation, role;
28337 survivor = graph.entity(utilOldestID(nodeIDs));
28338 for (i2 = 0; i2 < nodeIDs.length; i2++) {
28339 node = graph.entity(nodeIDs[i2]);
28340 relations = graph.parentRelations(node);
28341 for (j2 = 0; j2 < relations.length; j2++) {
28342 relation = relations[j2];
28343 role = relation.memberById(node.id).role || "";
28344 if (relation.hasFromViaTo()) {
28345 restrictionIDs.push(relation.id);
28347 if (seen[relation.id] !== void 0 && seen[relation.id] !== role) {
28350 seen[relation.id] = role;
28354 for (i2 = 0; i2 < nodeIDs.length; i2++) {
28355 node = graph.entity(nodeIDs[i2]);
28356 var parents = graph.parentWays(node);
28357 for (j2 = 0; j2 < parents.length; j2++) {
28358 var parent = parents[j2];
28359 relations = graph.parentRelations(parent);
28360 for (k = 0; k < relations.length; k++) {
28361 relation = relations[k];
28362 if (relation.hasFromViaTo()) {
28363 restrictionIDs.push(relation.id);
28368 restrictionIDs = utilArrayUniq(restrictionIDs);
28369 for (i2 = 0; i2 < restrictionIDs.length; i2++) {
28370 relation = graph.entity(restrictionIDs[i2]);
28371 if (!relation.isComplete(graph))
28373 var memberWays = relation.members.filter(function(m) {
28374 return m.type === "way";
28375 }).map(function(m) {
28376 return graph.entity(m.id);
28378 memberWays = utilArrayUniq(memberWays);
28379 var f2 = relation.memberByRole("from");
28380 var t = relation.memberByRole("to");
28381 var isUturn = f2.id === t.id;
28382 var nodes = { from: [], via: [], to: [], keyfrom: [], keyto: [] };
28383 for (j2 = 0; j2 < relation.members.length; j2++) {
28384 collectNodes(relation.members[j2], nodes);
28386 nodes.keyfrom = utilArrayUniq(nodes.keyfrom.filter(hasDuplicates));
28387 nodes.keyto = utilArrayUniq(nodes.keyto.filter(hasDuplicates));
28388 var filter2 = keyNodeFilter(nodes.keyfrom, nodes.keyto);
28389 nodes.from = nodes.from.filter(filter2);
28390 nodes.via = nodes.via.filter(filter2);
28391 nodes.to = nodes.to.filter(filter2);
28392 var connectFrom = false;
28393 var connectVia = false;
28394 var connectTo = false;
28395 var connectKeyFrom = false;
28396 var connectKeyTo = false;
28397 for (j2 = 0; j2 < nodeIDs.length; j2++) {
28398 var n2 = nodeIDs[j2];
28399 if (nodes.from.indexOf(n2) !== -1) {
28400 connectFrom = true;
28402 if (nodes.via.indexOf(n2) !== -1) {
28405 if (nodes.to.indexOf(n2) !== -1) {
28408 if (nodes.keyfrom.indexOf(n2) !== -1) {
28409 connectKeyFrom = true;
28411 if (nodes.keyto.indexOf(n2) !== -1) {
28412 connectKeyTo = true;
28415 if (connectFrom && connectTo && !isUturn) {
28416 return "restriction";
28418 if (connectFrom && connectVia) {
28419 return "restriction";
28421 if (connectTo && connectVia) {
28422 return "restriction";
28424 if (connectKeyFrom || connectKeyTo) {
28425 if (nodeIDs.length !== 2) {
28426 return "restriction";
28430 for (j2 = 0; j2 < memberWays.length; j2++) {
28431 way = memberWays[j2];
28432 if (way.contains(nodeIDs[0])) {
28435 if (way.contains(nodeIDs[1])) {
28441 for (j2 = 0; j2 < memberWays.length; j2++) {
28442 way = memberWays[j2];
28443 if (way.areAdjacent(n0, n1)) {
28449 return "restriction";
28453 for (j2 = 0; j2 < memberWays.length; j2++) {
28454 way = memberWays[j2].update({});
28455 for (k = 0; k < nodeIDs.length; k++) {
28456 if (nodeIDs[k] === survivor.id)
28458 if (way.areAdjacent(nodeIDs[k], survivor.id)) {
28459 way = way.removeNode(nodeIDs[k]);
28461 way = way.replaceNode(nodeIDs[k], survivor.id);
28464 if (way.isDegenerate()) {
28465 return "restriction";
28470 function hasDuplicates(n3, i3, arr) {
28471 return arr.indexOf(n3) !== arr.lastIndexOf(n3);
28473 function keyNodeFilter(froms, tos) {
28474 return function(n3) {
28475 return froms.indexOf(n3) === -1 && tos.indexOf(n3) === -1;
28478 function collectNodes(member, collection) {
28479 var entity = graph.hasEntity(member.id);
28482 var role2 = member.role || "";
28483 if (!collection[role2]) {
28484 collection[role2] = [];
28486 if (member.type === "node") {
28487 collection[role2].push(member.id);
28488 if (role2 === "via") {
28489 collection.keyfrom.push(member.id);
28490 collection.keyto.push(member.id);
28492 } else if (member.type === "way") {
28493 collection[role2].push.apply(collection[role2], entity.nodes);
28494 if (role2 === "from" || role2 === "via") {
28495 collection.keyfrom.push(entity.first());
28496 collection.keyfrom.push(entity.last());
28498 if (role2 === "to" || role2 === "via") {
28499 collection.keyto.push(entity.first());
28500 collection.keyto.push(entity.last());
28508 // modules/actions/copy_entities.js
28509 function actionCopyEntities(ids, fromGraph) {
28511 var action = function(graph) {
28512 ids.forEach(function(id3) {
28513 fromGraph.entity(id3).copy(fromGraph, _copies);
28515 for (var id2 in _copies) {
28516 graph = graph.replace(_copies[id2]);
28520 action.copies = function() {
28526 // modules/actions/delete_member.js
28527 function actionDeleteMember(relationId, memberIndex) {
28528 return function(graph) {
28529 var relation = graph.entity(relationId).removeMember(memberIndex);
28530 graph = graph.replace(relation);
28531 if (relation.isDegenerate()) {
28532 graph = actionDeleteRelation(relation.id)(graph);
28538 // modules/actions/discard_tags.js
28539 function actionDiscardTags(difference, discardTags) {
28540 discardTags = discardTags || {};
28541 return (graph) => {
28542 difference.modified().forEach(checkTags);
28543 difference.created().forEach(checkTags);
28545 function checkTags(entity) {
28546 const keys = Object.keys(entity.tags);
28547 let didDiscard = false;
28549 for (let i2 = 0; i2 < keys.length; i2++) {
28550 const k = keys[i2];
28551 if (discardTags[k] || !entity.tags[k]) {
28554 tags[k] = entity.tags[k];
28558 graph = graph.replace(entity.update({ tags }));
28564 // modules/actions/disconnect.js
28565 function actionDisconnect(nodeId, newNodeId) {
28567 var disconnectableRelationTypes = {
28568 "associatedStreet": true,
28569 "enforcement": true,
28572 var action = function(graph) {
28573 var node = graph.entity(nodeId);
28574 var connections = action.connections(graph);
28575 connections.forEach(function(connection) {
28576 var way = graph.entity(connection.wayID);
28577 var newNode = osmNode({ id: newNodeId, loc: node.loc, tags: node.tags });
28578 graph = graph.replace(newNode);
28579 if (connection.index === 0 && way.isArea()) {
28580 graph = graph.replace(way.replaceNode(way.nodes[0], newNode.id));
28581 } else if (way.isClosed() && connection.index === way.nodes.length - 1) {
28582 graph = graph.replace(way.unclose().addNode(newNode.id));
28584 graph = graph.replace(way.updateNode(newNode.id, connection.index));
28589 action.connections = function(graph) {
28590 var candidates = [];
28591 var keeping = false;
28592 var parentWays = graph.parentWays(graph.entity(nodeId));
28594 for (var i2 = 0; i2 < parentWays.length; i2++) {
28595 way = parentWays[i2];
28596 if (wayIds && wayIds.indexOf(way.id) === -1) {
28600 if (way.isArea() && way.nodes[0] === nodeId) {
28601 candidates.push({ wayID: way.id, index: 0 });
28603 for (var j2 = 0; j2 < way.nodes.length; j2++) {
28604 waynode = way.nodes[j2];
28605 if (waynode === nodeId) {
28606 if (way.isClosed() && parentWays.length > 1 && wayIds && wayIds.indexOf(way.id) !== -1 && j2 === way.nodes.length - 1) {
28609 candidates.push({ wayID: way.id, index: j2 });
28614 return keeping ? candidates : candidates.slice(1);
28616 action.disabled = function(graph) {
28617 var connections = action.connections(graph);
28618 if (connections.length === 0)
28619 return "not_connected";
28620 var parentWays = graph.parentWays(graph.entity(nodeId));
28621 var seenRelationIds = {};
28622 var sharedRelation;
28623 parentWays.forEach(function(way) {
28624 var relations = graph.parentRelations(way);
28625 relations.filter((relation) => !disconnectableRelationTypes[relation.tags.type]).forEach(function(relation) {
28626 if (relation.id in seenRelationIds) {
28628 if (wayIds.indexOf(way.id) !== -1 || wayIds.indexOf(seenRelationIds[relation.id]) !== -1) {
28629 sharedRelation = relation;
28632 sharedRelation = relation;
28635 seenRelationIds[relation.id] = way.id;
28639 if (sharedRelation)
28642 action.limitWays = function(val) {
28643 if (!arguments.length)
28651 // modules/actions/extract.js
28652 function actionExtract(entityID, projection2) {
28653 var extractedNodeID;
28654 var action = function(graph) {
28655 var entity = graph.entity(entityID);
28656 if (entity.type === "node") {
28657 return extractFromNode(entity, graph);
28659 return extractFromWayOrRelation(entity, graph);
28661 function extractFromNode(node, graph) {
28662 extractedNodeID = node.id;
28663 var replacement = osmNode({ loc: node.loc });
28664 graph = graph.replace(replacement);
28665 graph = graph.parentWays(node).reduce(function(accGraph, parentWay) {
28666 return accGraph.replace(parentWay.replaceNode(entityID, replacement.id));
28668 return graph.parentRelations(node).reduce(function(accGraph, parentRel) {
28669 return accGraph.replace(parentRel.replaceMember(node, replacement));
28672 function extractFromWayOrRelation(entity, graph) {
28673 var fromGeometry = entity.geometry(graph);
28674 var keysToCopyAndRetain = ["source", "wheelchair"];
28675 var keysToRetain = ["area"];
28676 var buildingKeysToRetain = ["architect", "building", "height", "layer"];
28677 var extractedLoc = path_default(projection2).centroid(entity.asGeoJSON(graph));
28678 extractedLoc = extractedLoc && projection2.invert(extractedLoc);
28679 if (!extractedLoc || !isFinite(extractedLoc[0]) || !isFinite(extractedLoc[1])) {
28680 extractedLoc = entity.extent(graph).center();
28682 var indoorAreaValues = {
28689 var isBuilding = entity.tags.building && entity.tags.building !== "no" || entity.tags["building:part"] && entity.tags["building:part"] !== "no";
28690 var isIndoorArea = fromGeometry === "area" && entity.tags.indoor && indoorAreaValues[entity.tags.indoor];
28691 var entityTags = Object.assign({}, entity.tags);
28692 var pointTags = {};
28693 for (var key in entityTags) {
28694 if (entity.type === "relation" && key === "type") {
28697 if (keysToRetain.indexOf(key) !== -1) {
28701 if (buildingKeysToRetain.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/))
28704 if (isIndoorArea && key === "indoor") {
28707 pointTags[key] = entityTags[key];
28708 if (keysToCopyAndRetain.indexOf(key) !== -1 || key.match(/^addr:.{1,}/)) {
28710 } else if (isIndoorArea && key === "level") {
28713 delete entityTags[key];
28715 if (!isBuilding && !isIndoorArea && fromGeometry === "area") {
28716 entityTags.area = "yes";
28718 var replacement = osmNode({ loc: extractedLoc, tags: pointTags });
28719 graph = graph.replace(replacement);
28720 extractedNodeID = replacement.id;
28721 return graph.replace(entity.update({ tags: entityTags }));
28723 action.getExtractedNodeID = function() {
28724 return extractedNodeID;
28729 // modules/actions/join.js
28730 function actionJoin(ids) {
28731 function groupEntitiesByGeometry(graph) {
28732 var entities = ids.map(function(id2) {
28733 return graph.entity(id2);
28735 return Object.assign(
28737 utilArrayGroupBy(entities, function(entity) {
28738 return entity.geometry(graph);
28742 var action = function(graph) {
28743 var ways = ids.map(graph.entity, graph);
28744 var survivorID = utilOldestID(ways.map((way) => way.id));
28745 ways.sort(function(a, b) {
28746 var aSided = a.isSided();
28747 var bSided = b.isSided();
28748 return aSided && !bSided ? -1 : bSided && !aSided ? 1 : 0;
28750 var sequences = osmJoinWays(ways, graph);
28751 var joined = sequences[0];
28752 graph = sequences.actions.reduce(function(g, action2) {
28755 var survivor = graph.entity(survivorID);
28756 survivor = survivor.update({ nodes: joined.nodes.map(function(n2) {
28759 graph = graph.replace(survivor);
28760 joined.forEach(function(way) {
28761 if (way.id === survivorID)
28763 graph.parentRelations(way).forEach(function(parent) {
28764 graph = graph.replace(parent.replaceMember(way, survivor));
28766 survivor = survivor.mergeTags(way.tags);
28767 graph = graph.replace(survivor);
28768 graph = actionDeleteWay(way.id)(graph);
28770 function checkForSimpleMultipolygon() {
28771 if (!survivor.isClosed())
28773 var multipolygons = graph.parentMultipolygons(survivor).filter(function(multipolygon2) {
28774 return multipolygon2.members.length === 1;
28776 if (multipolygons.length !== 1)
28778 var multipolygon = multipolygons[0];
28779 for (var key in survivor.tags) {
28780 if (multipolygon.tags[key] && multipolygon.tags[key] !== survivor.tags[key])
28783 survivor = survivor.mergeTags(multipolygon.tags);
28784 graph = graph.replace(survivor);
28785 graph = actionDeleteRelation(multipolygon.id, true)(graph);
28786 var tags = Object.assign({}, survivor.tags);
28787 if (survivor.geometry(graph) !== "area") {
28791 survivor = survivor.update({ tags });
28792 graph = graph.replace(survivor);
28794 checkForSimpleMultipolygon();
28797 action.resultingWayNodesLength = function(graph) {
28798 return ids.reduce(function(count, id2) {
28799 return count + graph.entity(id2).nodes.length;
28800 }, 0) - ids.length - 1;
28802 action.disabled = function(graph) {
28803 var geometries = groupEntitiesByGeometry(graph);
28804 if (ids.length < 2 || ids.length !== geometries.line.length) {
28805 return "not_eligible";
28807 var joined = osmJoinWays(ids.map(graph.entity, graph), graph);
28808 if (joined.length > 1) {
28809 return "not_adjacent";
28812 var sortedParentRelations = function(id2) {
28813 return graph.parentRelations(graph.entity(id2)).filter((rel) => !rel.isRestriction() && !rel.isConnectivity()).sort((a, b) => a.id - b.id);
28815 var relsA = sortedParentRelations(ids[0]);
28816 for (i2 = 1; i2 < ids.length; i2++) {
28817 var relsB = sortedParentRelations(ids[i2]);
28818 if (!utilArrayIdentical(relsA, relsB)) {
28819 return "conflicting_relations";
28822 for (i2 = 0; i2 < ids.length - 1; i2++) {
28823 for (var j2 = i2 + 1; j2 < ids.length; j2++) {
28824 var path1 = graph.childNodes(graph.entity(ids[i2])).map(function(e) {
28827 var path2 = graph.childNodes(graph.entity(ids[j2])).map(function(e) {
28830 var intersections = geoPathIntersections(path1, path2);
28831 var common = utilArrayIntersection(
28832 joined[0].nodes.map(function(n2) {
28833 return n2.loc.toString();
28835 intersections.map(function(n2) {
28836 return n2.toString();
28839 if (common.length !== intersections.length) {
28840 return "paths_intersect";
28844 var nodeIds = joined[0].nodes.map(function(n2) {
28849 var conflicting = false;
28850 joined[0].forEach(function(way) {
28851 var parents = graph.parentRelations(way);
28852 parents.forEach(function(parent) {
28853 if ((parent.isRestriction() || parent.isConnectivity()) && parent.members.some(function(m) {
28854 return nodeIds.indexOf(m.id) >= 0;
28859 for (var k in way.tags) {
28860 if (!(k in tags)) {
28861 tags[k] = way.tags[k];
28862 } else if (tags[k] && osmIsInterestingTag(k) && tags[k] !== way.tags[k]) {
28863 conflicting = true;
28868 return relation.isRestriction() ? "restriction" : "connectivity";
28871 return "conflicting_tags";
28877 // modules/actions/merge.js
28878 function actionMerge(ids) {
28879 function groupEntitiesByGeometry(graph) {
28880 var entities = ids.map(function(id2) {
28881 return graph.entity(id2);
28883 return Object.assign(
28884 { point: [], area: [], line: [], relation: [] },
28885 utilArrayGroupBy(entities, function(entity) {
28886 return entity.geometry(graph);
28890 var action = function(graph) {
28891 var geometries = groupEntitiesByGeometry(graph);
28892 var target = geometries.area[0] || geometries.line[0];
28893 var points = geometries.point;
28894 points.forEach(function(point2) {
28895 target = target.mergeTags(point2.tags);
28896 graph = graph.replace(target);
28897 graph.parentRelations(point2).forEach(function(parent) {
28898 graph = graph.replace(parent.replaceMember(point2, target));
28900 var nodes = utilArrayUniq(graph.childNodes(target));
28901 var removeNode = point2;
28902 if (!point2.isNew()) {
28903 var inserted = false;
28904 var canBeReplaced = function(node2) {
28905 return !(graph.parentWays(node2).length > 1 || graph.parentRelations(node2).length);
28907 var replaceNode = function(node2) {
28908 graph = graph.replace(point2.update({ tags: node2.tags, loc: node2.loc }));
28909 target = target.replaceNode(node2.id, point2.id);
28910 graph = graph.replace(target);
28911 removeNode = node2;
28916 for (i2 = 0; i2 < nodes.length; i2++) {
28918 if (canBeReplaced(node) && node.isNew()) {
28923 if (!inserted && point2.hasInterestingTags()) {
28924 for (i2 = 0; i2 < nodes.length; i2++) {
28926 if (canBeReplaced(node) && !node.hasInterestingTags()) {
28932 for (i2 = 0; i2 < nodes.length; i2++) {
28934 if (canBeReplaced(node) && utilCompareIDs(point2.id, node.id) < 0) {
28942 graph = graph.remove(removeNode);
28944 if (target.tags.area === "yes") {
28945 var tags = Object.assign({}, target.tags);
28947 if (osmTagSuggestingArea(tags)) {
28948 target = target.update({ tags });
28949 graph = graph.replace(target);
28954 action.disabled = function(graph) {
28955 var geometries = groupEntitiesByGeometry(graph);
28956 if (geometries.point.length === 0 || geometries.area.length + geometries.line.length !== 1 || geometries.relation.length !== 0) {
28957 return "not_eligible";
28963 // modules/actions/merge_nodes.js
28964 function actionMergeNodes(nodeIDs, loc) {
28965 function chooseLoc(graph) {
28966 if (!nodeIDs.length)
28969 var interestingCount = 0;
28970 var interestingLoc;
28971 for (var i2 = 0; i2 < nodeIDs.length; i2++) {
28972 var node = graph.entity(nodeIDs[i2]);
28973 if (node.hasInterestingTags()) {
28974 interestingLoc = ++interestingCount === 1 ? node.loc : null;
28976 sum = geoVecAdd(sum, node.loc);
28978 return interestingLoc || geoVecScale(sum, 1 / nodeIDs.length);
28980 var action = function(graph) {
28981 if (nodeIDs.length < 2)
28985 toLoc = chooseLoc(graph);
28987 for (var i2 = 0; i2 < nodeIDs.length; i2++) {
28988 var node = graph.entity(nodeIDs[i2]);
28989 if (node.loc !== toLoc) {
28990 graph = graph.replace(node.move(toLoc));
28993 return actionConnect(nodeIDs)(graph);
28995 action.disabled = function(graph) {
28996 if (nodeIDs.length < 2)
28997 return "not_eligible";
28998 for (var i2 = 0; i2 < nodeIDs.length; i2++) {
28999 var entity = graph.entity(nodeIDs[i2]);
29000 if (entity.type !== "node")
29001 return "not_eligible";
29003 return actionConnect(nodeIDs).disabled(graph);
29008 // modules/osm/changeset.js
29009 function osmChangeset() {
29010 if (!(this instanceof osmChangeset)) {
29011 return new osmChangeset().initialize(arguments);
29012 } else if (arguments.length) {
29013 this.initialize(arguments);
29016 osmEntity.changeset = osmChangeset;
29017 osmChangeset.prototype = Object.create(osmEntity.prototype);
29018 Object.assign(osmChangeset.prototype, {
29020 extent: function() {
29021 return new geoExtent();
29023 geometry: function() {
29024 return "changeset";
29026 asJXON: function() {
29030 tag: Object.keys(this.tags).map(function(k) {
29031 return { "@k": k, "@v": this.tags[k] };
29039 osmChangeJXON: function(changes) {
29040 var changeset_id = this.id;
29041 function nest(x, order) {
29043 for (var i2 = 0; i2 < x.length; i2++) {
29044 var tagName = Object.keys(x[i2])[0];
29045 if (!groups[tagName])
29046 groups[tagName] = [];
29047 groups[tagName].push(x[i2][tagName]);
29050 order.forEach(function(o) {
29052 ordered[o] = groups[o];
29056 function sort(changes2) {
29057 function resolve(item) {
29058 return relations.find(function(relation2) {
29059 return item.keyAttributes.type === "relation" && item.keyAttributes.ref === relation2["@id"];
29062 function isNew(item) {
29063 return !sorted[item["@id"]] && !processing.find(function(proc) {
29064 return proc["@id"] === item["@id"];
29067 var processing = [];
29069 var relations = changes2.relation;
29072 for (var i2 = 0; i2 < relations.length; i2++) {
29073 var relation = relations[i2];
29074 if (!sorted[relation["@id"]]) {
29075 processing.push(relation);
29077 while (processing.length > 0) {
29078 var next = processing[0], deps = next.member.map(resolve).filter(Boolean).filter(isNew);
29079 if (deps.length === 0) {
29080 sorted[next["@id"]] = next;
29081 processing.shift();
29083 processing = deps.concat(processing);
29087 changes2.relation = Object.values(sorted);
29090 function rep2(entity) {
29091 return entity.asJXON(changeset_id);
29096 "@generator": "iD",
29097 "create": sort(nest(changes.created.map(rep2), ["node", "way", "relation"])),
29098 "modify": nest(changes.modified.map(rep2), ["node", "way", "relation"]),
29099 "delete": Object.assign(nest(changes.deleted.map(rep2), ["relation", "way", "node"]), { "@if-unused": true })
29103 asGeoJSON: function() {
29108 // modules/osm/note.js
29109 function osmNote() {
29110 if (!(this instanceof osmNote)) {
29111 return new osmNote().initialize(arguments);
29112 } else if (arguments.length) {
29113 this.initialize(arguments);
29116 osmNote.id = function() {
29117 return osmNote.id.next--;
29119 osmNote.id.next = -1;
29120 Object.assign(osmNote.prototype, {
29122 initialize: function(sources) {
29123 for (var i2 = 0; i2 < sources.length; ++i2) {
29124 var source = sources[i2];
29125 for (var prop in source) {
29126 if (Object.prototype.hasOwnProperty.call(source, prop)) {
29127 if (source[prop] === void 0) {
29130 this[prop] = source[prop];
29136 this.id = osmNote.id().toString();
29140 extent: function() {
29141 return new geoExtent(this.loc);
29143 update: function(attrs) {
29144 return osmNote(this, attrs);
29146 isNew: function() {
29147 return this.id < 0;
29149 move: function(loc) {
29150 return this.update({ loc });
29154 // modules/osm/relation.js
29155 function osmRelation() {
29156 if (!(this instanceof osmRelation)) {
29157 return new osmRelation().initialize(arguments);
29158 } else if (arguments.length) {
29159 this.initialize(arguments);
29162 osmEntity.relation = osmRelation;
29163 osmRelation.prototype = Object.create(osmEntity.prototype);
29164 osmRelation.creationOrder = function(a, b) {
29165 var aId = parseInt(osmEntity.id.toOSM(a.id), 10);
29166 var bId = parseInt(osmEntity.id.toOSM(b.id), 10);
29167 if (aId < 0 || bId < 0)
29171 Object.assign(osmRelation.prototype, {
29174 copy: function(resolver, copies) {
29175 if (copies[this.id])
29176 return copies[this.id];
29177 var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
29178 var members = this.members.map(function(member) {
29179 return Object.assign({}, member, { id: resolver.entity(member.id).copy(resolver, copies).id });
29181 copy2 = copy2.update({ members });
29182 copies[this.id] = copy2;
29185 extent: function(resolver, memo) {
29186 return resolver.transient(this, "extent", function() {
29187 if (memo && memo[this.id])
29188 return geoExtent();
29190 memo[this.id] = true;
29191 var extent = geoExtent();
29192 for (var i2 = 0; i2 < this.members.length; i2++) {
29193 var member = resolver.hasEntity(this.members[i2].id);
29195 extent._extend(member.extent(resolver, memo));
29201 geometry: function(graph) {
29202 return graph.transient(this, "geometry", function() {
29203 return this.isMultipolygon() ? "area" : "relation";
29206 isDegenerate: function() {
29207 return this.members.length === 0;
29209 indexedMembers: function() {
29210 var result = new Array(this.members.length);
29211 for (var i2 = 0; i2 < this.members.length; i2++) {
29212 result[i2] = Object.assign({}, this.members[i2], { index: i2 });
29216 memberByRole: function(role) {
29217 for (var i2 = 0; i2 < this.members.length; i2++) {
29218 if (this.members[i2].role === role) {
29219 return Object.assign({}, this.members[i2], { index: i2 });
29223 membersByRole: function(role) {
29225 for (var i2 = 0; i2 < this.members.length; i2++) {
29226 if (this.members[i2].role === role) {
29227 result.push(Object.assign({}, this.members[i2], { index: i2 }));
29232 memberById: function(id2) {
29233 for (var i2 = 0; i2 < this.members.length; i2++) {
29234 if (this.members[i2].id === id2) {
29235 return Object.assign({}, this.members[i2], { index: i2 });
29239 memberByIdAndRole: function(id2, role) {
29240 for (var i2 = 0; i2 < this.members.length; i2++) {
29241 if (this.members[i2].id === id2 && this.members[i2].role === role) {
29242 return Object.assign({}, this.members[i2], { index: i2 });
29246 addMember: function(member, index) {
29247 var members = this.members.slice();
29248 members.splice(index === void 0 ? members.length : index, 0, member);
29249 return this.update({ members });
29251 updateMember: function(member, index) {
29252 var members = this.members.slice();
29253 members.splice(index, 1, Object.assign({}, members[index], member));
29254 return this.update({ members });
29256 removeMember: function(index) {
29257 var members = this.members.slice();
29258 members.splice(index, 1);
29259 return this.update({ members });
29261 removeMembersWithID: function(id2) {
29262 var members = this.members.filter(function(m) {
29263 return m.id !== id2;
29265 return this.update({ members });
29267 moveMember: function(fromIndex, toIndex) {
29268 var members = this.members.slice();
29269 members.splice(toIndex, 0, members.splice(fromIndex, 1)[0]);
29270 return this.update({ members });
29272 replaceMember: function(needle, replacement, keepDuplicates) {
29273 if (!this.memberById(needle.id))
29276 for (var i2 = 0; i2 < this.members.length; i2++) {
29277 var member = this.members[i2];
29278 if (member.id !== needle.id) {
29279 members.push(member);
29280 } else if (keepDuplicates || !this.memberByIdAndRole(replacement.id, member.role)) {
29281 members.push({ id: replacement.id, type: replacement.type, role: member.role });
29284 return this.update({ members });
29286 asJXON: function(changeset_id) {
29289 "@id": this.osmId(),
29290 "@version": this.version || 0,
29291 member: this.members.map(function(member) {
29296 ref: osmEntity.id.toOSM(member.id)
29300 tag: Object.keys(this.tags).map(function(k) {
29301 return { keyAttributes: { k, v: this.tags[k] } };
29305 if (changeset_id) {
29306 r.relation["@changeset"] = changeset_id;
29310 asGeoJSON: function(resolver) {
29311 return resolver.transient(this, "GeoJSON", function() {
29312 if (this.isMultipolygon()) {
29314 type: "MultiPolygon",
29315 coordinates: this.multipolygon(resolver)
29319 type: "FeatureCollection",
29320 properties: this.tags,
29321 features: this.members.map(function(member) {
29322 return Object.assign({ role: member.role }, resolver.entity(member.id).asGeoJSON(resolver));
29328 area: function(resolver) {
29329 return resolver.transient(this, "area", function() {
29330 return area_default(this.asGeoJSON(resolver));
29333 isMultipolygon: function() {
29334 return this.tags.type === "multipolygon";
29336 isComplete: function(resolver) {
29337 for (var i2 = 0; i2 < this.members.length; i2++) {
29338 if (!resolver.hasEntity(this.members[i2].id)) {
29344 hasFromViaTo: function() {
29345 return this.members.some(function(m) {
29346 return m.role === "from";
29347 }) && this.members.some(function(m) {
29348 return m.role === "via";
29349 }) && this.members.some(function(m) {
29350 return m.role === "to";
29353 isRestriction: function() {
29354 return !!(this.tags.type && this.tags.type.match(/^restriction:?/));
29356 isValidRestriction: function() {
29357 if (!this.isRestriction())
29359 var froms = this.members.filter(function(m) {
29360 return m.role === "from";
29362 var vias = this.members.filter(function(m) {
29363 return m.role === "via";
29365 var tos = this.members.filter(function(m) {
29366 return m.role === "to";
29368 if (froms.length !== 1 && this.tags.restriction !== "no_entry")
29370 if (froms.some(function(m) {
29371 return m.type !== "way";
29374 if (tos.length !== 1 && this.tags.restriction !== "no_exit")
29376 if (tos.some(function(m) {
29377 return m.type !== "way";
29380 if (vias.length === 0)
29382 if (vias.length > 1 && vias.some(function(m) {
29383 return m.type !== "way";
29388 isConnectivity: function() {
29389 return !!(this.tags.type && this.tags.type.match(/^connectivity:?/));
29391 multipolygon: function(resolver) {
29392 var outers = this.members.filter(function(m) {
29393 return "outer" === (m.role || "outer");
29395 var inners = this.members.filter(function(m) {
29396 return "inner" === m.role;
29398 outers = osmJoinWays(outers, resolver);
29399 inners = osmJoinWays(inners, resolver);
29400 var sequenceToLineString = function(sequence) {
29401 if (sequence.nodes.length > 2 && sequence.nodes[0] !== sequence.nodes[sequence.nodes.length - 1]) {
29402 sequence.nodes.push(sequence.nodes[0]);
29404 return sequence.nodes.map(function(node) {
29408 outers = outers.map(sequenceToLineString);
29409 inners = inners.map(sequenceToLineString);
29410 var result = outers.map(function(o2) {
29411 return [area_default({ type: "Polygon", coordinates: [o2] }) > 2 * Math.PI ? o2.reverse() : o2];
29413 function findOuter(inner2) {
29415 for (o2 = 0; o2 < outers.length; o2++) {
29416 outer = outers[o2];
29417 if (geoPolygonContainsPolygon(outer, inner2)) {
29421 for (o2 = 0; o2 < outers.length; o2++) {
29422 outer = outers[o2];
29423 if (geoPolygonIntersectsPolygon(outer, inner2, false)) {
29428 for (var i2 = 0; i2 < inners.length; i2++) {
29429 var inner = inners[i2];
29430 if (area_default({ type: "Polygon", coordinates: [inner] }) < 2 * Math.PI) {
29431 inner = inner.reverse();
29433 var o = findOuter(inners[i2]);
29434 if (o !== void 0) {
29435 result[o].push(inners[i2]);
29437 result.push([inners[i2]]);
29444 // modules/osm/qa_item.js
29445 var QAItem = class {
29446 constructor(loc, service, itemType, id2, props) {
29448 this.service = service.title;
29449 this.itemType = itemType;
29450 this.id = id2 ? id2 : `${QAItem.id()}`;
29451 this.update(props);
29452 if (service && typeof service.getIcon === "function") {
29453 this.icon = service.getIcon(itemType);
29457 const { loc, service, itemType, id: id2 } = this;
29458 Object.keys(props).forEach((prop) => this[prop] = props[prop]);
29460 this.service = service;
29461 this.itemType = itemType;
29466 return this.nextId--;
29469 QAItem.nextId = -1;
29471 // modules/actions/split.js
29472 function actionSplit(nodeIds, newWayIds) {
29473 if (typeof nodeIds === "string")
29474 nodeIds = [nodeIds];
29476 var _keepHistoryOn = "longest";
29477 var _createdWayIDs = [];
29478 function dist(graph, nA, nB) {
29479 var locA = graph.entity(nA).loc;
29480 var locB = graph.entity(nB).loc;
29481 var epsilon3 = 1e-6;
29482 return locA && locB ? geoSphericalDistance(locA, locB) : epsilon3;
29484 function splitArea(nodes, idxA, graph) {
29485 var lengths = new Array(nodes.length);
29490 function wrap2(index) {
29491 return utilWrap(index, nodes.length);
29494 for (i2 = wrap2(idxA + 1); i2 !== idxA; i2 = wrap2(i2 + 1)) {
29495 length += dist(graph, nodes[i2], nodes[wrap2(i2 - 1)]);
29496 lengths[i2] = length;
29499 for (i2 = wrap2(idxA - 1); i2 !== idxA; i2 = wrap2(i2 - 1)) {
29500 length += dist(graph, nodes[i2], nodes[wrap2(i2 + 1)]);
29501 if (length < lengths[i2]) {
29502 lengths[i2] = length;
29505 for (i2 = 0; i2 < nodes.length; i2++) {
29506 var cost = lengths[i2] / dist(graph, nodes[idxA], nodes[i2]);
29514 function totalLengthBetweenNodes(graph, nodes) {
29515 var totalLength = 0;
29516 for (var i2 = 0; i2 < nodes.length - 1; i2++) {
29517 totalLength += dist(graph, nodes[i2], nodes[i2 + 1]);
29519 return totalLength;
29521 function split(graph, nodeId, wayA, newWayId) {
29522 var wayB = osmWay({ id: newWayId, tags: wayA.tags });
29523 var origNodes = wayA.nodes.slice();
29526 var isArea = wayA.isArea();
29527 var isOuter = osmIsOldMultipolygonOuterMember(wayA, graph);
29528 if (wayA.isClosed()) {
29529 var nodes = wayA.nodes.slice(0, -1);
29530 var idxA = nodes.indexOf(nodeId);
29531 var idxB = splitArea(nodes, idxA, graph);
29533 nodesA = nodes.slice(idxA).concat(nodes.slice(0, idxB + 1));
29534 nodesB = nodes.slice(idxB, idxA + 1);
29536 nodesA = nodes.slice(idxA, idxB + 1);
29537 nodesB = nodes.slice(idxB).concat(nodes.slice(0, idxA + 1));
29540 var idx = wayA.nodes.indexOf(nodeId, 1);
29541 nodesA = wayA.nodes.slice(0, idx + 1);
29542 nodesB = wayA.nodes.slice(idx);
29544 var lengthA = totalLengthBetweenNodes(graph, nodesA);
29545 var lengthB = totalLengthBetweenNodes(graph, nodesB);
29546 if (_keepHistoryOn === "longest" && lengthB > lengthA) {
29547 wayA = wayA.update({ nodes: nodesB });
29548 wayB = wayB.update({ nodes: nodesA });
29549 var temp = lengthA;
29553 wayA = wayA.update({ nodes: nodesA });
29554 wayB = wayB.update({ nodes: nodesB });
29556 if (wayA.tags.step_count) {
29557 var stepCount = parseFloat(wayA.tags.step_count);
29558 if (stepCount && isFinite(stepCount) && stepCount > 0 && Math.round(stepCount) === stepCount) {
29559 var tagsA = Object.assign({}, wayA.tags);
29560 var tagsB = Object.assign({}, wayB.tags);
29561 var ratioA = lengthA / (lengthA + lengthB);
29562 var countA = Math.round(stepCount * ratioA);
29563 tagsA.step_count = countA.toString();
29564 tagsB.step_count = (stepCount - countA).toString();
29565 wayA = wayA.update({ tags: tagsA });
29566 wayB = wayB.update({ tags: tagsB });
29569 graph = graph.replace(wayA);
29570 graph = graph.replace(wayB);
29571 graph.parentRelations(wayA).forEach(function(relation) {
29573 if (relation.hasFromViaTo()) {
29574 var f2 = relation.memberByRole("from");
29575 var v = relation.membersByRole("via");
29576 var t = relation.memberByRole("to");
29578 if (f2.id === wayA.id || t.id === wayA.id) {
29580 if (v.length === 1 && v[0].type === "node") {
29581 keepB = wayB.contains(v[0].id);
29583 for (i2 = 0; i2 < v.length; i2++) {
29584 if (v[i2].type === "way") {
29585 var wayVia = graph.hasEntity(v[i2].id);
29586 if (wayVia && utilArrayIntersection(wayB.nodes, wayVia.nodes).length) {
29594 relation = relation.replaceMember(wayA, wayB);
29595 graph = graph.replace(relation);
29598 for (i2 = 0; i2 < v.length; i2++) {
29599 if (v[i2].type === "way" && v[i2].id === wayA.id) {
29605 graph = actionAddMember(relation.id, member, v[i2].index + 1)(graph);
29611 if (relation === isOuter) {
29612 graph = graph.replace(relation.mergeTags(wayA.tags));
29613 graph = graph.replace(wayA.update({ tags: {} }));
29614 graph = graph.replace(wayB.update({ tags: {} }));
29619 role: relation.memberById(wayA.id).role
29622 originalID: wayA.id,
29623 insertedID: wayB.id,
29626 graph = actionAddMember(relation.id, member, void 0, insertPair)(graph);
29629 if (!isOuter && isArea) {
29630 var multipolygon = osmRelation({
29631 tags: Object.assign({}, wayA.tags, { type: "multipolygon" }),
29633 { id: wayA.id, role: "outer", type: "way" },
29634 { id: wayB.id, role: "outer", type: "way" }
29637 graph = graph.replace(multipolygon);
29638 graph = graph.replace(wayA.update({ tags: {} }));
29639 graph = graph.replace(wayB.update({ tags: {} }));
29641 _createdWayIDs.push(wayB.id);
29644 var action = function(graph) {
29645 _createdWayIDs = [];
29646 var newWayIndex = 0;
29647 for (var i2 = 0; i2 < nodeIds.length; i2++) {
29648 var nodeId = nodeIds[i2];
29649 var candidates = action.waysForNode(nodeId, graph);
29650 for (var j2 = 0; j2 < candidates.length; j2++) {
29651 graph = split(graph, nodeId, candidates[j2], newWayIds && newWayIds[newWayIndex]);
29657 action.getCreatedWayIDs = function() {
29658 return _createdWayIDs;
29660 action.waysForNode = function(nodeId, graph) {
29661 var node = graph.entity(nodeId);
29662 var splittableParents = graph.parentWays(node).filter(isSplittable);
29664 var hasLine = splittableParents.some(function(parent) {
29665 return parent.geometry(graph) === "line";
29668 return splittableParents.filter(function(parent) {
29669 return parent.geometry(graph) === "line";
29673 return splittableParents;
29674 function isSplittable(parent) {
29675 if (_wayIDs && _wayIDs.indexOf(parent.id) === -1)
29677 if (parent.isClosed())
29679 for (var i2 = 1; i2 < parent.nodes.length - 1; i2++) {
29680 if (parent.nodes[i2] === nodeId)
29686 action.ways = function(graph) {
29687 return utilArrayUniq([].concat.apply([], nodeIds.map(function(nodeId) {
29688 return action.waysForNode(nodeId, graph);
29691 action.disabled = function(graph) {
29692 for (var i2 = 0; i2 < nodeIds.length; i2++) {
29693 var nodeId = nodeIds[i2];
29694 var candidates = action.waysForNode(nodeId, graph);
29695 if (candidates.length === 0 || _wayIDs && _wayIDs.length !== candidates.length) {
29696 return "not_eligible";
29700 action.limitWays = function(val) {
29701 if (!arguments.length)
29706 action.keepHistoryOn = function(val) {
29707 if (!arguments.length)
29708 return _keepHistoryOn;
29709 _keepHistoryOn = val;
29715 // modules/core/graph.js
29716 function coreGraph(other, mutable) {
29717 if (!(this instanceof coreGraph))
29718 return new coreGraph(other, mutable);
29719 if (other instanceof coreGraph) {
29720 var base = other.base();
29721 this.entities = Object.assign(Object.create(base.entities), other.entities);
29722 this._parentWays = Object.assign(Object.create(base.parentWays), other._parentWays);
29723 this._parentRels = Object.assign(Object.create(base.parentRels), other._parentRels);
29725 this.entities = /* @__PURE__ */ Object.create({});
29726 this._parentWays = /* @__PURE__ */ Object.create({});
29727 this._parentRels = /* @__PURE__ */ Object.create({});
29728 this.rebase(other || [], [this]);
29730 this.transients = {};
29731 this._childNodes = {};
29732 this.frozen = !mutable;
29734 coreGraph.prototype = {
29735 hasEntity: function(id2) {
29736 return this.entities[id2];
29738 entity: function(id2) {
29739 var entity = this.entities[id2];
29741 entity = this.entities.__proto__[id2];
29744 throw new Error("entity " + id2 + " not found");
29748 geometry: function(id2) {
29749 return this.entity(id2).geometry(this);
29751 transient: function(entity, key, fn) {
29752 var id2 = entity.id;
29753 var transients = this.transients[id2] || (this.transients[id2] = {});
29754 if (transients[key] !== void 0) {
29755 return transients[key];
29757 transients[key] = fn.call(entity);
29758 return transients[key];
29760 parentWays: function(entity) {
29761 var parents = this._parentWays[entity.id];
29764 parents.forEach(function(id2) {
29765 result.push(this.entity(id2));
29770 isPoi: function(entity) {
29771 var parents = this._parentWays[entity.id];
29772 return !parents || parents.size === 0;
29774 isShared: function(entity) {
29775 var parents = this._parentWays[entity.id];
29776 return parents && parents.size > 1;
29778 parentRelations: function(entity) {
29779 var parents = this._parentRels[entity.id];
29782 parents.forEach(function(id2) {
29783 result.push(this.entity(id2));
29788 parentMultipolygons: function(entity) {
29789 return this.parentRelations(entity).filter(function(relation) {
29790 return relation.isMultipolygon();
29793 childNodes: function(entity) {
29794 if (this._childNodes[entity.id])
29795 return this._childNodes[entity.id];
29799 for (var i2 = 0; i2 < entity.nodes.length; i2++) {
29800 nodes[i2] = this.entity(entity.nodes[i2]);
29803 Object.freeze(nodes);
29804 this._childNodes[entity.id] = nodes;
29805 return this._childNodes[entity.id];
29809 "entities": Object.getPrototypeOf(this.entities),
29810 "parentWays": Object.getPrototypeOf(this._parentWays),
29811 "parentRels": Object.getPrototypeOf(this._parentRels)
29814 rebase: function(entities, stack, force) {
29815 var base = this.base();
29816 var i2, j2, k, id2;
29817 for (i2 = 0; i2 < entities.length; i2++) {
29818 var entity = entities[i2];
29819 if (!entity.visible || !force && base.entities[entity.id])
29821 base.entities[entity.id] = entity;
29822 this._updateCalculated(void 0, entity, base.parentWays, base.parentRels);
29823 if (entity.type === "way") {
29824 for (j2 = 0; j2 < entity.nodes.length; j2++) {
29825 id2 = entity.nodes[j2];
29826 for (k = 1; k < stack.length; k++) {
29827 var ents = stack[k].entities;
29828 if (ents.hasOwnProperty(id2) && ents[id2] === void 0) {
29835 for (i2 = 0; i2 < stack.length; i2++) {
29836 stack[i2]._updateRebased();
29839 _updateRebased: function() {
29840 var base = this.base();
29841 Object.keys(this._parentWays).forEach(function(child) {
29842 if (base.parentWays[child]) {
29843 base.parentWays[child].forEach(function(id2) {
29844 if (!this.entities.hasOwnProperty(id2)) {
29845 this._parentWays[child].add(id2);
29850 Object.keys(this._parentRels).forEach(function(child) {
29851 if (base.parentRels[child]) {
29852 base.parentRels[child].forEach(function(id2) {
29853 if (!this.entities.hasOwnProperty(id2)) {
29854 this._parentRels[child].add(id2);
29859 this.transients = {};
29861 _updateCalculated: function(oldentity, entity, parentWays, parentRels) {
29862 parentWays = parentWays || this._parentWays;
29863 parentRels = parentRels || this._parentRels;
29864 var type3 = entity && entity.type || oldentity && oldentity.type;
29865 var removed, added, i2;
29866 if (type3 === "way") {
29867 if (oldentity && entity) {
29868 removed = utilArrayDifference(oldentity.nodes, entity.nodes);
29869 added = utilArrayDifference(entity.nodes, oldentity.nodes);
29870 } else if (oldentity) {
29871 removed = oldentity.nodes;
29873 } else if (entity) {
29875 added = entity.nodes;
29877 for (i2 = 0; i2 < removed.length; i2++) {
29878 parentWays[removed[i2]] = new Set(parentWays[removed[i2]]);
29879 parentWays[removed[i2]].delete(oldentity.id);
29881 for (i2 = 0; i2 < added.length; i2++) {
29882 parentWays[added[i2]] = new Set(parentWays[added[i2]]);
29883 parentWays[added[i2]].add(entity.id);
29885 } else if (type3 === "relation") {
29886 var oldentityMemberIDs = oldentity ? oldentity.members.map(function(m) {
29889 var entityMemberIDs = entity ? entity.members.map(function(m) {
29892 if (oldentity && entity) {
29893 removed = utilArrayDifference(oldentityMemberIDs, entityMemberIDs);
29894 added = utilArrayDifference(entityMemberIDs, oldentityMemberIDs);
29895 } else if (oldentity) {
29896 removed = oldentityMemberIDs;
29898 } else if (entity) {
29900 added = entityMemberIDs;
29902 for (i2 = 0; i2 < removed.length; i2++) {
29903 parentRels[removed[i2]] = new Set(parentRels[removed[i2]]);
29904 parentRels[removed[i2]].delete(oldentity.id);
29906 for (i2 = 0; i2 < added.length; i2++) {
29907 parentRels[added[i2]] = new Set(parentRels[added[i2]]);
29908 parentRels[added[i2]].add(entity.id);
29912 replace: function(entity) {
29913 if (this.entities[entity.id] === entity)
29915 return this.update(function() {
29916 this._updateCalculated(this.entities[entity.id], entity);
29917 this.entities[entity.id] = entity;
29920 remove: function(entity) {
29921 return this.update(function() {
29922 this._updateCalculated(entity, void 0);
29923 this.entities[entity.id] = void 0;
29926 revert: function(id2) {
29927 var baseEntity = this.base().entities[id2];
29928 var headEntity = this.entities[id2];
29929 if (headEntity === baseEntity)
29931 return this.update(function() {
29932 this._updateCalculated(headEntity, baseEntity);
29933 delete this.entities[id2];
29936 update: function() {
29937 var graph = this.frozen ? coreGraph(this, true) : this;
29938 for (var i2 = 0; i2 < arguments.length; i2++) {
29939 arguments[i2].call(graph, graph);
29942 graph.frozen = true;
29945 load: function(entities) {
29946 var base = this.base();
29947 this.entities = Object.create(base.entities);
29948 for (var i2 in entities) {
29949 this.entities[i2] = entities[i2];
29950 this._updateCalculated(base.entities[i2], this.entities[i2]);
29956 // modules/osm/intersection.js
29957 function osmTurn(turn) {
29958 if (!(this instanceof osmTurn)) {
29959 return new osmTurn(turn);
29961 Object.assign(this, turn);
29963 function osmIntersection(graph, startVertexId, maxDistance) {
29964 maxDistance = maxDistance || 30;
29965 var vgraph = coreGraph();
29967 function memberOfRestriction(entity) {
29968 return graph.parentRelations(entity).some(function(r) {
29969 return r.isRestriction();
29972 function isRoad(way2) {
29973 if (way2.isArea() || way2.isDegenerate())
29977 "motorway_link": true,
29979 "trunk_link": true,
29981 "primary_link": true,
29983 "secondary_link": true,
29985 "tertiary_link": true,
29986 "residential": true,
29987 "unclassified": true,
29988 "living_street": true,
29993 return roads[way2.tags.highway];
29995 var startNode = graph.entity(startVertexId);
29996 var checkVertices = [startNode];
29999 var vertexIds = [];
30009 while (checkVertices.length) {
30010 vertex = checkVertices.pop();
30011 checkWays = graph.parentWays(vertex);
30012 var hasWays = false;
30013 for (i2 = 0; i2 < checkWays.length; i2++) {
30014 way = checkWays[i2];
30015 if (!isRoad(way) && !memberOfRestriction(way))
30019 nodes = utilArrayUniq(graph.childNodes(way));
30020 for (j2 = 0; j2 < nodes.length; j2++) {
30022 if (node === vertex)
30024 if (vertices.indexOf(node) !== -1)
30026 if (geoSphericalDistance(node.loc, startNode.loc) > maxDistance)
30028 var hasParents = false;
30029 parents = graph.parentWays(node);
30030 for (k = 0; k < parents.length; k++) {
30031 parent = parents[k];
30032 if (parent === way)
30034 if (ways.indexOf(parent) !== -1)
30036 if (!isRoad(parent))
30042 checkVertices.push(node);
30047 vertices.push(vertex);
30050 vertices = utilArrayUniq(vertices);
30051 ways = utilArrayUniq(ways);
30052 ways.forEach(function(way2) {
30053 graph.childNodes(way2).forEach(function(node2) {
30054 vgraph = vgraph.replace(node2);
30056 vgraph = vgraph.replace(way2);
30057 graph.parentRelations(way2).forEach(function(relation) {
30058 if (relation.isRestriction()) {
30059 if (relation.isValidRestriction(graph)) {
30060 vgraph = vgraph.replace(relation);
30061 } else if (relation.isComplete(graph)) {
30062 actions.push(actionDeleteRelation(relation.id));
30067 ways.forEach(function(w) {
30068 var way2 = vgraph.entity(w.id);
30069 if (way2.tags.oneway === "-1") {
30070 var action = actionReverse(way2.id, { reverseOneway: true });
30071 actions.push(action);
30072 vgraph = action(vgraph);
30075 var origCount = osmEntity.id.next.way;
30076 vertices.forEach(function(v) {
30077 var splitAll = actionSplit([v.id]).keepHistoryOn("first");
30078 if (!splitAll.disabled(vgraph)) {
30079 splitAll.ways(vgraph).forEach(function(way2) {
30080 var splitOne = actionSplit([v.id]).limitWays([way2.id]).keepHistoryOn("first");
30081 actions.push(splitOne);
30082 vgraph = splitOne(vgraph);
30086 osmEntity.id.next.way = origCount;
30087 vertexIds = vertices.map(function(v) {
30092 vertexIds.forEach(function(id2) {
30093 var vertex2 = vgraph.entity(id2);
30094 var parents2 = vgraph.parentWays(vertex2);
30095 vertices.push(vertex2);
30096 ways = ways.concat(parents2);
30098 vertices = utilArrayUniq(vertices);
30099 ways = utilArrayUniq(ways);
30100 vertexIds = vertices.map(function(v) {
30103 wayIds = ways.map(function(w) {
30106 function withMetadata(way2, vertexIds2) {
30107 var __oneWay = way2.isOneWay();
30108 var __first = vertexIds2.indexOf(way2.first()) !== -1;
30109 var __last = vertexIds2.indexOf(way2.last()) !== -1;
30110 var __via = __first && __last;
30111 var __from = __first && !__oneWay || __last;
30112 var __to = __first || __last && !__oneWay;
30113 return way2.update({
30123 wayIds.forEach(function(id2) {
30124 var way2 = withMetadata(vgraph.entity(id2), vertexIds);
30125 vgraph = vgraph.replace(way2);
30129 var removeWayIds = [];
30130 var removeVertexIds = [];
30133 checkVertices = vertexIds.slice();
30134 for (i2 = 0; i2 < checkVertices.length; i2++) {
30135 var vertexId = checkVertices[i2];
30136 vertex = vgraph.hasEntity(vertexId);
30138 if (vertexIds.indexOf(vertexId) !== -1) {
30139 vertexIds.splice(vertexIds.indexOf(vertexId), 1);
30141 removeVertexIds.push(vertexId);
30144 parents = vgraph.parentWays(vertex);
30145 if (parents.length < 3) {
30146 if (vertexIds.indexOf(vertexId) !== -1) {
30147 vertexIds.splice(vertexIds.indexOf(vertexId), 1);
30150 if (parents.length === 2) {
30151 var a = parents[0];
30152 var b = parents[1];
30153 var aIsLeaf = a && !a.__via;
30154 var bIsLeaf = b && !b.__via;
30155 var leaf, survivor;
30156 if (aIsLeaf && !bIsLeaf) {
30159 } else if (!aIsLeaf && bIsLeaf) {
30163 if (leaf && survivor) {
30164 survivor = withMetadata(survivor, vertexIds);
30165 vgraph = vgraph.replace(survivor).remove(leaf);
30166 removeWayIds.push(leaf.id);
30170 parents = vgraph.parentWays(vertex);
30171 if (parents.length < 2) {
30172 if (vertexIds.indexOf(vertexId) !== -1) {
30173 vertexIds.splice(vertexIds.indexOf(vertexId), 1);
30175 removeVertexIds.push(vertexId);
30178 if (parents.length < 1) {
30179 vgraph = vgraph.remove(vertex);
30182 } while (keepGoing);
30183 vertices = vertices.filter(function(vertex2) {
30184 return removeVertexIds.indexOf(vertex2.id) === -1;
30185 }).map(function(vertex2) {
30186 return vgraph.entity(vertex2.id);
30188 ways = ways.filter(function(way2) {
30189 return removeWayIds.indexOf(way2.id) === -1;
30190 }).map(function(way2) {
30191 return vgraph.entity(way2.id);
30193 var intersection = {
30199 intersection.turns = function(fromWayId, maxViaWay) {
30204 var vgraph2 = intersection.graph;
30205 var keyVertexIds = intersection.vertices.map(function(v) {
30208 var start2 = vgraph2.entity(fromWayId);
30209 if (!start2 || !(start2.__from || start2.__via))
30211 var maxPathLength = maxViaWay * 2 + 3;
30215 function step(entity, currPath, currRestrictions, matchedRestriction) {
30216 currPath = (currPath || []).slice();
30217 if (currPath.length >= maxPathLength)
30219 currPath.push(entity.id);
30220 currRestrictions = (currRestrictions || []).slice();
30221 if (entity.type === "node") {
30222 stepNode(entity, currPath, currRestrictions);
30224 stepWay(entity, currPath, currRestrictions, matchedRestriction);
30227 function stepNode(entity, currPath, currRestrictions) {
30229 var parents2 = vgraph2.parentWays(entity);
30231 for (i3 = 0; i3 < parents2.length; i3++) {
30232 var way2 = parents2[i3];
30233 if (way2.__oneWay && way2.nodes[0] !== entity.id)
30235 if (currPath.indexOf(way2.id) !== -1 && currPath.length >= 3)
30237 var restrict = null;
30238 for (j3 = 0; j3 < currRestrictions.length; j3++) {
30239 var restriction = currRestrictions[j3];
30240 var f2 = restriction.memberByRole("from");
30241 var v = restriction.membersByRole("via");
30242 var t = restriction.memberByRole("to");
30243 var isNo = /^no_/.test(restriction.tags.restriction);
30244 var isOnly = /^only_/.test(restriction.tags.restriction);
30245 if (!(isNo || isOnly)) {
30248 var matchesFrom = f2.id === fromWayId;
30249 var matchesViaTo = false;
30250 var isAlongOnlyPath = false;
30251 if (t.id === way2.id) {
30252 if (v.length === 1 && v[0].type === "node") {
30253 matchesViaTo = v[0].id === entity.id && (matchesFrom && currPath.length === 2 || !matchesFrom && currPath.length > 2);
30256 for (k = 2; k < currPath.length; k += 2) {
30257 pathVias.push(currPath[k]);
30259 var restrictionVias = [];
30260 for (k = 0; k < v.length; k++) {
30261 if (v[k].type === "way") {
30262 restrictionVias.push(v[k].id);
30265 var diff = utilArrayDifference(pathVias, restrictionVias);
30266 matchesViaTo = !diff.length;
30268 } else if (isOnly) {
30269 for (k = 0; k < v.length; k++) {
30270 if (v[k].type === "way" && v[k].id === way2.id) {
30271 isAlongOnlyPath = true;
30276 if (matchesViaTo) {
30278 restrict = { id: restriction.id, direct: matchesFrom, from: f2.id, only: true, end: true };
30280 restrict = { id: restriction.id, direct: matchesFrom, from: f2.id, no: true, end: true };
30283 if (isAlongOnlyPath) {
30284 restrict = { id: restriction.id, direct: false, from: f2.id, only: true, end: false };
30285 } else if (isOnly) {
30286 restrict = { id: restriction.id, direct: false, from: f2.id, no: true, end: true };
30289 if (restrict && restrict.direct)
30292 nextWays.push({ way: way2, restrict });
30294 nextWays.forEach(function(nextWay) {
30295 step(nextWay.way, currPath, currRestrictions, nextWay.restrict);
30298 function stepWay(entity, currPath, currRestrictions, matchedRestriction) {
30300 if (currPath.length >= 3) {
30301 var turnPath = currPath.slice();
30302 if (matchedRestriction && matchedRestriction.direct === false) {
30303 for (i3 = 0; i3 < turnPath.length; i3++) {
30304 if (turnPath[i3] === matchedRestriction.from) {
30305 turnPath = turnPath.slice(i3);
30310 var turn = pathToTurn(turnPath);
30312 if (matchedRestriction) {
30313 turn.restrictionID = matchedRestriction.id;
30314 turn.no = matchedRestriction.no;
30315 turn.only = matchedRestriction.only;
30316 turn.direct = matchedRestriction.direct;
30318 turns.push(osmTurn(turn));
30320 if (currPath[0] === currPath[2])
30323 if (matchedRestriction && matchedRestriction.end)
30325 var n1 = vgraph2.entity(entity.first());
30326 var n2 = vgraph2.entity(entity.last());
30327 var dist = geoSphericalDistance(n1.loc, n2.loc);
30328 var nextNodes = [];
30329 if (currPath.length > 1) {
30330 if (dist > maxDistance)
30335 if (!entity.__oneWay && keyVertexIds.indexOf(n1.id) !== -1 && currPath.indexOf(n1.id) === -1) {
30336 nextNodes.push(n1);
30338 if (keyVertexIds.indexOf(n2.id) !== -1 && currPath.indexOf(n2.id) === -1) {
30339 nextNodes.push(n2);
30341 nextNodes.forEach(function(nextNode) {
30342 var fromRestrictions = vgraph2.parentRelations(entity).filter(function(r) {
30343 if (!r.isRestriction())
30345 var f2 = r.memberByRole("from");
30346 if (!f2 || f2.id !== entity.id)
30348 var isOnly = /^only_/.test(r.tags.restriction);
30351 var isOnlyVia = false;
30352 var v = r.membersByRole("via");
30353 if (v.length === 1 && v[0].type === "node") {
30354 isOnlyVia = v[0].id === nextNode.id;
30356 for (var i4 = 0; i4 < v.length; i4++) {
30357 if (v[i4].type !== "way")
30359 var viaWay = vgraph2.entity(v[i4].id);
30360 if (viaWay.first() === nextNode.id || viaWay.last() === nextNode.id) {
30368 step(nextNode, currPath, currRestrictions.concat(fromRestrictions), false);
30371 function pathToTurn(path) {
30372 if (path.length < 3)
30374 var fromWayId2, fromNodeId, fromVertexId;
30375 var toWayId, toNodeId, toVertexId;
30376 var viaWayIds, viaNodeId, isUturn;
30377 fromWayId2 = path[0];
30378 toWayId = path[path.length - 1];
30379 if (path.length === 3 && fromWayId2 === toWayId) {
30380 var way2 = vgraph2.entity(fromWayId2);
30384 viaNodeId = fromVertexId = toVertexId = path[1];
30385 fromNodeId = toNodeId = adjacentNode(fromWayId2, viaNodeId);
30388 fromVertexId = path[1];
30389 fromNodeId = adjacentNode(fromWayId2, fromVertexId);
30390 toVertexId = path[path.length - 2];
30391 toNodeId = adjacentNode(toWayId, toVertexId);
30392 if (path.length === 3) {
30393 viaNodeId = path[1];
30395 viaWayIds = path.filter(function(entityId) {
30396 return entityId[0] === "w";
30398 viaWayIds = viaWayIds.slice(1, viaWayIds.length - 1);
30402 key: path.join("_"),
30404 from: { node: fromNodeId, way: fromWayId2, vertex: fromVertexId },
30405 via: { node: viaNodeId, ways: viaWayIds },
30406 to: { node: toNodeId, way: toWayId, vertex: toVertexId },
30409 function adjacentNode(wayId, affixId) {
30410 var nodes2 = vgraph2.entity(wayId).nodes;
30411 return affixId === nodes2[0] ? nodes2[1] : nodes2[nodes2.length - 2];
30415 return intersection;
30417 function osmInferRestriction(graph, turn, projection2) {
30418 var fromWay = graph.entity(turn.from.way);
30419 var fromNode = graph.entity(turn.from.node);
30420 var fromVertex = graph.entity(turn.from.vertex);
30421 var toWay = graph.entity(turn.to.way);
30422 var toNode = graph.entity(turn.to.node);
30423 var toVertex = graph.entity(turn.to.vertex);
30424 var fromOneWay = fromWay.tags.oneway === "yes";
30425 var toOneWay = toWay.tags.oneway === "yes";
30426 var angle2 = (geoAngle(fromVertex, fromNode, projection2) - geoAngle(toVertex, toNode, projection2)) * 180 / Math.PI;
30427 while (angle2 < 0) {
30430 if (fromNode === toNode) {
30431 return "no_u_turn";
30433 if ((angle2 < 23 || angle2 > 336) && fromOneWay && toOneWay) {
30434 return "no_u_turn";
30436 if ((angle2 < 40 || angle2 > 319) && fromOneWay && toOneWay && turn.from.vertex !== turn.to.vertex) {
30437 return "no_u_turn";
30439 if (angle2 < 158) {
30440 return "no_right_turn";
30442 if (angle2 > 202) {
30443 return "no_left_turn";
30445 return "no_straight_on";
30448 // modules/actions/merge_polygon.js
30449 function actionMergePolygon(ids, newRelationId) {
30450 function groupEntities(graph) {
30451 var entities = ids.map(function(id2) {
30452 return graph.entity(id2);
30454 var geometryGroups = utilArrayGroupBy(entities, function(entity) {
30455 if (entity.type === "way" && entity.isClosed()) {
30456 return "closedWay";
30457 } else if (entity.type === "relation" && entity.isMultipolygon()) {
30458 return "multipolygon";
30463 return Object.assign(
30464 { closedWay: [], multipolygon: [], other: [] },
30468 var action = function(graph) {
30469 var entities = groupEntities(graph);
30470 var polygons = entities.multipolygon.reduce(function(polygons2, m) {
30471 return polygons2.concat(osmJoinWays(m.members, graph));
30472 }, []).concat(entities.closedWay.map(function(d) {
30473 var member = [{ id: d.id }];
30474 member.nodes = graph.childNodes(d);
30477 var contained = polygons.map(function(w, i2) {
30478 return polygons.map(function(d, n2) {
30481 return geoPolygonContainsPolygon(
30482 d.nodes.map(function(n3) {
30485 w.nodes.map(function(n3) {
30493 while (polygons.length) {
30494 extractUncontained(polygons);
30495 polygons = polygons.filter(isContained);
30496 contained = contained.filter(isContained).map(filterContained);
30498 function isContained(d, i2) {
30499 return contained[i2].some(function(val) {
30503 function filterContained(d) {
30504 return d.filter(isContained);
30506 function extractUncontained(polygons2) {
30507 polygons2.forEach(function(d, i2) {
30508 if (!isContained(d, i2)) {
30509 d.forEach(function(member) {
30513 role: outer ? "outer" : "inner"
30521 if (entities.multipolygon.length > 0) {
30522 var oldestID = utilOldestID(entities.multipolygon.map((entity) => entity.id));
30523 relation = entities.multipolygon.find((entity) => entity.id === oldestID);
30525 relation = osmRelation({ id: newRelationId, tags: { type: "multipolygon" } });
30527 entities.multipolygon.forEach(function(m) {
30528 if (m.id !== relation.id) {
30529 relation = relation.mergeTags(m.tags);
30530 graph = graph.remove(m);
30533 entities.closedWay.forEach(function(way) {
30534 function isThisOuter(m) {
30535 return m.id === way.id && m.role !== "inner";
30537 if (members.some(isThisOuter)) {
30538 relation = relation.mergeTags(way.tags);
30539 graph = graph.replace(way.update({ tags: {} }));
30542 return graph.replace(relation.update({
30544 tags: utilObjectOmit(relation.tags, ["area"])
30547 action.disabled = function(graph) {
30548 var entities = groupEntities(graph);
30549 if (entities.other.length > 0 || entities.closedWay.length + entities.multipolygon.length < 2) {
30550 return "not_eligible";
30552 if (!entities.multipolygon.every(function(r) {
30553 return r.isComplete(graph);
30555 return "incomplete_relation";
30557 if (!entities.multipolygon.length) {
30558 var sharedMultipolygons = [];
30559 entities.closedWay.forEach(function(way, i2) {
30561 sharedMultipolygons = graph.parentMultipolygons(way);
30563 sharedMultipolygons = utilArrayIntersection(sharedMultipolygons, graph.parentMultipolygons(way));
30566 sharedMultipolygons = sharedMultipolygons.filter(function(relation) {
30567 return relation.members.length === entities.closedWay.length;
30569 if (sharedMultipolygons.length) {
30570 return "not_eligible";
30572 } else if (entities.closedWay.some(function(way) {
30573 return utilArrayIntersection(graph.parentMultipolygons(way), entities.multipolygon).length;
30575 return "not_eligible";
30581 // modules/actions/merge_remote_changes.js
30582 var import_fast_deep_equal = __toESM(require_fast_deep_equal());
30584 // node_modules/node-diff3/index.mjs
30585 function LCS(buffer1, buffer2) {
30586 let equivalenceClasses = {};
30587 for (let j2 = 0; j2 < buffer2.length; j2++) {
30588 const item = buffer2[j2];
30589 if (equivalenceClasses[item]) {
30590 equivalenceClasses[item].push(j2);
30592 equivalenceClasses[item] = [j2];
30595 const NULLRESULT = { buffer1index: -1, buffer2index: -1, chain: null };
30596 let candidates = [NULLRESULT];
30597 for (let i2 = 0; i2 < buffer1.length; i2++) {
30598 const item = buffer1[i2];
30599 const buffer2indices = equivalenceClasses[item] || [];
30601 let c = candidates[0];
30602 for (let jx = 0; jx < buffer2indices.length; jx++) {
30603 const j2 = buffer2indices[jx];
30605 for (s = r; s < candidates.length; s++) {
30606 if (candidates[s].buffer2index < j2 && (s === candidates.length - 1 || candidates[s + 1].buffer2index > j2)) {
30610 if (s < candidates.length) {
30611 const newCandidate = { buffer1index: i2, buffer2index: j2, chain: candidates[s] };
30612 if (r === candidates.length) {
30613 candidates.push(c);
30619 if (r === candidates.length) {
30626 return candidates[candidates.length - 1];
30628 function diffIndices(buffer1, buffer2) {
30629 const lcs = LCS(buffer1, buffer2);
30631 let tail1 = buffer1.length;
30632 let tail2 = buffer2.length;
30633 for (let candidate = lcs; candidate !== null; candidate = candidate.chain) {
30634 const mismatchLength1 = tail1 - candidate.buffer1index - 1;
30635 const mismatchLength2 = tail2 - candidate.buffer2index - 1;
30636 tail1 = candidate.buffer1index;
30637 tail2 = candidate.buffer2index;
30638 if (mismatchLength1 || mismatchLength2) {
30640 buffer1: [tail1 + 1, mismatchLength1],
30641 buffer1Content: buffer1.slice(tail1 + 1, tail1 + 1 + mismatchLength1),
30642 buffer2: [tail2 + 1, mismatchLength2],
30643 buffer2Content: buffer2.slice(tail2 + 1, tail2 + 1 + mismatchLength2)
30650 function diff3MergeRegions(a, o, b) {
30652 function addHunk(h, ab) {
30655 oStart: h.buffer1[0],
30656 oLength: h.buffer1[1],
30657 abStart: h.buffer2[0],
30658 abLength: h.buffer2[1]
30661 diffIndices(o, a).forEach((item) => addHunk(item, "a"));
30662 diffIndices(o, b).forEach((item) => addHunk(item, "b"));
30663 hunks.sort((x, y) => x.oStart - y.oStart);
30665 let currOffset = 0;
30666 function advanceTo(endOffset) {
30667 if (endOffset > currOffset) {
30671 bufferStart: currOffset,
30672 bufferLength: endOffset - currOffset,
30673 bufferContent: o.slice(currOffset, endOffset)
30675 currOffset = endOffset;
30678 while (hunks.length) {
30679 let hunk = hunks.shift();
30680 let regionStart = hunk.oStart;
30681 let regionEnd = hunk.oStart + hunk.oLength;
30682 let regionHunks = [hunk];
30683 advanceTo(regionStart);
30684 while (hunks.length) {
30685 const nextHunk = hunks[0];
30686 const nextHunkStart = nextHunk.oStart;
30687 if (nextHunkStart > regionEnd)
30689 regionEnd = Math.max(regionEnd, nextHunkStart + nextHunk.oLength);
30690 regionHunks.push(hunks.shift());
30692 if (regionHunks.length === 1) {
30693 if (hunk.abLength > 0) {
30694 const buffer = hunk.ab === "a" ? a : b;
30698 bufferStart: hunk.abStart,
30699 bufferLength: hunk.abLength,
30700 bufferContent: buffer.slice(hunk.abStart, hunk.abStart + hunk.abLength)
30705 a: [a.length, -1, o.length, -1],
30706 b: [b.length, -1, o.length, -1]
30708 while (regionHunks.length) {
30709 hunk = regionHunks.shift();
30710 const oStart = hunk.oStart;
30711 const oEnd = oStart + hunk.oLength;
30712 const abStart = hunk.abStart;
30713 const abEnd = abStart + hunk.abLength;
30714 let b2 = bounds[hunk.ab];
30715 b2[0] = Math.min(abStart, b2[0]);
30716 b2[1] = Math.max(abEnd, b2[1]);
30717 b2[2] = Math.min(oStart, b2[2]);
30718 b2[3] = Math.max(oEnd, b2[3]);
30720 const aStart = bounds.a[0] + (regionStart - bounds.a[2]);
30721 const aEnd = bounds.a[1] + (regionEnd - bounds.a[3]);
30722 const bStart = bounds.b[0] + (regionStart - bounds.b[2]);
30723 const bEnd = bounds.b[1] + (regionEnd - bounds.b[3]);
30727 aLength: aEnd - aStart,
30728 aContent: a.slice(aStart, aEnd),
30729 oStart: regionStart,
30730 oLength: regionEnd - regionStart,
30731 oContent: o.slice(regionStart, regionEnd),
30733 bLength: bEnd - bStart,
30734 bContent: b.slice(bStart, bEnd)
30736 results.push(result);
30738 currOffset = regionEnd;
30740 advanceTo(o.length);
30743 function diff3Merge(a, o, b, options2) {
30745 excludeFalseConflicts: true,
30746 stringSeparator: /\s+/
30748 options2 = Object.assign(defaults2, options2);
30749 if (typeof a === "string")
30750 a = a.split(options2.stringSeparator);
30751 if (typeof o === "string")
30752 o = o.split(options2.stringSeparator);
30753 if (typeof b === "string")
30754 b = b.split(options2.stringSeparator);
30756 const regions = diff3MergeRegions(a, o, b);
30758 function flushOk() {
30759 if (okBuffer.length) {
30760 results.push({ ok: okBuffer });
30764 function isFalseConflict(a2, b2) {
30765 if (a2.length !== b2.length)
30767 for (let i2 = 0; i2 < a2.length; i2++) {
30768 if (a2[i2] !== b2[i2])
30773 regions.forEach((region) => {
30774 if (region.stable) {
30775 okBuffer.push(...region.bufferContent);
30777 if (options2.excludeFalseConflicts && isFalseConflict(region.aContent, region.bContent)) {
30778 okBuffer.push(...region.aContent);
30783 a: region.aContent,
30784 aIndex: region.aStart,
30785 o: region.oContent,
30786 oIndex: region.oStart,
30787 b: region.bContent,
30788 bIndex: region.bStart
30798 // modules/actions/merge_remote_changes.js
30799 var import_lodash = __toESM(require_lodash());
30800 function actionMergeRemoteChanges(id2, localGraph, remoteGraph, discardTags, formatUser) {
30801 discardTags = discardTags || {};
30802 var _option = "safe";
30803 var _conflicts = [];
30805 return typeof formatUser === "function" ? formatUser(d) : (0, import_lodash.escape)(d);
30807 function mergeLocation(remote, target) {
30808 function pointEqual(a, b) {
30809 var epsilon3 = 1e-6;
30810 return Math.abs(a[0] - b[0]) < epsilon3 && Math.abs(a[1] - b[1]) < epsilon3;
30812 if (_option === "force_local" || pointEqual(target.loc, remote.loc)) {
30815 if (_option === "force_remote") {
30816 return target.update({ loc: remote.loc });
30818 _conflicts.push(_t.html("merge_remote_changes.conflict.location", { user: { html: user(remote.user) } }));
30821 function mergeNodes(base, remote, target) {
30822 if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.nodes, remote.nodes)) {
30825 if (_option === "force_remote") {
30826 return target.update({ nodes: remote.nodes });
30828 var ccount = _conflicts.length;
30829 var o = base.nodes || [];
30830 var a = target.nodes || [];
30831 var b = remote.nodes || [];
30833 var hunks = diff3Merge(a, o, b, { excludeFalseConflicts: true });
30834 for (var i2 = 0; i2 < hunks.length; i2++) {
30835 var hunk = hunks[i2];
30837 nodes.push.apply(nodes, hunk.ok);
30839 var c = hunk.conflict;
30840 if ((0, import_fast_deep_equal.default)(c.o, c.a)) {
30841 nodes.push.apply(nodes, c.b);
30842 } else if ((0, import_fast_deep_equal.default)(c.o, c.b)) {
30843 nodes.push.apply(nodes, c.a);
30845 _conflicts.push(_t.html("merge_remote_changes.conflict.nodelist", { user: { html: user(remote.user) } }));
30850 return _conflicts.length === ccount ? target.update({ nodes }) : target;
30852 function mergeChildren(targetWay, children2, updates, graph) {
30853 function isUsed(node2, targetWay2) {
30854 var hasInterestingParent = graph.parentWays(node2).some(function(way) {
30855 return way.id !== targetWay2.id;
30857 return node2.hasInterestingTags() || hasInterestingParent || graph.parentRelations(node2).length > 0;
30859 var ccount = _conflicts.length;
30860 for (var i2 = 0; i2 < children2.length; i2++) {
30861 var id3 = children2[i2];
30862 var node = graph.hasEntity(id3);
30863 if (targetWay.nodes.indexOf(id3) === -1) {
30864 if (node && !isUsed(node, targetWay)) {
30865 updates.removeIds.push(id3);
30869 var local = localGraph.hasEntity(id3);
30870 var remote = remoteGraph.hasEntity(id3);
30872 if (_option === "force_remote" && remote && remote.visible) {
30873 updates.replacements.push(remote);
30874 } else if (_option === "force_local" && local) {
30875 target = osmEntity(local);
30877 target = target.update({ version: remote.version });
30879 updates.replacements.push(target);
30880 } else if (_option === "safe" && local && remote && local.version !== remote.version) {
30881 target = osmEntity(local, { version: remote.version });
30882 if (remote.visible) {
30883 target = mergeLocation(remote, target);
30885 _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
30887 if (_conflicts.length !== ccount)
30889 updates.replacements.push(target);
30894 function updateChildren(updates, graph) {
30895 for (var i2 = 0; i2 < updates.replacements.length; i2++) {
30896 graph = graph.replace(updates.replacements[i2]);
30898 if (updates.removeIds.length) {
30899 graph = actionDeleteMultiple(updates.removeIds)(graph);
30903 function mergeMembers(remote, target) {
30904 if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.members, remote.members)) {
30907 if (_option === "force_remote") {
30908 return target.update({ members: remote.members });
30910 _conflicts.push(_t.html("merge_remote_changes.conflict.memberlist", { user: { html: user(remote.user) } }));
30913 function mergeTags(base, remote, target) {
30914 if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.tags, remote.tags)) {
30917 if (_option === "force_remote") {
30918 return target.update({ tags: remote.tags });
30920 var ccount = _conflicts.length;
30921 var o = base.tags || {};
30922 var a = target.tags || {};
30923 var b = remote.tags || {};
30924 var keys = utilArrayUnion(utilArrayUnion(Object.keys(o), Object.keys(a)), Object.keys(b)).filter(function(k2) {
30925 return !discardTags[k2];
30927 var tags = Object.assign({}, a);
30928 var changed = false;
30929 for (var i2 = 0; i2 < keys.length; i2++) {
30931 if (o[k] !== b[k] && a[k] !== b[k]) {
30932 if (o[k] !== a[k]) {
30933 _conflicts.push(_t.html(
30934 "merge_remote_changes.conflict.tags",
30935 { tag: k, local: a[k], remote: b[k], user: { html: user(remote.user) } }
30938 if (b.hasOwnProperty(k)) {
30947 return changed && _conflicts.length === ccount ? target.update({ tags }) : target;
30949 var action = function(graph) {
30950 var updates = { replacements: [], removeIds: [] };
30951 var base = graph.base().entities[id2];
30952 var local = localGraph.entity(id2);
30953 var remote = remoteGraph.entity(id2);
30954 var target = osmEntity(local, { version: remote.version });
30955 if (!remote.visible) {
30956 if (_option === "force_remote") {
30957 return actionDeleteMultiple([id2])(graph);
30958 } else if (_option === "force_local") {
30959 if (target.type === "way") {
30960 target = mergeChildren(target, utilArrayUniq(local.nodes), updates, graph);
30961 graph = updateChildren(updates, graph);
30963 return graph.replace(target);
30965 _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
30969 if (target.type === "node") {
30970 target = mergeLocation(remote, target);
30971 } else if (target.type === "way") {
30972 graph.rebase(remoteGraph.childNodes(remote), [graph], false);
30973 target = mergeNodes(base, remote, target);
30974 target = mergeChildren(target, utilArrayUnion(local.nodes, remote.nodes), updates, graph);
30975 } else if (target.type === "relation") {
30976 target = mergeMembers(remote, target);
30978 target = mergeTags(base, remote, target);
30979 if (!_conflicts.length) {
30980 graph = updateChildren(updates, graph).replace(target);
30984 action.withOption = function(opt) {
30988 action.conflicts = function() {
30994 // modules/actions/move.js
30995 function actionMove(moveIDs, tryDelta, projection2, cache) {
30996 var _delta = tryDelta;
30997 function setupCache(graph) {
30998 function canMove(nodeID) {
30999 if (moveIDs.indexOf(nodeID) !== -1)
31001 var parents = graph.parentWays(graph.entity(nodeID));
31002 if (parents.length < 3)
31004 var parentsMoving = parents.every(function(way) {
31005 return cache.moving[way.id];
31007 if (!parentsMoving)
31008 delete cache.moving[nodeID];
31009 return parentsMoving;
31011 function cacheEntities(ids) {
31012 for (var i2 = 0; i2 < ids.length; i2++) {
31014 if (cache.moving[id2])
31016 cache.moving[id2] = true;
31017 var entity = graph.hasEntity(id2);
31020 if (entity.type === "node") {
31021 cache.nodes.push(id2);
31022 cache.startLoc[id2] = entity.loc;
31023 } else if (entity.type === "way") {
31024 cache.ways.push(id2);
31025 cacheEntities(entity.nodes);
31027 cacheEntities(entity.members.map(function(member) {
31033 function cacheIntersections(ids) {
31034 function isEndpoint(way2, id3) {
31035 return !way2.isClosed() && !!way2.affix(id3);
31037 for (var i2 = 0; i2 < ids.length; i2++) {
31039 var childNodes = graph.childNodes(graph.entity(id2));
31040 for (var j2 = 0; j2 < childNodes.length; j2++) {
31041 var node = childNodes[j2];
31042 var parents = graph.parentWays(node);
31043 if (parents.length !== 2)
31045 var moved = graph.entity(id2);
31046 var unmoved = null;
31047 for (var k = 0; k < parents.length; k++) {
31048 var way = parents[k];
31049 if (!cache.moving[way.id]) {
31056 if (utilArrayIntersection(moved.nodes, unmoved.nodes).length > 2)
31058 if (moved.isArea() || unmoved.isArea())
31060 cache.intersections.push({
31063 unmovedId: unmoved.id,
31064 movedIsEP: isEndpoint(moved, node.id),
31065 unmovedIsEP: isEndpoint(unmoved, node.id)
31075 cache.intersections = [];
31076 cache.replacedVertex = {};
31077 cache.startLoc = {};
31080 cacheEntities(moveIDs);
31081 cacheIntersections(cache.ways);
31082 cache.nodes = cache.nodes.filter(canMove);
31086 function replaceMovedVertex(nodeId, wayId, graph, delta) {
31087 var way = graph.entity(wayId);
31088 var moved = graph.entity(nodeId);
31089 var movedIndex = way.nodes.indexOf(nodeId);
31090 var len, prevIndex, nextIndex;
31091 if (way.isClosed()) {
31092 len = way.nodes.length - 1;
31093 prevIndex = (movedIndex + len - 1) % len;
31094 nextIndex = (movedIndex + len + 1) % len;
31096 len = way.nodes.length;
31097 prevIndex = movedIndex - 1;
31098 nextIndex = movedIndex + 1;
31100 var prev = graph.hasEntity(way.nodes[prevIndex]);
31101 var next = graph.hasEntity(way.nodes[nextIndex]);
31102 if (!prev || !next)
31104 var key = wayId + "_" + nodeId;
31105 var orig = cache.replacedVertex[key];
31108 cache.replacedVertex[key] = orig;
31109 cache.startLoc[orig.id] = cache.startLoc[nodeId];
31113 start2 = projection2(cache.startLoc[nodeId]);
31114 end = projection2.invert(geoVecAdd(start2, delta));
31116 end = cache.startLoc[nodeId];
31118 orig = orig.move(end);
31119 var angle2 = Math.abs(geoAngle(orig, prev, projection2) - geoAngle(orig, next, projection2)) * 180 / Math.PI;
31120 if (angle2 > 175 && angle2 < 185)
31122 var p1 = [prev.loc, orig.loc, moved.loc, next.loc].map(projection2);
31123 var p2 = [prev.loc, moved.loc, orig.loc, next.loc].map(projection2);
31124 var d1 = geoPathLength(p1);
31125 var d2 = geoPathLength(p2);
31126 var insertAt = d1 <= d2 ? movedIndex : nextIndex;
31127 if (way.isClosed() && insertAt === 0)
31129 way = way.addNode(orig.id, insertAt);
31130 return graph.replace(orig).replace(way);
31132 function removeDuplicateVertices(wayId, graph) {
31133 var way = graph.entity(wayId);
31134 var epsilon3 = 1e-6;
31136 function isInteresting(node, graph2) {
31137 return graph2.parentWays(node).length > 1 || graph2.parentRelations(node).length || node.hasInterestingTags();
31139 for (var i2 = 0; i2 < way.nodes.length; i2++) {
31140 curr = graph.entity(way.nodes[i2]);
31141 if (prev && curr && geoVecEqual(prev.loc, curr.loc, epsilon3)) {
31142 if (!isInteresting(prev, graph)) {
31143 way = way.removeNode(prev.id);
31144 graph = graph.replace(way).remove(prev);
31145 } else if (!isInteresting(curr, graph)) {
31146 way = way.removeNode(curr.id);
31147 graph = graph.replace(way).remove(curr);
31154 function unZorroIntersection(intersection, graph) {
31155 var vertex = graph.entity(intersection.nodeId);
31156 var way1 = graph.entity(intersection.movedId);
31157 var way2 = graph.entity(intersection.unmovedId);
31158 var isEP1 = intersection.movedIsEP;
31159 var isEP2 = intersection.unmovedIsEP;
31160 if (isEP1 && isEP2)
31162 var nodes1 = graph.childNodes(way1).filter(function(n2) {
31163 return n2 !== vertex;
31165 var nodes2 = graph.childNodes(way2).filter(function(n2) {
31166 return n2 !== vertex;
31168 if (way1.isClosed() && way1.first() === vertex.id)
31169 nodes1.push(nodes1[0]);
31170 if (way2.isClosed() && way2.first() === vertex.id)
31171 nodes2.push(nodes2[0]);
31172 var edge1 = !isEP1 && geoChooseEdge(nodes1, projection2(vertex.loc), projection2);
31173 var edge2 = !isEP2 && geoChooseEdge(nodes2, projection2(vertex.loc), projection2);
31175 if (!isEP1 && !isEP2) {
31176 var epsilon3 = 1e-6, maxIter = 10;
31177 for (var i2 = 0; i2 < maxIter; i2++) {
31178 loc = geoVecInterp(edge1.loc, edge2.loc, 0.5);
31179 edge1 = geoChooseEdge(nodes1, projection2(loc), projection2);
31180 edge2 = geoChooseEdge(nodes2, projection2(loc), projection2);
31181 if (Math.abs(edge1.distance - edge2.distance) < epsilon3)
31184 } else if (!isEP1) {
31189 graph = graph.replace(vertex.move(loc));
31190 if (!isEP1 && edge1.index !== way1.nodes.indexOf(vertex.id)) {
31191 way1 = way1.removeNode(vertex.id).addNode(vertex.id, edge1.index);
31192 graph = graph.replace(way1);
31194 if (!isEP2 && edge2.index !== way2.nodes.indexOf(vertex.id)) {
31195 way2 = way2.removeNode(vertex.id).addNode(vertex.id, edge2.index);
31196 graph = graph.replace(way2);
31200 function cleanupIntersections(graph) {
31201 for (var i2 = 0; i2 < cache.intersections.length; i2++) {
31202 var obj = cache.intersections[i2];
31203 graph = replaceMovedVertex(obj.nodeId, obj.movedId, graph, _delta);
31204 graph = replaceMovedVertex(obj.nodeId, obj.unmovedId, graph, null);
31205 graph = unZorroIntersection(obj, graph);
31206 graph = removeDuplicateVertices(obj.movedId, graph);
31207 graph = removeDuplicateVertices(obj.unmovedId, graph);
31211 function limitDelta(graph) {
31212 function moveNode(loc) {
31213 return geoVecAdd(projection2(loc), _delta);
31215 for (var i2 = 0; i2 < cache.intersections.length; i2++) {
31216 var obj = cache.intersections[i2];
31217 if (obj.movedIsEP && obj.unmovedIsEP)
31219 if (!obj.movedIsEP)
31221 var node = graph.entity(obj.nodeId);
31222 var start2 = projection2(node.loc);
31223 var end = geoVecAdd(start2, _delta);
31224 var movedNodes = graph.childNodes(graph.entity(obj.movedId));
31225 var movedPath = movedNodes.map(function(n2) {
31226 return moveNode(n2.loc);
31228 var unmovedNodes = graph.childNodes(graph.entity(obj.unmovedId));
31229 var unmovedPath = unmovedNodes.map(function(n2) {
31230 return projection2(n2.loc);
31232 var hits = geoPathIntersections(movedPath, unmovedPath);
31233 for (var j2 = 0; i2 < hits.length; i2++) {
31234 if (geoVecEqual(hits[j2], end))
31236 var edge = geoChooseEdge(unmovedNodes, end, projection2);
31237 _delta = geoVecSubtract(projection2(edge.loc), start2);
31241 var action = function(graph) {
31242 if (_delta[0] === 0 && _delta[1] === 0)
31245 if (cache.intersections.length) {
31248 for (var i2 = 0; i2 < cache.nodes.length; i2++) {
31249 var node = graph.entity(cache.nodes[i2]);
31250 var start2 = projection2(node.loc);
31251 var end = geoVecAdd(start2, _delta);
31252 graph = graph.replace(node.move(projection2.invert(end)));
31254 if (cache.intersections.length) {
31255 graph = cleanupIntersections(graph);
31259 action.delta = function() {
31265 // modules/actions/move_member.js
31266 function actionMoveMember(relationId, fromIndex, toIndex) {
31267 return function(graph) {
31268 return graph.replace(graph.entity(relationId).moveMember(fromIndex, toIndex));
31272 // modules/actions/move_node.js
31273 function actionMoveNode(nodeID, toLoc) {
31274 var action = function(graph, t) {
31275 if (t === null || !isFinite(t))
31277 t = Math.min(Math.max(+t, 0), 1);
31278 var node = graph.entity(nodeID);
31279 return graph.replace(
31280 node.move(geoVecInterp(node.loc, toLoc, t))
31283 action.transitionable = true;
31287 // modules/actions/noop.js
31288 function actionNoop() {
31289 return function(graph) {
31294 // modules/actions/orthogonalize.js
31295 function actionOrthogonalize(wayID, projection2, vertexID, degThresh, ep) {
31296 var epsilon3 = ep || 1e-4;
31297 var threshold = degThresh || 13;
31298 var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
31299 var upperThreshold = Math.cos(threshold * Math.PI / 180);
31300 var action = function(graph, t) {
31301 if (t === null || !isFinite(t))
31303 t = Math.min(Math.max(+t, 0), 1);
31304 var way = graph.entity(wayID);
31305 way = way.removeNode("");
31306 if (way.tags.nonsquare) {
31307 var tags = Object.assign({}, way.tags);
31308 delete tags.nonsquare;
31309 way = way.update({ tags });
31311 graph = graph.replace(way);
31312 var isClosed = way.isClosed();
31313 var nodes = graph.childNodes(way).slice();
31316 if (vertexID !== void 0) {
31317 nodes = nodeSubset(nodes, vertexID, isClosed);
31318 if (nodes.length !== 3)
31321 var nodeCount = {};
31323 var corner = { i: 0, dotp: 1 };
31324 var node, point2, loc, score, motions, i2, j2;
31325 for (i2 = 0; i2 < nodes.length; i2++) {
31327 nodeCount[node.id] = (nodeCount[node.id] || 0) + 1;
31328 points.push({ id: node.id, coord: projection2(node.loc) });
31330 if (points.length === 3) {
31331 for (i2 = 0; i2 < 1e3; i2++) {
31332 motions = points.map(calcMotion);
31333 points[corner.i].coord = geoVecAdd(points[corner.i].coord, motions[corner.i]);
31334 score = corner.dotp;
31335 if (score < epsilon3) {
31339 node = graph.entity(nodes[corner.i].id);
31340 loc = projection2.invert(points[corner.i].coord);
31341 graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t)));
31343 var straights = [];
31344 var simplified = [];
31345 for (i2 = 0; i2 < points.length; i2++) {
31346 point2 = points[i2];
31348 if (isClosed || i2 > 0 && i2 < points.length - 1) {
31349 var a = points[(i2 - 1 + points.length) % points.length];
31350 var b = points[(i2 + 1) % points.length];
31351 dotp = Math.abs(geoOrthoNormalizedDotProduct(a.coord, b.coord, point2.coord));
31353 if (dotp > upperThreshold) {
31354 straights.push(point2);
31356 simplified.push(point2);
31359 var bestPoints = clonePoints(simplified);
31360 var originalPoints = clonePoints(simplified);
31362 for (i2 = 0; i2 < 1e3; i2++) {
31363 motions = simplified.map(calcMotion);
31364 for (j2 = 0; j2 < motions.length; j2++) {
31365 simplified[j2].coord = geoVecAdd(simplified[j2].coord, motions[j2]);
31367 var newScore = geoOrthoCalcScore(simplified, isClosed, epsilon3, threshold);
31368 if (newScore < score) {
31369 bestPoints = clonePoints(simplified);
31372 if (score < epsilon3) {
31376 var bestCoords = bestPoints.map(function(p) {
31380 bestCoords.push(bestCoords[0]);
31381 for (i2 = 0; i2 < bestPoints.length; i2++) {
31382 point2 = bestPoints[i2];
31383 if (!geoVecEqual(originalPoints[i2].coord, point2.coord)) {
31384 node = graph.entity(point2.id);
31385 loc = projection2.invert(point2.coord);
31386 graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t)));
31389 for (i2 = 0; i2 < straights.length; i2++) {
31390 point2 = straights[i2];
31391 if (nodeCount[point2.id] > 1)
31393 node = graph.entity(point2.id);
31394 if (t === 1 && graph.parentWays(node).length === 1 && graph.parentRelations(node).length === 0 && !node.hasInterestingTags()) {
31395 graph = actionDeleteNode(node.id)(graph);
31397 var choice = geoVecProject(point2.coord, bestCoords);
31399 loc = projection2.invert(choice.target);
31400 graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t)));
31406 function clonePoints(array2) {
31407 return array2.map(function(p) {
31408 return { id: p.id, coord: [p.coord[0], p.coord[1]] };
31411 function calcMotion(point3, i3, array2) {
31412 if (!isClosed && (i3 === 0 || i3 === array2.length - 1))
31414 if (nodeCount[array2[i3].id] > 1)
31416 var a2 = array2[(i3 - 1 + array2.length) % array2.length].coord;
31417 var origin = point3.coord;
31418 var b2 = array2[(i3 + 1) % array2.length].coord;
31419 var p = geoVecSubtract(a2, origin);
31420 var q = geoVecSubtract(b2, origin);
31421 var scale = 2 * Math.min(geoVecLength(p), geoVecLength(q));
31422 p = geoVecNormalize(p);
31423 q = geoVecNormalize(q);
31424 var dotp2 = p[0] * q[0] + p[1] * q[1];
31425 var val = Math.abs(dotp2);
31426 if (val < lowerThreshold) {
31429 var vec = geoVecNormalize(geoVecAdd(p, q));
31430 return geoVecScale(vec, 0.1 * dotp2 * scale);
31435 function nodeSubset(nodes, vertexID2, isClosed) {
31436 var first = isClosed ? 0 : 1;
31437 var last = isClosed ? nodes.length : nodes.length - 1;
31438 for (var i2 = first; i2 < last; i2++) {
31439 if (nodes[i2].id === vertexID2) {
31441 nodes[(i2 - 1 + nodes.length) % nodes.length],
31443 nodes[(i2 + 1) % nodes.length]
31449 action.disabled = function(graph) {
31450 var way = graph.entity(wayID);
31451 way = way.removeNode("");
31452 graph = graph.replace(way);
31453 var isClosed = way.isClosed();
31454 var nodes = graph.childNodes(way).slice();
31457 var allowStraightAngles = false;
31458 if (vertexID !== void 0) {
31459 allowStraightAngles = true;
31460 nodes = nodeSubset(nodes, vertexID, isClosed);
31461 if (nodes.length !== 3)
31462 return "end_vertex";
31464 var coords = nodes.map(function(n2) {
31465 return projection2(n2.loc);
31467 var score = geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles);
31468 if (score === null) {
31469 return "not_squarish";
31470 } else if (score === 0) {
31471 return "square_enough";
31476 action.transitionable = true;
31480 // modules/actions/restrict_turn.js
31481 function actionRestrictTurn(turn, restrictionType, restrictionID) {
31482 return function(graph) {
31483 var fromWay = graph.entity(turn.from.way);
31484 var toWay = graph.entity(turn.to.way);
31485 var viaNode = turn.via.node && graph.entity(turn.via.node);
31486 var viaWays = turn.via.ways && turn.via.ways.map(function(id2) {
31487 return graph.entity(id2);
31490 members.push({ id: fromWay.id, type: "way", role: "from" });
31492 members.push({ id: viaNode.id, type: "node", role: "via" });
31493 } else if (viaWays) {
31494 viaWays.forEach(function(viaWay) {
31495 members.push({ id: viaWay.id, type: "way", role: "via" });
31498 members.push({ id: toWay.id, type: "way", role: "to" });
31499 return graph.replace(osmRelation({
31502 type: "restriction",
31503 restriction: restrictionType
31510 // modules/actions/revert.js
31511 function actionRevert(id2) {
31512 var action = function(graph) {
31513 var entity = graph.hasEntity(id2), base = graph.base().entities[id2];
31514 if (entity && !base) {
31515 if (entity.type === "node") {
31516 graph.parentWays(entity).forEach(function(parent) {
31517 parent = parent.removeNode(id2);
31518 graph = graph.replace(parent);
31519 if (parent.isDegenerate()) {
31520 graph = actionDeleteWay(parent.id)(graph);
31524 graph.parentRelations(entity).forEach(function(parent) {
31525 parent = parent.removeMembersWithID(id2);
31526 graph = graph.replace(parent);
31527 if (parent.isDegenerate()) {
31528 graph = actionDeleteRelation(parent.id)(graph);
31532 return graph.revert(id2);
31537 // modules/actions/rotate.js
31538 function actionRotate(rotateIds, pivot, angle2, projection2) {
31539 var action = function(graph) {
31540 return graph.update(function(graph2) {
31541 utilGetAllNodes(rotateIds, graph2).forEach(function(node) {
31542 var point2 = geoRotate([projection2(node.loc)], angle2, pivot)[0];
31543 graph2 = graph2.replace(node.move(projection2.invert(point2)));
31550 // modules/actions/scale.js
31551 function actionScale(ids, pivotLoc, scaleFactor, projection2) {
31552 return function(graph) {
31553 return graph.update(function(graph2) {
31554 let point2, radial;
31555 utilGetAllNodes(ids, graph2).forEach(function(node) {
31556 point2 = projection2(node.loc);
31558 point2[0] - pivotLoc[0],
31559 point2[1] - pivotLoc[1]
31562 pivotLoc[0] + scaleFactor * radial[0],
31563 pivotLoc[1] + scaleFactor * radial[1]
31565 graph2 = graph2.replace(node.move(projection2.invert(point2)));
31571 // modules/actions/straighten_nodes.js
31572 function actionStraightenNodes(nodeIDs, projection2) {
31573 function positionAlongWay(a, o, b) {
31574 return geoVecDot(a, b, o) / geoVecDot(b, b, o);
31576 function getEndpoints(points) {
31577 var ssr = geoGetSmallestSurroundingRectangle(points);
31578 var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
31579 var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
31580 var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
31581 var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
31582 var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
31588 var action = function(graph, t) {
31589 if (t === null || !isFinite(t))
31591 t = Math.min(Math.max(+t, 0), 1);
31592 var nodes = nodeIDs.map(function(id2) {
31593 return graph.entity(id2);
31595 var points = nodes.map(function(n2) {
31596 return projection2(n2.loc);
31598 var endpoints = getEndpoints(points);
31599 var startPoint = endpoints[0];
31600 var endPoint = endpoints[1];
31601 for (var i2 = 0; i2 < points.length; i2++) {
31602 var node = nodes[i2];
31603 var point2 = points[i2];
31604 var u = positionAlongWay(point2, startPoint, endPoint);
31605 var point22 = geoVecInterp(startPoint, endPoint, u);
31606 var loc2 = projection2.invert(point22);
31607 graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t)));
31611 action.disabled = function(graph) {
31612 var nodes = nodeIDs.map(function(id2) {
31613 return graph.entity(id2);
31615 var points = nodes.map(function(n2) {
31616 return projection2(n2.loc);
31618 var endpoints = getEndpoints(points);
31619 var startPoint = endpoints[0];
31620 var endPoint = endpoints[1];
31621 var maxDistance = 0;
31622 for (var i2 = 0; i2 < points.length; i2++) {
31623 var point2 = points[i2];
31624 var u = positionAlongWay(point2, startPoint, endPoint);
31625 var p = geoVecInterp(startPoint, endPoint, u);
31626 var dist = geoVecLength(p, point2);
31627 if (!isNaN(dist) && dist > maxDistance) {
31628 maxDistance = dist;
31631 if (maxDistance < 1e-4) {
31632 return "straight_enough";
31635 action.transitionable = true;
31639 // modules/actions/straighten_way.js
31640 function actionStraightenWay(selectedIDs, projection2) {
31641 function positionAlongWay(a, o, b) {
31642 return geoVecDot(a, b, o) / geoVecDot(b, b, o);
31644 function allNodes(graph) {
31646 var startNodes = [];
31648 var remainingWays = [];
31649 var selectedWays = selectedIDs.filter(function(w) {
31650 return graph.entity(w).type === "way";
31652 var selectedNodes = selectedIDs.filter(function(n2) {
31653 return graph.entity(n2).type === "node";
31655 for (var i2 = 0; i2 < selectedWays.length; i2++) {
31656 var way = graph.entity(selectedWays[i2]);
31657 nodes = way.nodes.slice(0);
31658 remainingWays.push(nodes);
31659 startNodes.push(nodes[0]);
31660 endNodes.push(nodes[nodes.length - 1]);
31662 startNodes = startNodes.filter(function(n2) {
31663 return startNodes.indexOf(n2) === startNodes.lastIndexOf(n2);
31665 endNodes = endNodes.filter(function(n2) {
31666 return endNodes.indexOf(n2) === endNodes.lastIndexOf(n2);
31668 var currNode = utilArrayDifference(startNodes, endNodes).concat(utilArrayDifference(endNodes, startNodes))[0];
31671 var getNextWay = function(currNode2, remainingWays2) {
31672 return remainingWays2.filter(function(way2) {
31673 return way2[0] === currNode2 || way2[way2.length - 1] === currNode2;
31676 while (remainingWays.length) {
31677 nextWay = getNextWay(currNode, remainingWays);
31678 remainingWays = utilArrayDifference(remainingWays, [nextWay]);
31679 if (nextWay[0] !== currNode) {
31682 nodes = nodes.concat(nextWay);
31683 currNode = nodes[nodes.length - 1];
31685 if (selectedNodes.length === 2) {
31686 var startNodeIdx = nodes.indexOf(selectedNodes[0]);
31687 var endNodeIdx = nodes.indexOf(selectedNodes[1]);
31688 var sortedStartEnd = [startNodeIdx, endNodeIdx];
31689 sortedStartEnd.sort(function(a, b) {
31692 nodes = nodes.slice(sortedStartEnd[0], sortedStartEnd[1] + 1);
31694 return nodes.map(function(n2) {
31695 return graph.entity(n2);
31698 function shouldKeepNode(node, graph) {
31699 return graph.parentWays(node).length > 1 || graph.parentRelations(node).length || node.hasInterestingTags();
31701 var action = function(graph, t) {
31702 if (t === null || !isFinite(t))
31704 t = Math.min(Math.max(+t, 0), 1);
31705 var nodes = allNodes(graph);
31706 var points = nodes.map(function(n2) {
31707 return projection2(n2.loc);
31709 var startPoint = points[0];
31710 var endPoint = points[points.length - 1];
31713 for (i2 = 1; i2 < points.length - 1; i2++) {
31714 var node = nodes[i2];
31715 var point2 = points[i2];
31716 if (t < 1 || shouldKeepNode(node, graph)) {
31717 var u = positionAlongWay(point2, startPoint, endPoint);
31718 var p = geoVecInterp(startPoint, endPoint, u);
31719 var loc2 = projection2.invert(p);
31720 graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t)));
31722 if (toDelete.indexOf(node) === -1) {
31723 toDelete.push(node);
31727 for (i2 = 0; i2 < toDelete.length; i2++) {
31728 graph = actionDeleteNode(toDelete[i2].id)(graph);
31732 action.disabled = function(graph) {
31733 var nodes = allNodes(graph);
31734 var points = nodes.map(function(n2) {
31735 return projection2(n2.loc);
31737 var startPoint = points[0];
31738 var endPoint = points[points.length - 1];
31739 var threshold = 0.2 * geoVecLength(startPoint, endPoint);
31741 if (threshold === 0) {
31742 return "too_bendy";
31744 var maxDistance = 0;
31745 for (i2 = 1; i2 < points.length - 1; i2++) {
31746 var point2 = points[i2];
31747 var u = positionAlongWay(point2, startPoint, endPoint);
31748 var p = geoVecInterp(startPoint, endPoint, u);
31749 var dist = geoVecLength(p, point2);
31750 if (isNaN(dist) || dist > threshold) {
31751 return "too_bendy";
31752 } else if (dist > maxDistance) {
31753 maxDistance = dist;
31756 var keepingAllNodes = nodes.every(function(node, i3) {
31757 return i3 === 0 || i3 === nodes.length - 1 || shouldKeepNode(node, graph);
31759 if (maxDistance < 1e-4 && keepingAllNodes) {
31760 return "straight_enough";
31763 action.transitionable = true;
31767 // modules/actions/unrestrict_turn.js
31768 function actionUnrestrictTurn(turn) {
31769 return function(graph) {
31770 return actionDeleteRelation(turn.restrictionID)(graph);
31774 // modules/actions/reflect.js
31775 function actionReflect(reflectIds, projection2) {
31776 var _useLongAxis = true;
31777 var action = function(graph, t) {
31778 if (t === null || !isFinite(t))
31780 t = Math.min(Math.max(+t, 0), 1);
31781 var nodes = utilGetAllNodes(reflectIds, graph);
31782 var points = nodes.map(function(n2) {
31783 return projection2(n2.loc);
31785 var ssr = geoGetSmallestSurroundingRectangle(points);
31786 var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
31787 var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
31788 var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
31789 var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
31791 var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
31792 if (_useLongAxis && isLong || !_useLongAxis && !isLong) {
31799 var dx = q[0] - p[0];
31800 var dy = q[1] - p[1];
31801 var a = (dx * dx - dy * dy) / (dx * dx + dy * dy);
31802 var b = 2 * dx * dy / (dx * dx + dy * dy);
31803 for (var i2 = 0; i2 < nodes.length; i2++) {
31804 var node = nodes[i2];
31805 var c = projection2(node.loc);
31807 a * (c[0] - p[0]) + b * (c[1] - p[1]) + p[0],
31808 b * (c[0] - p[0]) - a * (c[1] - p[1]) + p[1]
31810 var loc2 = projection2.invert(c2);
31811 node = node.move(geoVecInterp(node.loc, loc2, t));
31812 graph = graph.replace(node);
31816 action.useLongAxis = function(val) {
31817 if (!arguments.length)
31818 return _useLongAxis;
31819 _useLongAxis = val;
31822 action.transitionable = true;
31826 // modules/actions/upgrade_tags.js
31827 function actionUpgradeTags(entityId, oldTags, replaceTags) {
31828 return function(graph) {
31829 var entity = graph.entity(entityId);
31830 var tags = Object.assign({}, entity.tags);
31833 for (var oldTagKey in oldTags) {
31834 if (!(oldTagKey in tags))
31836 if (oldTags[oldTagKey] === "*") {
31837 transferValue = tags[oldTagKey];
31838 delete tags[oldTagKey];
31839 } else if (oldTags[oldTagKey] === tags[oldTagKey]) {
31840 delete tags[oldTagKey];
31842 var vals = tags[oldTagKey].split(";").filter(Boolean);
31843 var oldIndex = vals.indexOf(oldTags[oldTagKey]);
31844 if (vals.length === 1 || oldIndex === -1) {
31845 delete tags[oldTagKey];
31847 if (replaceTags && replaceTags[oldTagKey]) {
31848 semiIndex = oldIndex;
31850 vals.splice(oldIndex, 1);
31851 tags[oldTagKey] = vals.join(";");
31856 for (var replaceKey in replaceTags) {
31857 var replaceValue = replaceTags[replaceKey];
31858 if (replaceValue === "*") {
31859 if (tags[replaceKey] && tags[replaceKey] !== "no") {
31862 tags[replaceKey] = "yes";
31864 } else if (replaceValue === "$1") {
31865 tags[replaceKey] = transferValue;
31867 if (tags[replaceKey] && oldTags[replaceKey] && semiIndex !== void 0) {
31868 var existingVals = tags[replaceKey].split(";").filter(Boolean);
31869 if (existingVals.indexOf(replaceValue) === -1) {
31870 existingVals.splice(semiIndex, 0, replaceValue);
31871 tags[replaceKey] = existingVals.join(";");
31874 tags[replaceKey] = replaceValue;
31879 return graph.replace(entity.update({ tags }));
31883 // modules/behavior/edit.js
31884 function behaviorEdit(context) {
31885 function behavior() {
31886 context.map().minzoom(context.minEditableZoom());
31888 behavior.off = function() {
31889 context.map().minzoom(0);
31894 // modules/behavior/hover.js
31895 function behaviorHover(context) {
31896 var dispatch10 = dispatch_default("hover");
31897 var _selection = select_default2(null);
31898 var _newNodeId = null;
31899 var _initialNodeID = null;
31903 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
31904 function keydown(d3_event) {
31905 if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
31906 _selection.selectAll(".hover").classed("hover-suppressed", true).classed("hover", false);
31907 _selection.classed("hover-disabled", true);
31908 dispatch10.call("hover", this, null);
31911 function keyup(d3_event) {
31912 if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
31913 _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false).classed("hover", true);
31914 _selection.classed("hover-disabled", false);
31915 dispatch10.call("hover", this, _targets);
31918 function behavior(selection2) {
31919 _selection = selection2;
31921 if (_initialNodeID) {
31922 _newNodeId = _initialNodeID;
31923 _initialNodeID = null;
31927 _selection.on(_pointerPrefix + "over.hover", pointerover).on(_pointerPrefix + "out.hover", pointerout).on(_pointerPrefix + "down.hover", pointerover);
31928 select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", pointerout, true).on("keydown.hover", keydown).on("keyup.hover", keyup);
31929 function eventTarget(d3_event) {
31930 var datum2 = d3_event.target && d3_event.target.__data__;
31931 if (typeof datum2 !== "object")
31933 if (!(datum2 instanceof osmEntity) && datum2.properties && datum2.properties.entity instanceof osmEntity) {
31934 return datum2.properties.entity;
31938 function pointerover(d3_event) {
31939 if (context.mode().id.indexOf("drag") === -1 && (!d3_event.pointerType || d3_event.pointerType === "mouse") && d3_event.buttons)
31941 var target = eventTarget(d3_event);
31942 if (target && _targets.indexOf(target) === -1) {
31943 _targets.push(target);
31944 updateHover(d3_event, _targets);
31947 function pointerout(d3_event) {
31948 var target = eventTarget(d3_event);
31949 var index = _targets.indexOf(target);
31950 if (index !== -1) {
31951 _targets.splice(index);
31952 updateHover(d3_event, _targets);
31955 function allowsVertex(d) {
31956 return d.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d, context.graph());
31958 function modeAllowsHover(target) {
31959 var mode = context.mode();
31960 if (mode.id === "add-point") {
31961 return mode.preset.matchGeometry("vertex") || target.type !== "way" && target.geometry(context.graph()) !== "vertex";
31965 function updateHover(d3_event, targets) {
31966 _selection.selectAll(".hover").classed("hover", false);
31967 _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false);
31968 var mode = context.mode();
31969 if (!_newNodeId && (mode.id === "draw-line" || mode.id === "draw-area")) {
31970 var node = targets.find(function(target) {
31971 return target instanceof osmEntity && target.type === "node";
31973 _newNodeId = node && node.id;
31975 targets = targets.filter(function(datum3) {
31976 if (datum3 instanceof osmEntity) {
31977 return datum3.id !== _newNodeId && (datum3.type !== "node" || !_ignoreVertex || allowsVertex(datum3)) && modeAllowsHover(datum3);
31982 for (var i2 in targets) {
31983 var datum2 = targets[i2];
31984 if (datum2.__featurehash__) {
31985 selector += ", .data" + datum2.__featurehash__;
31986 } else if (datum2 instanceof QAItem) {
31987 selector += ", ." + datum2.service + ".itemId-" + datum2.id;
31988 } else if (datum2 instanceof osmNote) {
31989 selector += ", .note-" + datum2.id;
31990 } else if (datum2 instanceof osmEntity) {
31991 selector += ", ." + datum2.id;
31992 if (datum2.type === "relation") {
31993 for (var j2 in datum2.members) {
31994 selector += ", ." + datum2.members[j2].id;
31999 var suppressed = _altDisables && d3_event && d3_event.altKey;
32000 if (selector.trim().length) {
32001 selector = selector.slice(1);
32002 _selection.selectAll(selector).classed(suppressed ? "hover-suppressed" : "hover", true);
32004 dispatch10.call("hover", this, !suppressed && targets);
32007 behavior.off = function(selection2) {
32008 selection2.selectAll(".hover").classed("hover", false);
32009 selection2.selectAll(".hover-suppressed").classed("hover-suppressed", false);
32010 selection2.classed("hover-disabled", false);
32011 selection2.on(_pointerPrefix + "over.hover", null).on(_pointerPrefix + "out.hover", null).on(_pointerPrefix + "down.hover", null);
32012 select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", null, true).on("keydown.hover", null).on("keyup.hover", null);
32014 behavior.altDisables = function(val) {
32015 if (!arguments.length)
32016 return _altDisables;
32017 _altDisables = val;
32020 behavior.ignoreVertex = function(val) {
32021 if (!arguments.length)
32022 return _ignoreVertex;
32023 _ignoreVertex = val;
32026 behavior.initialNodeID = function(nodeId) {
32027 _initialNodeID = nodeId;
32030 return utilRebind(behavior, dispatch10, "on");
32033 // modules/behavior/draw.js
32034 var _disableSpace = false;
32035 var _lastSpace = null;
32036 function behaviorDraw(context) {
32037 var dispatch10 = dispatch_default(
32048 var keybinding = utilKeybinding("draw");
32049 var _hover = behaviorHover(context).altDisables(true).ignoreVertex(true).on("hover", context.ui().sidebar.hover);
32050 var _edit = behaviorEdit(context);
32051 var _closeTolerance = 4;
32052 var _tolerance = 12;
32053 var _mouseLeave = false;
32054 var _lastMouse = null;
32055 var _lastPointerUpEvent;
32057 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
32058 function datum2(d3_event) {
32059 var mode = context.mode();
32060 var isNote = mode && mode.id.indexOf("note") !== -1;
32061 if (d3_event.altKey || isNote)
32064 if (d3_event.type === "keydown") {
32065 element = _lastMouse && _lastMouse.target;
32067 element = d3_event.target;
32069 var d = element.__data__;
32070 return d && d.properties && d.properties.target ? d : {};
32072 function pointerdown(d3_event) {
32075 var pointerLocGetter = utilFastMouse(this);
32077 id: d3_event.pointerId || "mouse",
32079 downTime: +new Date(),
32080 downLoc: pointerLocGetter(d3_event)
32082 dispatch10.call("down", this, d3_event, datum2(d3_event));
32084 function pointerup(d3_event) {
32085 if (!_downPointer || _downPointer.id !== (d3_event.pointerId || "mouse"))
32087 var downPointer = _downPointer;
32088 _downPointer = null;
32089 _lastPointerUpEvent = d3_event;
32090 if (downPointer.isCancelled)
32092 var t2 = +new Date();
32093 var p2 = downPointer.pointerLocGetter(d3_event);
32094 var dist = geoVecLength(downPointer.downLoc, p2);
32095 if (dist < _closeTolerance || dist < _tolerance && t2 - downPointer.downTime < 500) {
32096 select_default2(window).on("click.draw-block", function() {
32097 d3_event.stopPropagation();
32099 context.map().dblclickZoomEnable(false);
32100 window.setTimeout(function() {
32101 context.map().dblclickZoomEnable(true);
32102 select_default2(window).on("click.draw-block", null);
32104 click(d3_event, p2);
32107 function pointermove(d3_event) {
32108 if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse") && !_downPointer.isCancelled) {
32109 var p2 = _downPointer.pointerLocGetter(d3_event);
32110 var dist = geoVecLength(_downPointer.downLoc, p2);
32111 if (dist >= _closeTolerance) {
32112 _downPointer.isCancelled = true;
32113 dispatch10.call("downcancel", this);
32116 if (d3_event.pointerType && d3_event.pointerType !== "mouse" || d3_event.buttons || _downPointer)
32118 if (_lastPointerUpEvent && _lastPointerUpEvent.pointerType !== "mouse" && d3_event.timeStamp - _lastPointerUpEvent.timeStamp < 100)
32120 _lastMouse = d3_event;
32121 dispatch10.call("move", this, d3_event, datum2(d3_event));
32123 function pointercancel(d3_event) {
32124 if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse")) {
32125 if (!_downPointer.isCancelled) {
32126 dispatch10.call("downcancel", this);
32128 _downPointer = null;
32131 function mouseenter() {
32132 _mouseLeave = false;
32134 function mouseleave() {
32135 _mouseLeave = true;
32137 function allowsVertex(d) {
32138 return d.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d, context.graph());
32140 function click(d3_event, loc) {
32141 var d = datum2(d3_event);
32142 var target = d && d.properties && d.properties.entity;
32143 var mode = context.mode();
32144 if (target && target.type === "node" && allowsVertex(target)) {
32145 dispatch10.call("clickNode", this, target, d);
32147 } else if (target && target.type === "way" && (mode.id !== "add-point" || mode.preset.matchGeometry("vertex"))) {
32148 var choice = geoChooseEdge(
32149 context.graph().childNodes(target),
32151 context.projection,
32155 var edge = [target.nodes[choice.index - 1], target.nodes[choice.index]];
32156 dispatch10.call("clickWay", this, choice.loc, edge, d);
32159 } else if (mode.id !== "add-point" || mode.preset.matchGeometry("point")) {
32160 var locLatLng = context.projection.invert(loc);
32161 dispatch10.call("click", this, locLatLng, d);
32164 function space(d3_event) {
32165 d3_event.preventDefault();
32166 d3_event.stopPropagation();
32167 var currSpace = context.map().mouse();
32168 if (_disableSpace && _lastSpace) {
32169 var dist = geoVecLength(_lastSpace, currSpace);
32170 if (dist > _tolerance) {
32171 _disableSpace = false;
32174 if (_disableSpace || _mouseLeave || !_lastMouse)
32176 _lastSpace = currSpace;
32177 _disableSpace = true;
32178 select_default2(window).on("keyup.space-block", function() {
32179 d3_event.preventDefault();
32180 d3_event.stopPropagation();
32181 _disableSpace = false;
32182 select_default2(window).on("keyup.space-block", null);
32184 var loc = context.map().mouse() || context.projection(context.map().center());
32185 click(d3_event, loc);
32187 function backspace(d3_event) {
32188 d3_event.preventDefault();
32189 dispatch10.call("undo");
32191 function del(d3_event) {
32192 d3_event.preventDefault();
32193 dispatch10.call("cancel");
32195 function ret(d3_event) {
32196 d3_event.preventDefault();
32197 dispatch10.call("finish");
32199 function behavior(selection2) {
32200 context.install(_hover);
32201 context.install(_edit);
32202 _downPointer = null;
32203 keybinding.on("\u232B", backspace).on("\u2326", del).on("\u238B", ret).on("\u21A9", ret).on("space", space).on("\u2325space", space);
32204 selection2.on("mouseenter.draw", mouseenter).on("mouseleave.draw", mouseleave).on(_pointerPrefix + "down.draw", pointerdown).on(_pointerPrefix + "move.draw", pointermove);
32205 select_default2(window).on(_pointerPrefix + "up.draw", pointerup, true).on("pointercancel.draw", pointercancel, true);
32206 select_default2(document).call(keybinding);
32209 behavior.off = function(selection2) {
32210 context.ui().sidebar.hover.cancel();
32211 context.uninstall(_hover);
32212 context.uninstall(_edit);
32213 selection2.on("mouseenter.draw", null).on("mouseleave.draw", null).on(_pointerPrefix + "down.draw", null).on(_pointerPrefix + "move.draw", null);
32214 select_default2(window).on(_pointerPrefix + "up.draw", null).on("pointercancel.draw", null);
32215 select_default2(document).call(keybinding.unbind);
32217 behavior.hover = function() {
32220 return utilRebind(behavior, dispatch10, "on");
32223 // modules/behavior/breathe.js
32224 var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
32226 // node_modules/d3-scale/src/init.js
32227 function initRange(domain2, range3) {
32228 switch (arguments.length) {
32232 this.range(domain2);
32235 this.range(range3).domain(domain2);
32241 // node_modules/d3-scale/src/constant.js
32242 function constants(x) {
32243 return function() {
32248 // node_modules/d3-scale/src/number.js
32249 function number2(x) {
32253 // node_modules/d3-scale/src/continuous.js
32255 function identity3(x) {
32258 function normalize(a, b) {
32259 return (b -= a = +a) ? function(x) {
32260 return (x - a) / b;
32261 } : constants(isNaN(b) ? NaN : 0.5);
32263 function clamper(a, b) {
32266 t = a, a = b, b = t;
32267 return function(x) {
32268 return Math.max(a, Math.min(b, x));
32271 function bimap(domain2, range3, interpolate) {
32272 var d0 = domain2[0], d1 = domain2[1], r0 = range3[0], r1 = range3[1];
32274 d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
32276 d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
32277 return function(x) {
32281 function polymap(domain2, range3, interpolate) {
32282 var j2 = Math.min(domain2.length, range3.length) - 1, d = new Array(j2), r = new Array(j2), i2 = -1;
32283 if (domain2[j2] < domain2[0]) {
32284 domain2 = domain2.slice().reverse();
32285 range3 = range3.slice().reverse();
32287 while (++i2 < j2) {
32288 d[i2] = normalize(domain2[i2], domain2[i2 + 1]);
32289 r[i2] = interpolate(range3[i2], range3[i2 + 1]);
32291 return function(x) {
32292 var i3 = bisect_default(domain2, x, 1, j2) - 1;
32293 return r[i3](d[i3](x));
32296 function copy(source, target) {
32297 return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
32299 function transformer2() {
32300 var domain2 = unit, range3 = unit, interpolate = value_default, transform2, untransform, unknown, clamp3 = identity3, piecewise, output, input;
32301 function rescale() {
32302 var n2 = Math.min(domain2.length, range3.length);
32303 if (clamp3 !== identity3)
32304 clamp3 = clamper(domain2[0], domain2[n2 - 1]);
32305 piecewise = n2 > 2 ? polymap : bimap;
32306 output = input = null;
32309 function scale(x) {
32310 return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain2.map(transform2), range3, interpolate)))(transform2(clamp3(x)));
32312 scale.invert = function(y) {
32313 return clamp3(untransform((input || (input = piecewise(range3, domain2.map(transform2), number_default)))(y)));
32315 scale.domain = function(_) {
32316 return arguments.length ? (domain2 = Array.from(_, number2), rescale()) : domain2.slice();
32318 scale.range = function(_) {
32319 return arguments.length ? (range3 = Array.from(_), rescale()) : range3.slice();
32321 scale.rangeRound = function(_) {
32322 return range3 = Array.from(_), interpolate = round_default, rescale();
32324 scale.clamp = function(_) {
32325 return arguments.length ? (clamp3 = _ ? true : identity3, rescale()) : clamp3 !== identity3;
32327 scale.interpolate = function(_) {
32328 return arguments.length ? (interpolate = _, rescale()) : interpolate;
32330 scale.unknown = function(_) {
32331 return arguments.length ? (unknown = _, scale) : unknown;
32333 return function(t, u) {
32334 transform2 = t, untransform = u;
32338 function continuous() {
32339 return transformer2()(identity3, identity3);
32342 // node_modules/d3-format/src/formatDecimal.js
32343 function formatDecimal_default(x) {
32344 return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10);
32346 function formatDecimalParts(x, p) {
32347 if ((i2 = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0)
32349 var i2, coefficient = x.slice(0, i2);
32351 coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
32356 // node_modules/d3-format/src/exponent.js
32357 function exponent_default(x) {
32358 return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
32361 // node_modules/d3-format/src/formatGroup.js
32362 function formatGroup_default(grouping, thousands) {
32363 return function(value, width) {
32364 var i2 = value.length, t = [], j2 = 0, g = grouping[0], length = 0;
32365 while (i2 > 0 && g > 0) {
32366 if (length + g + 1 > width)
32367 g = Math.max(1, width - length);
32368 t.push(value.substring(i2 -= g, i2 + g));
32369 if ((length += g + 1) > width)
32371 g = grouping[j2 = (j2 + 1) % grouping.length];
32373 return t.reverse().join(thousands);
32377 // node_modules/d3-format/src/formatNumerals.js
32378 function formatNumerals_default(numerals) {
32379 return function(value) {
32380 return value.replace(/[0-9]/g, function(i2) {
32381 return numerals[+i2];
32386 // node_modules/d3-format/src/formatSpecifier.js
32387 var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
32388 function formatSpecifier(specifier) {
32389 if (!(match = re.exec(specifier)))
32390 throw new Error("invalid format: " + specifier);
32392 return new FormatSpecifier({
32400 precision: match[8] && match[8].slice(1),
32405 formatSpecifier.prototype = FormatSpecifier.prototype;
32406 function FormatSpecifier(specifier) {
32407 this.fill = specifier.fill === void 0 ? " " : specifier.fill + "";
32408 this.align = specifier.align === void 0 ? ">" : specifier.align + "";
32409 this.sign = specifier.sign === void 0 ? "-" : specifier.sign + "";
32410 this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + "";
32411 this.zero = !!specifier.zero;
32412 this.width = specifier.width === void 0 ? void 0 : +specifier.width;
32413 this.comma = !!specifier.comma;
32414 this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;
32415 this.trim = !!specifier.trim;
32416 this.type = specifier.type === void 0 ? "" : specifier.type + "";
32418 FormatSpecifier.prototype.toString = function() {
32419 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;
32422 // node_modules/d3-format/src/formatTrim.js
32423 function formatTrim_default(s) {
32425 for (var n2 = s.length, i2 = 1, i0 = -1, i1; i2 < n2; ++i2) {
32443 return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
32446 // node_modules/d3-format/src/formatPrefixAuto.js
32447 var prefixExponent;
32448 function formatPrefixAuto_default(x, p) {
32449 var d = formatDecimalParts(x, p);
32452 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;
32453 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];
32456 // node_modules/d3-format/src/formatRounded.js
32457 function formatRounded_default(x, p) {
32458 var d = formatDecimalParts(x, p);
32461 var coefficient = d[0], exponent = d[1];
32462 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");
32465 // node_modules/d3-format/src/formatTypes.js
32466 var formatTypes_default = {
32467 "%": (x, p) => (x * 100).toFixed(p),
32468 "b": (x) => Math.round(x).toString(2),
32469 "c": (x) => x + "",
32470 "d": formatDecimal_default,
32471 "e": (x, p) => x.toExponential(p),
32472 "f": (x, p) => x.toFixed(p),
32473 "g": (x, p) => x.toPrecision(p),
32474 "o": (x) => Math.round(x).toString(8),
32475 "p": (x, p) => formatRounded_default(x * 100, p),
32476 "r": formatRounded_default,
32477 "s": formatPrefixAuto_default,
32478 "X": (x) => Math.round(x).toString(16).toUpperCase(),
32479 "x": (x) => Math.round(x).toString(16)
32482 // node_modules/d3-format/src/identity.js
32483 function identity_default3(x) {
32487 // node_modules/d3-format/src/locale.js
32488 var map = Array.prototype.map;
32489 var prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
32490 function locale_default(locale2) {
32491 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 + "";
32492 function newFormat(specifier) {
32493 specifier = formatSpecifier(specifier);
32494 var fill = specifier.fill, align = specifier.align, sign2 = specifier.sign, symbol = specifier.symbol, zero3 = specifier.zero, width = specifier.width, comma = specifier.comma, precision2 = specifier.precision, trim = specifier.trim, type3 = specifier.type;
32496 comma = true, type3 = "g";
32497 else if (!formatTypes_default[type3])
32498 precision2 === void 0 && (precision2 = 12), trim = true, type3 = "g";
32499 if (zero3 || fill === "0" && align === "=")
32500 zero3 = true, fill = "0", align = "=";
32501 var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type3) ? "0" + type3.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type3) ? percent : "";
32502 var formatType = formatTypes_default[type3], maybeSuffix = /[defgprs%]/.test(type3);
32503 precision2 = precision2 === void 0 ? 6 : /[gprs]/.test(type3) ? Math.max(1, Math.min(21, precision2)) : Math.max(0, Math.min(20, precision2));
32504 function format2(value) {
32505 var valuePrefix = prefix, valueSuffix = suffix, i2, n2, c;
32506 if (type3 === "c") {
32507 valueSuffix = formatType(value) + valueSuffix;
32511 var valueNegative = value < 0 || 1 / value < 0;
32512 value = isNaN(value) ? nan : formatType(Math.abs(value), precision2);
32514 value = formatTrim_default(value);
32515 if (valueNegative && +value === 0 && sign2 !== "+")
32516 valueNegative = false;
32517 valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix;
32518 valueSuffix = (type3 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : "");
32520 i2 = -1, n2 = value.length;
32521 while (++i2 < n2) {
32522 if (c = value.charCodeAt(i2), 48 > c || c > 57) {
32523 valueSuffix = (c === 46 ? decimal + value.slice(i2 + 1) : value.slice(i2)) + valueSuffix;
32524 value = value.slice(0, i2);
32530 if (comma && !zero3)
32531 value = group(value, Infinity);
32532 var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : "";
32533 if (comma && zero3)
32534 value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
32537 value = valuePrefix + value + valueSuffix + padding;
32540 value = valuePrefix + padding + value + valueSuffix;
32543 value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);
32546 value = padding + valuePrefix + value + valueSuffix;
32549 return numerals(value);
32551 format2.toString = function() {
32552 return specifier + "";
32556 function formatPrefix2(specifier, value) {
32557 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];
32558 return function(value2) {
32559 return f2(k * value2) + prefix;
32564 formatPrefix: formatPrefix2
32568 // node_modules/d3-format/src/defaultLocale.js
32575 currency: ["$", ""]
32577 function defaultLocale(definition) {
32578 locale = locale_default(definition);
32579 format = locale.format;
32580 formatPrefix = locale.formatPrefix;
32584 // node_modules/d3-format/src/precisionFixed.js
32585 function precisionFixed_default(step) {
32586 return Math.max(0, -exponent_default(Math.abs(step)));
32589 // node_modules/d3-format/src/precisionPrefix.js
32590 function precisionPrefix_default(step, value) {
32591 return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3 - exponent_default(Math.abs(step)));
32594 // node_modules/d3-format/src/precisionRound.js
32595 function precisionRound_default(step, max3) {
32596 step = Math.abs(step), max3 = Math.abs(max3) - step;
32597 return Math.max(0, exponent_default(max3) - exponent_default(step)) + 1;
32600 // node_modules/d3-scale/src/tickFormat.js
32601 function tickFormat(start2, stop, count, specifier) {
32602 var step = tickStep(start2, stop, count), precision2;
32603 specifier = formatSpecifier(specifier == null ? ",f" : specifier);
32604 switch (specifier.type) {
32606 var value = Math.max(Math.abs(start2), Math.abs(stop));
32607 if (specifier.precision == null && !isNaN(precision2 = precisionPrefix_default(step, value)))
32608 specifier.precision = precision2;
32609 return formatPrefix(specifier, value);
32616 if (specifier.precision == null && !isNaN(precision2 = precisionRound_default(step, Math.max(Math.abs(start2), Math.abs(stop)))))
32617 specifier.precision = precision2 - (specifier.type === "e");
32622 if (specifier.precision == null && !isNaN(precision2 = precisionFixed_default(step)))
32623 specifier.precision = precision2 - (specifier.type === "%") * 2;
32627 return format(specifier);
32630 // node_modules/d3-scale/src/linear.js
32631 function linearish(scale) {
32632 var domain2 = scale.domain;
32633 scale.ticks = function(count) {
32635 return ticks(d[0], d[d.length - 1], count == null ? 10 : count);
32637 scale.tickFormat = function(count, specifier) {
32639 return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
32641 scale.nice = function(count) {
32646 var i1 = d.length - 1;
32647 var start2 = d[i0];
32652 if (stop < start2) {
32653 step = start2, start2 = stop, stop = step;
32654 step = i0, i0 = i1, i1 = step;
32656 while (maxIter-- > 0) {
32657 step = tickIncrement(start2, stop, count);
32658 if (step === prestep) {
32662 } else if (step > 0) {
32663 start2 = Math.floor(start2 / step) * step;
32664 stop = Math.ceil(stop / step) * step;
32665 } else if (step < 0) {
32666 start2 = Math.ceil(start2 * step) / step;
32667 stop = Math.floor(stop * step) / step;
32677 function linear3() {
32678 var scale = continuous();
32679 scale.copy = function() {
32680 return copy(scale, linear3());
32682 initRange.apply(scale, arguments);
32683 return linearish(scale);
32686 // node_modules/d3-scale/src/quantize.js
32687 function quantize() {
32688 var x05 = 0, x12 = 1, n2 = 1, domain2 = [0.5], range3 = [0, 1], unknown;
32689 function scale(x) {
32690 return x != null && x <= x ? range3[bisect_default(domain2, x, 0, n2)] : unknown;
32692 function rescale() {
32694 domain2 = new Array(n2);
32696 domain2[i2] = ((i2 + 1) * x12 - (i2 - n2) * x05) / (n2 + 1);
32699 scale.domain = function(_) {
32700 return arguments.length ? ([x05, x12] = _, x05 = +x05, x12 = +x12, rescale()) : [x05, x12];
32702 scale.range = function(_) {
32703 return arguments.length ? (n2 = (range3 = Array.from(_)).length - 1, rescale()) : range3.slice();
32705 scale.invertExtent = function(y) {
32706 var i2 = range3.indexOf(y);
32707 return i2 < 0 ? [NaN, NaN] : i2 < 1 ? [x05, domain2[0]] : i2 >= n2 ? [domain2[n2 - 1], x12] : [domain2[i2 - 1], domain2[i2]];
32709 scale.unknown = function(_) {
32710 return arguments.length ? (unknown = _, scale) : scale;
32712 scale.thresholds = function() {
32713 return domain2.slice();
32715 scale.copy = function() {
32716 return quantize().domain([x05, x12]).range(range3).unknown(unknown);
32718 return initRange.apply(linearish(scale), arguments);
32721 // modules/behavior/breathe.js
32722 function behaviorBreathe() {
32723 var duration = 800;
32725 var selector = ".selected.shadow, .selected .shadow";
32726 var _selected = select_default2(null);
32731 function ratchetyInterpolator(a, b, steps2, units) {
32734 var sample = quantize().domain([0, 1]).range(quantize_default(number_default(a, b), steps2));
32735 return function(t) {
32736 return String(sample(t)) + (units || "");
32739 function reset(selection2) {
32740 selection2.style("stroke-opacity", null).style("stroke-width", null).style("fill-opacity", null).style("r", null);
32742 function setAnimationParams(transition2, fromTo) {
32743 var toFrom = fromTo === "from" ? "to" : "from";
32744 transition2.styleTween("stroke-opacity", function(d) {
32745 return ratchetyInterpolator(
32746 _params[d.id][toFrom].opacity,
32747 _params[d.id][fromTo].opacity,
32750 }).styleTween("stroke-width", function(d) {
32751 return ratchetyInterpolator(
32752 _params[d.id][toFrom].width,
32753 _params[d.id][fromTo].width,
32757 }).styleTween("fill-opacity", function(d) {
32758 return ratchetyInterpolator(
32759 _params[d.id][toFrom].opacity,
32760 _params[d.id][fromTo].opacity,
32763 }).styleTween("r", function(d) {
32764 return ratchetyInterpolator(
32765 _params[d.id][toFrom].width,
32766 _params[d.id][fromTo].width,
32772 function calcAnimationParams(selection2) {
32773 selection2.call(reset).each(function(d) {
32774 var s = select_default2(this);
32775 var tag = s.node().tagName;
32776 var p = { "from": {}, "to": {} };
32779 if (tag === "circle") {
32780 opacity = parseFloat(s.style("fill-opacity") || 0.5);
32781 width = parseFloat(s.style("r") || 15.5);
32783 opacity = parseFloat(s.style("stroke-opacity") || 0.7);
32784 width = parseFloat(s.style("stroke-width") || 10);
32787 p.from.opacity = opacity * 0.6;
32788 p.to.opacity = opacity * 1.25;
32789 p.from.width = width * 0.7;
32790 p.to.width = width * (tag === "circle" ? 1.5 : 1);
32794 function run(surface, fromTo) {
32795 var toFrom = fromTo === "from" ? "to" : "from";
32796 var currSelected = surface.selectAll(selector);
32797 var currClassed = surface.attr("class");
32798 if (_done || currSelected.empty()) {
32799 _selected.call(reset);
32800 _selected = select_default2(null);
32803 if (!(0, import_fast_deep_equal2.default)(currSelected.data(), _selected.data()) || currClassed !== _classed) {
32804 _selected.call(reset);
32805 _classed = currClassed;
32806 _selected = currSelected.call(calcAnimationParams);
32808 var didCallNextRun = false;
32809 _selected.transition().duration(duration).call(setAnimationParams, fromTo).on("end", function() {
32810 if (!didCallNextRun) {
32811 surface.call(run, toFrom);
32812 didCallNextRun = true;
32814 if (!select_default2(this).classed("selected")) {
32815 reset(select_default2(this));
32819 function behavior(surface) {
32821 _timer = timer(function() {
32822 if (surface.selectAll(selector).empty()) {
32825 surface.call(run, "from");
32830 behavior.restartIfNeeded = function(surface) {
32831 if (_selected.empty()) {
32832 surface.call(run, "from");
32838 behavior.off = function() {
32843 _selected.interrupt().call(reset);
32848 // modules/behavior/operation.js
32849 function behaviorOperation(context) {
32851 function keypress(d3_event) {
32852 if (!context.map().withinEditableZoom())
32854 if (_operation.availableForKeypress && !_operation.availableForKeypress())
32856 d3_event.preventDefault();
32857 var disabled = _operation.disabled();
32859 context.ui().flash.duration(4e3).iconName("#iD-operation-" + _operation.id).iconClass("operation disabled").label(_operation.tooltip())();
32861 context.ui().flash.duration(2e3).iconName("#iD-operation-" + _operation.id).iconClass("operation").label(_operation.annotation() || _operation.title)();
32862 if (_operation.point)
32863 _operation.point(null);
32867 function behavior() {
32868 if (_operation && _operation.available()) {
32869 context.keybinding().on(_operation.keys, keypress);
32873 behavior.off = function() {
32874 context.keybinding().off(_operation.keys);
32876 behavior.which = function(_) {
32877 if (!arguments.length)
32885 // modules/operations/circularize.js
32886 function operationCircularize(context, selectedIDs) {
32888 var _actions = selectedIDs.map(getAction).filter(Boolean);
32889 var _amount = _actions.length === 1 ? "single" : "multiple";
32890 var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n2) {
32893 function getAction(entityID) {
32894 var entity = context.entity(entityID);
32895 if (entity.type !== "way" || new Set(entity.nodes).size <= 1)
32898 _extent = entity.extent(context.graph());
32900 _extent = _extent.extend(entity.extent(context.graph()));
32902 return actionCircularize(entityID, context.projection);
32904 var operation = function() {
32905 if (!_actions.length)
32907 var combinedAction = function(graph, t) {
32908 _actions.forEach(function(action) {
32909 if (!action.disabled(graph)) {
32910 graph = action(graph, t);
32915 combinedAction.transitionable = true;
32916 context.perform(combinedAction, operation.annotation());
32917 window.setTimeout(function() {
32918 context.validator().validate();
32921 operation.available = function() {
32922 return _actions.length && selectedIDs.length === _actions.length;
32924 operation.disabled = function() {
32925 if (!_actions.length)
32927 var actionDisableds = _actions.map(function(action) {
32928 return action.disabled(context.graph());
32929 }).filter(Boolean);
32930 if (actionDisableds.length === _actions.length) {
32931 if (new Set(actionDisableds).size > 1) {
32932 return "multiple_blockers";
32934 return actionDisableds[0];
32935 } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
32936 return "too_large";
32937 } else if (someMissing()) {
32938 return "not_downloaded";
32939 } else if (selectedIDs.some(context.hasHiddenConnections)) {
32940 return "connected_to_hidden";
32943 function someMissing() {
32944 if (context.inIntro())
32946 var osm = context.connection();
32948 var missing = _coords.filter(function(loc) {
32949 return !osm.isDataLoaded(loc);
32951 if (missing.length) {
32952 missing.forEach(function(loc) {
32953 context.loadTileAtLoc(loc);
32961 operation.tooltip = function() {
32962 var disable = operation.disabled();
32963 return disable ? _t.append("operations.circularize." + disable + "." + _amount) : _t.append("operations.circularize.description." + _amount);
32965 operation.annotation = function() {
32966 return _t("operations.circularize.annotation.feature", { n: _actions.length });
32968 operation.id = "circularize";
32969 operation.keys = [_t("operations.circularize.key")];
32970 operation.title = _t.append("operations.circularize.title");
32971 operation.behavior = behaviorOperation(context).which(operation);
32975 // modules/ui/cmd.js
32976 var uiCmd = function(code) {
32977 var detected = utilDetect();
32978 if (detected.os === "mac") {
32981 if (detected.os === "win") {
32982 if (code === "\u2318\u21E7Z")
32985 var result = "", replacements = {
32989 "\u232B": "Backspace",
32992 for (var i2 = 0; i2 < code.length; i2++) {
32993 if (code[i2] in replacements) {
32994 result += replacements[code[i2]] + (i2 < code.length - 1 ? "+" : "");
32996 result += code[i2];
33001 uiCmd.display = function(code) {
33002 if (code.length !== 1)
33004 var detected = utilDetect();
33005 var mac = detected.os === "mac";
33006 var replacements = {
33007 "\u2318": mac ? "\u2318 " + _t("shortcuts.key.cmd") : _t("shortcuts.key.ctrl"),
33008 "\u21E7": mac ? "\u21E7 " + _t("shortcuts.key.shift") : _t("shortcuts.key.shift"),
33009 "\u2325": mac ? "\u2325 " + _t("shortcuts.key.option") : _t("shortcuts.key.alt"),
33010 "\u2303": mac ? "\u2303 " + _t("shortcuts.key.ctrl") : _t("shortcuts.key.ctrl"),
33011 "\u232B": mac ? "\u232B " + _t("shortcuts.key.delete") : _t("shortcuts.key.backspace"),
33012 "\u2326": mac ? "\u2326 " + _t("shortcuts.key.del") : _t("shortcuts.key.del"),
33013 "\u2196": mac ? "\u2196 " + _t("shortcuts.key.pgup") : _t("shortcuts.key.pgup"),
33014 "\u2198": mac ? "\u2198 " + _t("shortcuts.key.pgdn") : _t("shortcuts.key.pgdn"),
33015 "\u21DE": mac ? "\u21DE " + _t("shortcuts.key.home") : _t("shortcuts.key.home"),
33016 "\u21DF": mac ? "\u21DF " + _t("shortcuts.key.end") : _t("shortcuts.key.end"),
33017 "\u21B5": mac ? "\u23CE " + _t("shortcuts.key.return") : _t("shortcuts.key.enter"),
33018 "\u238B": mac ? "\u238B " + _t("shortcuts.key.esc") : _t("shortcuts.key.esc"),
33019 "\u2630": mac ? "\u2630 " + _t("shortcuts.key.menu") : _t("shortcuts.key.menu")
33021 return replacements[code] || code;
33024 // modules/operations/delete.js
33025 function operationDelete(context, selectedIDs) {
33026 var multi = selectedIDs.length === 1 ? "single" : "multiple";
33027 var action = actionDeleteMultiple(selectedIDs);
33028 var nodes = utilGetAllNodes(selectedIDs, context.graph());
33029 var coords = nodes.map(function(n2) {
33032 var extent = utilTotalExtent(selectedIDs, context.graph());
33033 var operation = function() {
33034 var nextSelectedID;
33035 var nextSelectedLoc;
33036 if (selectedIDs.length === 1) {
33037 var id2 = selectedIDs[0];
33038 var entity = context.entity(id2);
33039 var geometry = entity.geometry(context.graph());
33040 var parents = context.graph().parentWays(entity);
33041 var parent = parents[0];
33042 if (geometry === "vertex") {
33043 var nodes2 = parent.nodes;
33044 var i2 = nodes2.indexOf(id2);
33047 } else if (i2 === nodes2.length - 1) {
33050 var a = geoSphericalDistance(entity.loc, context.entity(nodes2[i2 - 1]).loc);
33051 var b = geoSphericalDistance(entity.loc, context.entity(nodes2[i2 + 1]).loc);
33052 i2 = a < b ? i2 - 1 : i2 + 1;
33054 nextSelectedID = nodes2[i2];
33055 nextSelectedLoc = context.entity(nextSelectedID).loc;
33058 context.perform(action, operation.annotation());
33059 context.validator().validate();
33060 if (nextSelectedID && nextSelectedLoc) {
33061 if (context.hasEntity(nextSelectedID)) {
33062 context.enter(modeSelect(context, [nextSelectedID]).follow(true));
33064 context.map().centerEase(nextSelectedLoc);
33065 context.enter(modeBrowse(context));
33068 context.enter(modeBrowse(context));
33071 operation.available = function() {
33074 operation.disabled = function() {
33075 if (extent.percentContainedIn(context.map().extent()) < 0.8) {
33076 return "too_large";
33077 } else if (someMissing()) {
33078 return "not_downloaded";
33079 } else if (selectedIDs.some(context.hasHiddenConnections)) {
33080 return "connected_to_hidden";
33081 } else if (selectedIDs.some(protectedMember)) {
33082 return "part_of_relation";
33083 } else if (selectedIDs.some(incompleteRelation)) {
33084 return "incomplete_relation";
33085 } else if (selectedIDs.some(hasWikidataTag)) {
33086 return "has_wikidata_tag";
33089 function someMissing() {
33090 if (context.inIntro())
33092 var osm = context.connection();
33094 var missing = coords.filter(function(loc) {
33095 return !osm.isDataLoaded(loc);
33097 if (missing.length) {
33098 missing.forEach(function(loc) {
33099 context.loadTileAtLoc(loc);
33106 function hasWikidataTag(id2) {
33107 var entity = context.entity(id2);
33108 return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
33110 function incompleteRelation(id2) {
33111 var entity = context.entity(id2);
33112 return entity.type === "relation" && !entity.isComplete(context.graph());
33114 function protectedMember(id2) {
33115 var entity = context.entity(id2);
33116 if (entity.type !== "way")
33118 var parents = context.graph().parentRelations(entity);
33119 for (var i2 = 0; i2 < parents.length; i2++) {
33120 var parent = parents[i2];
33121 var type3 = parent.tags.type;
33122 var role = parent.memberById(id2).role || "outer";
33123 if (type3 === "route" || type3 === "boundary" || type3 === "multipolygon" && role === "outer") {
33130 operation.tooltip = function() {
33131 var disable = operation.disabled();
33132 return disable ? _t.append("operations.delete." + disable + "." + multi) : _t.append("operations.delete.description." + multi);
33134 operation.annotation = function() {
33135 return selectedIDs.length === 1 ? _t("operations.delete.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.delete.annotation.feature", { n: selectedIDs.length });
33137 operation.id = "delete";
33138 operation.keys = [uiCmd("\u2318\u232B"), uiCmd("\u2318\u2326"), uiCmd("\u2326")];
33139 operation.title = _t.append("operations.delete.title");
33140 operation.behavior = behaviorOperation(context).which(operation);
33144 // modules/operations/orthogonalize.js
33145 function operationOrthogonalize(context, selectedIDs) {
33148 var _actions = selectedIDs.map(chooseAction).filter(Boolean);
33149 var _amount = _actions.length === 1 ? "single" : "multiple";
33150 var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n2) {
33153 function chooseAction(entityID) {
33154 var entity = context.entity(entityID);
33155 var geometry = entity.geometry(context.graph());
33157 _extent = entity.extent(context.graph());
33159 _extent = _extent.extend(entity.extent(context.graph()));
33161 if (entity.type === "way" && new Set(entity.nodes).size > 2) {
33162 if (_type && _type !== "feature")
33165 return actionOrthogonalize(entityID, context.projection);
33166 } else if (geometry === "vertex") {
33167 if (_type && _type !== "corner")
33170 var graph = context.graph();
33171 var parents = graph.parentWays(entity);
33172 if (parents.length === 1) {
33173 var way = parents[0];
33174 if (way.nodes.indexOf(entityID) !== -1) {
33175 return actionOrthogonalize(way.id, context.projection, entityID);
33181 var operation = function() {
33182 if (!_actions.length)
33184 var combinedAction = function(graph, t) {
33185 _actions.forEach(function(action) {
33186 if (!action.disabled(graph)) {
33187 graph = action(graph, t);
33192 combinedAction.transitionable = true;
33193 context.perform(combinedAction, operation.annotation());
33194 window.setTimeout(function() {
33195 context.validator().validate();
33198 operation.available = function() {
33199 return _actions.length && selectedIDs.length === _actions.length;
33201 operation.disabled = function() {
33202 if (!_actions.length)
33204 var actionDisableds = _actions.map(function(action) {
33205 return action.disabled(context.graph());
33206 }).filter(Boolean);
33207 if (actionDisableds.length === _actions.length) {
33208 if (new Set(actionDisableds).size > 1) {
33209 return "multiple_blockers";
33211 return actionDisableds[0];
33212 } else if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
33213 return "too_large";
33214 } else if (someMissing()) {
33215 return "not_downloaded";
33216 } else if (selectedIDs.some(context.hasHiddenConnections)) {
33217 return "connected_to_hidden";
33220 function someMissing() {
33221 if (context.inIntro())
33223 var osm = context.connection();
33225 var missing = _coords.filter(function(loc) {
33226 return !osm.isDataLoaded(loc);
33228 if (missing.length) {
33229 missing.forEach(function(loc) {
33230 context.loadTileAtLoc(loc);
33238 operation.tooltip = function() {
33239 var disable = operation.disabled();
33240 return disable ? _t.append("operations.orthogonalize." + disable + "." + _amount) : _t.append("operations.orthogonalize.description." + _type + "." + _amount);
33242 operation.annotation = function() {
33243 return _t("operations.orthogonalize.annotation." + _type, { n: _actions.length });
33245 operation.id = "orthogonalize";
33246 operation.keys = [_t("operations.orthogonalize.key")];
33247 operation.title = _t.append("operations.orthogonalize.title");
33248 operation.behavior = behaviorOperation(context).which(operation);
33252 // modules/operations/reflect.js
33253 function operationReflectShort(context, selectedIDs) {
33254 return operationReflect(context, selectedIDs, "short");
33256 function operationReflectLong(context, selectedIDs) {
33257 return operationReflect(context, selectedIDs, "long");
33259 function operationReflect(context, selectedIDs, axis) {
33260 axis = axis || "long";
33261 var multi = selectedIDs.length === 1 ? "single" : "multiple";
33262 var nodes = utilGetAllNodes(selectedIDs, context.graph());
33263 var coords = nodes.map(function(n2) {
33266 var extent = utilTotalExtent(selectedIDs, context.graph());
33267 var operation = function() {
33268 var action = actionReflect(selectedIDs, context.projection).useLongAxis(Boolean(axis === "long"));
33269 context.perform(action, operation.annotation());
33270 window.setTimeout(function() {
33271 context.validator().validate();
33274 operation.available = function() {
33275 return nodes.length >= 3;
33277 operation.disabled = function() {
33278 if (extent.percentContainedIn(context.map().extent()) < 0.8) {
33279 return "too_large";
33280 } else if (someMissing()) {
33281 return "not_downloaded";
33282 } else if (selectedIDs.some(context.hasHiddenConnections)) {
33283 return "connected_to_hidden";
33284 } else if (selectedIDs.some(incompleteRelation)) {
33285 return "incomplete_relation";
33288 function someMissing() {
33289 if (context.inIntro())
33291 var osm = context.connection();
33293 var missing = coords.filter(function(loc) {
33294 return !osm.isDataLoaded(loc);
33296 if (missing.length) {
33297 missing.forEach(function(loc) {
33298 context.loadTileAtLoc(loc);
33305 function incompleteRelation(id2) {
33306 var entity = context.entity(id2);
33307 return entity.type === "relation" && !entity.isComplete(context.graph());
33310 operation.tooltip = function() {
33311 var disable = operation.disabled();
33312 return disable ? _t.append("operations.reflect." + disable + "." + multi) : _t.append("operations.reflect.description." + axis + "." + multi);
33314 operation.annotation = function() {
33315 return _t("operations.reflect.annotation." + axis + ".feature", { n: selectedIDs.length });
33317 operation.id = "reflect-" + axis;
33318 operation.keys = [_t("operations.reflect.key." + axis)];
33319 operation.title = _t.append("operations.reflect.title." + axis);
33320 operation.behavior = behaviorOperation(context).which(operation);
33324 // modules/operations/move.js
33325 function operationMove(context, selectedIDs) {
33326 var multi = selectedIDs.length === 1 ? "single" : "multiple";
33327 var nodes = utilGetAllNodes(selectedIDs, context.graph());
33328 var coords = nodes.map(function(n2) {
33331 var extent = utilTotalExtent(selectedIDs, context.graph());
33332 var operation = function() {
33333 context.enter(modeMove(context, selectedIDs));
33335 operation.available = function() {
33336 return selectedIDs.length > 0;
33338 operation.disabled = function() {
33339 if (extent.percentContainedIn(context.map().extent()) < 0.8) {
33340 return "too_large";
33341 } else if (someMissing()) {
33342 return "not_downloaded";
33343 } else if (selectedIDs.some(context.hasHiddenConnections)) {
33344 return "connected_to_hidden";
33345 } else if (selectedIDs.some(incompleteRelation)) {
33346 return "incomplete_relation";
33349 function someMissing() {
33350 if (context.inIntro())
33352 var osm = context.connection();
33354 var missing = coords.filter(function(loc) {
33355 return !osm.isDataLoaded(loc);
33357 if (missing.length) {
33358 missing.forEach(function(loc) {
33359 context.loadTileAtLoc(loc);
33366 function incompleteRelation(id2) {
33367 var entity = context.entity(id2);
33368 return entity.type === "relation" && !entity.isComplete(context.graph());
33371 operation.tooltip = function() {
33372 var disable = operation.disabled();
33373 return disable ? _t.append("operations.move." + disable + "." + multi) : _t.append("operations.move.description." + multi);
33375 operation.annotation = function() {
33376 return selectedIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.move.annotation.feature", { n: selectedIDs.length });
33378 operation.id = "move";
33379 operation.keys = [_t("operations.move.key")];
33380 operation.title = _t.append("operations.move.title");
33381 operation.behavior = behaviorOperation(context).which(operation);
33382 operation.mouseOnly = true;
33386 // modules/modes/rotate.js
33387 function modeRotate(context, entityIDs) {
33388 var _tolerancePx = 4;
33393 var keybinding = utilKeybinding("rotate");
33395 behaviorEdit(context),
33396 operationCircularize(context, entityIDs).behavior,
33397 operationDelete(context, entityIDs).behavior,
33398 operationMove(context, entityIDs).behavior,
33399 operationOrthogonalize(context, entityIDs).behavior,
33400 operationReflectLong(context, entityIDs).behavior,
33401 operationReflectShort(context, entityIDs).behavior
33403 var annotation = entityIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.rotate.annotation.feature", { n: entityIDs.length });
33406 var _prevTransform;
33408 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
33409 function doRotate(d3_event) {
33411 if (context.graph() !== _prevGraph) {
33412 fn = context.perform;
33414 fn = context.replace;
33416 var projection2 = context.projection;
33417 var currTransform = projection2.transform();
33418 if (!_prevTransform || currTransform.k !== _prevTransform.k || currTransform.x !== _prevTransform.x || currTransform.y !== _prevTransform.y) {
33419 var nodes = utilGetAllNodes(entityIDs, context.graph());
33420 var points = nodes.map(function(n2) {
33421 return projection2(n2.loc);
33423 _pivot = getPivot(points);
33424 _prevAngle = void 0;
33426 var currMouse = context.map().mouse(d3_event);
33427 var currAngle = Math.atan2(currMouse[1] - _pivot[1], currMouse[0] - _pivot[0]);
33428 if (typeof _prevAngle === "undefined")
33429 _prevAngle = currAngle;
33430 var delta = currAngle - _prevAngle;
33431 fn(actionRotate(entityIDs, _pivot, delta, projection2));
33432 _prevTransform = currTransform;
33433 _prevAngle = currAngle;
33434 _prevGraph = context.graph();
33436 function getPivot(points) {
33438 if (points.length === 1) {
33439 _pivot2 = points[0];
33440 } else if (points.length === 2) {
33441 _pivot2 = geoVecInterp(points[0], points[1], 0.5);
33443 var polygonHull = hull_default(points);
33444 if (polygonHull.length === 2) {
33445 _pivot2 = geoVecInterp(points[0], points[1], 0.5);
33447 _pivot2 = centroid_default2(hull_default(points));
33452 function finish(d3_event) {
33453 d3_event.stopPropagation();
33454 context.replace(actionNoop(), annotation);
33455 context.enter(modeSelect(context, entityIDs));
33457 function cancel() {
33460 context.enter(modeSelect(context, entityIDs));
33462 function undone() {
33463 context.enter(modeBrowse(context));
33465 mode.enter = function() {
33467 context.features().forceVisible(entityIDs);
33468 behaviors.forEach(context.install);
33470 context.surface().on(_pointerPrefix + "down.modeRotate", function(d3_event) {
33471 downEvent = d3_event;
33473 select_default2(window).on(_pointerPrefix + "move.modeRotate", doRotate, true).on(_pointerPrefix + "up.modeRotate", function(d3_event) {
33476 var mapNode = context.container().select(".main-map").node();
33477 var pointGetter = utilFastMouse(mapNode);
33478 var p1 = pointGetter(downEvent);
33479 var p2 = pointGetter(d3_event);
33480 var dist = geoVecLength(p1, p2);
33481 if (dist <= _tolerancePx)
33485 context.history().on("undone.modeRotate", undone);
33486 keybinding.on("\u238B", cancel).on("\u21A9", finish);
33487 select_default2(document).call(keybinding);
33489 mode.exit = function() {
33490 behaviors.forEach(context.uninstall);
33491 context.surface().on(_pointerPrefix + "down.modeRotate", null);
33492 select_default2(window).on(_pointerPrefix + "move.modeRotate", null, true).on(_pointerPrefix + "up.modeRotate", null, true);
33493 context.history().on("undone.modeRotate", null);
33494 select_default2(document).call(keybinding.unbind);
33495 context.features().forceVisible([]);
33497 mode.selectedIDs = function() {
33498 if (!arguments.length)
33505 // modules/operations/rotate.js
33506 function operationRotate(context, selectedIDs) {
33507 var multi = selectedIDs.length === 1 ? "single" : "multiple";
33508 var nodes = utilGetAllNodes(selectedIDs, context.graph());
33509 var coords = nodes.map(function(n2) {
33512 var extent = utilTotalExtent(selectedIDs, context.graph());
33513 var operation = function() {
33514 context.enter(modeRotate(context, selectedIDs));
33516 operation.available = function() {
33517 return nodes.length >= 2;
33519 operation.disabled = function() {
33520 if (extent.percentContainedIn(context.map().extent()) < 0.8) {
33521 return "too_large";
33522 } else if (someMissing()) {
33523 return "not_downloaded";
33524 } else if (selectedIDs.some(context.hasHiddenConnections)) {
33525 return "connected_to_hidden";
33526 } else if (selectedIDs.some(incompleteRelation)) {
33527 return "incomplete_relation";
33530 function someMissing() {
33531 if (context.inIntro())
33533 var osm = context.connection();
33535 var missing = coords.filter(function(loc) {
33536 return !osm.isDataLoaded(loc);
33538 if (missing.length) {
33539 missing.forEach(function(loc) {
33540 context.loadTileAtLoc(loc);
33547 function incompleteRelation(id2) {
33548 var entity = context.entity(id2);
33549 return entity.type === "relation" && !entity.isComplete(context.graph());
33552 operation.tooltip = function() {
33553 var disable = operation.disabled();
33554 return disable ? _t.append("operations.rotate." + disable + "." + multi) : _t.append("operations.rotate.description." + multi);
33556 operation.annotation = function() {
33557 return selectedIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.rotate.annotation.feature", { n: selectedIDs.length });
33559 operation.id = "rotate";
33560 operation.keys = [_t("operations.rotate.key")];
33561 operation.title = _t.append("operations.rotate.title");
33562 operation.behavior = behaviorOperation(context).which(operation);
33563 operation.mouseOnly = true;
33567 // modules/modes/move.js
33568 function modeMove(context, entityIDs, baseGraph) {
33569 var _tolerancePx = 4;
33574 var keybinding = utilKeybinding("move");
33576 behaviorEdit(context),
33577 operationCircularize(context, entityIDs).behavior,
33578 operationDelete(context, entityIDs).behavior,
33579 operationOrthogonalize(context, entityIDs).behavior,
33580 operationReflectLong(context, entityIDs).behavior,
33581 operationReflectShort(context, entityIDs).behavior,
33582 operationRotate(context, entityIDs).behavior
33584 var annotation = entityIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.move.annotation.feature", { n: entityIDs.length });
33588 var _nudgeInterval;
33589 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
33590 function doMove(nudge) {
33591 nudge = nudge || [0, 0];
33593 if (_prevGraph !== context.graph()) {
33595 _origin = context.map().mouseCoordinates();
33596 fn = context.perform;
33598 fn = context.overwrite;
33600 var currMouse = context.map().mouse();
33601 var origMouse = context.projection(_origin);
33602 var delta = geoVecSubtract(geoVecSubtract(currMouse, origMouse), nudge);
33603 fn(actionMove(entityIDs, delta, context.projection, _cache4));
33604 _prevGraph = context.graph();
33606 function startNudge(nudge) {
33607 if (_nudgeInterval)
33608 window.clearInterval(_nudgeInterval);
33609 _nudgeInterval = window.setInterval(function() {
33610 context.map().pan(nudge);
33614 function stopNudge() {
33615 if (_nudgeInterval) {
33616 window.clearInterval(_nudgeInterval);
33617 _nudgeInterval = null;
33622 var nudge = geoViewportEdge(context.map().mouse(), context.map().dimensions());
33629 function finish(d3_event) {
33630 d3_event.stopPropagation();
33631 context.replace(actionNoop(), annotation);
33632 context.enter(modeSelect(context, entityIDs));
33635 function cancel() {
33637 while (context.graph() !== baseGraph)
33639 context.enter(modeBrowse(context));
33643 context.enter(modeSelect(context, entityIDs));
33647 function undone() {
33648 context.enter(modeBrowse(context));
33650 mode.enter = function() {
33651 _origin = context.map().mouseCoordinates();
33654 context.features().forceVisible(entityIDs);
33655 behaviors.forEach(context.install);
33657 context.surface().on(_pointerPrefix + "down.modeMove", function(d3_event) {
33658 downEvent = d3_event;
33660 select_default2(window).on(_pointerPrefix + "move.modeMove", move, true).on(_pointerPrefix + "up.modeMove", function(d3_event) {
33663 var mapNode = context.container().select(".main-map").node();
33664 var pointGetter = utilFastMouse(mapNode);
33665 var p1 = pointGetter(downEvent);
33666 var p2 = pointGetter(d3_event);
33667 var dist = geoVecLength(p1, p2);
33668 if (dist <= _tolerancePx)
33672 context.history().on("undone.modeMove", undone);
33673 keybinding.on("\u238B", cancel).on("\u21A9", finish);
33674 select_default2(document).call(keybinding);
33676 mode.exit = function() {
33678 behaviors.forEach(function(behavior) {
33679 context.uninstall(behavior);
33681 context.surface().on(_pointerPrefix + "down.modeMove", null);
33682 select_default2(window).on(_pointerPrefix + "move.modeMove", null, true).on(_pointerPrefix + "up.modeMove", null, true);
33683 context.history().on("undone.modeMove", null);
33684 select_default2(document).call(keybinding.unbind);
33685 context.features().forceVisible([]);
33687 mode.selectedIDs = function() {
33688 if (!arguments.length)
33695 // modules/behavior/paste.js
33696 function behaviorPaste(context) {
33697 function doPaste(d3_event) {
33698 if (!context.map().withinEditableZoom())
33700 d3_event.preventDefault();
33701 var baseGraph = context.graph();
33702 var mouse = context.map().mouse();
33703 var projection2 = context.projection;
33704 var viewport = geoExtent(projection2.clipExtent()).polygon();
33705 if (!geoPointInPolygon(mouse, viewport))
33707 var oldIDs = context.copyIDs();
33708 if (!oldIDs.length)
33710 var extent = geoExtent();
33711 var oldGraph = context.copyGraph();
33713 var action = actionCopyEntities(oldIDs, oldGraph);
33714 context.perform(action);
33715 var copies = action.copies();
33716 var originals = /* @__PURE__ */ new Set();
33717 Object.values(copies).forEach(function(entity) {
33718 originals.add(entity.id);
33720 for (var id2 in copies) {
33721 var oldEntity = oldGraph.entity(id2);
33722 var newEntity = copies[id2];
33723 extent._extend(oldEntity.extent(oldGraph));
33724 var parents = context.graph().parentWays(newEntity);
33725 var parentCopied = parents.some(function(parent) {
33726 return originals.has(parent.id);
33728 if (!parentCopied) {
33729 newIDs.push(newEntity.id);
33732 var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
33733 var delta = geoVecSubtract(mouse, copyPoint);
33734 context.perform(actionMove(newIDs, delta, projection2));
33735 context.enter(modeMove(context, newIDs, baseGraph));
33737 function behavior() {
33738 context.keybinding().on(uiCmd("\u2318V"), doPaste);
33741 behavior.off = function() {
33742 context.keybinding().off(uiCmd("\u2318V"));
33747 // modules/behavior/drag.js
33748 function behaviorDrag() {
33749 var dispatch10 = dispatch_default("start", "move", "end");
33750 var _tolerancePx = 1;
33751 var _penTolerancePx = 4;
33752 var _origin = null;
33753 var _selector = "";
33758 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
33759 var d3_event_userSelectProperty = utilPrefixCSSProperty("UserSelect");
33760 var d3_event_userSelectSuppress = function() {
33761 var selection2 = selection_default();
33762 var select = selection2.style(d3_event_userSelectProperty);
33763 selection2.style(d3_event_userSelectProperty, "none");
33764 return function() {
33765 selection2.style(d3_event_userSelectProperty, select);
33768 function pointerdown(d3_event) {
33771 _pointerId = d3_event.pointerId || "mouse";
33772 _targetNode = this;
33773 var pointerLocGetter = utilFastMouse(_surface || _targetNode.parentNode);
33775 var startOrigin = pointerLocGetter(d3_event);
33776 var started = false;
33777 var selectEnable = d3_event_userSelectSuppress();
33778 select_default2(window).on(_pointerPrefix + "move.drag", pointermove).on(_pointerPrefix + "up.drag pointercancel.drag", pointerup, true);
33780 offset = _origin.call(_targetNode, _targetEntity);
33781 offset = [offset[0] - startOrigin[0], offset[1] - startOrigin[1]];
33785 d3_event.stopPropagation();
33786 function pointermove(d3_event2) {
33787 if (_pointerId !== (d3_event2.pointerId || "mouse"))
33789 var p = pointerLocGetter(d3_event2);
33791 var dist = geoVecLength(startOrigin, p);
33792 var tolerance = d3_event2.pointerType === "pen" ? _penTolerancePx : _tolerancePx;
33793 if (dist < tolerance)
33796 dispatch10.call("start", this, d3_event2, _targetEntity);
33799 d3_event2.stopPropagation();
33800 d3_event2.preventDefault();
33801 var dx = p[0] - startOrigin[0];
33802 var dy = p[1] - startOrigin[1];
33803 dispatch10.call("move", this, d3_event2, _targetEntity, [p[0] + offset[0], p[1] + offset[1]], [dx, dy]);
33806 function pointerup(d3_event2) {
33807 if (_pointerId !== (d3_event2.pointerId || "mouse"))
33811 dispatch10.call("end", this, d3_event2, _targetEntity);
33812 d3_event2.preventDefault();
33814 select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
33818 function behavior(selection2) {
33819 var matchesSelector = utilPrefixDOMProperty("matchesSelector");
33820 var delegate = pointerdown;
33822 delegate = function(d3_event) {
33824 var target = d3_event.target;
33825 for (; target && target !== root3; target = target.parentNode) {
33826 var datum2 = target.__data__;
33827 _targetEntity = datum2 instanceof osmNote ? datum2 : datum2 && datum2.properties && datum2.properties.entity;
33828 if (_targetEntity && target[matchesSelector](_selector)) {
33829 return pointerdown.call(target, d3_event);
33834 selection2.on(_pointerPrefix + "down.drag" + _selector, delegate);
33836 behavior.off = function(selection2) {
33837 selection2.on(_pointerPrefix + "down.drag" + _selector, null);
33839 behavior.selector = function(_) {
33840 if (!arguments.length)
33845 behavior.origin = function(_) {
33846 if (!arguments.length)
33851 behavior.cancel = function() {
33852 select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
33855 behavior.targetNode = function(_) {
33856 if (!arguments.length)
33857 return _targetNode;
33861 behavior.targetEntity = function(_) {
33862 if (!arguments.length)
33863 return _targetEntity;
33867 behavior.surface = function(_) {
33868 if (!arguments.length)
33873 return utilRebind(behavior, dispatch10, "on");
33876 // modules/modes/drag_node.js
33877 function modeDragNode(context) {
33882 var hover = behaviorHover(context).altDisables(true).on("hover", context.ui().sidebar.hover);
33883 var edit2 = behaviorEdit(context);
33884 var _nudgeInterval;
33885 var _restoreSelectedIDs = [];
33886 var _wasMidpoint = false;
33887 var _isCancelled = false;
33891 function startNudge(d3_event, entity, nudge) {
33892 if (_nudgeInterval)
33893 window.clearInterval(_nudgeInterval);
33894 _nudgeInterval = window.setInterval(function() {
33895 context.map().pan(nudge);
33896 doMove(d3_event, entity, nudge);
33899 function stopNudge() {
33900 if (_nudgeInterval) {
33901 window.clearInterval(_nudgeInterval);
33902 _nudgeInterval = null;
33905 function moveAnnotation(entity) {
33906 return _t("operations.move.annotation." + entity.geometry(context.graph()));
33908 function connectAnnotation(nodeEntity, targetEntity) {
33909 var nodeGeometry = nodeEntity.geometry(context.graph());
33910 var targetGeometry = targetEntity.geometry(context.graph());
33911 if (nodeGeometry === "vertex" && targetGeometry === "vertex") {
33912 var nodeParentWayIDs = context.graph().parentWays(nodeEntity);
33913 var targetParentWayIDs = context.graph().parentWays(targetEntity);
33914 var sharedParentWays = utilArrayIntersection(nodeParentWayIDs, targetParentWayIDs);
33915 if (sharedParentWays.length !== 0) {
33916 if (sharedParentWays[0].areAdjacent(nodeEntity.id, targetEntity.id)) {
33917 return _t("operations.connect.annotation.from_vertex.to_adjacent_vertex");
33919 return _t("operations.connect.annotation.from_vertex.to_sibling_vertex");
33922 return _t("operations.connect.annotation.from_" + nodeGeometry + ".to_" + targetGeometry);
33924 function shouldSnapToNode(target) {
33925 if (!_activeEntity)
33927 return _activeEntity.geometry(context.graph()) !== "vertex" || (target.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(target, context.graph()));
33929 function origin(entity) {
33930 return context.projection(entity.loc);
33932 function keydown(d3_event) {
33933 if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
33934 if (context.surface().classed("nope")) {
33935 context.surface().classed("nope-suppressed", true);
33937 context.surface().classed("nope", false).classed("nope-disabled", true);
33940 function keyup(d3_event) {
33941 if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
33942 if (context.surface().classed("nope-suppressed")) {
33943 context.surface().classed("nope", true);
33945 context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
33948 function start2(d3_event, entity) {
33949 _wasMidpoint = entity.type === "midpoint";
33950 var hasHidden = context.features().hasHiddenConnections(entity, context.graph());
33951 _isCancelled = !context.editable() || d3_event.shiftKey || hasHidden;
33952 if (_isCancelled) {
33954 context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("modes.drag_node.connected_to_hidden"))();
33956 return drag.cancel();
33958 if (_wasMidpoint) {
33959 var midpoint = entity;
33960 entity = osmNode();
33961 context.perform(actionAddMidpoint(midpoint, entity));
33962 entity = context.entity(entity.id);
33963 var vertex = context.surface().selectAll("." + entity.id);
33964 drag.targetNode(vertex.node()).targetEntity(entity);
33966 context.perform(actionNoop());
33968 _activeEntity = entity;
33969 _startLoc = entity.loc;
33970 hover.ignoreVertex(entity.geometry(context.graph()) === "vertex");
33971 context.surface().selectAll("." + _activeEntity.id).classed("active", true);
33972 context.enter(mode);
33974 function datum2(d3_event) {
33975 if (!d3_event || d3_event.altKey) {
33978 var d = d3_event.target.__data__;
33979 return d && d.properties && d.properties.target ? d : {};
33982 function doMove(d3_event, entity, nudge) {
33983 nudge = nudge || [0, 0];
33984 var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
33985 var currMouse = geoVecSubtract(currPoint, nudge);
33986 var loc = context.projection.invert(currMouse);
33988 if (!_nudgeInterval) {
33989 var d = datum2(d3_event);
33990 target = d && d.properties && d.properties.entity;
33991 var targetLoc = target && target.loc;
33992 var targetNodes = d && d.properties && d.properties.nodes;
33994 if (shouldSnapToNode(target)) {
33997 } else if (targetNodes) {
33998 edge = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, end.id);
34005 actionMoveNode(entity.id, loc)
34007 var isInvalid = false;
34009 isInvalid = hasRelationConflict(entity, target, edge, context.graph());
34012 isInvalid = hasInvalidGeometry(entity, context.graph());
34014 var nope = context.surface().classed("nope");
34015 if (isInvalid === "relation" || isInvalid === "restriction") {
34017 context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(
34018 "operations.connect." + isInvalid,
34019 { relation: _mainPresetIndex.item("type/restriction").name() }
34022 } else if (isInvalid) {
34023 var errorID = isInvalid === "line" ? "lines" : "areas";
34024 context.ui().flash.duration(3e3).iconName("#iD-icon-no").label(_t.append("self_intersection.error." + errorID))();
34027 context.ui().flash.duration(1).label("")();
34030 var nopeDisabled = context.surface().classed("nope-disabled");
34031 if (nopeDisabled) {
34032 context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
34034 context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
34038 function hasRelationConflict(entity, target, edge, graph) {
34039 var testGraph = graph.update();
34041 var midpoint = osmNode();
34042 var action = actionAddMidpoint({
34044 edge: [target.nodes[edge.index - 1], target.nodes[edge.index]]
34046 testGraph = action(testGraph);
34049 var ids = [entity.id, target.id];
34050 return actionConnect(ids).disabled(testGraph);
34052 function hasInvalidGeometry(entity, graph) {
34053 var parents = graph.parentWays(entity);
34055 for (i2 = 0; i2 < parents.length; i2++) {
34056 var parent = parents[i2];
34058 var activeIndex = null;
34059 var relations = graph.parentRelations(parent);
34060 for (j2 = 0; j2 < relations.length; j2++) {
34061 if (!relations[j2].isMultipolygon())
34063 var rings = osmJoinWays(relations[j2].members, graph);
34064 for (k = 0; k < rings.length; k++) {
34065 nodes = rings[k].nodes;
34066 if (nodes.find(function(n2) {
34067 return n2.id === entity.id;
34070 if (geoHasSelfIntersections(nodes, entity.id)) {
34071 return "multipolygonMember";
34074 rings[k].coords = nodes.map(function(n2) {
34078 for (k = 0; k < rings.length; k++) {
34079 if (k === activeIndex)
34081 if (geoHasLineIntersections(rings[activeIndex].nodes, rings[k].nodes, entity.id)) {
34082 return "multipolygonRing";
34086 if (activeIndex === null) {
34087 nodes = parent.nodes.map(function(nodeID) {
34088 return graph.entity(nodeID);
34090 if (nodes.length && geoHasSelfIntersections(nodes, entity.id)) {
34091 return parent.geometry(graph);
34097 function move(d3_event, entity, point2) {
34100 d3_event.stopPropagation();
34101 context.surface().classed("nope-disabled", d3_event.altKey);
34102 _lastLoc = context.projection.invert(point2);
34103 doMove(d3_event, entity);
34104 var nudge = geoViewportEdge(point2, context.map().dimensions());
34106 startNudge(d3_event, entity, nudge);
34111 function end(d3_event, entity) {
34114 var wasPoint = entity.geometry(context.graph()) === "point";
34115 var d = datum2(d3_event);
34116 var nope = d && d.properties && d.properties.nope || context.surface().classed("nope");
34117 var target = d && d.properties && d.properties.entity;
34120 _actionBounceBack(entity.id, _startLoc)
34122 } else if (target && target.type === "way") {
34123 var choice = geoChooseEdge(context.graph().childNodes(target), context.map().mouse(), context.projection, entity.id);
34125 actionAddMidpoint({
34127 edge: [target.nodes[choice.index - 1], target.nodes[choice.index]]
34129 connectAnnotation(entity, target)
34131 } else if (target && target.type === "node" && shouldSnapToNode(target)) {
34133 actionConnect([target.id, entity.id]),
34134 connectAnnotation(entity, target)
34136 } else if (_wasMidpoint) {
34139 _t("operations.add.annotation.vertex")
34144 moveAnnotation(entity)
34148 context.enter(modeSelect(context, [entity.id]));
34150 var reselection = _restoreSelectedIDs.filter(function(id2) {
34151 return context.graph().hasEntity(id2);
34153 if (reselection.length) {
34154 context.enter(modeSelect(context, reselection));
34156 context.enter(modeBrowse(context));
34160 function _actionBounceBack(nodeID, toLoc) {
34161 var moveNode = actionMoveNode(nodeID, toLoc);
34162 var action = function(graph, t) {
34165 return moveNode(graph, t);
34167 action.transitionable = true;
34170 function cancel() {
34172 context.enter(modeBrowse(context));
34174 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);
34175 mode.enter = function() {
34176 context.install(hover);
34177 context.install(edit2);
34178 select_default2(window).on("keydown.dragNode", keydown).on("keyup.dragNode", keyup);
34179 context.history().on("undone.drag-node", cancel);
34181 mode.exit = function() {
34182 context.ui().sidebar.hover.cancel();
34183 context.uninstall(hover);
34184 context.uninstall(edit2);
34185 select_default2(window).on("keydown.dragNode", null).on("keyup.dragNode", null);
34186 context.history().on("undone.drag-node", null);
34187 _activeEntity = null;
34188 context.surface().classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false).selectAll(".active").classed("active", false);
34191 mode.selectedIDs = function() {
34192 if (!arguments.length)
34193 return _activeEntity ? [_activeEntity.id] : [];
34196 mode.activeID = function() {
34197 if (!arguments.length)
34198 return _activeEntity && _activeEntity.id;
34201 mode.restoreSelectedIDs = function(_) {
34202 if (!arguments.length)
34203 return _restoreSelectedIDs;
34204 _restoreSelectedIDs = _;
34207 mode.behavior = drag;
34211 // modules/services/keepRight.js
34212 var import_rbush = __toESM(require_rbush_min());
34214 // node_modules/d3-fetch/src/text.js
34215 function responseText(response) {
34217 throw new Error(response.status + " " + response.statusText);
34218 return response.text();
34220 function text_default3(input, init2) {
34221 return fetch(input, init2).then(responseText);
34224 // node_modules/d3-fetch/src/json.js
34225 function responseJson(response) {
34227 throw new Error(response.status + " " + response.statusText);
34228 if (response.status === 204 || response.status === 205)
34230 return response.json();
34232 function json_default(input, init2) {
34233 return fetch(input, init2).then(responseJson);
34236 // node_modules/d3-fetch/src/xml.js
34237 function parser(type3) {
34238 return (input, init2) => text_default3(input, init2).then((text2) => new DOMParser().parseFromString(text2, type3));
34240 var xml_default = parser("application/xml");
34241 var html = parser("text/html");
34242 var svg = parser("image/svg+xml");
34244 // modules/services/keepRight.js
34245 var tiler = utilTiler();
34246 var dispatch2 = dispatch_default("loaded");
34247 var _tileZoom = 14;
34248 var _krUrlRoot = "https://www.keepright.at";
34249 var _krData = { errorTypes: {}, localizeStrings: {} };
34324 function abortRequest(controller) {
34326 controller.abort();
34329 function abortUnwantedRequests(cache, tiles) {
34330 Object.keys(cache.inflightTile).forEach((k) => {
34331 const wanted = tiles.find((tile) => k === tile.id);
34333 abortRequest(cache.inflightTile[k]);
34334 delete cache.inflightTile[k];
34338 function encodeIssueRtree(d) {
34339 return { minX: d.loc[0], minY: d.loc[1], maxX: d.loc[0], maxY: d.loc[1], data: d };
34341 function updateRtree(item, replace) {
34342 _cache.rtree.remove(item, (a, b) => a.data.id === b.data.id);
34344 _cache.rtree.insert(item);
34347 function tokenReplacements(d) {
34348 if (!(d instanceof QAItem))
34350 const replacements = {};
34351 const issueTemplate = _krData.errorTypes[d.whichType];
34352 if (!issueTemplate) {
34353 console.log("No Template: ", d.whichType);
34354 console.log(" ", d.description);
34357 if (!issueTemplate.regex)
34359 const errorRegex = new RegExp(issueTemplate.regex, "i");
34360 const errorMatch = errorRegex.exec(d.description);
34362 console.log("Unmatched: ", d.whichType);
34363 console.log(" ", d.description);
34364 console.log(" ", errorRegex);
34367 for (let i2 = 1; i2 < errorMatch.length; i2++) {
34368 let capture = errorMatch[i2];
34370 idType = "IDs" in issueTemplate ? issueTemplate.IDs[i2 - 1] : "";
34371 if (idType && capture) {
34372 capture = parseError(capture, idType);
34374 const compare = capture.toLowerCase();
34375 if (_krData.localizeStrings[compare]) {
34376 capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare]);
34378 capture = unescape_default(capture);
34381 replacements["var" + i2] = capture;
34383 return replacements;
34385 function parseError(capture, idType) {
34386 const compare = capture.toLowerCase();
34387 if (_krData.localizeStrings[compare]) {
34388 capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare]);
34392 capture = linkErrorObject2(capture);
34395 capture = linkURL(capture);
34400 capture = linkEntity2(idType + capture);
34403 capture = parse20(capture);
34406 capture = parse211(capture);
34409 capture = parse231(capture);
34412 capture = parse294(capture);
34415 capture = parse370(capture);
34419 function linkErrorObject2(d) {
34420 return { html: `<a class="error_object_link">${d}</a>` };
34422 function linkEntity2(d) {
34423 return { html: `<a class="error_entity_link">${d}</a>` };
34425 function linkURL(d) {
34426 return { html: `<a class="kr_external_link" target="_blank" href="${d}">${d}</a>` };
34428 function parse211(capture2) {
34430 const items = capture2.split(", ");
34431 items.forEach((item) => {
34432 let id2 = linkEntity2("n" + item.slice(1));
34435 return newList.join(", ");
34437 function parse231(capture2) {
34439 const items = capture2.split("),");
34440 items.forEach((item) => {
34441 const match = item.match(/\#(\d+)\((.+)\)?/);
34442 if (match !== null && match.length > 2) {
34444 linkEntity2("w" + match[1]) + " " + _t("QA.keepRight.errorTypes.231.layer", { layer: match[2] })
34448 return newList.join(", ");
34450 function parse294(capture2) {
34452 const items = capture2.split(",");
34453 items.forEach((item) => {
34454 item = item.split(" ");
34455 const role = `"${item[0]}"`;
34456 const idType2 = item[1].slice(0, 1);
34457 let id2 = item[2].slice(1);
34458 id2 = linkEntity2(idType2 + id2);
34459 newList.push(`${role} ${item[1]} ${id2}`);
34461 return newList.join(", ");
34463 function parse370(capture2) {
34466 const match = capture2.match(/\(including the name (\'.+\')\)/);
34467 if (match && match.length) {
34468 return _t("QA.keepRight.errorTypes.370.including_the_name", { name: match[1] });
34472 function parse20(capture2) {
34474 const items = capture2.split(",");
34475 items.forEach((item) => {
34476 const id2 = linkEntity2("n" + item.slice(1));
34479 return newList.join(", ");
34482 var keepRight_default = {
34483 title: "keepRight",
34485 _mainFileFetcher.get("keepRight").then((d) => _krData = d);
34489 this.event = utilRebind(this, dispatch2, "on");
34493 Object.values(_cache.inflightTile).forEach(abortRequest);
34501 rtree: new import_rbush.default()
34504 loadIssues(projection2) {
34509 const tiles = tiler.zoomExtent([_tileZoom, _tileZoom]).getTiles(projection2);
34510 abortUnwantedRequests(_cache, tiles);
34511 tiles.forEach((tile) => {
34512 if (_cache.loadedTile[tile.id] || _cache.inflightTile[tile.id])
34514 const [left, top, right, bottom] = tile.extent.rectangle();
34515 const params = Object.assign({}, options2, { left, bottom, right, top });
34516 const url = `${_krUrlRoot}/export.php?` + utilQsString(params);
34517 const controller = new AbortController();
34518 _cache.inflightTile[tile.id] = controller;
34519 json_default(url, { signal: controller.signal }).then((data) => {
34520 delete _cache.inflightTile[tile.id];
34521 _cache.loadedTile[tile.id] = true;
34522 if (!data || !data.features || !data.features.length) {
34523 throw new Error("No Data");
34525 data.features.forEach((feature3) => {
34528 error_type: itemType,
34531 object_id: objectId,
34532 object_type: objectType,
34538 geometry: { coordinates: loc },
34539 properties: { description = "" }
34541 const issueTemplate = _krData.errorTypes[itemType];
34542 const parentIssueType = (Math.floor(itemType / 10) * 10).toString();
34543 const whichType = issueTemplate ? itemType : parentIssueType;
34544 const whichTemplate = _krData.errorTypes[whichType];
34545 switch (whichType) {
34547 description = `This feature has a FIXME tag: ${description}`;
34551 description = description.replace("A turn-", "This turn-");
34558 description = `This turn-restriction~${description}`;
34561 description = "This highway is missing a maxspeed tag";
34566 description = `This feature~${description}`;
34569 let coincident = false;
34571 let delta = coincident ? [1e-5, 0] : [0, 1e-5];
34572 loc = geoVecAdd(loc, delta);
34573 let bbox2 = geoExtent(loc).bbox();
34574 coincident = _cache.rtree.search(bbox2).length;
34575 } while (coincident);
34576 let d = new QAItem(loc, this, itemType, id2, {
34581 severity: whichTemplate.severity || "error",
34587 d.replacements = tokenReplacements(d);
34588 _cache.data[id2] = d;
34589 _cache.rtree.insert(encodeIssueRtree(d));
34591 dispatch2.call("loaded");
34593 delete _cache.inflightTile[tile.id];
34594 _cache.loadedTile[tile.id] = true;
34598 postUpdate(d, callback) {
34599 if (_cache.inflightPost[d.id]) {
34600 return callback({ message: "Error update already inflight", status: -2 }, d);
34602 const params = { schema: d.schema, id: d.id };
34604 params.st = d.newStatus;
34606 if (d.newComment !== void 0) {
34607 params.co = d.newComment;
34609 const url = `${_krUrlRoot}/comment.php?` + utilQsString(params);
34610 const controller = new AbortController();
34611 _cache.inflightPost[d.id] = controller;
34612 json_default(url, { signal: controller.signal }).finally(() => {
34613 delete _cache.inflightPost[d.id];
34614 if (d.newStatus === "ignore") {
34615 this.removeItem(d);
34616 } else if (d.newStatus === "ignore_t") {
34617 this.removeItem(d);
34618 _cache.closed[`${d.schema}:${d.id}`] = true;
34620 d = this.replaceItem(d.update({
34621 comment: d.newComment,
34622 newComment: void 0,
34630 getItems(projection2) {
34631 const viewport = projection2.clipExtent();
34632 const min3 = [viewport[0][0], viewport[1][1]];
34633 const max3 = [viewport[1][0], viewport[0][1]];
34634 const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
34635 return _cache.rtree.search(bbox2).map((d) => d.data);
34638 return _cache.data[id2];
34640 replaceItem(item) {
34641 if (!(item instanceof QAItem) || !item.id)
34643 _cache.data[item.id] = item;
34644 updateRtree(encodeIssueRtree(item), true);
34648 if (!(item instanceof QAItem) || !item.id)
34650 delete _cache.data[item.id];
34651 updateRtree(encodeIssueRtree(item), false);
34654 return `${_krUrlRoot}/report_map.php?schema=${item.schema}&error=${item.id}`;
34657 return Object.keys(_cache.closed).sort();
34661 // modules/services/improveOSM.js
34662 var import_rbush2 = __toESM(require_rbush_min());
34663 var tiler2 = utilTiler();
34664 var dispatch3 = dispatch_default("loaded");
34665 var _tileZoom2 = 14;
34666 var _impOsmUrls = {
34667 ow: "https://grab.community.improve-osm.org/directionOfFlowService",
34668 mr: "https://grab.community.improve-osm.org/missingGeoService",
34669 tr: "https://grab.community.improve-osm.org/turnRestrictionService"
34671 var _impOsmData = { icons: {} };
34673 function abortRequest2(i2) {
34674 Object.values(i2).forEach((controller) => {
34676 controller.abort();
34680 function abortUnwantedRequests2(cache, tiles) {
34681 Object.keys(cache.inflightTile).forEach((k) => {
34682 const wanted = tiles.find((tile) => k === tile.id);
34684 abortRequest2(cache.inflightTile[k]);
34685 delete cache.inflightTile[k];
34689 function encodeIssueRtree2(d) {
34690 return { minX: d.loc[0], minY: d.loc[1], maxX: d.loc[0], maxY: d.loc[1], data: d };
34692 function updateRtree2(item, replace) {
34693 _cache2.rtree.remove(item, (a, b) => a.data.id === b.data.id);
34695 _cache2.rtree.insert(item);
34698 function linkErrorObject(d) {
34699 return { html: `<a class="error_object_link">${d}</a>` };
34701 function linkEntity(d) {
34702 return { html: `<a class="error_entity_link">${d}</a>` };
34704 function pointAverage(points) {
34705 if (points.length) {
34706 const sum = points.reduce(
34707 (acc, point2) => geoVecAdd(acc, [point2.lon, point2.lat]),
34710 return geoVecScale(sum, 1 / points.length);
34715 function relativeBearing(p1, p2) {
34716 let angle2 = Math.atan2(p2.lon - p1.lon, p2.lat - p1.lat);
34718 angle2 += 2 * Math.PI;
34720 return angle2 * 180 / Math.PI;
34722 function cardinalDirection(bearing) {
34723 const dir = 45 * Math.round(bearing / 45);
34735 return _t(`QA.improveOSM.directions.${compass[dir]}`);
34737 function preventCoincident(loc, bumpUp) {
34738 let coincident = false;
34740 let delta = coincident ? [1e-5, 0] : bumpUp ? [0, 1e-5] : [0, 0];
34741 loc = geoVecAdd(loc, delta);
34742 let bbox2 = geoExtent(loc).bbox();
34743 coincident = _cache2.rtree.search(bbox2).length;
34744 } while (coincident);
34747 var improveOSM_default = {
34748 title: "improveOSM",
34750 _mainFileFetcher.get("qa_data").then((d) => _impOsmData = d.improveOSM);
34754 this.event = utilRebind(this, dispatch3, "on");
34758 Object.values(_cache2.inflightTile).forEach(abortRequest2);
34766 rtree: new import_rbush2.default()
34769 loadIssues(projection2) {
34775 const tiles = tiler2.zoomExtent([_tileZoom2, _tileZoom2]).getTiles(projection2);
34776 abortUnwantedRequests2(_cache2, tiles);
34777 tiles.forEach((tile) => {
34778 if (_cache2.loadedTile[tile.id] || _cache2.inflightTile[tile.id])
34780 const [east, north, west, south] = tile.extent.rectangle();
34781 const params = Object.assign({}, options2, { east, south, west, north });
34782 const requests = {};
34783 Object.keys(_impOsmUrls).forEach((k) => {
34784 const kParams = Object.assign(
34787 k === "mr" ? { type: "PARKING,ROAD,BOTH,PATH" } : { confidenceLevel: "C1" }
34789 const url = `${_impOsmUrls[k]}/search?` + utilQsString(kParams);
34790 const controller = new AbortController();
34791 requests[k] = controller;
34792 json_default(url, { signal: controller.signal }).then((data) => {
34793 delete _cache2.inflightTile[tile.id][k];
34794 if (!Object.keys(_cache2.inflightTile[tile.id]).length) {
34795 delete _cache2.inflightTile[tile.id];
34796 _cache2.loadedTile[tile.id] = true;
34798 if (data.roadSegments) {
34799 data.roadSegments.forEach((feature3) => {
34800 const { points, wayId, fromNodeId, toNodeId } = feature3;
34801 const itemId = `${wayId}${fromNodeId}${toNodeId}`;
34802 let mid = points.length / 2;
34804 if (mid % 1 === 0) {
34805 loc = pointAverage([points[mid - 1], points[mid]]);
34807 mid = points[Math.floor(mid)];
34808 loc = [mid.lon, mid.lat];
34810 loc = preventCoincident(loc, false);
34811 let d = new QAItem(loc, this, k, itemId, {
34822 percentage: feature3.percentOfTrips,
34823 num_trips: feature3.numberOfTrips,
34824 highway: linkErrorObject(_t("QA.keepRight.error_parts.highway")),
34825 from_node: linkEntity("n" + feature3.fromNodeId),
34826 to_node: linkEntity("n" + feature3.toNodeId)
34828 _cache2.data[d.id] = d;
34829 _cache2.rtree.insert(encodeIssueRtree2(d));
34833 data.tiles.forEach((feature3) => {
34834 const { type: type3, x, y, numberOfTrips } = feature3;
34835 const geoType = type3.toLowerCase();
34836 const itemId = `${geoType}${x}${y}${numberOfTrips}`;
34837 let loc = pointAverage(feature3.points);
34838 loc = preventCoincident(loc, false);
34839 let d = new QAItem(loc, this, `${k}-${geoType}`, itemId, {
34841 identifier: { x, y }
34844 num_trips: numberOfTrips,
34845 geometry_type: _t(`QA.improveOSM.geometry_types.${geoType}`)
34847 if (numberOfTrips === -1) {
34848 d.desc = _t("QA.improveOSM.error_types.mr.description_alt", d.replacements);
34850 _cache2.data[d.id] = d;
34851 _cache2.rtree.insert(encodeIssueRtree2(d));
34854 if (data.entities) {
34855 data.entities.forEach((feature3) => {
34856 const { point: point2, id: id2, segments, numberOfPasses, turnType } = feature3;
34857 const itemId = `${id2.replace(/[,:+#]/g, "_")}`;
34858 const loc = preventCoincident([point2.lon, point2.lat], true);
34859 const ids = id2.split(",");
34860 const from_way = ids[0];
34861 const via_node = ids[3];
34862 const to_way = ids[2].split(":")[1];
34863 let d = new QAItem(loc, this, k, itemId, {
34866 objectId: via_node,
34869 const [p1, p2] = segments[0].points;
34870 const dir_of_travel = cardinalDirection(relativeBearing(p1, p2));
34872 num_passed: numberOfPasses,
34873 num_trips: segments[0].numberOfTrips,
34874 turn_restriction: turnType.toLowerCase(),
34875 from_way: linkEntity("w" + from_way),
34876 to_way: linkEntity("w" + to_way),
34877 travel_direction: dir_of_travel,
34878 junction: linkErrorObject(_t("QA.keepRight.error_parts.this_node"))
34880 _cache2.data[d.id] = d;
34881 _cache2.rtree.insert(encodeIssueRtree2(d));
34882 dispatch3.call("loaded");
34886 delete _cache2.inflightTile[tile.id][k];
34887 if (!Object.keys(_cache2.inflightTile[tile.id]).length) {
34888 delete _cache2.inflightTile[tile.id];
34889 _cache2.loadedTile[tile.id] = true;
34893 _cache2.inflightTile[tile.id] = requests;
34896 getComments(item) {
34897 if (item.comments) {
34898 return Promise.resolve(item);
34900 const key = item.issueKey;
34902 if (key === "ow") {
34903 qParams = item.identifier;
34904 } else if (key === "mr") {
34905 qParams.tileX = item.identifier.x;
34906 qParams.tileY = item.identifier.y;
34907 } else if (key === "tr") {
34908 qParams.targetId = item.identifier;
34910 const url = `${_impOsmUrls[key]}/retrieveComments?` + utilQsString(qParams);
34911 const cacheComments = (data) => {
34912 item.comments = data.comments ? data.comments.reverse() : [];
34913 this.replaceItem(item);
34915 return json_default(url).then(cacheComments).then(() => item);
34917 postUpdate(d, callback) {
34918 if (!osm_default.authenticated()) {
34919 return callback({ message: "Not Authenticated", status: -3 }, d);
34921 if (_cache2.inflightPost[d.id]) {
34922 return callback({ message: "Error update already inflight", status: -2 }, d);
34924 osm_default.userDetails(sendPayload.bind(this));
34925 function sendPayload(err, user) {
34927 return callback(err, d);
34929 const key = d.issueKey;
34930 const url = `${_impOsmUrls[key]}/comment`;
34932 username: user.display_name,
34933 targetIds: [d.identifier]
34936 payload.status = d.newStatus;
34937 payload.text = "status changed";
34939 if (d.newComment) {
34940 payload.text = d.newComment;
34942 const controller = new AbortController();
34943 _cache2.inflightPost[d.id] = controller;
34946 signal: controller.signal,
34947 body: JSON.stringify(payload)
34949 json_default(url, options2).then(() => {
34950 delete _cache2.inflightPost[d.id];
34951 if (!d.newStatus) {
34952 const now3 = new Date();
34953 let comments = d.comments ? d.comments : [];
34955 username: payload.username,
34956 text: payload.text,
34957 timestamp: now3.getTime() / 1e3
34959 this.replaceItem(d.update({
34964 this.removeItem(d);
34965 if (d.newStatus === "SOLVED") {
34966 if (!(d.issueKey in _cache2.closed)) {
34967 _cache2.closed[d.issueKey] = 0;
34969 _cache2.closed[d.issueKey] += 1;
34974 }).catch((err2) => {
34975 delete _cache2.inflightPost[d.id];
34977 callback(err2.message);
34981 getItems(projection2) {
34982 const viewport = projection2.clipExtent();
34983 const min3 = [viewport[0][0], viewport[1][1]];
34984 const max3 = [viewport[1][0], viewport[0][1]];
34985 const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
34986 return _cache2.rtree.search(bbox2).map((d) => d.data);
34989 return _cache2.data[id2];
34991 getIcon(itemType) {
34992 return _impOsmData.icons[itemType];
34994 replaceItem(issue) {
34995 if (!(issue instanceof QAItem) || !issue.id)
34997 _cache2.data[issue.id] = issue;
34998 updateRtree2(encodeIssueRtree2(issue), true);
35001 removeItem(issue) {
35002 if (!(issue instanceof QAItem) || !issue.id)
35004 delete _cache2.data[issue.id];
35005 updateRtree2(encodeIssueRtree2(issue), false);
35007 getClosedCounts() {
35008 return _cache2.closed;
35012 // modules/services/osmose.js
35013 var import_rbush3 = __toESM(require_rbush_min());
35015 // node_modules/marked/lib/marked.esm.js
35016 function getDefaults() {
35026 langPrefix: "language-",
35033 smartypants: false,
35039 var defaults = getDefaults();
35040 function changeDefaults(newDefaults) {
35041 defaults = newDefaults;
35043 var escapeTest = /[&<>"']/;
35044 var escapeReplace = /[&<>"']/g;
35045 var escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
35046 var escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
35047 var escapeReplacements = {
35054 var getEscapeReplacement = (ch) => escapeReplacements[ch];
35055 function escape4(html2, encode) {
35057 if (escapeTest.test(html2)) {
35058 return html2.replace(escapeReplace, getEscapeReplacement);
35061 if (escapeTestNoEncode.test(html2)) {
35062 return html2.replace(escapeReplaceNoEncode, getEscapeReplacement);
35067 var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
35068 function unescape3(html2) {
35069 return html2.replace(unescapeTest, (_, n2) => {
35070 n2 = n2.toLowerCase();
35071 if (n2 === "colon")
35073 if (n2.charAt(0) === "#") {
35074 return n2.charAt(1) === "x" ? String.fromCharCode(parseInt(n2.substring(2), 16)) : String.fromCharCode(+n2.substring(1));
35079 var caret = /(^|[^\[])\^/g;
35080 function edit(regex, opt) {
35081 regex = typeof regex === "string" ? regex : regex.source;
35084 replace: (name, val) => {
35085 val = val.source || val;
35086 val = val.replace(caret, "$1");
35087 regex = regex.replace(name, val);
35091 return new RegExp(regex, opt);
35096 var nonWordAndColonTest = /[^\w:]/g;
35097 var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
35098 function cleanUrl(sanitize, base, href) {
35102 prot = decodeURIComponent(unescape3(href)).replace(nonWordAndColonTest, "").toLowerCase();
35106 if (prot.indexOf("javascript:") === 0 || prot.indexOf("vbscript:") === 0 || prot.indexOf("data:") === 0) {
35110 if (base && !originIndependentUrl.test(href)) {
35111 href = resolveUrl(base, href);
35114 href = encodeURI(href).replace(/%25/g, "%");
35121 var justDomain = /^[^:]+:\/*[^/]*$/;
35122 var protocol = /^([^:]+:)[\s\S]*$/;
35123 var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
35124 function resolveUrl(base, href) {
35125 if (!baseUrls[" " + base]) {
35126 if (justDomain.test(base)) {
35127 baseUrls[" " + base] = base + "/";
35129 baseUrls[" " + base] = rtrim(base, "/", true);
35132 base = baseUrls[" " + base];
35133 const relativeBase = base.indexOf(":") === -1;
35134 if (href.substring(0, 2) === "//") {
35135 if (relativeBase) {
35138 return base.replace(protocol, "$1") + href;
35139 } else if (href.charAt(0) === "/") {
35140 if (relativeBase) {
35143 return base.replace(domain, "$1") + href;
35145 return base + href;
35148 var noopTest = { exec: function noopTest2() {
35150 function merge2(obj) {
35151 let i2 = 1, target, key;
35152 for (; i2 < arguments.length; i2++) {
35153 target = arguments[i2];
35154 for (key in target) {
35155 if (Object.prototype.hasOwnProperty.call(target, key)) {
35156 obj[key] = target[key];
35162 function splitCells(tableRow, count) {
35163 const row = tableRow.replace(/\|/g, (match, offset, str2) => {
35164 let escaped = false, curr = offset;
35165 while (--curr >= 0 && str2[curr] === "\\")
35166 escaped = !escaped;
35172 }), cells = row.split(/ \|/);
35174 if (!cells[0].trim()) {
35177 if (cells.length > 0 && !cells[cells.length - 1].trim()) {
35180 if (cells.length > count) {
35181 cells.splice(count);
35183 while (cells.length < count)
35186 for (; i2 < cells.length; i2++) {
35187 cells[i2] = cells[i2].trim().replace(/\\\|/g, "|");
35191 function rtrim(str2, c, invert) {
35192 const l = str2.length;
35197 while (suffLen < l) {
35198 const currChar = str2.charAt(l - suffLen - 1);
35199 if (currChar === c && !invert) {
35201 } else if (currChar !== c && invert) {
35207 return str2.slice(0, l - suffLen);
35209 function findClosingBracket(str2, b) {
35210 if (str2.indexOf(b[1]) === -1) {
35213 const l = str2.length;
35214 let level = 0, i2 = 0;
35215 for (; i2 < l; i2++) {
35216 if (str2[i2] === "\\") {
35218 } else if (str2[i2] === b[0]) {
35220 } else if (str2[i2] === b[1]) {
35229 function checkSanitizeDeprecation(opt) {
35230 if (opt && opt.sanitize && !opt.silent) {
35231 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");
35234 function repeatString(pattern, count) {
35239 while (count > 1) {
35244 pattern += pattern;
35246 return result + pattern;
35248 function outputLink(cap, link2, raw, lexer2) {
35249 const href = link2.href;
35250 const title = link2.title ? escape4(link2.title) : null;
35251 const text2 = cap[1].replace(/\\([\[\]])/g, "$1");
35252 if (cap[0].charAt(0) !== "!") {
35253 lexer2.state.inLink = true;
35260 tokens: lexer2.inlineTokens(text2)
35262 lexer2.state.inLink = false;
35270 text: escape4(text2)
35273 function indentCodeCompensation(raw, text2) {
35274 const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
35275 if (matchIndentToCode === null) {
35278 const indentToCode = matchIndentToCode[1];
35279 return text2.split("\n").map((node) => {
35280 const matchIndentInNode = node.match(/^\s+/);
35281 if (matchIndentInNode === null) {
35284 const [indentInNode] = matchIndentInNode;
35285 if (indentInNode.length >= indentToCode.length) {
35286 return node.slice(indentToCode.length);
35291 var Tokenizer = class {
35292 constructor(options2) {
35293 this.options = options2 || defaults;
35296 const cap = this.rules.block.newline.exec(src);
35297 if (cap && cap[0].length > 0) {
35305 const cap = this.rules.block.code.exec(src);
35307 const text2 = cap[0].replace(/^ {1,4}/gm, "");
35311 codeBlockStyle: "indented",
35312 text: !this.options.pedantic ? rtrim(text2, "\n") : text2
35317 const cap = this.rules.block.fences.exec(src);
35319 const raw = cap[0];
35320 const text2 = indentCodeCompensation(raw, cap[3] || "");
35324 lang: cap[2] ? cap[2].trim().replace(this.rules.inline._escapes, "$1") : cap[2],
35330 const cap = this.rules.block.heading.exec(src);
35332 let text2 = cap[2].trim();
35333 if (/#$/.test(text2)) {
35334 const trimmed = rtrim(text2, "#");
35335 if (this.options.pedantic) {
35336 text2 = trimmed.trim();
35337 } else if (!trimmed || / $/.test(trimmed)) {
35338 text2 = trimmed.trim();
35344 depth: cap[1].length,
35346 tokens: this.lexer.inline(text2)
35351 const cap = this.rules.block.hr.exec(src);
35360 const cap = this.rules.block.blockquote.exec(src);
35362 const text2 = cap[0].replace(/^ *>[ \t]?/gm, "");
35364 type: "blockquote",
35366 tokens: this.lexer.blockTokens(text2, []),
35372 let cap = this.rules.block.list.exec(src);
35374 let raw, istask, ischecked, indent2, i2, blankLine, endsWithBlankLine, line, nextLine, rawLine, itemContents, endEarly;
35375 let bull = cap[1].trim();
35376 const isordered = bull.length > 1;
35380 ordered: isordered,
35381 start: isordered ? +bull.slice(0, -1) : "",
35385 bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
35386 if (this.options.pedantic) {
35387 bull = isordered ? bull : "[*+-]";
35389 const itemRegex = new RegExp(`^( {0,3}${bull})((?:[ ][^\\n]*)?(?:\\n|$))`);
35392 if (!(cap = itemRegex.exec(src))) {
35395 if (this.rules.block.hr.test(src)) {
35399 src = src.substring(raw.length);
35400 line = cap[2].split("\n", 1)[0];
35401 nextLine = src.split("\n", 1)[0];
35402 if (this.options.pedantic) {
35404 itemContents = line.trimLeft();
35406 indent2 = cap[2].search(/[^ ]/);
35407 indent2 = indent2 > 4 ? 1 : indent2;
35408 itemContents = line.slice(indent2);
35409 indent2 += cap[1].length;
35412 if (!line && /^ *$/.test(nextLine)) {
35413 raw += nextLine + "\n";
35414 src = src.substring(nextLine.length + 1);
35418 const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?: [^\\n]*)?(?:\\n|$))`);
35419 const hrRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
35420 const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}(?:\`\`\`|~~~)`);
35421 const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}#`);
35423 rawLine = src.split("\n", 1)[0];
35425 if (this.options.pedantic) {
35426 line = line.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ");
35428 if (fencesBeginRegex.test(line)) {
35431 if (headingBeginRegex.test(line)) {
35434 if (nextBulletRegex.test(line)) {
35437 if (hrRegex.test(src)) {
35440 if (line.search(/[^ ]/) >= indent2 || !line.trim()) {
35441 itemContents += "\n" + line.slice(indent2);
35442 } else if (!blankLine) {
35443 itemContents += "\n" + line;
35447 if (!blankLine && !line.trim()) {
35450 raw += rawLine + "\n";
35451 src = src.substring(rawLine.length + 1);
35455 if (endsWithBlankLine) {
35457 } else if (/\n *\n *$/.test(raw)) {
35458 endsWithBlankLine = true;
35461 if (this.options.gfm) {
35462 istask = /^\[[ xX]\] /.exec(itemContents);
35464 ischecked = istask[0] !== "[ ] ";
35465 itemContents = itemContents.replace(/^\[[ xX]\] +/, "");
35472 checked: ischecked,
35478 list.items[list.items.length - 1].raw = raw.trimRight();
35479 list.items[list.items.length - 1].text = itemContents.trimRight();
35480 list.raw = list.raw.trimRight();
35481 const l = list.items.length;
35482 for (i2 = 0; i2 < l; i2++) {
35483 this.lexer.state.top = false;
35484 list.items[i2].tokens = this.lexer.blockTokens(list.items[i2].text, []);
35485 const spacers = list.items[i2].tokens.filter((t) => t.type === "space");
35486 const hasMultipleLineBreaks = spacers.every((t) => {
35487 const chars = t.raw.split("");
35488 let lineBreaks = 0;
35489 for (const char of chars) {
35490 if (char === "\n") {
35493 if (lineBreaks > 1) {
35499 if (!list.loose && spacers.length && hasMultipleLineBreaks) {
35501 list.items[i2].loose = true;
35508 const cap = this.rules.block.html.exec(src);
35513 pre: !this.options.sanitizer && (cap[1] === "pre" || cap[1] === "script" || cap[1] === "style"),
35516 if (this.options.sanitize) {
35517 const text2 = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]);
35518 token.type = "paragraph";
35519 token.text = text2;
35520 token.tokens = this.lexer.inline(text2);
35526 const cap = this.rules.block.def.exec(src);
35529 cap[3] = cap[3].substring(1, cap[3].length - 1);
35530 const tag = cap[1].toLowerCase().replace(/\s+/g, " ");
35535 href: cap[2] ? cap[2].replace(this.rules.inline._escapes, "$1") : cap[2],
35536 title: cap[3] ? cap[3].replace(this.rules.inline._escapes, "$1") : cap[3]
35541 const cap = this.rules.block.table.exec(src);
35545 header: splitCells(cap[1]).map((c) => {
35546 return { text: c };
35548 align: cap[2].replace(/^ *|\| *$/g, "").split(/ *\| */),
35549 rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, "").split("\n") : []
35551 if (item.header.length === item.align.length) {
35553 let l = item.align.length;
35554 let i2, j2, k, row;
35555 for (i2 = 0; i2 < l; i2++) {
35556 if (/^ *-+: *$/.test(item.align[i2])) {
35557 item.align[i2] = "right";
35558 } else if (/^ *:-+: *$/.test(item.align[i2])) {
35559 item.align[i2] = "center";
35560 } else if (/^ *:-+ *$/.test(item.align[i2])) {
35561 item.align[i2] = "left";
35563 item.align[i2] = null;
35566 l = item.rows.length;
35567 for (i2 = 0; i2 < l; i2++) {
35568 item.rows[i2] = splitCells(item.rows[i2], item.header.length).map((c) => {
35569 return { text: c };
35572 l = item.header.length;
35573 for (j2 = 0; j2 < l; j2++) {
35574 item.header[j2].tokens = this.lexer.inline(item.header[j2].text);
35576 l = item.rows.length;
35577 for (j2 = 0; j2 < l; j2++) {
35578 row = item.rows[j2];
35579 for (k = 0; k < row.length; k++) {
35580 row[k].tokens = this.lexer.inline(row[k].text);
35588 const cap = this.rules.block.lheading.exec(src);
35593 depth: cap[2].charAt(0) === "=" ? 1 : 2,
35595 tokens: this.lexer.inline(cap[1])
35600 const cap = this.rules.block.paragraph.exec(src);
35602 const text2 = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1];
35607 tokens: this.lexer.inline(text2)
35612 const cap = this.rules.block.text.exec(src);
35618 tokens: this.lexer.inline(cap[0])
35623 const cap = this.rules.inline.escape.exec(src);
35628 text: escape4(cap[1])
35633 const cap = this.rules.inline.tag.exec(src);
35635 if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
35636 this.lexer.state.inLink = true;
35637 } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
35638 this.lexer.state.inLink = false;
35640 if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
35641 this.lexer.state.inRawBlock = true;
35642 } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
35643 this.lexer.state.inRawBlock = false;
35646 type: this.options.sanitize ? "text" : "html",
35648 inLink: this.lexer.state.inLink,
35649 inRawBlock: this.lexer.state.inRawBlock,
35650 text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]) : cap[0]
35655 const cap = this.rules.inline.link.exec(src);
35657 const trimmedUrl = cap[2].trim();
35658 if (!this.options.pedantic && /^</.test(trimmedUrl)) {
35659 if (!/>$/.test(trimmedUrl)) {
35662 const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
35663 if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
35667 const lastParenIndex = findClosingBracket(cap[2], "()");
35668 if (lastParenIndex > -1) {
35669 const start2 = cap[0].indexOf("!") === 0 ? 5 : 4;
35670 const linkLen = start2 + cap[1].length + lastParenIndex;
35671 cap[2] = cap[2].substring(0, lastParenIndex);
35672 cap[0] = cap[0].substring(0, linkLen).trim();
35678 if (this.options.pedantic) {
35679 const link2 = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
35685 title = cap[3] ? cap[3].slice(1, -1) : "";
35687 href = href.trim();
35688 if (/^</.test(href)) {
35689 if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
35690 href = href.slice(1);
35692 href = href.slice(1, -1);
35695 return outputLink(cap, {
35696 href: href ? href.replace(this.rules.inline._escapes, "$1") : href,
35697 title: title ? title.replace(this.rules.inline._escapes, "$1") : title
35698 }, cap[0], this.lexer);
35701 reflink(src, links) {
35703 if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
35704 let link2 = (cap[2] || cap[1]).replace(/\s+/g, " ");
35705 link2 = links[link2.toLowerCase()];
35706 if (!link2 || !link2.href) {
35707 const text2 = cap[0].charAt(0);
35714 return outputLink(cap, link2, cap[0], this.lexer);
35717 emStrong(src, maskedSrc, prevChar = "") {
35718 let match = this.rules.inline.emStrong.lDelim.exec(src);
35721 if (match[3] && prevChar.match(/[\p{L}\p{N}]/u))
35723 const nextChar = match[1] || match[2] || "";
35724 if (!nextChar || nextChar && (prevChar === "" || this.rules.inline.punctuation.exec(prevChar))) {
35725 const lLength = match[0].length - 1;
35726 let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
35727 const endReg = match[0][0] === "*" ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
35728 endReg.lastIndex = 0;
35729 maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
35730 while ((match = endReg.exec(maskedSrc)) != null) {
35731 rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
35734 rLength = rDelim.length;
35735 if (match[3] || match[4]) {
35736 delimTotal += rLength;
35738 } else if (match[5] || match[6]) {
35739 if (lLength % 3 && !((lLength + rLength) % 3)) {
35740 midDelimTotal += rLength;
35744 delimTotal -= rLength;
35745 if (delimTotal > 0)
35747 rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
35748 const raw = src.slice(0, lLength + match.index + (match[0].length - rDelim.length) + rLength);
35749 if (Math.min(lLength, rLength) % 2) {
35750 const text3 = raw.slice(1, -1);
35755 tokens: this.lexer.inlineTokens(text3)
35758 const text2 = raw.slice(2, -2);
35763 tokens: this.lexer.inlineTokens(text2)
35769 const cap = this.rules.inline.code.exec(src);
35771 let text2 = cap[2].replace(/\n/g, " ");
35772 const hasNonSpaceChars = /[^ ]/.test(text2);
35773 const hasSpaceCharsOnBothEnds = /^ /.test(text2) && / $/.test(text2);
35774 if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
35775 text2 = text2.substring(1, text2.length - 1);
35777 text2 = escape4(text2, true);
35786 const cap = this.rules.inline.br.exec(src);
35795 const cap = this.rules.inline.del.exec(src);
35801 tokens: this.lexer.inlineTokens(cap[2])
35805 autolink(src, mangle2) {
35806 const cap = this.rules.inline.autolink.exec(src);
35809 if (cap[2] === "@") {
35810 text2 = escape4(this.options.mangle ? mangle2(cap[1]) : cap[1]);
35811 href = "mailto:" + text2;
35813 text2 = escape4(cap[1]);
35831 url(src, mangle2) {
35833 if (cap = this.rules.inline.url.exec(src)) {
35835 if (cap[2] === "@") {
35836 text2 = escape4(this.options.mangle ? mangle2(cap[0]) : cap[0]);
35837 href = "mailto:" + text2;
35841 prevCapZero = cap[0];
35842 cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
35843 } while (prevCapZero !== cap[0]);
35844 text2 = escape4(cap[0]);
35845 if (cap[1] === "www.") {
35846 href = "http://" + text2;
35866 inlineText(src, smartypants2) {
35867 const cap = this.rules.inline.text.exec(src);
35870 if (this.lexer.state.inRawBlock) {
35871 text2 = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]) : cap[0];
35873 text2 = escape4(this.options.smartypants ? smartypants2(cap[0]) : cap[0]);
35884 newline: /^(?: *(?:\n|$))+/,
35885 code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
35886 fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
35887 hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
35888 heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
35889 blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
35890 list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
35891 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|$))",
35892 def: /^ {0,3}\[(label)\]: *(?:\n *)?<?([^\s>]+)>?(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
35894 lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,
35895 _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
35898 block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
35899 block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
35900 block.def = edit(block.def).replace("label", block._label).replace("title", block._title).getRegex();
35901 block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
35902 block.listItemStart = edit(/^( *)(bull) */).replace("bull", block.bullet).getRegex();
35903 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();
35904 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";
35905 block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
35906 block.html = edit(block.html, "i").replace("comment", block._comment).replace("tag", block._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
35907 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();
35908 block.blockquote = edit(block.blockquote).replace("paragraph", block.paragraph).getRegex();
35909 block.normal = merge2({}, block);
35910 block.gfm = merge2({}, block.normal, {
35911 table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
35913 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();
35914 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();
35915 block.pedantic = merge2({}, block.normal, {
35917 `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
35918 ).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(),
35919 def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
35920 heading: /^(#{1,6})(.*)(?:\n+|$)/,
35922 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()
35925 escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
35926 autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
35928 tag: "^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",
35929 link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
35930 reflink: /^!?\[(label)\]\[(ref)\]/,
35931 nolink: /^!?\[(ref)\](?:\[\])?/,
35932 reflinkSearch: "reflink|nolink(?!\\()",
35934 lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
35935 rDelimAst: /^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,
35936 rDelimUnd: /^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/
35938 code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
35939 br: /^( {2,}|\\)\n(?!\s*$)/,
35941 text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
35942 punctuation: /^([\spunctuation])/
35944 inline._punctuation = "!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";
35945 inline.punctuation = edit(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex();
35946 inline.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
35947 inline.escapedEmSt = /(?:^|[^\\])(?:\\\\)*\\[*_]/g;
35948 inline._comment = edit(block._comment).replace("(?:-->|$)", "-->").getRegex();
35949 inline.emStrong.lDelim = edit(inline.emStrong.lDelim).replace(/punct/g, inline._punctuation).getRegex();
35950 inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, "g").replace(/punct/g, inline._punctuation).getRegex();
35951 inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, "g").replace(/punct/g, inline._punctuation).getRegex();
35952 inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
35953 inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
35954 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])?)+(?![-_])/;
35955 inline.autolink = edit(inline.autolink).replace("scheme", inline._scheme).replace("email", inline._email).getRegex();
35956 inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
35957 inline.tag = edit(inline.tag).replace("comment", inline._comment).replace("attribute", inline._attribute).getRegex();
35958 inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
35959 inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
35960 inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
35961 inline.link = edit(inline.link).replace("label", inline._label).replace("href", inline._href).replace("title", inline._title).getRegex();
35962 inline.reflink = edit(inline.reflink).replace("label", inline._label).replace("ref", block._label).getRegex();
35963 inline.nolink = edit(inline.nolink).replace("ref", block._label).getRegex();
35964 inline.reflinkSearch = edit(inline.reflinkSearch, "g").replace("reflink", inline.reflink).replace("nolink", inline.nolink).getRegex();
35965 inline.normal = merge2({}, inline);
35966 inline.pedantic = merge2({}, inline.normal, {
35969 middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
35970 endAst: /\*\*(?!\*)/g,
35975 middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
35976 endAst: /\*(?!\*)/g,
35979 link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", inline._label).getRegex(),
35980 reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", inline._label).getRegex()
35982 inline.gfm = merge2({}, inline.normal, {
35983 escape: edit(inline.escape).replace("])", "~|])").getRegex(),
35984 _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
35985 url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
35986 _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
35987 del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
35988 text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
35990 inline.gfm.url = edit(inline.gfm.url, "i").replace("email", inline.gfm._extended_email).getRegex();
35991 inline.breaks = merge2({}, inline.gfm, {
35992 br: edit(inline.br).replace("{2,}", "*").getRegex(),
35993 text: edit(inline.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
35995 function smartypants(text2) {
35996 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");
35998 function mangle(text2) {
35999 let out = "", i2, ch;
36000 const l = text2.length;
36001 for (i2 = 0; i2 < l; i2++) {
36002 ch = text2.charCodeAt(i2);
36003 if (Math.random() > 0.5) {
36004 ch = "x" + ch.toString(16);
36006 out += "&#" + ch + ";";
36010 var Lexer = class {
36011 constructor(options2) {
36013 this.tokens.links = /* @__PURE__ */ Object.create(null);
36014 this.options = options2 || defaults;
36015 this.options.tokenizer = this.options.tokenizer || new Tokenizer();
36016 this.tokenizer = this.options.tokenizer;
36017 this.tokenizer.options = this.options;
36018 this.tokenizer.lexer = this;
36019 this.inlineQueue = [];
36026 block: block.normal,
36027 inline: inline.normal
36029 if (this.options.pedantic) {
36030 rules.block = block.pedantic;
36031 rules.inline = inline.pedantic;
36032 } else if (this.options.gfm) {
36033 rules.block = block.gfm;
36034 if (this.options.breaks) {
36035 rules.inline = inline.breaks;
36037 rules.inline = inline.gfm;
36040 this.tokenizer.rules = rules;
36042 static get rules() {
36048 static lex(src, options2) {
36049 const lexer2 = new Lexer(options2);
36050 return lexer2.lex(src);
36052 static lexInline(src, options2) {
36053 const lexer2 = new Lexer(options2);
36054 return lexer2.inlineTokens(src);
36057 src = src.replace(/\r\n|\r/g, "\n");
36058 this.blockTokens(src, this.tokens);
36060 while (next = this.inlineQueue.shift()) {
36061 this.inlineTokens(next.src, next.tokens);
36063 return this.tokens;
36065 blockTokens(src, tokens = []) {
36066 if (this.options.pedantic) {
36067 src = src.replace(/\t/g, " ").replace(/^ +$/gm, "");
36069 src = src.replace(/^( *)(\t+)/gm, (_, leading, tabs) => {
36070 return leading + " ".repeat(tabs.length);
36073 let token, lastToken, cutSrc, lastParagraphClipped;
36075 if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((extTokenizer) => {
36076 if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
36077 src = src.substring(token.raw.length);
36078 tokens.push(token);
36085 if (token = this.tokenizer.space(src)) {
36086 src = src.substring(token.raw.length);
36087 if (token.raw.length === 1 && tokens.length > 0) {
36088 tokens[tokens.length - 1].raw += "\n";
36090 tokens.push(token);
36094 if (token = this.tokenizer.code(src)) {
36095 src = src.substring(token.raw.length);
36096 lastToken = tokens[tokens.length - 1];
36097 if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
36098 lastToken.raw += "\n" + token.raw;
36099 lastToken.text += "\n" + token.text;
36100 this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
36102 tokens.push(token);
36106 if (token = this.tokenizer.fences(src)) {
36107 src = src.substring(token.raw.length);
36108 tokens.push(token);
36111 if (token = this.tokenizer.heading(src)) {
36112 src = src.substring(token.raw.length);
36113 tokens.push(token);
36116 if (token = this.tokenizer.hr(src)) {
36117 src = src.substring(token.raw.length);
36118 tokens.push(token);
36121 if (token = this.tokenizer.blockquote(src)) {
36122 src = src.substring(token.raw.length);
36123 tokens.push(token);
36126 if (token = this.tokenizer.list(src)) {
36127 src = src.substring(token.raw.length);
36128 tokens.push(token);
36131 if (token = this.tokenizer.html(src)) {
36132 src = src.substring(token.raw.length);
36133 tokens.push(token);
36136 if (token = this.tokenizer.def(src)) {
36137 src = src.substring(token.raw.length);
36138 lastToken = tokens[tokens.length - 1];
36139 if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
36140 lastToken.raw += "\n" + token.raw;
36141 lastToken.text += "\n" + token.raw;
36142 this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
36143 } else if (!this.tokens.links[token.tag]) {
36144 this.tokens.links[token.tag] = {
36151 if (token = this.tokenizer.table(src)) {
36152 src = src.substring(token.raw.length);
36153 tokens.push(token);
36156 if (token = this.tokenizer.lheading(src)) {
36157 src = src.substring(token.raw.length);
36158 tokens.push(token);
36162 if (this.options.extensions && this.options.extensions.startBlock) {
36163 let startIndex = Infinity;
36164 const tempSrc = src.slice(1);
36166 this.options.extensions.startBlock.forEach(function(getStartIndex) {
36167 tempStart = getStartIndex.call({ lexer: this }, tempSrc);
36168 if (typeof tempStart === "number" && tempStart >= 0) {
36169 startIndex = Math.min(startIndex, tempStart);
36172 if (startIndex < Infinity && startIndex >= 0) {
36173 cutSrc = src.substring(0, startIndex + 1);
36176 if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
36177 lastToken = tokens[tokens.length - 1];
36178 if (lastParagraphClipped && lastToken.type === "paragraph") {
36179 lastToken.raw += "\n" + token.raw;
36180 lastToken.text += "\n" + token.text;
36181 this.inlineQueue.pop();
36182 this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
36184 tokens.push(token);
36186 lastParagraphClipped = cutSrc.length !== src.length;
36187 src = src.substring(token.raw.length);
36190 if (token = this.tokenizer.text(src)) {
36191 src = src.substring(token.raw.length);
36192 lastToken = tokens[tokens.length - 1];
36193 if (lastToken && lastToken.type === "text") {
36194 lastToken.raw += "\n" + token.raw;
36195 lastToken.text += "\n" + token.text;
36196 this.inlineQueue.pop();
36197 this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
36199 tokens.push(token);
36204 const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
36205 if (this.options.silent) {
36206 console.error(errMsg);
36209 throw new Error(errMsg);
36213 this.state.top = true;
36216 inline(src, tokens = []) {
36217 this.inlineQueue.push({ src, tokens });
36220 inlineTokens(src, tokens = []) {
36221 let token, lastToken, cutSrc;
36222 let maskedSrc = src;
36224 let keepPrevChar, prevChar;
36225 if (this.tokens.links) {
36226 const links = Object.keys(this.tokens.links);
36227 if (links.length > 0) {
36228 while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
36229 if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) {
36230 maskedSrc = maskedSrc.slice(0, match.index) + "[" + repeatString("a", match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
36235 while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
36236 maskedSrc = maskedSrc.slice(0, match.index) + "[" + repeatString("a", match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
36238 while ((match = this.tokenizer.rules.inline.escapedEmSt.exec(maskedSrc)) != null) {
36239 maskedSrc = maskedSrc.slice(0, match.index + match[0].length - 2) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);
36240 this.tokenizer.rules.inline.escapedEmSt.lastIndex--;
36243 if (!keepPrevChar) {
36246 keepPrevChar = false;
36247 if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((extTokenizer) => {
36248 if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
36249 src = src.substring(token.raw.length);
36250 tokens.push(token);
36257 if (token = this.tokenizer.escape(src)) {
36258 src = src.substring(token.raw.length);
36259 tokens.push(token);
36262 if (token = this.tokenizer.tag(src)) {
36263 src = src.substring(token.raw.length);
36264 lastToken = tokens[tokens.length - 1];
36265 if (lastToken && token.type === "text" && lastToken.type === "text") {
36266 lastToken.raw += token.raw;
36267 lastToken.text += token.text;
36269 tokens.push(token);
36273 if (token = this.tokenizer.link(src)) {
36274 src = src.substring(token.raw.length);
36275 tokens.push(token);
36278 if (token = this.tokenizer.reflink(src, this.tokens.links)) {
36279 src = src.substring(token.raw.length);
36280 lastToken = tokens[tokens.length - 1];
36281 if (lastToken && token.type === "text" && lastToken.type === "text") {
36282 lastToken.raw += token.raw;
36283 lastToken.text += token.text;
36285 tokens.push(token);
36289 if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
36290 src = src.substring(token.raw.length);
36291 tokens.push(token);
36294 if (token = this.tokenizer.codespan(src)) {
36295 src = src.substring(token.raw.length);
36296 tokens.push(token);
36299 if (token = this.tokenizer.br(src)) {
36300 src = src.substring(token.raw.length);
36301 tokens.push(token);
36304 if (token = this.tokenizer.del(src)) {
36305 src = src.substring(token.raw.length);
36306 tokens.push(token);
36309 if (token = this.tokenizer.autolink(src, mangle)) {
36310 src = src.substring(token.raw.length);
36311 tokens.push(token);
36314 if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
36315 src = src.substring(token.raw.length);
36316 tokens.push(token);
36320 if (this.options.extensions && this.options.extensions.startInline) {
36321 let startIndex = Infinity;
36322 const tempSrc = src.slice(1);
36324 this.options.extensions.startInline.forEach(function(getStartIndex) {
36325 tempStart = getStartIndex.call({ lexer: this }, tempSrc);
36326 if (typeof tempStart === "number" && tempStart >= 0) {
36327 startIndex = Math.min(startIndex, tempStart);
36330 if (startIndex < Infinity && startIndex >= 0) {
36331 cutSrc = src.substring(0, startIndex + 1);
36334 if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
36335 src = src.substring(token.raw.length);
36336 if (token.raw.slice(-1) !== "_") {
36337 prevChar = token.raw.slice(-1);
36339 keepPrevChar = true;
36340 lastToken = tokens[tokens.length - 1];
36341 if (lastToken && lastToken.type === "text") {
36342 lastToken.raw += token.raw;
36343 lastToken.text += token.text;
36345 tokens.push(token);
36350 const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
36351 if (this.options.silent) {
36352 console.error(errMsg);
36355 throw new Error(errMsg);
36362 var Renderer = class {
36363 constructor(options2) {
36364 this.options = options2 || defaults;
36366 code(code, infostring, escaped) {
36367 const lang = (infostring || "").match(/\S*/)[0];
36368 if (this.options.highlight) {
36369 const out = this.options.highlight(code, lang);
36370 if (out != null && out !== code) {
36375 code = code.replace(/\n$/, "") + "\n";
36377 return "<pre><code>" + (escaped ? code : escape4(code, true)) + "</code></pre>\n";
36379 return '<pre><code class="' + this.options.langPrefix + escape4(lang, true) + '">' + (escaped ? code : escape4(code, true)) + "</code></pre>\n";
36381 blockquote(quote2) {
36382 return `<blockquote>
36383 ${quote2}</blockquote>
36389 heading(text2, level, raw, slugger) {
36390 if (this.options.headerIds) {
36391 const id2 = this.options.headerPrefix + slugger.slug(raw);
36392 return `<h${level} id="${id2}">${text2}</h${level}>
36395 return `<h${level}>${text2}</h${level}>
36399 return this.options.xhtml ? "<hr/>\n" : "<hr>\n";
36401 list(body, ordered, start2) {
36402 const type3 = ordered ? "ol" : "ul", startatt = ordered && start2 !== 1 ? ' start="' + start2 + '"' : "";
36403 return "<" + type3 + startatt + ">\n" + body + "</" + type3 + ">\n";
36406 return `<li>${text2}</li>
36409 checkbox(checked) {
36410 return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox"' + (this.options.xhtml ? " /" : "") + "> ";
36413 return `<p>${text2}</p>
36416 table(header, body) {
36418 body = `<tbody>${body}</tbody>`;
36419 return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
36421 tablerow(content) {
36426 tablecell(content, flags) {
36427 const type3 = flags.header ? "th" : "td";
36428 const tag = flags.align ? `<${type3} align="${flags.align}">` : `<${type3}>`;
36429 return tag + content + `</${type3}>
36433 return `<strong>${text2}</strong>`;
36436 return `<em>${text2}</em>`;
36439 return `<code>${text2}</code>`;
36442 return this.options.xhtml ? "<br/>" : "<br>";
36445 return `<del>${text2}</del>`;
36447 link(href, title, text2) {
36448 href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
36449 if (href === null) {
36452 let out = '<a href="' + escape4(href) + '"';
36454 out += ' title="' + title + '"';
36456 out += ">" + text2 + "</a>";
36459 image(href, title, text2) {
36460 href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
36461 if (href === null) {
36464 let out = `<img src="${href}" alt="${text2}"`;
36466 out += ` title="${title}"`;
36468 out += this.options.xhtml ? "/>" : ">";
36475 var TextRenderer = class {
36494 link(href, title, text2) {
36497 image(href, title, text2) {
36504 var Slugger = class {
36509 return value.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig, "").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, "").replace(/\s/g, "-");
36511 getNextSafeSlug(originalSlug, isDryRun) {
36512 let slug = originalSlug;
36513 let occurenceAccumulator = 0;
36514 if (this.seen.hasOwnProperty(slug)) {
36515 occurenceAccumulator = this.seen[originalSlug];
36517 occurenceAccumulator++;
36518 slug = originalSlug + "-" + occurenceAccumulator;
36519 } while (this.seen.hasOwnProperty(slug));
36522 this.seen[originalSlug] = occurenceAccumulator;
36523 this.seen[slug] = 0;
36527 slug(value, options2 = {}) {
36528 const slug = this.serialize(value);
36529 return this.getNextSafeSlug(slug, options2.dryrun);
36532 var Parser = class {
36533 constructor(options2) {
36534 this.options = options2 || defaults;
36535 this.options.renderer = this.options.renderer || new Renderer();
36536 this.renderer = this.options.renderer;
36537 this.renderer.options = this.options;
36538 this.textRenderer = new TextRenderer();
36539 this.slugger = new Slugger();
36541 static parse(tokens, options2) {
36542 const parser3 = new Parser(options2);
36543 return parser3.parse(tokens);
36545 static parseInline(tokens, options2) {
36546 const parser3 = new Parser(options2);
36547 return parser3.parseInline(tokens);
36549 parse(tokens, top = true) {
36550 let out = "", i2, j2, k, l2, l3, row, cell, header, body, token, ordered, start2, loose, itemBody, item, checked, task, checkbox, ret;
36551 const l = tokens.length;
36552 for (i2 = 0; i2 < l; i2++) {
36553 token = tokens[i2];
36554 if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
36555 ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
36556 if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(token.type)) {
36561 switch (token.type) {
36566 out += this.renderer.hr();
36570 out += this.renderer.heading(
36571 this.parseInline(token.tokens),
36573 unescape3(this.parseInline(token.tokens, this.textRenderer)),
36579 out += this.renderer.code(
36589 l2 = token.header.length;
36590 for (j2 = 0; j2 < l2; j2++) {
36591 cell += this.renderer.tablecell(
36592 this.parseInline(token.header[j2].tokens),
36593 { header: true, align: token.align[j2] }
36596 header += this.renderer.tablerow(cell);
36598 l2 = token.rows.length;
36599 for (j2 = 0; j2 < l2; j2++) {
36600 row = token.rows[j2];
36603 for (k = 0; k < l3; k++) {
36604 cell += this.renderer.tablecell(
36605 this.parseInline(row[k].tokens),
36606 { header: false, align: token.align[k] }
36609 body += this.renderer.tablerow(cell);
36611 out += this.renderer.table(header, body);
36614 case "blockquote": {
36615 body = this.parse(token.tokens);
36616 out += this.renderer.blockquote(body);
36620 ordered = token.ordered;
36621 start2 = token.start;
36622 loose = token.loose;
36623 l2 = token.items.length;
36625 for (j2 = 0; j2 < l2; j2++) {
36626 item = token.items[j2];
36627 checked = item.checked;
36631 checkbox = this.renderer.checkbox(checked);
36633 if (item.tokens.length > 0 && item.tokens[0].type === "paragraph") {
36634 item.tokens[0].text = checkbox + " " + item.tokens[0].text;
36635 if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
36636 item.tokens[0].tokens[0].text = checkbox + " " + item.tokens[0].tokens[0].text;
36639 item.tokens.unshift({
36645 itemBody += checkbox;
36648 itemBody += this.parse(item.tokens, loose);
36649 body += this.renderer.listitem(itemBody, task, checked);
36651 out += this.renderer.list(body, ordered, start2);
36655 out += this.renderer.html(token.text);
36658 case "paragraph": {
36659 out += this.renderer.paragraph(this.parseInline(token.tokens));
36663 body = token.tokens ? this.parseInline(token.tokens) : token.text;
36664 while (i2 + 1 < l && tokens[i2 + 1].type === "text") {
36665 token = tokens[++i2];
36666 body += "\n" + (token.tokens ? this.parseInline(token.tokens) : token.text);
36668 out += top ? this.renderer.paragraph(body) : body;
36672 const errMsg = 'Token with "' + token.type + '" type was not found.';
36673 if (this.options.silent) {
36674 console.error(errMsg);
36677 throw new Error(errMsg);
36684 parseInline(tokens, renderer) {
36685 renderer = renderer || this.renderer;
36686 let out = "", i2, token, ret;
36687 const l = tokens.length;
36688 for (i2 = 0; i2 < l; i2++) {
36689 token = tokens[i2];
36690 if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
36691 ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
36692 if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(token.type)) {
36697 switch (token.type) {
36699 out += renderer.text(token.text);
36703 out += renderer.html(token.text);
36707 out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
36711 out += renderer.image(token.href, token.title, token.text);
36715 out += renderer.strong(this.parseInline(token.tokens, renderer));
36719 out += renderer.em(this.parseInline(token.tokens, renderer));
36723 out += renderer.codespan(token.text);
36727 out += renderer.br();
36731 out += renderer.del(this.parseInline(token.tokens, renderer));
36735 out += renderer.text(token.text);
36739 const errMsg = 'Token with "' + token.type + '" type was not found.';
36740 if (this.options.silent) {
36741 console.error(errMsg);
36744 throw new Error(errMsg);
36752 function marked(src, opt, callback) {
36753 if (typeof src === "undefined" || src === null) {
36754 throw new Error("marked(): input parameter is undefined or null");
36756 if (typeof src !== "string") {
36757 throw new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected");
36759 if (typeof opt === "function") {
36763 opt = merge2({}, marked.defaults, opt || {});
36764 checkSanitizeDeprecation(opt);
36766 const highlight = opt.highlight;
36769 tokens = Lexer.lex(src, opt);
36771 return callback(e);
36773 const done = function(err) {
36777 if (opt.walkTokens) {
36778 marked.walkTokens(tokens, opt.walkTokens);
36780 out = Parser.parse(tokens, opt);
36785 opt.highlight = highlight;
36786 return err ? callback(err) : callback(null, out);
36788 if (!highlight || highlight.length < 3) {
36791 delete opt.highlight;
36792 if (!tokens.length)
36795 marked.walkTokens(tokens, function(token) {
36796 if (token.type === "code") {
36799 highlight(token.text, token.lang, function(err, code) {
36803 if (code != null && code !== token.text) {
36805 token.escaped = true;
36808 if (pending === 0) {
36815 if (pending === 0) {
36820 function onError(e) {
36821 e.message += "\nPlease report this to https://github.com/markedjs/marked.";
36823 return "<p>An error occurred:</p><pre>" + escape4(e.message + "", true) + "</pre>";
36828 const tokens = Lexer.lex(src, opt);
36829 if (opt.walkTokens) {
36831 return Promise.all(marked.walkTokens(tokens, opt.walkTokens)).then(() => {
36832 return Parser.parse(tokens, opt);
36835 marked.walkTokens(tokens, opt.walkTokens);
36837 return Parser.parse(tokens, opt);
36842 marked.options = marked.setOptions = function(opt) {
36843 merge2(marked.defaults, opt);
36844 changeDefaults(marked.defaults);
36847 marked.getDefaults = getDefaults;
36848 marked.defaults = defaults;
36849 marked.use = function(...args) {
36850 const opts = merge2({}, ...args);
36851 const extensions = marked.defaults.extensions || { renderers: {}, childTokens: {} };
36853 args.forEach((pack) => {
36854 if (pack.extensions) {
36855 hasExtensions = true;
36856 pack.extensions.forEach((ext) => {
36858 throw new Error("extension name required");
36860 if (ext.renderer) {
36861 const prevRenderer = extensions.renderers ? extensions.renderers[ext.name] : null;
36862 if (prevRenderer) {
36863 extensions.renderers[ext.name] = function(...args2) {
36864 let ret = ext.renderer.apply(this, args2);
36865 if (ret === false) {
36866 ret = prevRenderer.apply(this, args2);
36871 extensions.renderers[ext.name] = ext.renderer;
36874 if (ext.tokenizer) {
36875 if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
36876 throw new Error("extension level must be 'block' or 'inline'");
36878 if (extensions[ext.level]) {
36879 extensions[ext.level].unshift(ext.tokenizer);
36881 extensions[ext.level] = [ext.tokenizer];
36884 if (ext.level === "block") {
36885 if (extensions.startBlock) {
36886 extensions.startBlock.push(ext.start);
36888 extensions.startBlock = [ext.start];
36890 } else if (ext.level === "inline") {
36891 if (extensions.startInline) {
36892 extensions.startInline.push(ext.start);
36894 extensions.startInline = [ext.start];
36899 if (ext.childTokens) {
36900 extensions.childTokens[ext.name] = ext.childTokens;
36904 if (pack.renderer) {
36905 const renderer = marked.defaults.renderer || new Renderer();
36906 for (const prop in pack.renderer) {
36907 const prevRenderer = renderer[prop];
36908 renderer[prop] = (...args2) => {
36909 let ret = pack.renderer[prop].apply(renderer, args2);
36910 if (ret === false) {
36911 ret = prevRenderer.apply(renderer, args2);
36916 opts.renderer = renderer;
36918 if (pack.tokenizer) {
36919 const tokenizer = marked.defaults.tokenizer || new Tokenizer();
36920 for (const prop in pack.tokenizer) {
36921 const prevTokenizer = tokenizer[prop];
36922 tokenizer[prop] = (...args2) => {
36923 let ret = pack.tokenizer[prop].apply(tokenizer, args2);
36924 if (ret === false) {
36925 ret = prevTokenizer.apply(tokenizer, args2);
36930 opts.tokenizer = tokenizer;
36932 if (pack.walkTokens) {
36933 const walkTokens2 = marked.defaults.walkTokens;
36934 opts.walkTokens = function(token) {
36936 values.push(pack.walkTokens.call(this, token));
36938 values = values.concat(walkTokens2.call(this, token));
36943 if (hasExtensions) {
36944 opts.extensions = extensions;
36946 marked.setOptions(opts);
36949 marked.walkTokens = function(tokens, callback) {
36951 for (const token of tokens) {
36952 values = values.concat(callback.call(marked, token));
36953 switch (token.type) {
36955 for (const cell of token.header) {
36956 values = values.concat(marked.walkTokens(cell.tokens, callback));
36958 for (const row of token.rows) {
36959 for (const cell of row) {
36960 values = values.concat(marked.walkTokens(cell.tokens, callback));
36966 values = values.concat(marked.walkTokens(token.items, callback));
36970 if (marked.defaults.extensions && marked.defaults.extensions.childTokens && marked.defaults.extensions.childTokens[token.type]) {
36971 marked.defaults.extensions.childTokens[token.type].forEach(function(childTokens) {
36972 values = values.concat(marked.walkTokens(token[childTokens], callback));
36974 } else if (token.tokens) {
36975 values = values.concat(marked.walkTokens(token.tokens, callback));
36982 marked.parseInline = function(src, opt) {
36983 if (typeof src === "undefined" || src === null) {
36984 throw new Error("marked.parseInline(): input parameter is undefined or null");
36986 if (typeof src !== "string") {
36987 throw new Error("marked.parseInline(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected");
36989 opt = merge2({}, marked.defaults, opt || {});
36990 checkSanitizeDeprecation(opt);
36992 const tokens = Lexer.lexInline(src, opt);
36993 if (opt.walkTokens) {
36994 marked.walkTokens(tokens, opt.walkTokens);
36996 return Parser.parseInline(tokens, opt);
36998 e.message += "\nPlease report this to https://github.com/markedjs/marked.";
37000 return "<p>An error occurred:</p><pre>" + escape4(e.message + "", true) + "</pre>";
37005 marked.Parser = Parser;
37006 marked.parser = Parser.parse;
37007 marked.Renderer = Renderer;
37008 marked.TextRenderer = TextRenderer;
37009 marked.Lexer = Lexer;
37010 marked.lexer = Lexer.lex;
37011 marked.Tokenizer = Tokenizer;
37012 marked.Slugger = Slugger;
37013 marked.parse = marked;
37014 var options = marked.options;
37015 var setOptions = marked.setOptions;
37016 var use = marked.use;
37017 var walkTokens = marked.walkTokens;
37018 var parseInline = marked.parseInline;
37019 var parser2 = Parser.parse;
37020 var lexer = Lexer.lex;
37022 // modules/services/osmose.js
37023 var tiler3 = utilTiler();
37024 var dispatch4 = dispatch_default("loaded");
37025 var _tileZoom3 = 14;
37026 var _osmoseUrlRoot = "https://osmose.openstreetmap.fr/api/0.3";
37027 var _osmoseData = { icons: {}, items: [] };
37029 function abortRequest3(controller) {
37031 controller.abort();
37034 function abortUnwantedRequests3(cache, tiles) {
37035 Object.keys(cache.inflightTile).forEach((k) => {
37036 let wanted = tiles.find((tile) => k === tile.id);
37038 abortRequest3(cache.inflightTile[k]);
37039 delete cache.inflightTile[k];
37043 function encodeIssueRtree3(d) {
37044 return { minX: d.loc[0], minY: d.loc[1], maxX: d.loc[0], maxY: d.loc[1], data: d };
37046 function updateRtree3(item, replace) {
37047 _cache3.rtree.remove(item, (a, b) => a.data.id === b.data.id);
37049 _cache3.rtree.insert(item);
37052 function preventCoincident2(loc) {
37053 let coincident = false;
37055 let delta = coincident ? [1e-5, 0] : [0, 1e-5];
37056 loc = geoVecAdd(loc, delta);
37057 let bbox2 = geoExtent(loc).bbox();
37058 coincident = _cache3.rtree.search(bbox2).length;
37059 } while (coincident);
37062 var osmose_default = {
37065 _mainFileFetcher.get("qa_data").then((d) => {
37066 _osmoseData = d.osmose;
37067 _osmoseData.items = Object.keys(d.osmose.icons).map((s) => s.split("-")[0]).reduce((unique, item) => unique.indexOf(item) !== -1 ? unique : [...unique, item], []);
37072 this.event = utilRebind(this, dispatch4, "on");
37078 Object.values(_cache3.inflightTile).forEach(abortRequest3);
37079 _strings = _cache3.strings;
37080 _colors = _cache3.colors;
37088 rtree: new import_rbush3.default(),
37093 loadIssues(projection2) {
37095 item: _osmoseData.items
37097 let tiles = tiler3.zoomExtent([_tileZoom3, _tileZoom3]).getTiles(projection2);
37098 abortUnwantedRequests3(_cache3, tiles);
37099 tiles.forEach((tile) => {
37100 if (_cache3.loadedTile[tile.id] || _cache3.inflightTile[tile.id])
37102 let [x, y, z] = tile.xyz;
37103 let url = `${_osmoseUrlRoot}/issues/${z}/${x}/${y}.geojson?` + utilQsString(params);
37104 let controller = new AbortController();
37105 _cache3.inflightTile[tile.id] = controller;
37106 json_default(url, { signal: controller.signal }).then((data) => {
37107 delete _cache3.inflightTile[tile.id];
37108 _cache3.loadedTile[tile.id] = true;
37109 if (data.features) {
37110 data.features.forEach((issue) => {
37111 const { item, class: cl, uuid: id2 } = issue.properties;
37112 const itemType = `${item}-${cl}`;
37113 if (itemType in _osmoseData.icons) {
37114 let loc = issue.geometry.coordinates;
37115 loc = preventCoincident2(loc);
37116 let d = new QAItem(loc, this, itemType, id2, { item });
37117 if (item === 8300 || item === 8360) {
37120 _cache3.data[d.id] = d;
37121 _cache3.rtree.insert(encodeIssueRtree3(d));
37125 dispatch4.call("loaded");
37127 delete _cache3.inflightTile[tile.id];
37128 _cache3.loadedTile[tile.id] = true;
37132 loadIssueDetail(issue) {
37133 if (issue.elems !== void 0) {
37134 return Promise.resolve(issue);
37136 const url = `${_osmoseUrlRoot}/issue/${issue.id}?langs=${_mainLocalizer.localeCode()}`;
37137 const cacheDetails = (data) => {
37138 issue.elems = data.elems.map((e) => e.type.substring(0, 1) + e.id);
37139 issue.detail = data.subtitle ? marked(data.subtitle.auto) : "";
37140 this.replaceItem(issue);
37142 return json_default(url).then(cacheDetails).then(() => issue);
37144 loadStrings(locale2 = _mainLocalizer.localeCode()) {
37145 const items = Object.keys(_osmoseData.icons);
37146 if (locale2 in _cache3.strings && Object.keys(_cache3.strings[locale2]).length === items.length) {
37147 return Promise.resolve(_cache3.strings[locale2]);
37149 if (!(locale2 in _cache3.strings)) {
37150 _cache3.strings[locale2] = {};
37152 const allRequests = items.map((itemType) => {
37153 if (itemType in _cache3.strings[locale2])
37155 const cacheData = (data) => {
37156 const [cat = { items: [] }] = data.categories;
37157 const [item2 = { class: [] }] = cat.items;
37158 const [cl2 = null] = item2.class;
37160 console.log(`Osmose strings request (${itemType}) had unexpected data`);
37163 const { item: itemInt, color: color2 } = item2;
37164 if (/^#[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/.test(color2)) {
37165 _cache3.colors[itemInt] = color2;
37167 const { title, detail, fix, trap } = cl2;
37168 let issueStrings = {};
37170 issueStrings.title = title.auto;
37172 issueStrings.detail = marked(detail.auto);
37174 issueStrings.trap = marked(trap.auto);
37176 issueStrings.fix = marked(fix.auto);
37177 _cache3.strings[locale2][itemType] = issueStrings;
37179 const [item, cl] = itemType.split("-");
37180 const url = `${_osmoseUrlRoot}/items/${item}/class/${cl}?langs=${locale2}`;
37181 return json_default(url).then(cacheData);
37182 }).filter(Boolean);
37183 return Promise.all(allRequests).then(() => _cache3.strings[locale2]);
37185 getStrings(itemType, locale2 = _mainLocalizer.localeCode()) {
37186 return locale2 in _cache3.strings ? _cache3.strings[locale2][itemType] : {};
37188 getColor(itemType) {
37189 return itemType in _cache3.colors ? _cache3.colors[itemType] : "#FFFFFF";
37191 postUpdate(issue, callback) {
37192 if (_cache3.inflightPost[issue.id]) {
37193 return callback({ message: "Issue update already inflight", status: -2 }, issue);
37195 const url = `${_osmoseUrlRoot}/issue/${issue.id}/${issue.newStatus}`;
37196 const controller = new AbortController();
37197 const after = () => {
37198 delete _cache3.inflightPost[issue.id];
37199 this.removeItem(issue);
37200 if (issue.newStatus === "done") {
37201 if (!(issue.item in _cache3.closed)) {
37202 _cache3.closed[issue.item] = 0;
37204 _cache3.closed[issue.item] += 1;
37207 callback(null, issue);
37209 _cache3.inflightPost[issue.id] = controller;
37210 fetch(url, { signal: controller.signal }).then(after).catch((err) => {
37211 delete _cache3.inflightPost[issue.id];
37213 callback(err.message);
37216 getItems(projection2) {
37217 const viewport = projection2.clipExtent();
37218 const min3 = [viewport[0][0], viewport[1][1]];
37219 const max3 = [viewport[1][0], viewport[0][1]];
37220 const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
37221 return _cache3.rtree.search(bbox2).map((d) => d.data);
37224 return _cache3.data[id2];
37226 getIcon(itemType) {
37227 return _osmoseData.icons[itemType];
37229 replaceItem(item) {
37230 if (!(item instanceof QAItem) || !item.id)
37232 _cache3.data[item.id] = item;
37233 updateRtree3(encodeIssueRtree3(item), true);
37237 if (!(item instanceof QAItem) || !item.id)
37239 delete _cache3.data[item.id];
37240 updateRtree3(encodeIssueRtree3(item), false);
37242 getClosedCounts() {
37243 return _cache3.closed;
37246 return `https://osmose.openstreetmap.fr/en/error/${item.id}`;
37250 // modules/services/mapillary.js
37251 var import_pbf = __toESM(require_pbf());
37252 var import_rbush4 = __toESM(require_rbush_min());
37253 var import_vector_tile = __toESM(require_vector_tile());
37254 var accessToken = "MLY|4100327730013843|5bb78b81720791946a9a7b956c57b7cf";
37255 var apiUrl = "https://graph.mapillary.com/";
37256 var baseTileUrl = "https://tiles.mapillary.com/maps/vtp";
37257 var mapFeatureTileUrl = `${baseTileUrl}/mly_map_feature_point/2/{z}/{x}/{y}?access_token=${accessToken}`;
37258 var tileUrl = `${baseTileUrl}/mly1_public/2/{z}/{x}/{y}?access_token=${accessToken}`;
37259 var trafficSignTileUrl = `${baseTileUrl}/mly_map_feature_traffic_sign/2/{z}/{x}/{y}?access_token=${accessToken}`;
37260 var viewercss = "mapillary-js/mapillary.css";
37261 var viewerjs = "mapillary-js/mapillary.js";
37263 var dispatch5 = dispatch_default("change", "loadedImages", "loadedSigns", "loadedMapFeatures", "bearingChanged", "imageChanged");
37264 var _loadViewerPromise;
37265 var _mlyActiveImage;
37267 var _mlyFallback = false;
37268 var _mlyHighlightedDetection;
37269 var _mlyShowFeatureDetections = false;
37270 var _mlyShowSignDetections = false;
37272 var _mlyViewerFilter = ["all"];
37273 function loadTiles(which, url, maxZoom2, projection2) {
37274 const tiler8 = utilTiler().zoomExtent([minZoom, maxZoom2]).skipNullIsland(true);
37275 const tiles = tiler8.getTiles(projection2);
37276 tiles.forEach(function(tile) {
37277 loadTile(which, url, tile);
37280 function loadTile(which, url, tile) {
37281 const cache = _mlyCache.requests;
37282 const tileId = `${tile.id}-${which}`;
37283 if (cache.loaded[tileId] || cache.inflight[tileId])
37285 const controller = new AbortController();
37286 cache.inflight[tileId] = controller;
37287 const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
37288 fetch(requestUrl, { signal: controller.signal }).then(function(response) {
37289 if (!response.ok) {
37290 throw new Error(response.status + " " + response.statusText);
37292 cache.loaded[tileId] = true;
37293 delete cache.inflight[tileId];
37294 return response.arrayBuffer();
37295 }).then(function(data) {
37297 throw new Error("No Data");
37299 loadTileDataToCache(data, tile, which);
37300 if (which === "images") {
37301 dispatch5.call("loadedImages");
37302 } else if (which === "signs") {
37303 dispatch5.call("loadedSigns");
37304 } else if (which === "points") {
37305 dispatch5.call("loadedMapFeatures");
37307 }).catch(function() {
37308 cache.loaded[tileId] = true;
37309 delete cache.inflight[tileId];
37312 function loadTileDataToCache(data, tile, which) {
37313 const vectorTile = new import_vector_tile.VectorTile(new import_pbf.default(data));
37314 let features2, cache, layer, i2, feature3, loc, d;
37315 if (vectorTile.layers.hasOwnProperty("image")) {
37317 cache = _mlyCache.images;
37318 layer = vectorTile.layers.image;
37319 for (i2 = 0; i2 < layer.length; i2++) {
37320 feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
37321 loc = feature3.geometry.coordinates;
37324 captured_at: feature3.properties.captured_at,
37325 ca: feature3.properties.compass_angle,
37326 id: feature3.properties.id,
37327 is_pano: feature3.properties.is_pano,
37328 sequence_id: feature3.properties.sequence_id
37330 cache.forImageId[d.id] = d;
37340 cache.rtree.load(features2);
37343 if (vectorTile.layers.hasOwnProperty("sequence")) {
37345 cache = _mlyCache.sequences;
37346 layer = vectorTile.layers.sequence;
37347 for (i2 = 0; i2 < layer.length; i2++) {
37348 feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
37349 if (cache.lineString[feature3.properties.id]) {
37350 cache.lineString[feature3.properties.id].push(feature3);
37352 cache.lineString[feature3.properties.id] = [feature3];
37356 if (vectorTile.layers.hasOwnProperty("point")) {
37358 cache = _mlyCache[which];
37359 layer = vectorTile.layers.point;
37360 for (i2 = 0; i2 < layer.length; i2++) {
37361 feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
37362 loc = feature3.geometry.coordinates;
37365 id: feature3.properties.id,
37366 first_seen_at: feature3.properties.first_seen_at,
37367 last_seen_at: feature3.properties.last_seen_at,
37368 value: feature3.properties.value
37379 cache.rtree.load(features2);
37382 if (vectorTile.layers.hasOwnProperty("traffic_sign")) {
37384 cache = _mlyCache[which];
37385 layer = vectorTile.layers.traffic_sign;
37386 for (i2 = 0; i2 < layer.length; i2++) {
37387 feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
37388 loc = feature3.geometry.coordinates;
37391 id: feature3.properties.id,
37392 first_seen_at: feature3.properties.first_seen_at,
37393 last_seen_at: feature3.properties.last_seen_at,
37394 value: feature3.properties.value
37405 cache.rtree.load(features2);
37409 function loadData(url) {
37410 return fetch(url).then(function(response) {
37411 if (!response.ok) {
37412 throw new Error(response.status + " " + response.statusText);
37414 return response.json();
37415 }).then(function(result) {
37419 return result.data || [];
37422 function partitionViewport(projection2) {
37423 const z = geoScaleToZoom(projection2.scale());
37424 const z2 = Math.ceil(z * 2) / 2 + 2.5;
37425 const tiler8 = utilTiler().zoomExtent([z2, z2]);
37426 return tiler8.getTiles(projection2).map(function(tile) {
37427 return tile.extent;
37430 function searchLimited(limit, projection2, rtree) {
37431 limit = limit || 5;
37432 return partitionViewport(projection2).reduce(function(result, extent) {
37433 const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d) {
37436 return found.length ? result.concat(found) : result;
37439 var mapillary_default = {
37444 this.event = utilRebind(this, dispatch5, "on");
37446 reset: function() {
37448 Object.values(_mlyCache.requests.inflight).forEach(function(request3) {
37453 images: { rtree: new import_rbush4.default(), forImageId: {} },
37454 image_detections: { forImageId: {} },
37455 signs: { rtree: new import_rbush4.default() },
37456 points: { rtree: new import_rbush4.default() },
37457 sequences: { rtree: new import_rbush4.default(), lineString: {} },
37458 requests: { loaded: {}, inflight: {} }
37460 _mlyActiveImage = null;
37462 images: function(projection2) {
37464 return searchLimited(limit, projection2, _mlyCache.images.rtree);
37466 signs: function(projection2) {
37468 return searchLimited(limit, projection2, _mlyCache.signs.rtree);
37470 mapFeatures: function(projection2) {
37472 return searchLimited(limit, projection2, _mlyCache.points.rtree);
37474 cachedImage: function(imageId) {
37475 return _mlyCache.images.forImageId[imageId];
37477 sequences: function(projection2) {
37478 const viewport = projection2.clipExtent();
37479 const min3 = [viewport[0][0], viewport[1][1]];
37480 const max3 = [viewport[1][0], viewport[0][1]];
37481 const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
37482 const sequenceIds = {};
37483 let lineStrings = [];
37484 _mlyCache.images.rtree.search(bbox2).forEach(function(d) {
37485 if (d.data.sequence_id) {
37486 sequenceIds[d.data.sequence_id] = true;
37489 Object.keys(sequenceIds).forEach(function(sequenceId) {
37490 if (_mlyCache.sequences.lineString[sequenceId]) {
37491 lineStrings = lineStrings.concat(_mlyCache.sequences.lineString[sequenceId]);
37494 return lineStrings;
37496 loadImages: function(projection2) {
37497 loadTiles("images", tileUrl, 14, projection2);
37499 loadSigns: function(projection2) {
37500 loadTiles("signs", trafficSignTileUrl, 14, projection2);
37502 loadMapFeatures: function(projection2) {
37503 loadTiles("points", mapFeatureTileUrl, 14, projection2);
37505 ensureViewerLoaded: function(context) {
37506 if (_loadViewerPromise)
37507 return _loadViewerPromise;
37508 const wrap2 = context.container().select(".photoviewer").selectAll(".mly-wrapper").data([0]);
37509 wrap2.enter().append("div").attr("id", "ideditor-mly").attr("class", "photo-wrapper mly-wrapper").classed("hide", true);
37511 _loadViewerPromise = new Promise((resolve, reject) => {
37512 let loadedCount = 0;
37513 function loaded() {
37515 if (loadedCount === 2)
37518 const head = select_default2("head");
37519 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() {
37522 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() {
37525 }).catch(function() {
37526 _loadViewerPromise = null;
37527 }).then(function() {
37528 that.initViewer(context);
37530 return _loadViewerPromise;
37532 loadSignResources: function(context) {
37533 context.ui().svgDefs.addSprites(["mapillary-sprite"], false);
37536 loadObjectResources: function(context) {
37537 context.ui().svgDefs.addSprites(["mapillary-object-sprite"], false);
37540 resetTags: function() {
37541 if (_mlyViewer && !_mlyFallback) {
37542 _mlyViewer.getComponent("tag").removeAll();
37545 showFeatureDetections: function(value) {
37546 _mlyShowFeatureDetections = value;
37547 if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
37551 showSignDetections: function(value) {
37552 _mlyShowSignDetections = value;
37553 if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
37557 filterViewer: function(context) {
37558 const showsPano = context.photos().showsPanoramic();
37559 const showsFlat = context.photos().showsFlat();
37560 const fromDate = context.photos().fromDate();
37561 const toDate = context.photos().toDate();
37562 const filter2 = ["all"];
37564 filter2.push(["!=", "cameraType", "spherical"]);
37565 if (!showsFlat && showsPano)
37566 filter2.push(["==", "pano", true]);
37568 filter2.push([">=", "capturedAt", new Date(fromDate).getTime()]);
37571 filter2.push([">=", "capturedAt", new Date(toDate).getTime()]);
37574 _mlyViewer.setFilter(filter2);
37576 _mlyViewerFilter = filter2;
37579 showViewer: function(context) {
37580 const wrap2 = context.container().select(".photoviewer").classed("hide", false);
37581 const isHidden = wrap2.selectAll(".photo-wrapper.mly-wrapper.hide").size();
37582 if (isHidden && _mlyViewer) {
37583 wrap2.selectAll(".photo-wrapper:not(.mly-wrapper)").classed("hide", true);
37584 wrap2.selectAll(".photo-wrapper.mly-wrapper").classed("hide", false);
37585 _mlyViewer.resize();
37589 hideViewer: function(context) {
37590 _mlyActiveImage = null;
37591 if (!_mlyFallback && _mlyViewer) {
37592 _mlyViewer.getComponent("sequence").stop();
37594 const viewer = context.container().select(".photoviewer");
37595 if (!viewer.empty())
37596 viewer.datum(null);
37597 viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
37598 this.updateUrlImage(null);
37599 dispatch5.call("imageChanged");
37600 dispatch5.call("loadedMapFeatures");
37601 dispatch5.call("loadedSigns");
37602 return this.setStyles(context, null);
37604 updateUrlImage: function(imageId) {
37605 if (!window.mocha) {
37606 const hash = utilStringQs(window.location.hash);
37608 hash.photo = "mapillary/" + imageId;
37612 window.location.replace("#" + utilQsString(hash, true));
37615 highlightDetection: function(detection) {
37617 _mlyHighlightedDetection = detection.id;
37621 initViewer: function(context) {
37623 if (!window.mapillary)
37632 container: "ideditor-mly"
37634 if (!mapillary.isSupported() && mapillary.isFallbackSupported()) {
37635 _mlyFallback = true;
37648 _mlyViewer = new mapillary.Viewer(opts);
37649 _mlyViewer.on("image", imageChanged);
37650 _mlyViewer.on("bearing", bearingChanged);
37651 if (_mlyViewerFilter) {
37652 _mlyViewer.setFilter(_mlyViewerFilter);
37654 context.ui().photoviewer.on("resize.mapillary", function() {
37656 _mlyViewer.resize();
37658 function imageChanged(node) {
37660 const image = node.image;
37661 that.setActiveImage(image);
37662 that.setStyles(context, null);
37663 const loc = [image.originalLngLat.lng, image.originalLngLat.lat];
37664 context.map().centerEase(loc);
37665 that.updateUrlImage(image.id);
37666 if (_mlyShowFeatureDetections || _mlyShowSignDetections) {
37667 that.updateDetections(image.id, `${apiUrl}/${image.id}/detections?access_token=${accessToken}&fields=id,image,geometry,value`);
37669 dispatch5.call("imageChanged");
37671 function bearingChanged(e) {
37672 dispatch5.call("bearingChanged", void 0, e);
37675 selectImage: function(context, imageId) {
37676 if (_mlyViewer && imageId) {
37677 _mlyViewer.moveTo(imageId).catch(function(e) {
37678 console.error("mly3", e);
37683 getActiveImage: function() {
37684 return _mlyActiveImage;
37686 getDetections: function(id2) {
37687 return loadData(`${apiUrl}/${id2}/detections?access_token=${accessToken}&fields=id,value,image`);
37689 setActiveImage: function(image) {
37691 _mlyActiveImage = {
37692 ca: image.originalCompassAngle,
37694 loc: [image.originalLngLat.lng, image.originalLngLat.lat],
37695 is_pano: image.cameraType === "spherical",
37696 sequence_id: image.sequenceId
37699 _mlyActiveImage = null;
37702 setStyles: function(context, hovered) {
37703 const hoveredImageId = hovered && hovered.id;
37704 const hoveredSequenceId = hovered && hovered.sequence_id;
37705 const selectedSequenceId = _mlyActiveImage && _mlyActiveImage.sequence_id;
37706 context.container().selectAll(".layer-mapillary .viewfield-group").classed("highlighted", function(d) {
37707 return d.sequence_id === selectedSequenceId || d.id === hoveredImageId;
37708 }).classed("hovered", function(d) {
37709 return d.id === hoveredImageId;
37711 context.container().selectAll(".layer-mapillary .sequence").classed("highlighted", function(d) {
37712 return d.properties.id === hoveredSequenceId;
37713 }).classed("currentView", function(d) {
37714 return d.properties.id === selectedSequenceId;
37718 updateDetections: function(imageId, url) {
37719 if (!_mlyViewer || _mlyFallback)
37723 const cache = _mlyCache.image_detections;
37724 if (cache.forImageId[imageId]) {
37725 showDetections(_mlyCache.image_detections.forImageId[imageId]);
37727 loadData(url).then((detections) => {
37728 detections.forEach(function(detection) {
37729 if (!cache.forImageId[imageId]) {
37730 cache.forImageId[imageId] = [];
37732 cache.forImageId[imageId].push({
37733 geometry: detection.geometry,
37736 value: detection.value
37739 showDetections(_mlyCache.image_detections.forImageId[imageId] || []);
37742 function showDetections(detections) {
37743 const tagComponent = _mlyViewer.getComponent("tag");
37744 detections.forEach(function(data) {
37745 const tag = makeTag(data);
37747 tagComponent.add([tag]);
37751 function makeTag(data) {
37752 const valueParts = data.value.split("--");
37753 if (!valueParts.length)
37757 let color2 = 16777215;
37758 if (_mlyHighlightedDetection === data.id) {
37760 text2 = valueParts[1];
37761 if (text2 === "flat" || text2 === "discrete" || text2 === "sign") {
37762 text2 = valueParts[2];
37764 text2 = text2.replace(/-/g, " ");
37765 text2 = text2.charAt(0).toUpperCase() + text2.slice(1);
37766 _mlyHighlightedDetection = null;
37768 var decodedGeometry = window.atob(data.geometry);
37769 var uintArray = new Uint8Array(decodedGeometry.length);
37770 for (var i2 = 0; i2 < decodedGeometry.length; i2++) {
37771 uintArray[i2] = decodedGeometry.charCodeAt(i2);
37773 const tile = new import_vector_tile.VectorTile(new import_pbf.default(uintArray.buffer));
37774 const layer = tile.layers["mpy-or"];
37775 const geometries = layer.feature(0).loadGeometry();
37776 const polygon2 = geometries.map((ring) => ring.map((point2) => [point2.x / layer.extent, point2.y / layer.extent]));
37777 tag = new mapillary.OutlineTag(
37779 new mapillary.PolygonGeometry(polygon2[0]),
37792 cache: function() {
37797 // modules/core/validation/models.js
37798 function validationIssue(attrs) {
37799 this.type = attrs.type;
37800 this.subtype = attrs.subtype;
37801 this.severity = attrs.severity;
37802 this.message = attrs.message;
37803 this.reference = attrs.reference;
37804 this.entityIds = attrs.entityIds;
37805 this.loc = attrs.loc;
37806 this.data = attrs.data;
37807 this.dynamicFixes = attrs.dynamicFixes;
37808 this.hash = attrs.hash;
37809 this.id = generateID.apply(this);
37810 this.key = generateKey.apply(this);
37811 this.autoFix = null;
37812 function generateID() {
37813 var parts = [this.type];
37815 parts.push(this.hash);
37817 if (this.subtype) {
37818 parts.push(this.subtype);
37820 if (this.entityIds) {
37821 var entityKeys = this.entityIds.slice().sort();
37822 parts.push.apply(parts, entityKeys);
37824 return parts.join(":");
37826 function generateKey() {
37827 return this.id + ":" + Date.now().toString();
37829 this.extent = function(resolver) {
37831 return geoExtent(this.loc);
37833 if (this.entityIds && this.entityIds.length) {
37834 return this.entityIds.reduce(function(extent, entityId) {
37835 return extent.extend(resolver.entity(entityId).extent(resolver));
37840 this.fixes = function(context) {
37841 var fixes = this.dynamicFixes ? this.dynamicFixes(context) : [];
37843 if (issue.severity === "warning") {
37844 fixes.push(new validationIssueFix({
37845 title: _t.append("issues.fix.ignore_issue.title"),
37846 icon: "iD-icon-close",
37847 onClick: function() {
37848 context.validator().ignoreIssue(this.issue.id);
37852 fixes.forEach(function(fix) {
37853 fix.id = fix.title.stringId;
37855 if (fix.autoArgs) {
37856 issue.autoFix = fix;
37862 function validationIssueFix(attrs) {
37863 this.title = attrs.title;
37864 this.onClick = attrs.onClick;
37865 this.disabledReason = attrs.disabledReason;
37866 this.icon = attrs.icon;
37867 this.entityIds = attrs.entityIds || [];
37868 this.autoArgs = attrs.autoArgs;
37872 // modules/services/maprules.js
37873 var buildRuleChecks = function() {
37875 equals: function(equals) {
37876 return function(tags) {
37877 return Object.keys(equals).every(function(k) {
37878 return equals[k] === tags[k];
37882 notEquals: function(notEquals) {
37883 return function(tags) {
37884 return Object.keys(notEquals).some(function(k) {
37885 return notEquals[k] !== tags[k];
37889 absence: function(absence) {
37890 return function(tags) {
37891 return Object.keys(tags).indexOf(absence) === -1;
37894 presence: function(presence) {
37895 return function(tags) {
37896 return Object.keys(tags).indexOf(presence) > -1;
37899 greaterThan: function(greaterThan) {
37900 var key = Object.keys(greaterThan)[0];
37901 var value = greaterThan[key];
37902 return function(tags) {
37903 return tags[key] > value;
37906 greaterThanEqual: function(greaterThanEqual) {
37907 var key = Object.keys(greaterThanEqual)[0];
37908 var value = greaterThanEqual[key];
37909 return function(tags) {
37910 return tags[key] >= value;
37913 lessThan: function(lessThan) {
37914 var key = Object.keys(lessThan)[0];
37915 var value = lessThan[key];
37916 return function(tags) {
37917 return tags[key] < value;
37920 lessThanEqual: function(lessThanEqual) {
37921 var key = Object.keys(lessThanEqual)[0];
37922 var value = lessThanEqual[key];
37923 return function(tags) {
37924 return tags[key] <= value;
37927 positiveRegex: function(positiveRegex) {
37928 var tagKey = Object.keys(positiveRegex)[0];
37929 var expression = positiveRegex[tagKey].join("|");
37930 var regex = new RegExp(expression);
37931 return function(tags) {
37932 return regex.test(tags[tagKey]);
37935 negativeRegex: function(negativeRegex) {
37936 var tagKey = Object.keys(negativeRegex)[0];
37937 var expression = negativeRegex[tagKey].join("|");
37938 var regex = new RegExp(expression);
37939 return function(tags) {
37940 return !regex.test(tags[tagKey]);
37945 var buildLineKeys = function() {
37960 var maprules_default = {
37962 this._ruleChecks = buildRuleChecks();
37963 this._validationRules = [];
37964 this._areaKeys = osmAreaKeys;
37965 this._lineKeys = buildLineKeys();
37967 filterRuleChecks: function(selector) {
37968 var _ruleChecks = this._ruleChecks;
37969 return Object.keys(selector).reduce(function(rules, key) {
37970 if (["geometry", "error", "warning"].indexOf(key) === -1) {
37971 rules.push(_ruleChecks[key](selector[key]));
37976 buildTagMap: function(selector) {
37977 var getRegexValues = function(regexes) {
37978 return regexes.map(function(regex) {
37979 return regex.replace(/\$|\^/g, "");
37982 var tagMap = Object.keys(selector).reduce(function(expectedTags, key) {
37984 var isRegex = /regex/gi.test(key);
37985 var isEqual = /equals/gi.test(key);
37986 if (isRegex || isEqual) {
37987 Object.keys(selector[key]).forEach(function(selectorKey) {
37988 values = isEqual ? [selector[key][selectorKey]] : getRegexValues(selector[key][selectorKey]);
37989 if (expectedTags.hasOwnProperty(selectorKey)) {
37990 values = values.concat(expectedTags[selectorKey]);
37992 expectedTags[selectorKey] = values;
37994 } else if (/(greater|less)Than(Equal)?|presence/g.test(key)) {
37995 var tagKey = /presence/.test(key) ? selector[key] : Object.keys(selector[key])[0];
37996 values = [selector[key][tagKey]];
37997 if (expectedTags.hasOwnProperty(tagKey)) {
37998 values = values.concat(expectedTags[tagKey]);
38000 expectedTags[tagKey] = values;
38002 return expectedTags;
38006 inferGeometry: function(tagMap) {
38007 var _lineKeys = this._lineKeys;
38008 var _areaKeys = this._areaKeys;
38009 var keyValueDoesNotImplyArea = function(key2) {
38010 return utilArrayIntersection(tagMap[key2], Object.keys(_areaKeys[key2])).length > 0;
38012 var keyValueImpliesLine = function(key2) {
38013 return utilArrayIntersection(tagMap[key2], Object.keys(_lineKeys[key2])).length > 0;
38015 if (tagMap.hasOwnProperty("area")) {
38016 if (tagMap.area.indexOf("yes") > -1) {
38019 if (tagMap.area.indexOf("no") > -1) {
38023 for (var key in tagMap) {
38024 if (key in _areaKeys && !keyValueDoesNotImplyArea(key)) {
38027 if (key in _lineKeys && keyValueImpliesLine(key)) {
38033 addRule: function(selector) {
38035 checks: this.filterRuleChecks(selector),
38036 matches: function(entity) {
38037 return this.checks.every(function(check) {
38038 return check(entity.tags);
38041 inferredGeometry: this.inferGeometry(this.buildTagMap(selector), this._areaKeys),
38042 geometryMatches: function(entity, graph) {
38043 if (entity.type === "node" || entity.type === "relation") {
38044 return selector.geometry === entity.type;
38045 } else if (entity.type === "way") {
38046 return this.inferredGeometry === entity.geometry(graph);
38049 findIssues: function(entity, graph, issues) {
38050 if (this.geometryMatches(entity, graph) && this.matches(entity)) {
38051 var severity = Object.keys(selector).indexOf("error") > -1 ? "error" : "warning";
38052 var message = selector[severity];
38053 issues.push(new validationIssue({
38056 message: function() {
38059 entityIds: [entity.id]
38064 this._validationRules.push(rule);
38066 clearRules: function() {
38067 this._validationRules = [];
38069 validationRules: function() {
38070 return this._validationRules;
38072 ruleChecks: function() {
38073 return this._ruleChecks;
38077 // modules/services/nominatim.js
38078 var import_rbush5 = __toESM(require_rbush_min());
38079 var apibase = nominatimApiUrl;
38080 var _inflight = {};
38081 var _nominatimCache;
38082 var nominatim_default = {
38085 _nominatimCache = new import_rbush5.default();
38087 reset: function() {
38088 Object.values(_inflight).forEach(function(controller) {
38089 controller.abort();
38092 _nominatimCache = new import_rbush5.default();
38094 countryCode: function(location, callback) {
38095 this.reverse(location, function(err, result) {
38097 return callback(err);
38098 } else if (result.address) {
38099 return callback(null, result.address.country_code);
38101 return callback("Unable to geocode", null);
38105 reverse: function(loc, callback) {
38106 var cached = _nominatimCache.search(
38107 { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] }
38109 if (cached.length > 0) {
38111 callback(null, cached[0].data);
38114 var params = { zoom: 13, format: "json", addressdetails: 1, lat: loc[1], lon: loc[0] };
38115 var url = apibase + "reverse?" + utilQsString(params);
38116 if (_inflight[url])
38118 var controller = new AbortController();
38119 _inflight[url] = controller;
38120 json_default(url, { signal: controller.signal }).then(function(result) {
38121 delete _inflight[url];
38122 if (result && result.error) {
38123 throw new Error(result.error);
38125 var extent = geoExtent(loc).padByMeters(200);
38126 _nominatimCache.insert(Object.assign(extent.bbox(), { data: result }));
38128 callback(null, result);
38129 }).catch(function(err) {
38130 delete _inflight[url];
38131 if (err.name === "AbortError")
38134 callback(err.message);
38137 search: function(val, callback) {
38138 var searchVal = encodeURIComponent(val);
38139 var url = apibase + "search/" + searchVal + "?limit=10&format=json";
38140 if (_inflight[url])
38142 var controller = new AbortController();
38143 _inflight[url] = controller;
38144 json_default(url, { signal: controller.signal }).then(function(result) {
38145 delete _inflight[url];
38146 if (result && result.error) {
38147 throw new Error(result.error);
38150 callback(null, result);
38151 }).catch(function(err) {
38152 delete _inflight[url];
38153 if (err.name === "AbortError")
38156 callback(err.message);
38161 // node_modules/name-suggestion-index/lib/matcher.js
38162 var import_which_polygon3 = __toESM(require_which_polygon(), 1);
38164 // node_modules/name-suggestion-index/lib/simplify.js
38165 var import_diacritics2 = __toESM(require_diacritics(), 1);
38166 function simplify(str2) {
38167 if (typeof str2 !== "string")
38169 return import_diacritics2.default.remove(
38170 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()
38174 // node_modules/name-suggestion-index/config/matchGroups.json
38175 var matchGroups_default = {
38177 adult_gaming_centre: [
38179 "amenity/gambling",
38180 "leisure/adult_gaming_centre"
38184 "shop/hairdresser_supply"
38198 "tourism/camp_site",
38199 "tourism/caravan_site"
38210 "healthcare/clinic",
38211 "healthcare/laboratory",
38212 "healthcare/physiotherapist",
38213 "healthcare/sample_collection",
38214 "healthcare/dialysis"
38219 "shop/convenience",
38227 "amenity/coworking_space",
38228 "office/coworking",
38229 "office/coworking_space"
38234 "healthcare/dentist"
38237 "office/telecommunication",
38239 "shop/electronics",
38243 "shop/mobile_phone",
38244 "shop/telecommunication"
38248 "shop/haberdashery",
38252 "shop/accessories",
38256 "shop/department_store",
38258 "shop/fashion_accessories",
38264 "office/accountant",
38265 "office/financial",
38266 "office/financial_advisor",
38267 "office/tax_advisor",
38271 "leisure/fitness_centre",
38272 "leisure/fitness_center",
38273 "leisure/sports_centre",
38274 "leisure/sports_center"
38279 "amenity/fast_food",
38280 "amenity/ice_cream",
38282 "amenity/restaurant",
38287 "shop/confectionary",
38288 "shop/confectionery",
38298 "shop/convenience;gas",
38299 "shop/gas;convenience"
38309 "shop/bathroom_furnishing",
38312 "shop/doityourself",
38317 "shop/hardware_store",
38318 "shop/power_tools",
38325 "shop/health_food",
38327 "shop/nutrition_supplements"
38330 "shop/electronics",
38337 "shop/video_games",
38342 "amenity/hospital",
38343 "healthcare/hospital"
38347 "shop/interior_decoration"
38349 lifeboat_station: [
38350 "amenity/lifeboat_station",
38351 "emergency/lifeboat_station",
38352 "emergency/marine_rescue"
38359 "amenity/money_transfer",
38360 "shop/money_transfer"
38363 "shop/office_supplies",
38373 "amenity/parcel_locker",
38374 "amenity/vending_machine"
38378 "amenity/pharmacy",
38379 "healthcare/pharmacy"
38382 "amenity/theme_park",
38383 "leisure/amusement_arcade",
38384 "leisure/playground"
38387 "amenity/bicycle_rental",
38388 "amenity/boat_rental",
38389 "amenity/car_rental",
38390 "amenity/truck_rental",
38391 "amenity/vehicle_rental",
38396 "amenity/childcare",
38398 "amenity/kindergarten",
38399 "amenity/language_school",
38400 "amenity/prep_school",
38402 "amenity/university"
38405 "shop/storage_units",
38406 "shop/storage_rental"
38410 "power/substation",
38411 "power/sub_station"
38415 "shop/frozen_food",
38416 "shop/greengrocer",
38418 "shop/supermarket",
38422 "shop/variety_store",
38427 "amenity/vending_machine",
38429 "shop/vending_machine"
38434 "amenity/weight_clinic",
38435 "healthcare/counselling",
38436 "leisure/fitness_centre",
38437 "office/therapist",
38441 "shop/health_food",
38444 "shop/nutrition_supplements",
38449 "shop/supermarket",
38450 "shop/department_store"
38455 // node_modules/name-suggestion-index/config/genericWords.json
38456 var genericWords_default = {
38458 "^(barn|bazaa?r|bench|bou?tique|building|casa|church)$",
38459 "^(baseball|basketball|football|soccer|softball|tennis(halle)?)\\s?(field|court)?$",
38460 "^(club|green|out|ware)\\s?house$",
38461 "^(driveway|el \xE1rbol|fountain|generic|golf|government|graveyard)$",
38462 "^(fixme|n\\s?\\/?\\s?a|name|no\\s?name|none|null|temporary|test|unknown)$",
38463 "^(hofladen|librairie|magazine?|maison)$",
38464 "^(mobile home|skate)?\\s?park$",
38465 "^(obuwie|pond|pool|sale|shops?|sklep|stores?)$",
38468 "^tattoo( studio)?$",
38470 "^\u0446\u0435\u0440\u043A\u043E\u0432\u043D\u0430\u044F( \u043B\u0430\u0432\u043A\u0430)?$"
38474 // node_modules/name-suggestion-index/config/trees.json
38475 var trees_default = {
38478 emoji: "\u{1F354}",
38479 mainTag: "brand:wikidata",
38480 sourceTags: ["brand", "name"],
38482 primary: "^(name|name:\\w+)$",
38483 alternate: "^(brand|brand:\\w+|operator|operator:\\w+|\\w+_name|\\w+_name:\\w+)$"
38487 emoji: "\u{1F6A9}",
38488 mainTag: "flag:wikidata",
38490 primary: "^(flag:name|flag:name:\\w+)$",
38491 alternate: "^(country|country:\\w+|flag|flag:\\w+|subject|subject:\\w+)$"
38495 emoji: "\u{1F4BC}",
38496 mainTag: "operator:wikidata",
38497 sourceTags: ["operator"],
38499 primary: "^(name|name:\\w+|operator|operator:\\w+)$",
38500 alternate: "^(brand|brand:\\w+|\\w+_name|\\w+_name:\\w+)$"
38504 emoji: "\u{1F687}",
38505 mainTag: "network:wikidata",
38506 sourceTags: ["network"],
38508 primary: "^network$",
38509 alternate: "^(operator|operator:\\w+|network:\\w+|\\w+_name|\\w+_name:\\w+)$"
38515 // node_modules/name-suggestion-index/lib/matcher.js
38516 var matchGroups = matchGroups_default.matchGroups;
38517 var trees = trees_default.trees;
38518 var Matcher = class {
38520 this.matchIndex = void 0;
38521 this.genericWords = /* @__PURE__ */ new Map();
38522 (genericWords_default.genericWords || []).forEach((s) => this.genericWords.set(s, new RegExp(s, "i")));
38523 this.itemLocation = void 0;
38524 this.locationSets = void 0;
38525 this.locationIndex = void 0;
38526 this.warnings = [];
38528 buildMatchIndex(data) {
38530 if (that.matchIndex)
38532 that.matchIndex = /* @__PURE__ */ new Map();
38533 const seenTree = /* @__PURE__ */ new Map();
38534 Object.keys(data).forEach((tkv) => {
38535 const category = data[tkv];
38536 const parts = tkv.split("/", 3);
38537 const t = parts[0];
38538 const k = parts[1];
38539 const v = parts[2];
38540 const thiskv = `${k}/${v}`;
38541 const tree = trees[t];
38542 let branch = that.matchIndex.get(thiskv);
38545 primary: /* @__PURE__ */ new Map(),
38546 alternate: /* @__PURE__ */ new Map(),
38547 excludeGeneric: /* @__PURE__ */ new Map(),
38548 excludeNamed: /* @__PURE__ */ new Map()
38550 that.matchIndex.set(thiskv, branch);
38552 const properties = category.properties || {};
38553 const exclude = properties.exclude || {};
38554 (exclude.generic || []).forEach((s) => branch.excludeGeneric.set(s, new RegExp(s, "i")));
38555 (exclude.named || []).forEach((s) => branch.excludeNamed.set(s, new RegExp(s, "i")));
38556 const excludeRegexes = [...branch.excludeGeneric.values(), ...branch.excludeNamed.values()];
38557 let items = category.items;
38558 if (!Array.isArray(items) || !items.length)
38560 const primaryName = new RegExp(tree.nameTags.primary, "i");
38561 const alternateName = new RegExp(tree.nameTags.alternate, "i");
38562 const notName = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
38563 const skipGenericKV = skipGenericKVMatches(t, k, v);
38564 const genericKV = /* @__PURE__ */ new Set([`${k}/yes`, `building/yes`]);
38565 const matchGroupKV = /* @__PURE__ */ new Set();
38566 Object.values(matchGroups).forEach((matchGroup) => {
38567 const inGroup = matchGroup.some((otherkv) => otherkv === thiskv);
38570 matchGroup.forEach((otherkv) => {
38571 if (otherkv === thiskv)
38573 matchGroupKV.add(otherkv);
38574 const otherk = otherkv.split("/", 2)[0];
38575 genericKV.add(`${otherk}/yes`);
38578 items.forEach((item) => {
38581 if (Array.isArray(item.matchTags) && item.matchTags.length) {
38582 item.matchTags = item.matchTags.filter((matchTag) => !matchGroupKV.has(matchTag) && !genericKV.has(matchTag));
38583 if (!item.matchTags.length)
38584 delete item.matchTags;
38586 let kvTags = [`${thiskv}`].concat(item.matchTags || []);
38587 if (!skipGenericKV) {
38588 kvTags = kvTags.concat(Array.from(genericKV));
38590 Object.keys(item.tags).forEach((osmkey) => {
38591 if (notName.test(osmkey))
38593 const osmvalue = item.tags[osmkey];
38594 if (!osmvalue || excludeRegexes.some((regex) => regex.test(osmvalue)))
38596 if (primaryName.test(osmkey)) {
38597 kvTags.forEach((kv) => insertName("primary", t, kv, simplify(osmvalue), item.id));
38598 } else if (alternateName.test(osmkey)) {
38599 kvTags.forEach((kv) => insertName("alternate", t, kv, simplify(osmvalue), item.id));
38602 let keepMatchNames = /* @__PURE__ */ new Set();
38603 (item.matchNames || []).forEach((matchName) => {
38604 const nsimple = simplify(matchName);
38605 kvTags.forEach((kv) => {
38606 const branch2 = that.matchIndex.get(kv);
38607 const primaryLeaf = branch2 && branch2.primary.get(nsimple);
38608 const alternateLeaf = branch2 && branch2.alternate.get(nsimple);
38609 const inPrimary = primaryLeaf && primaryLeaf.has(item.id);
38610 const inAlternate = alternateLeaf && alternateLeaf.has(item.id);
38611 if (!inPrimary && !inAlternate) {
38612 insertName("alternate", t, kv, nsimple, item.id);
38613 keepMatchNames.add(matchName);
38617 if (keepMatchNames.size) {
38618 item.matchNames = Array.from(keepMatchNames);
38620 delete item.matchNames;
38624 function insertName(which, t, kv, nsimple, itemID) {
38626 that.warnings.push(`Warning: skipping empty ${which} name for item ${t}/${kv}: ${itemID}`);
38629 let branch = that.matchIndex.get(kv);
38632 primary: /* @__PURE__ */ new Map(),
38633 alternate: /* @__PURE__ */ new Map(),
38634 excludeGeneric: /* @__PURE__ */ new Map(),
38635 excludeNamed: /* @__PURE__ */ new Map()
38637 that.matchIndex.set(kv, branch);
38639 let leaf = branch[which].get(nsimple);
38641 leaf = /* @__PURE__ */ new Set();
38642 branch[which].set(nsimple, leaf);
38645 if (!/yes$/.test(kv)) {
38646 const kvnsimple = `${kv}/${nsimple}`;
38647 const existing = seenTree.get(kvnsimple);
38648 if (existing && existing !== t) {
38649 const items = Array.from(leaf);
38650 that.warnings.push(`Duplicate cache key "${kvnsimple}" in trees "${t}" and "${existing}", check items: ${items}`);
38653 seenTree.set(kvnsimple, t);
38656 function skipGenericKVMatches(t, k, v) {
38657 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";
38660 buildLocationIndex(data, loco) {
38662 if (that.locationIndex)
38664 that.itemLocation = /* @__PURE__ */ new Map();
38665 that.locationSets = /* @__PURE__ */ new Map();
38666 Object.keys(data).forEach((tkv) => {
38667 const items = data[tkv].items;
38668 if (!Array.isArray(items) || !items.length)
38670 items.forEach((item) => {
38671 if (that.itemLocation.has(item.id))
38675 resolved = loco.resolveLocationSet(item.locationSet);
38677 console.warn(`buildLocationIndex: ${err.message}`);
38679 if (!resolved || !resolved.id)
38681 that.itemLocation.set(item.id, resolved.id);
38682 if (that.locationSets.has(resolved.id))
38684 let feature3 = _cloneDeep2(resolved.feature);
38685 feature3.id = resolved.id;
38686 feature3.properties.id = resolved.id;
38687 if (!feature3.geometry.coordinates.length || !feature3.properties.area) {
38688 console.warn(`buildLocationIndex: locationSet ${resolved.id} for ${item.id} resolves to an empty feature:`);
38689 console.warn(JSON.stringify(feature3));
38692 that.locationSets.set(resolved.id, feature3);
38695 that.locationIndex = (0, import_which_polygon3.default)({ type: "FeatureCollection", features: [...that.locationSets.values()] });
38696 function _cloneDeep2(obj) {
38697 return JSON.parse(JSON.stringify(obj));
38700 match(k, v, n2, loc) {
38702 if (!that.matchIndex) {
38703 throw new Error("match: matchIndex not built.");
38705 let matchLocations;
38706 if (Array.isArray(loc) && that.locationIndex) {
38707 matchLocations = that.locationIndex([loc[0], loc[1], loc[0], loc[1]], true);
38709 const nsimple = simplify(n2);
38710 let seen = /* @__PURE__ */ new Set();
38712 gatherResults("primary");
38713 gatherResults("alternate");
38714 if (results.length)
38716 gatherResults("exclude");
38717 return results.length ? results : null;
38718 function gatherResults(which) {
38719 const kv = `${k}/${v}`;
38720 let didMatch = tryMatch(which, kv);
38723 for (let mg in matchGroups) {
38724 const matchGroup = matchGroups[mg];
38725 const inGroup = matchGroup.some((otherkv) => otherkv === kv);
38728 for (let i2 = 0; i2 < matchGroup.length; i2++) {
38729 const otherkv = matchGroup[i2];
38730 if (otherkv === kv)
38732 didMatch = tryMatch(which, otherkv);
38737 if (which === "exclude") {
38738 const regex = [...that.genericWords.values()].find((regex2) => regex2.test(n2));
38740 results.push({ match: "excludeGeneric", pattern: String(regex) });
38745 function tryMatch(which, kv) {
38746 const branch = that.matchIndex.get(kv);
38749 if (which === "exclude") {
38750 let regex = [...branch.excludeNamed.values()].find((regex2) => regex2.test(n2));
38752 results.push({ match: "excludeNamed", pattern: String(regex), kv });
38755 regex = [...branch.excludeGeneric.values()].find((regex2) => regex2.test(n2));
38757 results.push({ match: "excludeGeneric", pattern: String(regex), kv });
38762 const leaf = branch[which].get(nsimple);
38763 if (!leaf || !leaf.size)
38765 let hits = Array.from(leaf).map((itemID) => {
38766 let area = Infinity;
38767 if (that.itemLocation && that.locationSets) {
38768 const location = that.locationSets.get(that.itemLocation.get(itemID));
38769 area = location && location.properties.area || Infinity;
38771 return { match: which, itemID, area, kv, nsimple };
38773 let sortFn = byAreaDescending;
38774 if (matchLocations) {
38775 hits = hits.filter(isValidLocation);
38776 sortFn = byAreaAscending;
38780 hits.sort(sortFn).forEach((hit) => {
38781 if (seen.has(hit.itemID))
38783 seen.add(hit.itemID);
38787 function isValidLocation(hit) {
38788 if (!that.itemLocation)
38790 return matchLocations.find((props) => props.id === that.itemLocation.get(hit.itemID));
38792 function byAreaAscending(hitA, hitB) {
38793 return hitA.area - hitB.area;
38795 function byAreaDescending(hitA, hitB) {
38796 return hitB.area - hitA.area;
38801 return this.warnings;
38805 // modules/services/nsi.js
38806 var import_vparse2 = __toESM(require_vparse());
38808 // modules/core/difference.js
38809 var import_fast_deep_equal3 = __toESM(require_fast_deep_equal());
38810 function coreDifference(base, head) {
38812 var _didChange = {};
38814 function checkEntityID(id2) {
38815 var h = head.entities[id2];
38816 var b = base.entities[id2];
38822 _changes[id2] = { base: b, head: h };
38823 _didChange.deletion = true;
38827 _changes[id2] = { base: b, head: h };
38828 _didChange.addition = true;
38832 if (h.members && b.members && !(0, import_fast_deep_equal3.default)(h.members, b.members)) {
38833 _changes[id2] = { base: b, head: h };
38834 _didChange.geometry = true;
38835 _didChange.properties = true;
38838 if (h.loc && b.loc && !geoVecEqual(h.loc, b.loc)) {
38839 _changes[id2] = { base: b, head: h };
38840 _didChange.geometry = true;
38842 if (h.nodes && b.nodes && !(0, import_fast_deep_equal3.default)(h.nodes, b.nodes)) {
38843 _changes[id2] = { base: b, head: h };
38844 _didChange.geometry = true;
38846 if (h.tags && b.tags && !(0, import_fast_deep_equal3.default)(h.tags, b.tags)) {
38847 _changes[id2] = { base: b, head: h };
38848 _didChange.properties = true;
38853 var ids = utilArrayUniq(Object.keys(head.entities).concat(Object.keys(base.entities)));
38854 for (var i2 = 0; i2 < ids.length; i2++) {
38855 checkEntityID(ids[i2]);
38859 _diff.length = function length() {
38860 return Object.keys(_changes).length;
38862 _diff.changes = function changes() {
38865 _diff.didChange = _didChange;
38866 _diff.extantIDs = function extantIDs(includeRelMembers) {
38867 var result = /* @__PURE__ */ new Set();
38868 Object.keys(_changes).forEach(function(id2) {
38869 if (_changes[id2].head) {
38872 var h = _changes[id2].head;
38873 var b = _changes[id2].base;
38874 var entity = h || b;
38875 if (includeRelMembers && entity.type === "relation") {
38876 var mh = h ? h.members.map(function(m) {
38879 var mb = b ? b.members.map(function(m) {
38882 utilArrayUnion(mh, mb).forEach(function(memberID) {
38883 if (head.hasEntity(memberID)) {
38884 result.add(memberID);
38889 return Array.from(result);
38891 _diff.modified = function modified() {
38893 Object.values(_changes).forEach(function(change) {
38894 if (change.base && change.head) {
38895 result.push(change.head);
38900 _diff.created = function created() {
38902 Object.values(_changes).forEach(function(change) {
38903 if (!change.base && change.head) {
38904 result.push(change.head);
38909 _diff.deleted = function deleted() {
38911 Object.values(_changes).forEach(function(change) {
38912 if (change.base && !change.head) {
38913 result.push(change.base);
38918 _diff.summary = function summary() {
38920 var keys = Object.keys(_changes);
38921 for (var i2 = 0; i2 < keys.length; i2++) {
38922 var change = _changes[keys[i2]];
38923 if (change.head && change.head.geometry(head) !== "vertex") {
38924 addEntity(change.head, head, change.base ? "modified" : "created");
38925 } else if (change.base && change.base.geometry(base) !== "vertex") {
38926 addEntity(change.base, base, "deleted");
38927 } else if (change.base && change.head) {
38928 var moved = !(0, import_fast_deep_equal3.default)(change.base.loc, change.head.loc);
38929 var retagged = !(0, import_fast_deep_equal3.default)(change.base.tags, change.head.tags);
38931 addParents(change.head);
38933 if (retagged || moved && change.head.hasInterestingTags()) {
38934 addEntity(change.head, head, "modified");
38936 } else if (change.head && change.head.hasInterestingTags()) {
38937 addEntity(change.head, head, "created");
38938 } else if (change.base && change.base.hasInterestingTags()) {
38939 addEntity(change.base, base, "deleted");
38942 return Object.values(relevant);
38943 function addEntity(entity, graph, changeType) {
38944 relevant[entity.id] = {
38950 function addParents(entity) {
38951 var parents = head.parentWays(entity);
38952 for (var j2 = parents.length - 1; j2 >= 0; j2--) {
38953 var parent = parents[j2];
38954 if (!(parent.id in relevant)) {
38955 addEntity(parent, head, "modified");
38960 _diff.complete = function complete(extent) {
38963 for (id2 in _changes) {
38964 change = _changes[id2];
38965 var h = change.head;
38966 var b = change.base;
38967 var entity = h || b;
38969 if (extent && (!h || !h.intersects(extent, head)) && (!b || !b.intersects(extent, base))) {
38973 if (entity.type === "way") {
38974 var nh = h ? h.nodes : [];
38975 var nb = b ? b.nodes : [];
38977 diff = utilArrayDifference(nh, nb);
38978 for (i2 = 0; i2 < diff.length; i2++) {
38979 result[diff[i2]] = head.hasEntity(diff[i2]);
38981 diff = utilArrayDifference(nb, nh);
38982 for (i2 = 0; i2 < diff.length; i2++) {
38983 result[diff[i2]] = head.hasEntity(diff[i2]);
38986 if (entity.type === "relation" && entity.isMultipolygon()) {
38987 var mh = h ? h.members.map(function(m) {
38990 var mb = b ? b.members.map(function(m) {
38993 var ids = utilArrayUnion(mh, mb);
38994 for (i2 = 0; i2 < ids.length; i2++) {
38995 var member = head.hasEntity(ids[i2]);
38998 if (extent && !member.intersects(extent, head))
39000 result[ids[i2]] = member;
39003 addParents(head.parentWays(entity), result);
39004 addParents(head.parentRelations(entity), result);
39007 function addParents(parents, result2) {
39008 for (var i3 = 0; i3 < parents.length; i3++) {
39009 var parent = parents[i3];
39010 if (parent.id in result2)
39012 result2[parent.id] = parent;
39013 addParents(head.parentRelations(parent), result2);
39020 // modules/core/tree.js
39021 var import_rbush6 = __toESM(require_rbush_min());
39022 function coreTree(head) {
39023 var _rtree = new import_rbush6.default();
39025 var _segmentsRTree = new import_rbush6.default();
39026 var _segmentsBBoxes = {};
39027 var _segmentsByWayId = {};
39029 function entityBBox(entity) {
39030 var bbox2 = entity.extent(head).bbox();
39031 bbox2.id = entity.id;
39032 _bboxes[entity.id] = bbox2;
39035 function segmentBBox(segment) {
39036 var extent = segment.extent(head);
39039 var bbox2 = extent.bbox();
39040 bbox2.segment = segment;
39041 _segmentsBBoxes[segment.id] = bbox2;
39044 function removeEntity(entity) {
39045 _rtree.remove(_bboxes[entity.id]);
39046 delete _bboxes[entity.id];
39047 if (_segmentsByWayId[entity.id]) {
39048 _segmentsByWayId[entity.id].forEach(function(segment) {
39049 _segmentsRTree.remove(_segmentsBBoxes[segment.id]);
39050 delete _segmentsBBoxes[segment.id];
39052 delete _segmentsByWayId[entity.id];
39055 function loadEntities(entities) {
39056 _rtree.load(entities.map(entityBBox));
39058 entities.forEach(function(entity) {
39059 if (entity.segments) {
39060 var entitySegments = entity.segments(head);
39061 _segmentsByWayId[entity.id] = entitySegments;
39062 segments = segments.concat(entitySegments);
39065 if (segments.length)
39066 _segmentsRTree.load(segments.map(segmentBBox).filter(Boolean));
39068 function updateParents(entity, insertions, memo) {
39069 head.parentWays(entity).forEach(function(way) {
39070 if (_bboxes[way.id]) {
39072 insertions[way.id] = way;
39074 updateParents(way, insertions, memo);
39076 head.parentRelations(entity).forEach(function(relation) {
39077 if (memo[entity.id])
39079 memo[entity.id] = true;
39080 if (_bboxes[relation.id]) {
39081 removeEntity(relation);
39082 insertions[relation.id] = relation;
39084 updateParents(relation, insertions, memo);
39087 tree.rebase = function(entities, force) {
39088 var insertions = {};
39089 for (var i2 = 0; i2 < entities.length; i2++) {
39090 var entity = entities[i2];
39091 if (!entity.visible)
39093 if (head.entities.hasOwnProperty(entity.id) || _bboxes[entity.id]) {
39096 } else if (_bboxes[entity.id]) {
39097 removeEntity(entity);
39100 insertions[entity.id] = entity;
39101 updateParents(entity, insertions, {});
39103 loadEntities(Object.values(insertions));
39106 function updateToGraph(graph) {
39107 if (graph === head)
39109 var diff = coreDifference(head, graph);
39111 var changed = diff.didChange;
39112 if (!changed.addition && !changed.deletion && !changed.geometry)
39114 var insertions = {};
39115 if (changed.deletion) {
39116 diff.deleted().forEach(function(entity) {
39117 removeEntity(entity);
39120 if (changed.geometry) {
39121 diff.modified().forEach(function(entity) {
39122 removeEntity(entity);
39123 insertions[entity.id] = entity;
39124 updateParents(entity, insertions, {});
39127 if (changed.addition) {
39128 diff.created().forEach(function(entity) {
39129 insertions[entity.id] = entity;
39132 loadEntities(Object.values(insertions));
39134 tree.intersects = function(extent, graph) {
39135 updateToGraph(graph);
39136 return _rtree.search(extent.bbox()).map(function(bbox2) {
39137 return graph.entity(bbox2.id);
39140 tree.waySegments = function(extent, graph) {
39141 updateToGraph(graph);
39142 return _segmentsRTree.search(extent.bbox()).map(function(bbox2) {
39143 return bbox2.segment;
39149 // modules/svg/icon.js
39150 function svgIcon(name, svgklass, useklass) {
39151 return function drawIcon(selection2) {
39152 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);
39156 // modules/ui/modal.js
39157 function uiModal(selection2, blocking) {
39158 let keybinding = utilKeybinding("modal");
39159 let previous = selection2.select("div.modal");
39160 let animate = previous.empty();
39161 previous.transition().duration(200).style("opacity", 0).remove();
39162 let shaded = selection2.append("div").attr("class", "shaded").style("opacity", 0);
39163 shaded.close = () => {
39164 shaded.transition().duration(200).style("opacity", 0).remove();
39165 modal.transition().duration(200).style("top", "0px");
39166 select_default2(document).call(keybinding.unbind);
39168 let modal = shaded.append("div").attr("class", "modal fillL");
39169 modal.append("input").attr("class", "keytrap keytrap-first").on("focus.keytrap", moveFocusToLast);
39171 shaded.on("click.remove-modal", (d3_event) => {
39172 if (d3_event.target === this) {
39176 modal.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", shaded.close).call(svgIcon("#iD-icon-close"));
39177 keybinding.on("\u232B", shaded.close).on("\u238B", shaded.close);
39178 select_default2(document).call(keybinding);
39180 modal.append("div").attr("class", "content");
39181 modal.append("input").attr("class", "keytrap keytrap-last").on("focus.keytrap", moveFocusToFirst);
39183 shaded.transition().style("opacity", 1);
39185 shaded.style("opacity", 1);
39188 function moveFocusToFirst() {
39189 let node = modal.select("a, button, input:not(.keytrap), select, textarea").node();
39193 select_default2(this).node().blur();
39196 function moveFocusToLast() {
39197 let nodes = modal.selectAll("a, button, input:not(.keytrap), select, textarea").nodes();
39198 if (nodes.length) {
39199 nodes[nodes.length - 1].focus();
39201 select_default2(this).node().blur();
39206 // modules/ui/loading.js
39207 function uiLoading(context) {
39208 let _modalSelection = select_default2(null);
39210 let _blocking = false;
39211 let loading = (selection2) => {
39212 _modalSelection = uiModal(selection2, _blocking);
39213 let loadertext = _modalSelection.select(".content").classed("loading-modal", true).append("div").attr("class", "modal-section fillL");
39214 loadertext.append("img").attr("class", "loader").attr("src", context.imagePath("loader-white.gif"));
39215 loadertext.append("h3").html(_message);
39216 _modalSelection.select("button.close").attr("class", "hide");
39219 loading.message = function(val) {
39220 if (!arguments.length)
39225 loading.blocking = function(val) {
39226 if (!arguments.length)
39231 loading.close = () => {
39232 _modalSelection.remove();
39234 loading.isShown = () => {
39235 return _modalSelection && !_modalSelection.empty() && _modalSelection.node().parentNode;
39240 // modules/core/history.js
39241 function coreHistory(context) {
39242 var dispatch10 = dispatch_default("reset", "change", "merge", "restore", "undone", "redone", "storage_error");
39243 var lock = utilSessionMutex("lock");
39244 var _hasUnresolvedRestorableChanges = lock.lock() && !!corePreferences(getKey("saved_history"));
39245 var duration = 150;
39246 var _imageryUsed = [];
39247 var _photoOverlaysUsed = [];
39248 var _checkpoints = {};
39253 function _act(actions, t) {
39254 actions = Array.prototype.slice.call(actions);
39256 if (typeof actions[actions.length - 1] !== "function") {
39257 annotation = actions.pop();
39259 var graph = _stack[_index].graph;
39260 for (var i2 = 0; i2 < actions.length; i2++) {
39261 graph = actions[i2](graph, t);
39266 imageryUsed: _imageryUsed,
39267 photoOverlaysUsed: _photoOverlaysUsed,
39268 transform: context.projection.transform(),
39269 selectedIDs: context.selectedIDs()
39272 function _perform(args, t) {
39273 var previous = _stack[_index].graph;
39274 _stack = _stack.slice(0, _index + 1);
39275 var actionResult = _act(args, t);
39276 _stack.push(actionResult);
39278 return change(previous);
39280 function _replace(args, t) {
39281 var previous = _stack[_index].graph;
39282 var actionResult = _act(args, t);
39283 _stack[_index] = actionResult;
39284 return change(previous);
39286 function _overwrite(args, t) {
39287 var previous = _stack[_index].graph;
39292 _stack = _stack.slice(0, _index + 1);
39293 var actionResult = _act(args, t);
39294 _stack.push(actionResult);
39296 return change(previous);
39298 function change(previous) {
39299 var difference = coreDifference(previous, history.graph());
39300 if (!_pausedGraph) {
39301 dispatch10.call("change", this, difference);
39305 function getKey(n2) {
39306 return "iD_" + window.location.origin + "_" + n2;
39309 graph: function() {
39310 return _stack[_index].graph;
39316 return _stack[0].graph;
39318 merge: function(entities) {
39319 var stack = _stack.map(function(state) {
39320 return state.graph;
39322 _stack[0].graph.rebase(entities, stack, false);
39323 _tree.rebase(entities, false);
39324 dispatch10.call("merge", this, entities);
39326 perform: function() {
39327 select_default2(document).interrupt("history.perform");
39328 var transitionable = false;
39329 var action0 = arguments[0];
39330 if (arguments.length === 1 || arguments.length === 2 && typeof arguments[1] !== "function") {
39331 transitionable = !!action0.transitionable;
39333 if (transitionable) {
39334 var origArguments = arguments;
39335 select_default2(document).transition("history.perform").duration(duration).ease(linear2).tween("history.tween", function() {
39336 return function(t) {
39338 _overwrite([action0], t);
39340 }).on("start", function() {
39341 _perform([action0], 0);
39342 }).on("end interrupt", function() {
39343 _overwrite(origArguments, 1);
39346 return _perform(arguments);
39349 replace: function() {
39350 select_default2(document).interrupt("history.perform");
39351 return _replace(arguments, 1);
39353 overwrite: function() {
39354 select_default2(document).interrupt("history.perform");
39355 return _overwrite(arguments, 1);
39357 pop: function(n2) {
39358 select_default2(document).interrupt("history.perform");
39359 var previous = _stack[_index].graph;
39360 if (isNaN(+n2) || +n2 < 0) {
39363 while (n2-- > 0 && _index > 0) {
39367 return change(previous);
39370 select_default2(document).interrupt("history.perform");
39371 var previousStack = _stack[_index];
39372 var previous = previousStack.graph;
39373 while (_index > 0) {
39375 if (_stack[_index].annotation)
39378 dispatch10.call("undone", this, _stack[_index], previousStack);
39379 return change(previous);
39382 select_default2(document).interrupt("history.perform");
39383 var previousStack = _stack[_index];
39384 var previous = previousStack.graph;
39385 var tryIndex = _index;
39386 while (tryIndex < _stack.length - 1) {
39388 if (_stack[tryIndex].annotation) {
39390 dispatch10.call("redone", this, _stack[_index], previousStack);
39394 return change(previous);
39396 pauseChangeDispatch: function() {
39397 if (!_pausedGraph) {
39398 _pausedGraph = _stack[_index].graph;
39401 resumeChangeDispatch: function() {
39402 if (_pausedGraph) {
39403 var previous = _pausedGraph;
39404 _pausedGraph = null;
39405 return change(previous);
39408 undoAnnotation: function() {
39411 if (_stack[i2].annotation)
39412 return _stack[i2].annotation;
39416 redoAnnotation: function() {
39417 var i2 = _index + 1;
39418 while (i2 <= _stack.length - 1) {
39419 if (_stack[i2].annotation)
39420 return _stack[i2].annotation;
39424 intersects: function(extent) {
39425 return _tree.intersects(extent, _stack[_index].graph);
39427 difference: function() {
39428 var base = _stack[0].graph;
39429 var head = _stack[_index].graph;
39430 return coreDifference(base, head);
39432 changes: function(action) {
39433 var base = _stack[0].graph;
39434 var head = _stack[_index].graph;
39436 head = action(head);
39438 var difference = coreDifference(base, head);
39440 modified: difference.modified(),
39441 created: difference.created(),
39442 deleted: difference.deleted()
39445 hasChanges: function() {
39446 return this.difference().length() > 0;
39448 imageryUsed: function(sources) {
39450 _imageryUsed = sources;
39453 var s = /* @__PURE__ */ new Set();
39454 _stack.slice(1, _index + 1).forEach(function(state) {
39455 state.imageryUsed.forEach(function(source) {
39456 if (source !== "Custom") {
39461 return Array.from(s);
39464 photoOverlaysUsed: function(sources) {
39466 _photoOverlaysUsed = sources;
39469 var s = /* @__PURE__ */ new Set();
39470 _stack.slice(1, _index + 1).forEach(function(state) {
39471 if (state.photoOverlaysUsed && Array.isArray(state.photoOverlaysUsed)) {
39472 state.photoOverlaysUsed.forEach(function(photoOverlay) {
39473 s.add(photoOverlay);
39477 return Array.from(s);
39480 checkpoint: function(key) {
39481 _checkpoints[key] = {
39487 reset: function(key) {
39488 if (key !== void 0 && _checkpoints.hasOwnProperty(key)) {
39489 _stack = _checkpoints[key].stack;
39490 _index = _checkpoints[key].index;
39492 _stack = [{ graph: coreGraph() }];
39494 _tree = coreTree(_stack[0].graph);
39497 dispatch10.call("reset");
39498 dispatch10.call("change");
39501 toIntroGraph: function() {
39502 var nextID = { n: 0, r: 0, w: 0 };
39504 var graph = this.graph();
39505 var baseEntities = {};
39506 Object.values(graph.base().entities).forEach(function(entity) {
39507 var copy2 = copyIntroEntity(entity);
39508 baseEntities[copy2.id] = copy2;
39510 Object.keys(graph.entities).forEach(function(id2) {
39511 var entity = graph.entities[id2];
39513 var copy2 = copyIntroEntity(entity);
39514 baseEntities[copy2.id] = copy2;
39516 delete baseEntities[id2];
39519 Object.values(baseEntities).forEach(function(entity) {
39520 if (Array.isArray(entity.nodes)) {
39521 entity.nodes = entity.nodes.map(function(node) {
39522 return permIDs[node] || node;
39525 if (Array.isArray(entity.members)) {
39526 entity.members = entity.members.map(function(member) {
39527 member.id = permIDs[member.id] || member.id;
39532 return JSON.stringify({ dataIntroGraph: baseEntities });
39533 function copyIntroEntity(source) {
39534 var copy2 = utilObjectOmit(source, ["type", "user", "v", "version", "visible"]);
39535 if (copy2.tags && !Object.keys(copy2.tags)) {
39538 if (Array.isArray(copy2.loc)) {
39539 copy2.loc[0] = +copy2.loc[0].toFixed(6);
39540 copy2.loc[1] = +copy2.loc[1].toFixed(6);
39542 var match = source.id.match(/([nrw])-\d*/);
39543 if (match !== null) {
39544 var nrw = match[1];
39547 permID = nrw + ++nextID[nrw];
39548 } while (baseEntities.hasOwnProperty(permID));
39549 copy2.id = permIDs[source.id] = permID;
39554 toJSON: function() {
39555 if (!this.hasChanges())
39557 var allEntities = {};
39558 var baseEntities = {};
39559 var base = _stack[0];
39560 var s = _stack.map(function(i2) {
39563 Object.keys(i2.graph.entities).forEach(function(id2) {
39564 var entity = i2.graph.entities[id2];
39566 var key = osmEntity.key(entity);
39567 allEntities[key] = entity;
39568 modified.push(key);
39572 if (id2 in base.graph.entities) {
39573 baseEntities[id2] = base.graph.entities[id2];
39575 if (entity && entity.nodes) {
39576 entity.nodes.forEach(function(nodeID) {
39577 if (nodeID in base.graph.entities) {
39578 baseEntities[nodeID] = base.graph.entities[nodeID];
39582 var baseParents = base.graph._parentWays[id2];
39584 baseParents.forEach(function(parentID) {
39585 if (parentID in base.graph.entities) {
39586 baseEntities[parentID] = base.graph.entities[parentID];
39592 if (modified.length)
39593 x.modified = modified;
39594 if (deleted.length)
39595 x.deleted = deleted;
39596 if (i2.imageryUsed)
39597 x.imageryUsed = i2.imageryUsed;
39598 if (i2.photoOverlaysUsed)
39599 x.photoOverlaysUsed = i2.photoOverlaysUsed;
39601 x.annotation = i2.annotation;
39603 x.transform = i2.transform;
39604 if (i2.selectedIDs)
39605 x.selectedIDs = i2.selectedIDs;
39608 return JSON.stringify({
39610 entities: Object.values(allEntities),
39611 baseEntities: Object.values(baseEntities),
39613 nextIDs: osmEntity.id.next,
39615 timestamp: new Date().getTime()
39618 fromJSON: function(json, loadChildNodes) {
39619 var h = JSON.parse(json);
39620 var loadComplete = true;
39621 osmEntity.id.next = h.nextIDs;
39623 if (h.version === 2 || h.version === 3) {
39624 var allEntities = {};
39625 h.entities.forEach(function(entity) {
39626 allEntities[osmEntity.key(entity)] = osmEntity(entity);
39628 if (h.version === 3) {
39629 var baseEntities = h.baseEntities.map(function(d) {
39630 return osmEntity(d);
39632 var stack = _stack.map(function(state) {
39633 return state.graph;
39635 _stack[0].graph.rebase(baseEntities, stack, true);
39636 _tree.rebase(baseEntities, true);
39637 if (loadChildNodes) {
39638 var osm = context.connection();
39639 var baseWays = baseEntities.filter(function(e) {
39640 return e.type === "way";
39642 var nodeIDs = baseWays.reduce(function(acc, way) {
39643 return utilArrayUnion(acc, way.nodes);
39645 var missing = nodeIDs.filter(function(n2) {
39646 return !_stack[0].graph.hasEntity(n2);
39648 if (missing.length && osm) {
39649 loadComplete = false;
39650 context.map().redrawEnable(false);
39651 var loading = uiLoading(context).blocking(true);
39652 context.container().call(loading);
39653 var childNodesLoaded = function(err, result) {
39655 var visibleGroups = utilArrayGroupBy(result.data, "visible");
39656 var visibles = visibleGroups.true || [];
39657 var invisibles = visibleGroups.false || [];
39658 if (visibles.length) {
39659 var visibleIDs = visibles.map(function(entity) {
39662 var stack2 = _stack.map(function(state) {
39663 return state.graph;
39665 missing = utilArrayDifference(missing, visibleIDs);
39666 _stack[0].graph.rebase(visibles, stack2, true);
39667 _tree.rebase(visibles, true);
39669 invisibles.forEach(function(entity) {
39670 osm.loadEntityVersion(entity.id, +entity.version - 1, childNodesLoaded);
39673 if (err || !missing.length) {
39675 context.map().redrawEnable(true);
39676 dispatch10.call("change");
39677 dispatch10.call("restore", this);
39680 osm.loadMultiple(missing, childNodesLoaded);
39684 _stack = h.stack.map(function(d) {
39685 var entities = {}, entity;
39687 d.modified.forEach(function(key) {
39688 entity = allEntities[key];
39689 entities[entity.id] = entity;
39693 d.deleted.forEach(function(id2) {
39694 entities[id2] = void 0;
39698 graph: coreGraph(_stack[0].graph).load(entities),
39699 annotation: d.annotation,
39700 imageryUsed: d.imageryUsed,
39701 photoOverlaysUsed: d.photoOverlaysUsed,
39702 transform: d.transform,
39703 selectedIDs: d.selectedIDs
39707 _stack = h.stack.map(function(d) {
39709 for (var i2 in d.entities) {
39710 var entity = d.entities[i2];
39711 entities[i2] = entity === "undefined" ? void 0 : osmEntity(entity);
39713 d.graph = coreGraph(_stack[0].graph).load(entities);
39717 var transform2 = _stack[_index].transform;
39719 context.map().transformEase(transform2, 0);
39721 if (loadComplete) {
39722 dispatch10.call("change");
39723 dispatch10.call("restore", this);
39728 return lock.lock();
39730 unlock: function() {
39734 if (lock.locked() && !_hasUnresolvedRestorableChanges) {
39735 const success = corePreferences(getKey("saved_history"), history.toJSON() || null);
39737 dispatch10.call("storage_error");
39741 clearSaved: function() {
39742 context.debouncedSave.cancel();
39743 if (lock.locked()) {
39744 _hasUnresolvedRestorableChanges = false;
39745 corePreferences(getKey("saved_history"), null);
39746 corePreferences("comment", null);
39747 corePreferences("hashtags", null);
39748 corePreferences("source", null);
39752 savedHistoryJSON: function() {
39753 return corePreferences(getKey("saved_history"));
39755 hasRestorableChanges: function() {
39756 return _hasUnresolvedRestorableChanges;
39758 restore: function() {
39759 if (lock.locked()) {
39760 _hasUnresolvedRestorableChanges = false;
39761 var json = this.savedHistoryJSON();
39763 history.fromJSON(json, true);
39769 return utilRebind(history, dispatch10, "on");
39772 // modules/validations/index.js
39773 var validations_exports = {};
39774 __export(validations_exports, {
39775 validationAlmostJunction: () => validationAlmostJunction,
39776 validationCloseNodes: () => validationCloseNodes,
39777 validationCrossingWays: () => validationCrossingWays,
39778 validationDisconnectedWay: () => validationDisconnectedWay,
39779 validationFormatting: () => validationFormatting,
39780 validationHelpRequest: () => validationHelpRequest,
39781 validationImpossibleOneway: () => validationImpossibleOneway,
39782 validationIncompatibleSource: () => validationIncompatibleSource,
39783 validationMaprules: () => validationMaprules,
39784 validationMismatchedGeometry: () => validationMismatchedGeometry,
39785 validationMissingRole: () => validationMissingRole,
39786 validationMissingTag: () => validationMissingTag,
39787 validationOutdatedTags: () => validationOutdatedTags,
39788 validationPrivateData: () => validationPrivateData,
39789 validationSuspiciousName: () => validationSuspiciousName,
39790 validationUnsquareWay: () => validationUnsquareWay
39793 // modules/validations/almost_junction.js
39794 function validationAlmostJunction(context) {
39795 const type3 = "almost_junction";
39796 const EXTEND_TH_METERS = 5;
39797 const WELD_TH_METERS = 0.75;
39798 const CLOSE_NODE_TH = EXTEND_TH_METERS - WELD_TH_METERS;
39799 const SIG_ANGLE_TH = Math.atan(WELD_TH_METERS / EXTEND_TH_METERS);
39800 function isHighway(entity) {
39801 return entity.type === "way" && osmRoutableHighwayTagValues[entity.tags.highway];
39803 function isTaggedAsNotContinuing(node) {
39804 return node.tags.noexit === "yes" || node.tags.amenity === "parking_entrance" || node.tags.entrance && node.tags.entrance !== "no";
39806 const validation = function checkAlmostJunction(entity, graph) {
39807 if (!isHighway(entity))
39809 if (entity.isDegenerate())
39811 const tree = context.history().tree();
39812 const extendableNodeInfos = findConnectableEndNodesByExtension(entity);
39814 extendableNodeInfos.forEach((extendableNodeInfo) => {
39815 issues.push(new validationIssue({
39817 subtype: "highway-highway",
39818 severity: "warning",
39819 message: function(context2) {
39820 const entity1 = context2.hasEntity(this.entityIds[0]);
39821 if (this.entityIds[0] === this.entityIds[2]) {
39822 return entity1 ? _t.append("issues.almost_junction.self.message", {
39823 feature: utilDisplayLabel(entity1, context2.graph())
39826 const entity2 = context2.hasEntity(this.entityIds[2]);
39827 return entity1 && entity2 ? _t.append("issues.almost_junction.message", {
39828 feature: utilDisplayLabel(entity1, context2.graph()),
39829 feature2: utilDisplayLabel(entity2, context2.graph())
39833 reference: showReference,
39836 extendableNodeInfo.node.id,
39837 extendableNodeInfo.wid
39839 loc: extendableNodeInfo.node.loc,
39840 hash: JSON.stringify(extendableNodeInfo.node.loc),
39842 midId: extendableNodeInfo.mid.id,
39843 edge: extendableNodeInfo.edge,
39844 cross_loc: extendableNodeInfo.cross_loc
39846 dynamicFixes: makeFixes
39850 function makeFixes(context2) {
39851 let fixes = [new validationIssueFix({
39852 icon: "iD-icon-abutment",
39853 title: _t.append("issues.fix.connect_features.title"),
39854 onClick: function(context3) {
39855 const annotation = _t("issues.fix.connect_almost_junction.annotation");
39856 const [, endNodeId, crossWayId] = this.issue.entityIds;
39857 const midNode = context3.entity(this.issue.data.midId);
39858 const endNode = context3.entity(endNodeId);
39859 const crossWay = context3.entity(crossWayId);
39860 const nearEndNodes = findNearbyEndNodes(endNode, crossWay);
39861 if (nearEndNodes.length > 0) {
39862 const collinear = findSmallJoinAngle(midNode, endNode, nearEndNodes);
39865 actionMergeNodes([collinear.id, endNode.id], collinear.loc),
39871 const targetEdge = this.issue.data.edge;
39872 const crossLoc = this.issue.data.cross_loc;
39873 const edgeNodes = [context3.entity(targetEdge[0]), context3.entity(targetEdge[1])];
39874 const closestNodeInfo = geoSphericalClosestNode(edgeNodes, crossLoc);
39875 if (closestNodeInfo.distance < WELD_TH_METERS) {
39877 actionMergeNodes([closestNodeInfo.node.id, endNode.id], closestNodeInfo.node.loc),
39882 actionAddMidpoint({ loc: crossLoc, edge: targetEdge }, endNode),
39888 const node = context2.hasEntity(this.entityIds[1]);
39889 if (node && !node.hasInterestingTags()) {
39890 fixes.push(new validationIssueFix({
39891 icon: "maki-barrier",
39892 title: _t.append("issues.fix.tag_as_disconnected.title"),
39893 onClick: function(context3) {
39894 const nodeID = this.issue.entityIds[1];
39895 const tags = Object.assign({}, context3.entity(nodeID).tags);
39896 tags.noexit = "yes";
39898 actionChangeTags(nodeID, tags),
39899 _t("issues.fix.tag_as_disconnected.annotation")
39906 function showReference(selection2) {
39907 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.almost_junction.highway-highway.reference"));
39909 function isExtendableCandidate(node, way) {
39910 const osm = services.osm;
39911 if (osm && !osm.isDataLoaded(node.loc)) {
39914 if (isTaggedAsNotContinuing(node) || graph.parentWays(node).length !== 1) {
39917 let occurrences = 0;
39918 for (const index in way.nodes) {
39919 if (way.nodes[index] === node.id) {
39921 if (occurrences > 1) {
39928 function findConnectableEndNodesByExtension(way) {
39930 if (way.isClosed())
39933 const indices = [0, way.nodes.length - 1];
39934 indices.forEach((nodeIndex) => {
39935 const nodeID = way.nodes[nodeIndex];
39936 const node = graph.entity(nodeID);
39937 if (!isExtendableCandidate(node, way))
39939 const connectionInfo = canConnectByExtend(way, nodeIndex);
39940 if (!connectionInfo)
39942 testNodes = graph.childNodes(way).slice();
39943 testNodes[nodeIndex] = testNodes[nodeIndex].move(connectionInfo.cross_loc);
39944 if (geoHasSelfIntersections(testNodes, nodeID))
39946 results.push(connectionInfo);
39950 function findNearbyEndNodes(node, way) {
39953 way.nodes[way.nodes.length - 1]
39954 ].map((d) => graph.entity(d)).filter((d) => {
39955 return d.id !== node.id && geoSphericalDistance(node.loc, d.loc) <= CLOSE_NODE_TH;
39958 function findSmallJoinAngle(midNode, tipNode, endNodes) {
39960 let minAngle = Infinity;
39961 endNodes.forEach((endNode) => {
39962 const a1 = geoAngle(midNode, tipNode, context.projection) + Math.PI;
39963 const a2 = geoAngle(midNode, endNode, context.projection) + Math.PI;
39964 const diff = Math.max(a1, a2) - Math.min(a1, a2);
39965 if (diff < minAngle) {
39970 if (minAngle <= SIG_ANGLE_TH)
39974 function hasTag(tags, key) {
39975 return tags[key] !== void 0 && tags[key] !== "no";
39977 function canConnectWays(way, way2) {
39978 if (way.id === way2.id)
39980 if ((hasTag(way.tags, "bridge") || hasTag(way2.tags, "bridge")) && !(hasTag(way.tags, "bridge") && hasTag(way2.tags, "bridge")))
39982 if ((hasTag(way.tags, "tunnel") || hasTag(way2.tags, "tunnel")) && !(hasTag(way.tags, "tunnel") && hasTag(way2.tags, "tunnel")))
39984 const layer1 = way.tags.layer || "0", layer2 = way2.tags.layer || "0";
39985 if (layer1 !== layer2)
39987 const level1 = way.tags.level || "0", level2 = way2.tags.level || "0";
39988 if (level1 !== level2)
39992 function canConnectByExtend(way, endNodeIdx) {
39993 const tipNid = way.nodes[endNodeIdx];
39994 const midNid = endNodeIdx === 0 ? way.nodes[1] : way.nodes[way.nodes.length - 2];
39995 const tipNode = graph.entity(tipNid);
39996 const midNode = graph.entity(midNid);
39997 const lon = tipNode.loc[0];
39998 const lat = tipNode.loc[1];
39999 const lon_range = geoMetersToLon(EXTEND_TH_METERS, lat) / 2;
40000 const lat_range = geoMetersToLat(EXTEND_TH_METERS) / 2;
40001 const queryExtent = geoExtent([
40002 [lon - lon_range, lat - lat_range],
40003 [lon + lon_range, lat + lat_range]
40005 const edgeLen = geoSphericalDistance(midNode.loc, tipNode.loc);
40006 const t = EXTEND_TH_METERS / edgeLen + 1;
40007 const extTipLoc = geoVecInterp(midNode.loc, tipNode.loc, t);
40008 const segmentInfos = tree.waySegments(queryExtent, graph);
40009 for (let i2 = 0; i2 < segmentInfos.length; i2++) {
40010 let segmentInfo = segmentInfos[i2];
40011 let way2 = graph.entity(segmentInfo.wayId);
40012 if (!isHighway(way2))
40014 if (!canConnectWays(way, way2))
40016 let nAid = segmentInfo.nodes[0], nBid = segmentInfo.nodes[1];
40017 if (nAid === tipNid || nBid === tipNid)
40019 let nA = graph.entity(nAid), nB = graph.entity(nBid);
40020 let crossLoc = geoLineIntersection([tipNode.loc, extTipLoc], [nA.loc, nB.loc]);
40026 edge: [nA.id, nB.id],
40027 cross_loc: crossLoc
40034 validation.type = type3;
40038 // modules/validations/close_nodes.js
40039 function validationCloseNodes(context) {
40040 var type3 = "close_nodes";
40041 var pointThresholdMeters = 0.2;
40042 var validation = function(entity, graph) {
40043 if (entity.type === "node") {
40044 return getIssuesForNode(entity);
40045 } else if (entity.type === "way") {
40046 return getIssuesForWay(entity);
40049 function getIssuesForNode(node) {
40050 var parentWays = graph.parentWays(node);
40051 if (parentWays.length) {
40052 return getIssuesForVertex(node, parentWays);
40054 return getIssuesForDetachedPoint(node);
40057 function wayTypeFor(way) {
40058 if (way.tags.boundary && way.tags.boundary !== "no")
40060 if (way.tags.indoor && way.tags.indoor !== "no")
40062 if (way.tags.building && way.tags.building !== "no" || way.tags["building:part"] && way.tags["building:part"] !== "no")
40064 if (osmPathHighwayTagValues[way.tags.highway])
40066 var parentRelations = graph.parentRelations(way);
40067 for (var i2 in parentRelations) {
40068 var relation = parentRelations[i2];
40069 if (relation.tags.type === "boundary")
40071 if (relation.isMultipolygon()) {
40072 if (relation.tags.indoor && relation.tags.indoor !== "no")
40074 if (relation.tags.building && relation.tags.building !== "no" || relation.tags["building:part"] && relation.tags["building:part"] !== "no")
40080 function shouldCheckWay(way) {
40081 if (way.nodes.length <= 2 || way.isClosed() && way.nodes.length <= 4)
40083 var bbox2 = way.extent(graph).bbox();
40084 var hypotenuseMeters = geoSphericalDistance([bbox2.minX, bbox2.minY], [bbox2.maxX, bbox2.maxY]);
40085 if (hypotenuseMeters < 1.5)
40089 function getIssuesForWay(way) {
40090 if (!shouldCheckWay(way))
40092 var issues = [], nodes = graph.childNodes(way);
40093 for (var i2 = 0; i2 < nodes.length - 1; i2++) {
40094 var node1 = nodes[i2];
40095 var node2 = nodes[i2 + 1];
40096 var issue = getWayIssueIfAny(node1, node2, way);
40098 issues.push(issue);
40102 function getIssuesForVertex(node, parentWays) {
40104 function checkForCloseness(node1, node2, way) {
40105 var issue = getWayIssueIfAny(node1, node2, way);
40107 issues.push(issue);
40109 for (var i2 = 0; i2 < parentWays.length; i2++) {
40110 var parentWay = parentWays[i2];
40111 if (!shouldCheckWay(parentWay))
40113 var lastIndex = parentWay.nodes.length - 1;
40114 for (var j2 = 0; j2 < parentWay.nodes.length; j2++) {
40116 if (parentWay.nodes[j2 - 1] === node.id) {
40117 checkForCloseness(node, graph.entity(parentWay.nodes[j2]), parentWay);
40120 if (j2 !== lastIndex) {
40121 if (parentWay.nodes[j2 + 1] === node.id) {
40122 checkForCloseness(graph.entity(parentWay.nodes[j2]), node, parentWay);
40129 function thresholdMetersForWay(way) {
40130 if (!shouldCheckWay(way))
40132 var wayType = wayTypeFor(way);
40133 if (wayType === "boundary")
40135 if (wayType === "indoor")
40137 if (wayType === "building")
40139 if (wayType === "path")
40143 function getIssuesForDetachedPoint(node) {
40145 var lon = node.loc[0];
40146 var lat = node.loc[1];
40147 var lon_range = geoMetersToLon(pointThresholdMeters, lat) / 2;
40148 var lat_range = geoMetersToLat(pointThresholdMeters) / 2;
40149 var queryExtent = geoExtent([
40150 [lon - lon_range, lat - lat_range],
40151 [lon + lon_range, lat + lat_range]
40153 var intersected = context.history().tree().intersects(queryExtent, graph);
40154 for (var j2 = 0; j2 < intersected.length; j2++) {
40155 var nearby = intersected[j2];
40156 if (nearby.id === node.id)
40158 if (nearby.type !== "node" || nearby.geometry(graph) !== "point")
40160 if (nearby.loc === node.loc || geoSphericalDistance(node.loc, nearby.loc) < pointThresholdMeters) {
40161 if ("memorial:type" in node.tags && "memorial:type" in nearby.tags && node.tags["memorial:type"] === "stolperstein" && nearby.tags["memorial:type"] === "stolperstein")
40163 if ("memorial" in node.tags && "memorial" in nearby.tags && node.tags.memorial === "stolperstein" && nearby.tags.memorial === "stolperstein")
40165 var zAxisKeys = { layer: true, level: true, "addr:housenumber": true, "addr:unit": true };
40166 var zAxisDifferentiates = false;
40167 for (var key in zAxisKeys) {
40168 var nodeValue = node.tags[key] || "0";
40169 var nearbyValue = nearby.tags[key] || "0";
40170 if (nodeValue !== nearbyValue) {
40171 zAxisDifferentiates = true;
40175 if (zAxisDifferentiates)
40177 issues.push(new validationIssue({
40179 subtype: "detached",
40180 severity: "warning",
40181 message: function(context2) {
40182 var entity2 = context2.hasEntity(this.entityIds[0]), entity22 = context2.hasEntity(this.entityIds[1]);
40183 return entity2 && entity22 ? _t.append("issues.close_nodes.detached.message", {
40184 feature: utilDisplayLabel(entity2, context2.graph()),
40185 feature2: utilDisplayLabel(entity22, context2.graph())
40188 reference: showReference,
40189 entityIds: [node.id, nearby.id],
40190 dynamicFixes: function() {
40192 new validationIssueFix({
40193 icon: "iD-operation-disconnect",
40194 title: _t.append("issues.fix.move_points_apart.title")
40196 new validationIssueFix({
40197 icon: "iD-icon-layers",
40198 title: _t.append("issues.fix.use_different_layers_or_levels.title")
40206 function showReference(selection2) {
40207 var referenceText = _t("issues.close_nodes.detached.reference");
40208 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
40211 function getWayIssueIfAny(node1, node2, way) {
40212 if (node1.id === node2.id || node1.hasInterestingTags() && node2.hasInterestingTags()) {
40215 if (node1.loc !== node2.loc) {
40216 var parentWays1 = graph.parentWays(node1);
40217 var parentWays2 = new Set(graph.parentWays(node2));
40218 var sharedWays = parentWays1.filter(function(parentWay) {
40219 return parentWays2.has(parentWay);
40221 var thresholds = sharedWays.map(function(parentWay) {
40222 return thresholdMetersForWay(parentWay);
40224 var threshold = Math.min(...thresholds);
40225 var distance = geoSphericalDistance(node1.loc, node2.loc);
40226 if (distance > threshold)
40229 return new validationIssue({
40231 subtype: "vertices",
40232 severity: "warning",
40233 message: function(context2) {
40234 var entity2 = context2.hasEntity(this.entityIds[0]);
40235 return entity2 ? _t.append("issues.close_nodes.message", { way: utilDisplayLabel(entity2, context2.graph()) }) : "";
40237 reference: showReference,
40238 entityIds: [way.id, node1.id, node2.id],
40240 dynamicFixes: function() {
40242 new validationIssueFix({
40243 icon: "iD-icon-plus",
40244 title: _t.append("issues.fix.merge_points.title"),
40245 onClick: function(context2) {
40246 var entityIds = this.issue.entityIds;
40247 var action = actionMergeNodes([entityIds[1], entityIds[2]]);
40248 context2.perform(action, _t("issues.fix.merge_close_vertices.annotation"));
40251 new validationIssueFix({
40252 icon: "iD-operation-disconnect",
40253 title: _t.append("issues.fix.move_points_apart.title")
40258 function showReference(selection2) {
40259 var referenceText = _t("issues.close_nodes.reference");
40260 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
40264 validation.type = type3;
40268 // modules/validations/crossing_ways.js
40269 function validationCrossingWays(context) {
40270 var type3 = "crossing_ways";
40271 function getFeatureWithFeatureTypeTagsForWay(way, graph) {
40272 if (getFeatureType(way, graph) === null) {
40273 var parentRels = graph.parentRelations(way);
40274 for (var i2 = 0; i2 < parentRels.length; i2++) {
40275 var rel = parentRels[i2];
40276 if (getFeatureType(rel, graph) !== null) {
40283 function hasTag(tags, key) {
40284 return tags[key] !== void 0 && tags[key] !== "no";
40286 function taggedAsIndoor(tags) {
40287 return hasTag(tags, "indoor") || hasTag(tags, "level") || tags.highway === "corridor";
40289 function allowsBridge(featureType) {
40290 return featureType === "highway" || featureType === "railway" || featureType === "waterway";
40292 function allowsTunnel(featureType) {
40293 return featureType === "highway" || featureType === "railway" || featureType === "waterway";
40295 var ignoredBuildings = {
40301 function getFeatureType(entity, graph) {
40302 var geometry = entity.geometry(graph);
40303 if (geometry !== "line" && geometry !== "area")
40305 var tags = entity.tags;
40306 if (hasTag(tags, "building") && !ignoredBuildings[tags.building])
40308 if (hasTag(tags, "highway") && osmRoutableHighwayTagValues[tags.highway])
40310 if (geometry !== "line")
40312 if (hasTag(tags, "railway") && osmRailwayTrackTagValues[tags.railway])
40314 if (hasTag(tags, "waterway") && osmFlowingWaterwayTagValues[tags.waterway])
40318 function isLegitCrossing(tags1, featureType1, tags2, featureType2) {
40319 var level1 = tags1.level || "0";
40320 var level2 = tags2.level || "0";
40321 if (taggedAsIndoor(tags1) && taggedAsIndoor(tags2) && level1 !== level2) {
40324 var layer1 = tags1.layer || "0";
40325 var layer2 = tags2.layer || "0";
40326 if (allowsBridge(featureType1) && allowsBridge(featureType2)) {
40327 if (hasTag(tags1, "bridge") && !hasTag(tags2, "bridge"))
40329 if (!hasTag(tags1, "bridge") && hasTag(tags2, "bridge"))
40331 if (hasTag(tags1, "bridge") && hasTag(tags2, "bridge") && layer1 !== layer2)
40333 } else if (allowsBridge(featureType1) && hasTag(tags1, "bridge"))
40335 else if (allowsBridge(featureType2) && hasTag(tags2, "bridge"))
40337 if (allowsTunnel(featureType1) && allowsTunnel(featureType2)) {
40338 if (hasTag(tags1, "tunnel") && !hasTag(tags2, "tunnel"))
40340 if (!hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel"))
40342 if (hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel") && layer1 !== layer2)
40344 } else if (allowsTunnel(featureType1) && hasTag(tags1, "tunnel"))
40346 else if (allowsTunnel(featureType2) && hasTag(tags2, "tunnel"))
40348 if (featureType1 === "waterway" && featureType2 === "highway" && tags2.man_made === "pier")
40350 if (featureType2 === "waterway" && featureType1 === "highway" && tags1.man_made === "pier")
40352 if (featureType1 === "building" || featureType2 === "building" || taggedAsIndoor(tags1) || taggedAsIndoor(tags2)) {
40353 if (layer1 !== layer2)
40358 var highwaysDisallowingFords = {
40360 motorway_link: true,
40364 primary_link: true,
40366 secondary_link: true
40368 var nonCrossingHighways = { track: true };
40369 function tagsForConnectionNodeIfAllowed(entity1, entity2, graph) {
40370 var featureType1 = getFeatureType(entity1, graph);
40371 var featureType2 = getFeatureType(entity2, graph);
40372 var geometry1 = entity1.geometry(graph);
40373 var geometry2 = entity2.geometry(graph);
40374 var bothLines = geometry1 === "line" && geometry2 === "line";
40375 if (featureType1 === featureType2) {
40376 if (featureType1 === "highway") {
40377 var entity1IsPath = osmPathHighwayTagValues[entity1.tags.highway];
40378 var entity2IsPath = osmPathHighwayTagValues[entity2.tags.highway];
40379 if ((entity1IsPath || entity2IsPath) && entity1IsPath !== entity2IsPath) {
40380 var roadFeature = entity1IsPath ? entity2 : entity1;
40381 if (nonCrossingHighways[roadFeature.tags.highway]) {
40384 var pathFeature = entity1IsPath ? entity1 : entity2;
40385 if (["marked", "unmarked", "traffic_signals"].indexOf(pathFeature.tags.crossing) !== -1) {
40386 return bothLines ? { highway: "crossing", crossing: pathFeature.tags.crossing } : {};
40388 return bothLines ? { highway: "crossing" } : {};
40392 if (featureType1 === "waterway")
40394 if (featureType1 === "railway")
40397 var featureTypes = [featureType1, featureType2];
40398 if (featureTypes.indexOf("highway") !== -1) {
40399 if (featureTypes.indexOf("railway") !== -1) {
40402 var isTram = entity1.tags.railway === "tram" || entity2.tags.railway === "tram";
40403 if (osmPathHighwayTagValues[entity1.tags.highway] || osmPathHighwayTagValues[entity2.tags.highway]) {
40405 return { railway: "tram_crossing" };
40406 return { railway: "crossing" };
40409 return { railway: "tram_level_crossing" };
40410 return { railway: "level_crossing" };
40413 if (featureTypes.indexOf("waterway") !== -1) {
40414 if (hasTag(entity1.tags, "tunnel") && hasTag(entity2.tags, "tunnel"))
40416 if (hasTag(entity1.tags, "bridge") && hasTag(entity2.tags, "bridge"))
40418 if (highwaysDisallowingFords[entity1.tags.highway] || highwaysDisallowingFords[entity2.tags.highway]) {
40421 return bothLines ? { ford: "yes" } : {};
40427 function findCrossingsByWay(way1, graph, tree) {
40428 var edgeCrossInfos = [];
40429 if (way1.type !== "way")
40430 return edgeCrossInfos;
40431 var taggedFeature1 = getFeatureWithFeatureTypeTagsForWay(way1, graph);
40432 var way1FeatureType = getFeatureType(taggedFeature1, graph);
40433 if (way1FeatureType === null)
40434 return edgeCrossInfos;
40435 var checkedSingleCrossingWays = {};
40438 var n1, n2, nA, nB, nAId, nBId;
40439 var segment1, segment2;
40441 var segmentInfos, segment2Info, way2, taggedFeature2, way2FeatureType;
40442 var way1Nodes = graph.childNodes(way1);
40443 var comparedWays = {};
40444 for (i2 = 0; i2 < way1Nodes.length - 1; i2++) {
40445 n1 = way1Nodes[i2];
40446 n2 = way1Nodes[i2 + 1];
40447 extent = geoExtent([
40449 Math.min(n1.loc[0], n2.loc[0]),
40450 Math.min(n1.loc[1], n2.loc[1])
40453 Math.max(n1.loc[0], n2.loc[0]),
40454 Math.max(n1.loc[1], n2.loc[1])
40457 segmentInfos = tree.waySegments(extent, graph);
40458 for (j2 = 0; j2 < segmentInfos.length; j2++) {
40459 segment2Info = segmentInfos[j2];
40460 if (segment2Info.wayId === way1.id)
40462 if (checkedSingleCrossingWays[segment2Info.wayId])
40464 comparedWays[segment2Info.wayId] = true;
40465 way2 = graph.hasEntity(segment2Info.wayId);
40468 taggedFeature2 = getFeatureWithFeatureTypeTagsForWay(way2, graph);
40469 way2FeatureType = getFeatureType(taggedFeature2, graph);
40470 if (way2FeatureType === null || isLegitCrossing(taggedFeature1.tags, way1FeatureType, taggedFeature2.tags, way2FeatureType)) {
40473 oneOnly = way1FeatureType === "building" || way2FeatureType === "building";
40474 nAId = segment2Info.nodes[0];
40475 nBId = segment2Info.nodes[1];
40476 if (nAId === n1.id || nAId === n2.id || nBId === n1.id || nBId === n2.id) {
40479 nA = graph.hasEntity(nAId);
40482 nB = graph.hasEntity(nBId);
40485 segment1 = [n1.loc, n2.loc];
40486 segment2 = [nA.loc, nB.loc];
40487 var point2 = geoLineIntersection(segment1, segment2);
40489 edgeCrossInfos.push({
40493 featureType: way1FeatureType,
40494 edge: [n1.id, n2.id]
40498 featureType: way2FeatureType,
40499 edge: [nA.id, nB.id]
40505 checkedSingleCrossingWays[way2.id] = true;
40511 return edgeCrossInfos;
40513 function waysToCheck(entity, graph) {
40514 var featureType = getFeatureType(entity, graph);
40517 if (entity.type === "way") {
40519 } else if (entity.type === "relation") {
40520 return entity.members.reduce(function(array2, member) {
40521 if (member.type === "way" && (!member.role || member.role === "outer" || member.role === "inner")) {
40522 var entity2 = graph.hasEntity(member.id);
40523 if (entity2 && array2.indexOf(entity2) === -1) {
40524 array2.push(entity2);
40532 var validation = function checkCrossingWays(entity, graph) {
40533 var tree = context.history().tree();
40534 var ways = waysToCheck(entity, graph);
40536 var wayIndex, crossingIndex, crossings;
40537 for (wayIndex in ways) {
40538 crossings = findCrossingsByWay(ways[wayIndex], graph, tree);
40539 for (crossingIndex in crossings) {
40540 issues.push(createIssue(crossings[crossingIndex], graph));
40545 function createIssue(crossing, graph) {
40546 crossing.wayInfos.sort(function(way1Info, way2Info) {
40547 var type1 = way1Info.featureType;
40548 var type22 = way2Info.featureType;
40549 if (type1 === type22) {
40550 return utilDisplayLabel(way1Info.way, graph) > utilDisplayLabel(way2Info.way, graph);
40551 } else if (type1 === "waterway") {
40553 } else if (type22 === "waterway") {
40556 return type1 < type22;
40558 var entities = crossing.wayInfos.map(function(wayInfo) {
40559 return getFeatureWithFeatureTypeTagsForWay(wayInfo.way, graph);
40561 var edges = [crossing.wayInfos[0].edge, crossing.wayInfos[1].edge];
40562 var featureTypes = [crossing.wayInfos[0].featureType, crossing.wayInfos[1].featureType];
40563 var connectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph);
40564 var featureType1 = crossing.wayInfos[0].featureType;
40565 var featureType2 = crossing.wayInfos[1].featureType;
40566 var isCrossingIndoors = taggedAsIndoor(entities[0].tags) && taggedAsIndoor(entities[1].tags);
40567 var isCrossingTunnels = allowsTunnel(featureType1) && hasTag(entities[0].tags, "tunnel") && allowsTunnel(featureType2) && hasTag(entities[1].tags, "tunnel");
40568 var isCrossingBridges = allowsBridge(featureType1) && hasTag(entities[0].tags, "bridge") && allowsBridge(featureType2) && hasTag(entities[1].tags, "bridge");
40569 var subtype = [featureType1, featureType2].sort().join("-");
40570 var crossingTypeID = subtype;
40571 if (isCrossingIndoors) {
40572 crossingTypeID = "indoor-indoor";
40573 } else if (isCrossingTunnels) {
40574 crossingTypeID = "tunnel-tunnel";
40575 } else if (isCrossingBridges) {
40576 crossingTypeID = "bridge-bridge";
40578 if (connectionTags && (isCrossingIndoors || isCrossingTunnels || isCrossingBridges)) {
40579 crossingTypeID += "_connectable";
40581 var uniqueID = crossing.crossPoint[0].toFixed(4) + "," + crossing.crossPoint[1].toFixed(4);
40582 return new validationIssue({
40585 severity: "warning",
40586 message: function(context2) {
40587 var graph2 = context2.graph();
40588 var entity1 = graph2.hasEntity(this.entityIds[0]), entity2 = graph2.hasEntity(this.entityIds[1]);
40589 return entity1 && entity2 ? _t.append("issues.crossing_ways.message", {
40590 feature: utilDisplayLabel(entity1, graph2),
40591 feature2: utilDisplayLabel(entity2, graph2)
40594 reference: showReference,
40595 entityIds: entities.map(function(entity) {
40604 loc: crossing.crossPoint,
40605 dynamicFixes: function(context2) {
40606 var mode = context2.mode();
40607 if (!mode || mode.id !== "select" || mode.selectedIDs().length !== 1)
40609 var selectedIndex = this.entityIds[0] === mode.selectedIDs()[0] ? 0 : 1;
40610 var selectedFeatureType = this.data.featureTypes[selectedIndex];
40611 var otherFeatureType = this.data.featureTypes[selectedIndex === 0 ? 1 : 0];
40613 if (connectionTags) {
40614 fixes.push(makeConnectWaysFix(this.data.connectionTags));
40616 if (isCrossingIndoors) {
40617 fixes.push(new validationIssueFix({
40618 icon: "iD-icon-layers",
40619 title: _t.append("issues.fix.use_different_levels.title")
40621 } else if (isCrossingTunnels || isCrossingBridges || featureType1 === "building" || featureType2 === "building") {
40622 fixes.push(makeChangeLayerFix("higher"));
40623 fixes.push(makeChangeLayerFix("lower"));
40624 } else if (context2.graph().geometry(this.entityIds[0]) === "line" && context2.graph().geometry(this.entityIds[1]) === "line") {
40625 if (allowsBridge(selectedFeatureType) && selectedFeatureType !== "waterway") {
40626 fixes.push(makeAddBridgeOrTunnelFix("add_a_bridge", "temaki-bridge", "bridge"));
40628 var skipTunnelFix = otherFeatureType === "waterway" && selectedFeatureType !== "waterway";
40629 if (allowsTunnel(selectedFeatureType) && !skipTunnelFix) {
40630 fixes.push(makeAddBridgeOrTunnelFix("add_a_tunnel", "temaki-tunnel", "tunnel"));
40633 fixes.push(new validationIssueFix({
40634 icon: "iD-operation-move",
40635 title: _t.append("issues.fix.reposition_features.title")
40640 function showReference(selection2) {
40641 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.crossing_ways." + crossingTypeID + ".reference"));
40644 function makeAddBridgeOrTunnelFix(fixTitleID, iconName, bridgeOrTunnel) {
40645 return new validationIssueFix({
40647 title: _t.append("issues.fix." + fixTitleID + ".title"),
40648 onClick: function(context2) {
40649 var mode = context2.mode();
40650 if (!mode || mode.id !== "select")
40652 var selectedIDs = mode.selectedIDs();
40653 if (selectedIDs.length !== 1)
40655 var selectedWayID = selectedIDs[0];
40656 if (!context2.hasEntity(selectedWayID))
40658 var resultWayIDs = [selectedWayID];
40659 var edge, crossedEdge, crossedWayID;
40660 if (this.issue.entityIds[0] === selectedWayID) {
40661 edge = this.issue.data.edges[0];
40662 crossedEdge = this.issue.data.edges[1];
40663 crossedWayID = this.issue.entityIds[1];
40665 edge = this.issue.data.edges[1];
40666 crossedEdge = this.issue.data.edges[0];
40667 crossedWayID = this.issue.entityIds[0];
40669 var crossingLoc = this.issue.loc;
40670 var projection2 = context2.projection;
40671 var action = function actionAddStructure(graph) {
40672 var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
40673 var crossedWay = graph.hasEntity(crossedWayID);
40674 var structLengthMeters = crossedWay && crossedWay.tags.width && parseFloat(crossedWay.tags.width);
40675 if (!structLengthMeters) {
40676 structLengthMeters = crossedWay && crossedWay.impliedLineWidthMeters();
40678 if (structLengthMeters) {
40679 if (getFeatureType(crossedWay, graph) === "railway") {
40680 structLengthMeters *= 2;
40683 structLengthMeters = 8;
40685 var a1 = geoAngle(edgeNodes[0], edgeNodes[1], projection2) + Math.PI;
40686 var a2 = geoAngle(graph.entity(crossedEdge[0]), graph.entity(crossedEdge[1]), projection2) + Math.PI;
40687 var crossingAngle = Math.max(a1, a2) - Math.min(a1, a2);
40688 if (crossingAngle > Math.PI)
40689 crossingAngle -= Math.PI;
40690 structLengthMeters = structLengthMeters / 2 / Math.sin(crossingAngle) * 2;
40691 structLengthMeters += 4;
40692 structLengthMeters = Math.min(Math.max(structLengthMeters, 4), 50);
40693 function geomToProj(geoPoint) {
40695 geoLonToMeters(geoPoint[0], geoPoint[1]),
40696 geoLatToMeters(geoPoint[1])
40699 function projToGeom(projPoint) {
40700 var lat = geoMetersToLat(projPoint[1]);
40702 geoMetersToLon(projPoint[0], lat),
40706 var projEdgeNode1 = geomToProj(edgeNodes[0].loc);
40707 var projEdgeNode2 = geomToProj(edgeNodes[1].loc);
40708 var projectedAngle = geoVecAngle(projEdgeNode1, projEdgeNode2);
40709 var projectedCrossingLoc = geomToProj(crossingLoc);
40710 var linearToSphericalMetersRatio = geoVecLength(projEdgeNode1, projEdgeNode2) / geoSphericalDistance(edgeNodes[0].loc, edgeNodes[1].loc);
40711 function locSphericalDistanceFromCrossingLoc(angle2, distanceMeters) {
40712 var lengthSphericalMeters = distanceMeters * linearToSphericalMetersRatio;
40713 return projToGeom([
40714 projectedCrossingLoc[0] + Math.cos(angle2) * lengthSphericalMeters,
40715 projectedCrossingLoc[1] + Math.sin(angle2) * lengthSphericalMeters
40718 var endpointLocGetter1 = function(lengthMeters) {
40719 return locSphericalDistanceFromCrossingLoc(projectedAngle, lengthMeters);
40721 var endpointLocGetter2 = function(lengthMeters) {
40722 return locSphericalDistanceFromCrossingLoc(projectedAngle + Math.PI, lengthMeters);
40724 var minEdgeLengthMeters = 0.55;
40725 function determineEndpoint(edge2, endNode, locGetter) {
40727 var idealLengthMeters = structLengthMeters / 2;
40728 var crossingToEdgeEndDistance = geoSphericalDistance(crossingLoc, endNode.loc);
40729 if (crossingToEdgeEndDistance - idealLengthMeters > minEdgeLengthMeters) {
40730 var idealNodeLoc = locGetter(idealLengthMeters);
40731 newNode = osmNode();
40732 graph = actionAddMidpoint({ loc: idealNodeLoc, edge: edge2 }, newNode)(graph);
40735 endNode.parentIntersectionWays(graph).forEach(function(way) {
40736 way.nodes.forEach(function(nodeID) {
40737 if (nodeID === endNode.id) {
40738 if (endNode.id === way.first() && endNode.id !== way.last() || endNode.id === way.last() && endNode.id !== way.first()) {
40746 if (edgeCount >= 3) {
40747 var insetLength = crossingToEdgeEndDistance - minEdgeLengthMeters;
40748 if (insetLength > minEdgeLengthMeters) {
40749 var insetNodeLoc = locGetter(insetLength);
40750 newNode = osmNode();
40751 graph = actionAddMidpoint({ loc: insetNodeLoc, edge: edge2 }, newNode)(graph);
40757 var splitAction = actionSplit([newNode.id]).limitWays(resultWayIDs);
40758 graph = splitAction(graph);
40759 if (splitAction.getCreatedWayIDs().length) {
40760 resultWayIDs.push(splitAction.getCreatedWayIDs()[0]);
40764 var structEndNode1 = determineEndpoint(edge, edgeNodes[1], endpointLocGetter1);
40765 var structEndNode2 = determineEndpoint([edgeNodes[0].id, structEndNode1.id], edgeNodes[0], endpointLocGetter2);
40766 var structureWay = resultWayIDs.map(function(id2) {
40767 return graph.entity(id2);
40768 }).find(function(way) {
40769 return way.nodes.indexOf(structEndNode1.id) !== -1 && way.nodes.indexOf(structEndNode2.id) !== -1;
40771 var tags = Object.assign({}, structureWay.tags);
40772 if (bridgeOrTunnel === "bridge") {
40773 tags.bridge = "yes";
40776 var tunnelValue = "yes";
40777 if (getFeatureType(structureWay, graph) === "waterway") {
40778 tunnelValue = "culvert";
40780 tags.tunnel = tunnelValue;
40783 graph = actionChangeTags(structureWay.id, tags)(graph);
40786 context2.perform(action, _t("issues.fix." + fixTitleID + ".annotation"));
40787 context2.enter(modeSelect(context2, resultWayIDs));
40791 function makeConnectWaysFix(connectionTags) {
40792 var fixTitleID = "connect_features";
40793 if (connectionTags.ford) {
40794 fixTitleID = "connect_using_ford";
40796 return new validationIssueFix({
40797 icon: "iD-icon-crossing",
40798 title: _t.append("issues.fix." + fixTitleID + ".title"),
40799 onClick: function(context2) {
40800 var loc = this.issue.loc;
40801 var connectionTags2 = this.issue.data.connectionTags;
40802 var edges = this.issue.data.edges;
40804 function actionConnectCrossingWays(graph) {
40805 var node = osmNode({ loc, tags: connectionTags2 });
40806 graph = graph.replace(node);
40807 var nodesToMerge = [node.id];
40808 var mergeThresholdInMeters = 0.75;
40809 edges.forEach(function(edge) {
40810 var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
40811 var nearby = geoSphericalClosestNode(edgeNodes, loc);
40812 if ((!nearby.node.hasInterestingTags() || nearby.node.isCrossing()) && nearby.distance < mergeThresholdInMeters) {
40813 nodesToMerge.push(nearby.node.id);
40815 graph = actionAddMidpoint({ loc, edge }, node)(graph);
40818 if (nodesToMerge.length > 1) {
40819 graph = actionMergeNodes(nodesToMerge, loc)(graph);
40823 _t("issues.fix.connect_crossing_features.annotation")
40828 function makeChangeLayerFix(higherOrLower) {
40829 return new validationIssueFix({
40830 icon: "iD-icon-" + (higherOrLower === "higher" ? "up" : "down"),
40831 title: _t.append("issues.fix.tag_this_as_" + higherOrLower + ".title"),
40832 onClick: function(context2) {
40833 var mode = context2.mode();
40834 if (!mode || mode.id !== "select")
40836 var selectedIDs = mode.selectedIDs();
40837 if (selectedIDs.length !== 1)
40839 var selectedID = selectedIDs[0];
40840 if (!this.issue.entityIds.some(function(entityId) {
40841 return entityId === selectedID;
40844 var entity = context2.hasEntity(selectedID);
40847 var tags = Object.assign({}, entity.tags);
40848 var layer = tags.layer && Number(tags.layer);
40849 if (layer && !isNaN(layer)) {
40850 if (higherOrLower === "higher") {
40856 if (higherOrLower === "higher") {
40862 tags.layer = layer.toString();
40864 actionChangeTags(entity.id, tags),
40865 _t("operations.change_tags.annotation")
40870 validation.type = type3;
40874 // modules/behavior/draw_way.js
40875 function behaviorDrawWay(context, wayID, mode, startGraph) {
40876 const keybinding = utilKeybinding("drawWay");
40877 var dispatch10 = dispatch_default("rejectedSelfIntersection");
40878 var behavior = behaviorDraw(context);
40884 var _pointerHasMoved = false;
40886 var _didResolveTempEdit = false;
40887 function createDrawNode(loc) {
40888 _drawNode = osmNode({ loc });
40889 context.pauseChangeDispatch();
40890 context.replace(function actionAddDrawNode(graph) {
40891 var way = graph.entity(wayID);
40892 return graph.replace(_drawNode).replace(way.addNode(_drawNode.id, _nodeIndex));
40894 context.resumeChangeDispatch();
40895 setActiveElements();
40897 function removeDrawNode() {
40898 context.pauseChangeDispatch();
40900 function actionDeleteDrawNode(graph) {
40901 var way = graph.entity(wayID);
40902 return graph.replace(way.removeNode(_drawNode.id)).remove(_drawNode);
40906 _drawNode = void 0;
40907 context.resumeChangeDispatch();
40909 function keydown(d3_event) {
40910 if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
40911 if (context.surface().classed("nope")) {
40912 context.surface().classed("nope-suppressed", true);
40914 context.surface().classed("nope", false).classed("nope-disabled", true);
40917 function keyup(d3_event) {
40918 if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
40919 if (context.surface().classed("nope-suppressed")) {
40920 context.surface().classed("nope", true);
40922 context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
40925 function allowsVertex(d) {
40926 return d.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d, context.graph());
40928 function move(d3_event, datum2) {
40929 var loc = context.map().mouseCoordinates();
40931 createDrawNode(loc);
40932 context.surface().classed("nope-disabled", d3_event.altKey);
40933 var targetLoc = datum2 && datum2.properties && datum2.properties.entity && allowsVertex(datum2.properties.entity) && datum2.properties.entity.loc;
40934 var targetNodes = datum2 && datum2.properties && datum2.properties.nodes;
40937 } else if (targetNodes) {
40938 var choice = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, _drawNode.id);
40943 context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
40944 _drawNode = context.entity(_drawNode.id);
40945 checkGeometry(true);
40947 function checkGeometry(includeDrawNode) {
40948 var nopeDisabled = context.surface().classed("nope-disabled");
40949 var isInvalid = isInvalidGeometry(includeDrawNode);
40950 if (nopeDisabled) {
40951 context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
40953 context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
40956 function isInvalidGeometry(includeDrawNode) {
40957 var testNode = _drawNode;
40958 var parentWay = context.graph().entity(wayID);
40959 var nodes = context.graph().childNodes(parentWay).slice();
40960 if (includeDrawNode) {
40961 if (parentWay.isClosed()) {
40965 if (parentWay.isClosed()) {
40966 if (nodes.length < 3)
40969 nodes.splice(-2, 1);
40970 testNode = nodes[nodes.length - 2];
40975 return testNode && geoHasSelfIntersections(nodes, testNode.id);
40977 function undone() {
40978 _didResolveTempEdit = true;
40979 context.pauseChangeDispatch();
40981 if (context.graph() === startGraph) {
40982 nextMode = modeSelect(context, [wayID]);
40987 context.perform(actionNoop());
40989 context.resumeChangeDispatch();
40990 context.enter(nextMode);
40992 function setActiveElements() {
40995 context.surface().selectAll("." + _drawNode.id).classed("active", true);
40997 function resetToStartGraph() {
40998 while (context.graph() !== startGraph) {
41002 var drawWay = function(surface) {
41003 _drawNode = void 0;
41004 _didResolveTempEdit = false;
41005 _origWay = context.entity(wayID);
41006 if (typeof _nodeIndex === "number") {
41007 _headNodeID = _origWay.nodes[_nodeIndex];
41008 } else if (_origWay.isClosed()) {
41009 _headNodeID = _origWay.nodes[_origWay.nodes.length - 2];
41011 _headNodeID = _origWay.nodes[_origWay.nodes.length - 1];
41013 _wayGeometry = _origWay.geometry(context.graph());
41015 (_origWay.nodes.length === (_origWay.isClosed() ? 2 : 1) ? "operations.start.annotation." : "operations.continue.annotation.") + _wayGeometry
41017 _pointerHasMoved = false;
41018 context.pauseChangeDispatch();
41019 context.perform(actionNoop(), _annotation);
41020 context.resumeChangeDispatch();
41021 behavior.hover().initialNodeID(_headNodeID);
41022 behavior.on("move", function() {
41023 _pointerHasMoved = true;
41024 move.apply(this, arguments);
41025 }).on("down", function() {
41026 move.apply(this, arguments);
41027 }).on("downcancel", function() {
41030 }).on("click", drawWay.add).on("clickWay", drawWay.addWay).on("clickNode", drawWay.addNode).on("undo", context.undo).on("cancel", drawWay.cancel).on("finish", drawWay.finish);
41031 select_default2(window).on("keydown.drawWay", keydown).on("keyup.drawWay", keyup);
41032 context.map().dblclickZoomEnable(false).on("drawn.draw", setActiveElements);
41033 setActiveElements();
41034 surface.call(behavior);
41035 context.history().on("undone.draw", undone);
41037 drawWay.off = function(surface) {
41038 if (!_didResolveTempEdit) {
41039 context.pauseChangeDispatch();
41040 resetToStartGraph();
41041 context.resumeChangeDispatch();
41043 _drawNode = void 0;
41044 _nodeIndex = void 0;
41045 context.map().on("drawn.draw", null);
41046 surface.call(behavior.off).selectAll(".active").classed("active", false);
41047 surface.classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false);
41048 select_default2(window).on("keydown.drawWay", null).on("keyup.drawWay", null);
41049 context.history().on("undone.draw", null);
41051 function attemptAdd(d, loc, doAdd) {
41053 context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
41054 _drawNode = context.entity(_drawNode.id);
41056 createDrawNode(loc);
41058 checkGeometry(true);
41059 if (d && d.properties && d.properties.nope || context.surface().classed("nope")) {
41060 if (!_pointerHasMoved) {
41063 dispatch10.call("rejectedSelfIntersection", this);
41066 context.pauseChangeDispatch();
41068 _didResolveTempEdit = true;
41069 context.resumeChangeDispatch();
41070 context.enter(mode);
41072 drawWay.add = function(loc, d) {
41073 attemptAdd(d, loc, function() {
41076 drawWay.addWay = function(loc, edge, d) {
41077 attemptAdd(d, loc, function() {
41079 actionAddMidpoint({ loc, edge }, _drawNode),
41084 drawWay.addNode = function(node, d) {
41085 if (node.id === _headNodeID || _origWay.isClosed() && node.id === _origWay.first()) {
41089 attemptAdd(d, node.loc, function() {
41091 function actionReplaceDrawNode(graph) {
41092 graph = graph.replace(graph.entity(wayID).removeNode(_drawNode.id)).remove(_drawNode);
41093 return graph.replace(graph.entity(wayID).addNode(node.id, _nodeIndex));
41099 function getFeatureType(ways) {
41100 if (ways.every((way) => way.isClosed()))
41102 if (ways.every((way) => !way.isClosed()))
41106 function followMode() {
41107 if (_didResolveTempEdit)
41110 const isDrawingArea = _origWay.nodes[0] === _origWay.nodes.slice(-1)[0];
41111 const [secondLastNodeId, lastNodeId] = _origWay.nodes.slice(isDrawingArea ? -3 : -2);
41112 const historyGraph = context.history().graph();
41113 if (!lastNodeId || !secondLastNodeId || !historyGraph.hasEntity(lastNodeId) || !historyGraph.hasEntity(secondLastNodeId)) {
41114 context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.needs_more_initial_nodes"))();
41117 const lastNodesParents = historyGraph.parentWays(historyGraph.entity(lastNodeId)).filter((w) => w.id !== wayID);
41118 const secondLastNodesParents = historyGraph.parentWays(historyGraph.entity(secondLastNodeId)).filter((w) => w.id !== wayID);
41119 const featureType = getFeatureType(lastNodesParents);
41120 if (lastNodesParents.length !== 1 || secondLastNodesParents.length === 0) {
41121 context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(`operations.follow.error.intersection_of_multiple_ways.${featureType}`))();
41124 if (!secondLastNodesParents.some((n2) => n2.id === lastNodesParents[0].id)) {
41125 context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(`operations.follow.error.intersection_of_different_ways.${featureType}`))();
41128 const way = lastNodesParents[0];
41129 const indexOfLast = way.nodes.indexOf(lastNodeId);
41130 const indexOfSecondLast = way.nodes.indexOf(secondLastNodeId);
41131 const isDescendingPastZero = indexOfLast === way.nodes.length - 2 && indexOfSecondLast === 0;
41132 let nextNodeIndex = indexOfLast + (indexOfLast > indexOfSecondLast && !isDescendingPastZero ? 1 : -1);
41133 if (nextNodeIndex === -1)
41134 nextNodeIndex = indexOfSecondLast === 1 ? way.nodes.length - 2 : 1;
41135 const nextNode = historyGraph.entity(way.nodes[nextNodeIndex]);
41136 drawWay.addNode(nextNode, {
41137 geometry: { type: "Point", coordinates: nextNode.loc },
41139 properties: { target: true, entity: nextNode }
41142 context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.unknown"))();
41145 keybinding.on(_t("operations.follow.key"), followMode);
41146 select_default2(document).call(keybinding);
41147 drawWay.finish = function() {
41148 checkGeometry(false);
41149 if (context.surface().classed("nope")) {
41150 dispatch10.call("rejectedSelfIntersection", this);
41153 context.pauseChangeDispatch();
41155 _didResolveTempEdit = true;
41156 context.resumeChangeDispatch();
41157 var way = context.hasEntity(wayID);
41158 if (!way || way.isDegenerate()) {
41162 window.setTimeout(function() {
41163 context.map().dblclickZoomEnable(true);
41165 var isNewFeature = !mode.isContinuing;
41166 context.enter(modeSelect(context, [wayID]).newFeature(isNewFeature));
41168 drawWay.cancel = function() {
41169 context.pauseChangeDispatch();
41170 resetToStartGraph();
41171 context.resumeChangeDispatch();
41172 window.setTimeout(function() {
41173 context.map().dblclickZoomEnable(true);
41175 context.surface().classed("nope", false).classed("nope-disabled", false).classed("nope-suppressed", false);
41176 context.enter(modeBrowse(context));
41178 drawWay.nodeIndex = function(val) {
41179 if (!arguments.length)
41184 drawWay.activeID = function() {
41185 if (!arguments.length)
41186 return _drawNode && _drawNode.id;
41189 return utilRebind(drawWay, dispatch10, "on");
41192 // modules/modes/draw_line.js
41193 function modeDrawLine(context, wayID, startGraph, button, affix, continuing) {
41198 var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawLine", function() {
41199 context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.lines"))();
41201 mode.wayID = wayID;
41202 mode.isContinuing = continuing;
41203 mode.enter = function() {
41204 behavior.nodeIndex(affix === "prefix" ? 0 : void 0);
41205 context.install(behavior);
41207 mode.exit = function() {
41208 context.uninstall(behavior);
41210 mode.selectedIDs = function() {
41213 mode.activeID = function() {
41214 return behavior && behavior.activeID() || [];
41219 // modules/validations/disconnected_way.js
41220 function validationDisconnectedWay() {
41221 var type3 = "disconnected_way";
41222 function isTaggedAsHighway(entity) {
41223 return osmRoutableHighwayTagValues[entity.tags.highway];
41225 var validation = function checkDisconnectedWay(entity, graph) {
41226 var routingIslandWays = routingIslandForEntity(entity);
41227 if (!routingIslandWays)
41229 return [new validationIssue({
41231 subtype: "highway",
41232 severity: "warning",
41233 message: function(context) {
41234 var entity2 = this.entityIds.length && context.hasEntity(this.entityIds[0]);
41235 var label = entity2 && utilDisplayLabel(entity2, context.graph());
41236 return _t.append("issues.disconnected_way.routable.message", { count: this.entityIds.length, highway: label });
41238 reference: showReference,
41239 entityIds: Array.from(routingIslandWays).map(function(way) {
41242 dynamicFixes: makeFixes
41244 function makeFixes(context) {
41246 var singleEntity = this.entityIds.length === 1 && context.hasEntity(this.entityIds[0]);
41247 if (singleEntity) {
41248 if (singleEntity.type === "way" && !singleEntity.isClosed()) {
41249 var textDirection = _mainLocalizer.textDirection();
41250 var startFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.first(), "start");
41252 fixes.push(startFix);
41253 var endFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.last(), "end");
41255 fixes.push(endFix);
41257 if (!fixes.length) {
41258 fixes.push(new validationIssueFix({
41259 title: _t.append("issues.fix.connect_feature.title")
41262 fixes.push(new validationIssueFix({
41263 icon: "iD-operation-delete",
41264 title: _t.append("issues.fix.delete_feature.title"),
41265 entityIds: [singleEntity.id],
41266 onClick: function(context2) {
41267 var id2 = this.issue.entityIds[0];
41268 var operation = operationDelete(context2, [id2]);
41269 if (!operation.disabled()) {
41275 fixes.push(new validationIssueFix({
41276 title: _t.append("issues.fix.connect_features.title")
41281 function showReference(selection2) {
41282 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.disconnected_way.routable.reference"));
41284 function routingIslandForEntity(entity2) {
41285 var routingIsland = /* @__PURE__ */ new Set();
41286 var waysToCheck = [];
41287 function queueParentWays(node) {
41288 graph.parentWays(node).forEach(function(parentWay) {
41289 if (!routingIsland.has(parentWay) && isRoutableWay(parentWay, false)) {
41290 routingIsland.add(parentWay);
41291 waysToCheck.push(parentWay);
41295 if (entity2.type === "way" && isRoutableWay(entity2, true)) {
41296 routingIsland.add(entity2);
41297 waysToCheck.push(entity2);
41298 } else if (entity2.type === "node" && isRoutableNode(entity2)) {
41299 routingIsland.add(entity2);
41300 queueParentWays(entity2);
41304 while (waysToCheck.length) {
41305 var wayToCheck = waysToCheck.pop();
41306 var childNodes = graph.childNodes(wayToCheck);
41307 for (var i2 in childNodes) {
41308 var vertex = childNodes[i2];
41309 if (isConnectedVertex(vertex)) {
41312 if (isRoutableNode(vertex)) {
41313 routingIsland.add(vertex);
41315 queueParentWays(vertex);
41318 return routingIsland;
41320 function isConnectedVertex(vertex) {
41321 var osm = services.osm;
41322 if (osm && !osm.isDataLoaded(vertex.loc))
41324 if (vertex.tags.entrance && vertex.tags.entrance !== "no")
41326 if (vertex.tags.amenity === "parking_entrance")
41330 function isRoutableNode(node) {
41331 if (node.tags.highway === "elevator")
41335 function isRoutableWay(way, ignoreInnerWays) {
41336 if (isTaggedAsHighway(way) || way.tags.route === "ferry")
41338 return graph.parentRelations(way).some(function(parentRelation) {
41339 if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry")
41341 if (parentRelation.isMultipolygon() && isTaggedAsHighway(parentRelation) && (!ignoreInnerWays || parentRelation.memberById(way.id).role !== "inner"))
41346 function makeContinueDrawingFixIfAllowed(textDirection, vertexID, whichEnd) {
41347 var vertex = graph.hasEntity(vertexID);
41348 if (!vertex || vertex.tags.noexit === "yes")
41350 var useLeftContinue = whichEnd === "start" && textDirection === "ltr" || whichEnd === "end" && textDirection === "rtl";
41351 return new validationIssueFix({
41352 icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
41353 title: _t.append("issues.fix.continue_from_" + whichEnd + ".title"),
41354 entityIds: [vertexID],
41355 onClick: function(context) {
41356 var wayId = this.issue.entityIds[0];
41357 var way = context.hasEntity(wayId);
41358 var vertexId = this.entityIds[0];
41359 var vertex2 = context.hasEntity(vertexId);
41360 if (!way || !vertex2)
41362 var map2 = context.map();
41363 if (!context.editable() || !map2.trimmedExtent().contains(vertex2.loc)) {
41364 map2.zoomToEase(vertex2);
41367 modeDrawLine(context, wayId, context.graph(), "line", way.affix(vertexId), true)
41373 validation.type = type3;
41377 // modules/validations/invalid_format.js
41378 function validationFormatting() {
41379 var type3 = "invalid_format";
41380 var validation = function(entity) {
41382 function isValidEmail(email) {
41383 var valid_email = /^[^\(\)\\,":;<>@\[\]]+@[^\(\)\\,":;<>@\[\]\.]+(?:\.[a-z0-9-]+)*$/i;
41384 return !email || valid_email.test(email);
41386 function showReferenceEmail(selection2) {
41387 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.invalid_format.email.reference"));
41389 if (entity.tags.email) {
41390 var emails = entity.tags.email.split(";").map(function(s) {
41392 }).filter(function(x) {
41393 return !isValidEmail(x);
41395 if (emails.length) {
41396 issues.push(new validationIssue({
41399 severity: "warning",
41400 message: function(context) {
41401 var entity2 = context.hasEntity(this.entityIds[0]);
41402 return entity2 ? _t.append(
41403 "issues.invalid_format.email.message" + this.data,
41404 { feature: utilDisplayLabel(entity2, context.graph()), email: emails.join(", ") }
41407 reference: showReferenceEmail,
41408 entityIds: [entity.id],
41409 hash: emails.join(),
41410 data: emails.length > 1 ? "_multi" : ""
41416 validation.type = type3;
41420 // modules/validations/help_request.js
41421 function validationHelpRequest(context) {
41422 var type3 = "help_request";
41423 var validation = function checkFixmeTag(entity) {
41424 if (!entity.tags.fixme)
41426 if (entity.version === void 0)
41428 if (entity.v !== void 0) {
41429 var baseEntity = context.history().base().hasEntity(entity.id);
41430 if (!baseEntity || !baseEntity.tags.fixme)
41433 return [new validationIssue({
41435 subtype: "fixme_tag",
41436 severity: "warning",
41437 message: function(context2) {
41438 var entity2 = context2.hasEntity(this.entityIds[0]);
41439 return entity2 ? _t.append("issues.fixme_tag.message", {
41440 feature: utilDisplayLabel(entity2, context2.graph(), true)
41443 dynamicFixes: function() {
41445 new validationIssueFix({
41446 title: _t.append("issues.fix.address_the_concern.title")
41450 reference: showReference,
41451 entityIds: [entity.id]
41453 function showReference(selection2) {
41454 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.fixme_tag.reference"));
41457 validation.type = type3;
41461 // modules/validations/impossible_oneway.js
41462 function validationImpossibleOneway() {
41463 var type3 = "impossible_oneway";
41464 var validation = function checkImpossibleOneway(entity, graph) {
41465 if (entity.type !== "way" || entity.geometry(graph) !== "line")
41467 if (entity.isClosed())
41469 if (!typeForWay(entity))
41471 if (!isOneway(entity))
41473 var firstIssues = issuesForNode(entity, entity.first());
41474 var lastIssues = issuesForNode(entity, entity.last());
41475 return firstIssues.concat(lastIssues);
41476 function typeForWay(way) {
41477 if (way.geometry(graph) !== "line")
41479 if (osmRoutableHighwayTagValues[way.tags.highway])
41481 if (osmFlowingWaterwayTagValues[way.tags.waterway])
41485 function isOneway(way) {
41486 if (way.tags.oneway === "yes")
41488 if (way.tags.oneway)
41490 for (var key in way.tags) {
41491 if (osmOneWayTags[key] && osmOneWayTags[key][way.tags[key]]) {
41497 function nodeOccursMoreThanOnce(way, nodeID) {
41498 var occurrences = 0;
41499 for (var index in way.nodes) {
41500 if (way.nodes[index] === nodeID) {
41502 if (occurrences > 1)
41508 function isConnectedViaOtherTypes(way, node) {
41509 var wayType = typeForWay(way);
41510 if (wayType === "highway") {
41511 if (node.tags.entrance && node.tags.entrance !== "no")
41513 if (node.tags.amenity === "parking_entrance")
41515 } else if (wayType === "waterway") {
41516 if (node.id === way.first()) {
41517 if (node.tags.natural === "spring")
41520 if (node.tags.manhole === "drain")
41524 return graph.parentWays(node).some(function(parentWay) {
41525 if (parentWay.id === way.id)
41527 if (wayType === "highway") {
41528 if (parentWay.geometry(graph) === "area" && osmRoutableHighwayTagValues[parentWay.tags.highway])
41530 if (parentWay.tags.route === "ferry")
41532 return graph.parentRelations(parentWay).some(function(parentRelation) {
41533 if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry")
41535 return parentRelation.isMultipolygon() && osmRoutableHighwayTagValues[parentRelation.tags.highway];
41537 } else if (wayType === "waterway") {
41538 if (parentWay.tags.natural === "water" || parentWay.tags.natural === "coastline")
41544 function issuesForNode(way, nodeID) {
41545 var isFirst = nodeID === way.first();
41546 var wayType = typeForWay(way);
41547 if (nodeOccursMoreThanOnce(way, nodeID))
41549 var osm = services.osm;
41552 var node = graph.hasEntity(nodeID);
41553 if (!node || !osm.isDataLoaded(node.loc))
41555 if (isConnectedViaOtherTypes(way, node))
41557 var attachedWaysOfSameType = graph.parentWays(node).filter(function(parentWay) {
41558 if (parentWay.id === way.id)
41560 return typeForWay(parentWay) === wayType;
41562 if (wayType === "waterway" && attachedWaysOfSameType.length === 0)
41564 var attachedOneways = attachedWaysOfSameType.filter(function(attachedWay) {
41565 return isOneway(attachedWay);
41567 if (attachedOneways.length < attachedWaysOfSameType.length)
41569 if (attachedOneways.length) {
41570 var connectedEndpointsOkay = attachedOneways.some(function(attachedOneway) {
41571 if ((isFirst ? attachedOneway.first() : attachedOneway.last()) !== nodeID)
41573 if (nodeOccursMoreThanOnce(attachedOneway, nodeID))
41577 if (connectedEndpointsOkay)
41580 var placement = isFirst ? "start" : "end", messageID = wayType + ".", referenceID = wayType + ".";
41581 if (wayType === "waterway") {
41582 messageID += "connected." + placement;
41583 referenceID += "connected";
41585 messageID += placement;
41586 referenceID += placement;
41588 return [new validationIssue({
41591 severity: "warning",
41592 message: function(context) {
41593 var entity2 = context.hasEntity(this.entityIds[0]);
41594 return entity2 ? _t.append("issues.impossible_oneway." + messageID + ".message", {
41595 feature: utilDisplayLabel(entity2, context.graph())
41598 reference: getReference(referenceID),
41599 entityIds: [way.id, node.id],
41600 dynamicFixes: function() {
41602 if (attachedOneways.length) {
41603 fixes.push(new validationIssueFix({
41604 icon: "iD-operation-reverse",
41605 title: _t.append("issues.fix.reverse_feature.title"),
41606 entityIds: [way.id],
41607 onClick: function(context) {
41608 var id2 = this.issue.entityIds[0];
41609 context.perform(actionReverse(id2), _t("operations.reverse.annotation.line", { n: 1 }));
41613 if (node.tags.noexit !== "yes") {
41614 var textDirection = _mainLocalizer.textDirection();
41615 var useLeftContinue = isFirst && textDirection === "ltr" || !isFirst && textDirection === "rtl";
41616 fixes.push(new validationIssueFix({
41617 icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
41618 title: _t.append("issues.fix.continue_from_" + (isFirst ? "start" : "end") + ".title"),
41619 onClick: function(context) {
41620 var entityID = this.issue.entityIds[0];
41621 var vertexID = this.issue.entityIds[1];
41622 var way2 = context.entity(entityID);
41623 var vertex = context.entity(vertexID);
41624 continueDrawing(way2, vertex, context);
41632 function getReference(referenceID2) {
41633 return function showReference(selection2) {
41634 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.impossible_oneway." + referenceID2 + ".reference"));
41639 function continueDrawing(way, vertex, context) {
41640 var map2 = context.map();
41641 if (!context.editable() || !map2.trimmedExtent().contains(vertex.loc)) {
41642 map2.zoomToEase(vertex);
41645 modeDrawLine(context, way.id, context.graph(), "line", way.affix(vertex.id), true)
41648 validation.type = type3;
41652 // modules/validations/incompatible_source.js
41653 function validationIncompatibleSource() {
41654 const type3 = "incompatible_source";
41655 const incompatibleRules = [
41658 regex: /(^amap$|^amap\.com|autonavi|mapabc|高德)/i
41662 regex: /(baidu|mapbar|百度)/i
41667 exceptRegex: /((books|drive)\.google|google\s?(books|drive|plus))|(esri\/Google_Africa_Buildings)/i
41670 const validation = function checkIncompatibleSource(entity) {
41671 const entitySources = entity.tags && entity.tags.source && entity.tags.source.split(";");
41672 if (!entitySources)
41674 const entityID = entity.id;
41675 return entitySources.map((source) => {
41676 const matchRule = incompatibleRules.find((rule) => {
41677 if (!rule.regex.test(source))
41679 if (rule.exceptRegex && rule.exceptRegex.test(source))
41685 return new validationIssue({
41687 severity: "warning",
41688 message: (context) => {
41689 const entity2 = context.hasEntity(entityID);
41690 return entity2 ? _t.append("issues.incompatible_source.feature.message", {
41691 feature: utilDisplayLabel(entity2, context.graph(), true),
41695 reference: getReference(matchRule.id),
41696 entityIds: [entityID],
41698 dynamicFixes: () => {
41700 new validationIssueFix({ title: _t.append("issues.fix.remove_proprietary_data.title") })
41704 }).filter(Boolean);
41705 function getReference(id2) {
41706 return function showReference(selection2) {
41707 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append(`issues.incompatible_source.reference.${id2}`));
41711 validation.type = type3;
41715 // modules/validations/maprules.js
41716 function validationMaprules() {
41717 var type3 = "maprules";
41718 var validation = function checkMaprules(entity, graph) {
41719 if (!services.maprules)
41721 var rules = services.maprules.validationRules();
41723 for (var i2 = 0; i2 < rules.length; i2++) {
41724 var rule = rules[i2];
41725 rule.findIssues(entity, graph, issues);
41729 validation.type = type3;
41733 // modules/validations/mismatched_geometry.js
41734 var import_fast_deep_equal4 = __toESM(require_fast_deep_equal());
41735 function validationMismatchedGeometry() {
41736 var type3 = "mismatched_geometry";
41737 function tagSuggestingLineIsArea(entity) {
41738 if (entity.type !== "way" || entity.isClosed())
41740 var tagSuggestingArea = entity.tagSuggestingArea();
41741 if (!tagSuggestingArea) {
41744 var asLine = _mainPresetIndex.matchTags(tagSuggestingArea, "line");
41745 var asArea = _mainPresetIndex.matchTags(tagSuggestingArea, "area");
41746 if (asLine && asArea && asLine === asArea) {
41749 return tagSuggestingArea;
41751 function makeConnectEndpointsFixOnClick(way, graph) {
41752 if (way.nodes.length < 3)
41754 var nodes = graph.childNodes(way), testNodes;
41755 var firstToLastDistanceMeters = geoSphericalDistance(nodes[0].loc, nodes[nodes.length - 1].loc);
41756 if (firstToLastDistanceMeters < 0.75) {
41757 testNodes = nodes.slice();
41759 testNodes.push(testNodes[0]);
41760 if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
41761 return function(context) {
41762 var way2 = context.entity(this.issue.entityIds[0]);
41764 actionMergeNodes([way2.nodes[0], way2.nodes[way2.nodes.length - 1]], nodes[0].loc),
41765 _t("issues.fix.connect_endpoints.annotation")
41770 testNodes = nodes.slice();
41771 testNodes.push(testNodes[0]);
41772 if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
41773 return function(context) {
41774 var wayId = this.issue.entityIds[0];
41775 var way2 = context.entity(wayId);
41776 var nodeId = way2.nodes[0];
41777 var index = way2.nodes.length;
41779 actionAddVertex(wayId, nodeId, index),
41780 _t("issues.fix.connect_endpoints.annotation")
41785 function lineTaggedAsAreaIssue(entity) {
41786 var tagSuggestingArea = tagSuggestingLineIsArea(entity);
41787 if (!tagSuggestingArea)
41789 var validAsLine = false;
41790 var presetAsLine = _mainPresetIndex.matchTags(entity.tags, "line");
41791 if (presetAsLine) {
41792 validAsLine = true;
41793 var key = Object.keys(tagSuggestingArea)[0];
41794 if (presetAsLine.tags[key] && presetAsLine.tags[key] === "*") {
41795 validAsLine = false;
41797 if (Object.keys(presetAsLine.tags).length === 0) {
41798 validAsLine = false;
41801 return new validationIssue({
41803 subtype: "area_as_line",
41804 severity: "warning",
41805 message: function(context) {
41806 var entity2 = context.hasEntity(this.entityIds[0]);
41807 return entity2 ? _t.append("issues.tag_suggests_area.message", {
41808 feature: utilDisplayLabel(entity2, "area", true),
41809 tag: utilTagText({ tags: tagSuggestingArea })
41812 reference: showReference,
41813 entityIds: [entity.id],
41814 hash: JSON.stringify(tagSuggestingArea),
41815 dynamicFixes: function(context) {
41817 var entity2 = context.entity(this.entityIds[0]);
41818 var connectEndsOnClick = makeConnectEndpointsFixOnClick(entity2, context.graph());
41819 if (!validAsLine) {
41820 fixes.push(new validationIssueFix({
41821 title: _t.append("issues.fix.connect_endpoints.title"),
41822 onClick: connectEndsOnClick
41825 fixes.push(new validationIssueFix({
41826 icon: "iD-operation-delete",
41827 title: _t.append("issues.fix.remove_tag.title"),
41828 onClick: function(context2) {
41829 var entityId = this.issue.entityIds[0];
41830 var entity3 = context2.entity(entityId);
41831 var tags = Object.assign({}, entity3.tags);
41832 for (var key2 in tagSuggestingArea) {
41836 actionChangeTags(entityId, tags),
41837 _t("issues.fix.remove_tag.annotation")
41844 function showReference(selection2) {
41845 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.tag_suggests_area.reference"));
41848 function vertexPointIssue(entity, graph) {
41849 if (entity.type !== "node")
41851 if (Object.keys(entity.tags).length === 0)
41853 if (entity.isOnAddressLine(graph))
41855 var geometry = entity.geometry(graph);
41856 var allowedGeometries = osmNodeGeometriesForTags(entity.tags);
41857 if (geometry === "point" && !allowedGeometries.point && allowedGeometries.vertex) {
41858 return new validationIssue({
41860 subtype: "vertex_as_point",
41861 severity: "warning",
41862 message: function(context) {
41863 var entity2 = context.hasEntity(this.entityIds[0]);
41864 return entity2 ? _t.append("issues.vertex_as_point.message", {
41865 feature: utilDisplayLabel(entity2, "vertex", true)
41868 reference: function showReference(selection2) {
41869 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.vertex_as_point.reference"));
41871 entityIds: [entity.id]
41873 } else if (geometry === "vertex" && !allowedGeometries.vertex && allowedGeometries.point) {
41874 return new validationIssue({
41876 subtype: "point_as_vertex",
41877 severity: "warning",
41878 message: function(context) {
41879 var entity2 = context.hasEntity(this.entityIds[0]);
41880 return entity2 ? _t.append("issues.point_as_vertex.message", {
41881 feature: utilDisplayLabel(entity2, "point", true)
41884 reference: function showReference(selection2) {
41885 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.point_as_vertex.reference"));
41887 entityIds: [entity.id],
41888 dynamicFixes: extractPointDynamicFixes
41893 function otherMismatchIssue(entity, graph) {
41894 if (!entity.hasInterestingTags())
41896 if (entity.type !== "node" && entity.type !== "way")
41898 if (entity.type === "node" && entity.isOnAddressLine(graph))
41900 var sourceGeom = entity.geometry(graph);
41901 var targetGeoms = entity.type === "way" ? ["point", "vertex"] : ["line", "area"];
41902 if (sourceGeom === "area")
41903 targetGeoms.unshift("line");
41904 var asSource = _mainPresetIndex.match(entity, graph);
41905 var targetGeom = targetGeoms.find((nodeGeom) => {
41906 var asTarget = _mainPresetIndex.matchTags(entity.tags, nodeGeom);
41907 if (!asSource || !asTarget || asSource === asTarget || (0, import_fast_deep_equal4.default)(asSource.tags, asTarget.tags))
41909 if (asTarget.isFallback())
41911 var primaryKey = Object.keys(asTarget.tags)[0];
41912 if (primaryKey === "building")
41914 if (asTarget.tags[primaryKey] === "*")
41916 return asSource.isFallback() || asSource.tags[primaryKey] === "*";
41920 var subtype = targetGeom + "_as_" + sourceGeom;
41921 if (targetGeom === "vertex")
41922 targetGeom = "point";
41923 if (sourceGeom === "vertex")
41924 sourceGeom = "point";
41925 var referenceId = targetGeom + "_as_" + sourceGeom;
41927 if (targetGeom === "point") {
41928 dynamicFixes = extractPointDynamicFixes;
41929 } else if (sourceGeom === "area" && targetGeom === "line") {
41930 dynamicFixes = lineToAreaDynamicFixes;
41932 return new validationIssue({
41935 severity: "warning",
41936 message: function(context) {
41937 var entity2 = context.hasEntity(this.entityIds[0]);
41938 return entity2 ? _t.append("issues." + referenceId + ".message", {
41939 feature: utilDisplayLabel(entity2, targetGeom, true)
41942 reference: function showReference(selection2) {
41943 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.mismatched_geometry.reference"));
41945 entityIds: [entity.id],
41949 function lineToAreaDynamicFixes(context) {
41950 var convertOnClick;
41951 var entityId = this.entityIds[0];
41952 var entity = context.entity(entityId);
41953 var tags = Object.assign({}, entity.tags);
41955 if (!osmTagSuggestingArea(tags)) {
41956 convertOnClick = function(context2) {
41957 var entityId2 = this.issue.entityIds[0];
41958 var entity2 = context2.entity(entityId2);
41959 var tags2 = Object.assign({}, entity2.tags);
41964 actionChangeTags(entityId2, tags2),
41965 _t("issues.fix.convert_to_line.annotation")
41970 new validationIssueFix({
41971 icon: "iD-icon-line",
41972 title: _t.append("issues.fix.convert_to_line.title"),
41973 onClick: convertOnClick
41977 function extractPointDynamicFixes(context) {
41978 var entityId = this.entityIds[0];
41979 var extractOnClick = null;
41980 if (!context.hasHiddenConnections(entityId)) {
41981 extractOnClick = function(context2) {
41982 var entityId2 = this.issue.entityIds[0];
41983 var action = actionExtract(entityId2, context2.projection);
41986 _t("operations.extract.annotation", { n: 1 })
41988 context2.enter(modeSelect(context2, [action.getExtractedNodeID()]));
41992 new validationIssueFix({
41993 icon: "iD-operation-extract",
41994 title: _t.append("issues.fix.extract_point.title"),
41995 onClick: extractOnClick
41999 function unclosedMultipolygonPartIssues(entity, graph) {
42000 if (entity.type !== "relation" || !entity.isMultipolygon() || entity.isDegenerate() || !entity.isComplete(graph))
42002 var sequences = osmJoinWays(entity.members, graph);
42004 for (var i2 in sequences) {
42005 var sequence = sequences[i2];
42006 if (!sequence.nodes)
42008 var firstNode = sequence.nodes[0];
42009 var lastNode = sequence.nodes[sequence.nodes.length - 1];
42010 if (firstNode === lastNode)
42012 var issue = new validationIssue({
42014 subtype: "unclosed_multipolygon_part",
42015 severity: "warning",
42016 message: function(context) {
42017 var entity2 = context.hasEntity(this.entityIds[0]);
42018 return entity2 ? _t.append("issues.unclosed_multipolygon_part.message", {
42019 feature: utilDisplayLabel(entity2, context.graph(), true)
42022 reference: showReference,
42023 loc: sequence.nodes[0].loc,
42024 entityIds: [entity.id],
42025 hash: sequence.map(function(way) {
42029 issues.push(issue);
42032 function showReference(selection2) {
42033 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unclosed_multipolygon_part.reference"));
42036 var validation = function checkMismatchedGeometry(entity, graph) {
42037 var vertexPoint = vertexPointIssue(entity, graph);
42039 return [vertexPoint];
42040 var lineAsArea = lineTaggedAsAreaIssue(entity);
42042 return [lineAsArea];
42043 var mismatch = otherMismatchIssue(entity, graph);
42046 return unclosedMultipolygonPartIssues(entity, graph);
42048 validation.type = type3;
42052 // modules/validations/missing_role.js
42053 function validationMissingRole() {
42054 var type3 = "missing_role";
42055 var validation = function checkMissingRole(entity, graph) {
42057 if (entity.type === "way") {
42058 graph.parentRelations(entity).forEach(function(relation) {
42059 if (!relation.isMultipolygon())
42061 var member = relation.memberById(entity.id);
42062 if (member && isMissingRole(member)) {
42063 issues.push(makeIssue(entity, relation, member));
42066 } else if (entity.type === "relation" && entity.isMultipolygon()) {
42067 entity.indexedMembers().forEach(function(member) {
42068 var way = graph.hasEntity(member.id);
42069 if (way && isMissingRole(member)) {
42070 issues.push(makeIssue(way, entity, member));
42076 function isMissingRole(member) {
42077 return !member.role || !member.role.trim().length;
42079 function makeIssue(way, relation, member) {
42080 return new validationIssue({
42082 severity: "warning",
42083 message: function(context) {
42084 var member2 = context.hasEntity(this.entityIds[1]), relation2 = context.hasEntity(this.entityIds[0]);
42085 return member2 && relation2 ? _t.append("issues.missing_role.message", {
42086 member: utilDisplayLabel(member2, context.graph()),
42087 relation: utilDisplayLabel(relation2, context.graph())
42090 reference: showReference,
42091 entityIds: [relation.id, way.id],
42095 hash: member.index.toString(),
42096 dynamicFixes: function() {
42098 makeAddRoleFix("inner"),
42099 makeAddRoleFix("outer"),
42100 new validationIssueFix({
42101 icon: "iD-operation-delete",
42102 title: _t.append("issues.fix.remove_from_relation.title"),
42103 onClick: function(context) {
42105 actionDeleteMember(this.issue.entityIds[0], this.issue.data.member.index),
42106 _t("operations.delete_member.annotation", {
42115 function showReference(selection2) {
42116 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.missing_role.multipolygon.reference"));
42119 function makeAddRoleFix(role) {
42120 return new validationIssueFix({
42121 title: _t.append("issues.fix.set_as_" + role + ".title"),
42122 onClick: function(context) {
42123 var oldMember = this.issue.data.member;
42124 var member = { id: this.issue.entityIds[1], type: oldMember.type, role };
42126 actionChangeMember(this.issue.entityIds[0], member, oldMember.index),
42127 _t("operations.change_role.annotation", {
42134 validation.type = type3;
42138 // modules/validations/missing_tag.js
42139 function validationMissingTag(context) {
42140 var type3 = "missing_tag";
42141 function hasDescriptiveTags(entity, graph) {
42142 var onlyAttributeKeys = ["description", "name", "note", "start_date"];
42143 var entityDescriptiveKeys = Object.keys(entity.tags).filter(function(k) {
42144 if (k === "area" || !osmIsInterestingTag(k))
42146 return !onlyAttributeKeys.some(function(attributeKey) {
42147 return k === attributeKey || k.indexOf(attributeKey + ":") === 0;
42150 if (entity.type === "relation" && entityDescriptiveKeys.length === 1 && entity.tags.type === "multipolygon") {
42151 return osmOldMultipolygonOuterMemberOfRelation(entity, graph);
42153 return entityDescriptiveKeys.length > 0;
42155 function isUnknownRoad(entity) {
42156 return entity.type === "way" && entity.tags.highway === "road";
42158 function isUntypedRelation(entity) {
42159 return entity.type === "relation" && !entity.tags.type;
42161 var validation = function checkMissingTag(entity, graph) {
42163 var osm = context.connection();
42164 var isUnloadedNode = entity.type === "node" && osm && !osm.isDataLoaded(entity.loc);
42165 if (!isUnloadedNode && entity.geometry(graph) !== "vertex" && !entity.hasParentRelations(graph)) {
42166 if (Object.keys(entity.tags).length === 0) {
42168 } else if (!hasDescriptiveTags(entity, graph)) {
42169 subtype = "descriptive";
42170 } else if (isUntypedRelation(entity)) {
42171 subtype = "relation_type";
42174 if (!subtype && isUnknownRoad(entity)) {
42175 subtype = "highway_classification";
42179 var messageID = subtype === "highway_classification" ? "unknown_road" : "missing_tag." + subtype;
42180 var referenceID = subtype === "highway_classification" ? "unknown_road" : "missing_tag";
42181 var canDelete = entity.version === void 0 || entity.v !== void 0;
42182 var severity = canDelete && subtype !== "highway_classification" ? "error" : "warning";
42183 return [new validationIssue({
42187 message: function(context2) {
42188 var entity2 = context2.hasEntity(this.entityIds[0]);
42189 return entity2 ? _t.append("issues." + messageID + ".message", {
42190 feature: utilDisplayLabel(entity2, context2.graph())
42193 reference: showReference,
42194 entityIds: [entity.id],
42195 dynamicFixes: function(context2) {
42197 var selectFixType = subtype === "highway_classification" ? "select_road_type" : "select_preset";
42198 fixes.push(new validationIssueFix({
42199 icon: "iD-icon-search",
42200 title: _t.append("issues.fix." + selectFixType + ".title"),
42201 onClick: function(context3) {
42202 context3.ui().sidebar.showPresetList();
42206 var id2 = this.entityIds[0];
42207 var operation = operationDelete(context2, [id2]);
42208 var disabledReasonID = operation.disabled();
42209 if (!disabledReasonID) {
42210 deleteOnClick = function(context3) {
42211 var id3 = this.issue.entityIds[0];
42212 var operation2 = operationDelete(context3, [id3]);
42213 if (!operation2.disabled()) {
42219 new validationIssueFix({
42220 icon: "iD-operation-delete",
42221 title: _t.append("issues.fix.delete_feature.title"),
42222 disabledReason: disabledReasonID ? _t("operations.delete." + disabledReasonID + ".single") : void 0,
42223 onClick: deleteOnClick
42229 function showReference(selection2) {
42230 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues." + referenceID + ".reference"));
42233 validation.type = type3;
42237 // modules/validations/outdated_tags.js
42238 function validationOutdatedTags() {
42239 const type3 = "outdated_tags";
42240 let _waitingForDeprecated = true;
42241 let _dataDeprecated;
42242 _mainFileFetcher.get("deprecated").then((d) => _dataDeprecated = d).catch(() => {
42243 }).finally(() => _waitingForDeprecated = false);
42244 function oldTagIssues(entity, graph) {
42245 const oldTags = Object.assign({}, entity.tags);
42246 let preset = _mainPresetIndex.match(entity, graph);
42247 let subtype = "deprecated_tags";
42250 if (!entity.hasInterestingTags())
42252 if (preset.replacement) {
42253 const newPreset = _mainPresetIndex.item(preset.replacement);
42254 graph = actionChangePreset(entity.id, preset, newPreset, true)(graph);
42255 entity = graph.entity(entity.id);
42256 preset = newPreset;
42258 if (_dataDeprecated) {
42259 const deprecatedTags = entity.deprecatedTags(_dataDeprecated);
42260 if (deprecatedTags.length) {
42261 deprecatedTags.forEach((tag) => {
42262 graph = actionUpgradeTags(entity.id, tag.old, tag.replace)(graph);
42264 entity = graph.entity(entity.id);
42267 let newTags = Object.assign({}, entity.tags);
42268 if (preset.tags !== preset.addTags) {
42269 Object.keys(preset.addTags).forEach((k) => {
42271 if (preset.addTags[k] === "*") {
42272 newTags[k] = "yes";
42274 newTags[k] = preset.addTags[k];
42279 const nsi = services.nsi;
42280 let waitingForNsi = false;
42283 waitingForNsi = nsi.status() === "loading";
42284 if (!waitingForNsi) {
42285 const loc = entity.extent(graph).center();
42286 nsiResult = nsi.upgradeTags(newTags, loc);
42288 newTags = nsiResult.newTags;
42289 subtype = "noncanonical_brand";
42294 issues.provisional = _waitingForDeprecated || waitingForNsi;
42295 const tagDiff = utilTagDiff(oldTags, newTags);
42296 if (!tagDiff.length)
42298 const isOnlyAddingTags = tagDiff.every((d) => d.type === "+");
42301 prefix = "noncanonical_brand.";
42302 } else if (subtype === "deprecated_tags" && isOnlyAddingTags) {
42303 subtype = "incomplete_tags";
42304 prefix = "incomplete.";
42306 let autoArgs = subtype !== "noncanonical_brand" ? [doUpgrade, _t("issues.fix.upgrade_tags.annotation")] : null;
42307 issues.push(new validationIssue({
42310 severity: "warning",
42311 message: showMessage,
42312 reference: showReference,
42313 entityIds: [entity.id],
42314 hash: utilHashcode(JSON.stringify(tagDiff)),
42315 dynamicFixes: () => {
42317 new validationIssueFix({
42319 title: _t.append("issues.fix.upgrade_tags.title"),
42320 onClick: (context) => {
42321 context.perform(doUpgrade, _t("issues.fix.upgrade_tags.annotation"));
42325 const item = nsiResult && nsiResult.matched;
42328 new validationIssueFix({
42329 title: _t.append("issues.fix.tag_as_not.title", { name: item.displayName }),
42330 onClick: (context) => {
42331 context.perform(addNotTag, _t("issues.fix.tag_as_not.annotation"));
42340 function doUpgrade(graph2) {
42341 const currEntity = graph2.hasEntity(entity.id);
42344 let newTags2 = Object.assign({}, currEntity.tags);
42345 tagDiff.forEach((diff) => {
42346 if (diff.type === "-") {
42347 delete newTags2[diff.key];
42348 } else if (diff.type === "+") {
42349 newTags2[diff.key] = diff.newVal;
42352 return actionChangeTags(currEntity.id, newTags2)(graph2);
42354 function addNotTag(graph2) {
42355 const currEntity = graph2.hasEntity(entity.id);
42358 const item = nsiResult && nsiResult.matched;
42361 let newTags2 = Object.assign({}, currEntity.tags);
42362 const wd = item.mainTag;
42363 const notwd = `not:${wd}`;
42364 const qid = item.tags[wd];
42365 newTags2[notwd] = qid;
42366 if (newTags2[wd] === qid) {
42367 const wp = item.mainTag.replace("wikidata", "wikipedia");
42368 delete newTags2[wd];
42369 delete newTags2[wp];
42371 return actionChangeTags(currEntity.id, newTags2)(graph2);
42373 function showMessage(context) {
42374 const currEntity = context.hasEntity(entity.id);
42377 let messageID = `issues.outdated_tags.${prefix}message`;
42378 if (subtype === "noncanonical_brand" && isOnlyAddingTags) {
42379 messageID += "_incomplete";
42381 return _t.append(messageID, {
42382 feature: utilDisplayLabel(currEntity, context.graph(), true)
42385 function showReference(selection2) {
42386 let enter = selection2.selectAll(".issue-reference").data([0]).enter();
42387 enter.append("div").attr("class", "issue-reference").call(_t.append(`issues.outdated_tags.${prefix}reference`));
42388 enter.append("strong").call(_t.append("issues.suggested"));
42389 enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", (d) => {
42390 let klass = d.type === "+" ? "add" : "remove";
42391 return `tagDiff-cell tagDiff-cell-${klass}`;
42392 }).html((d) => d.display);
42395 function oldMultipolygonIssues(entity, graph) {
42396 let multipolygon, outerWay;
42397 if (entity.type === "relation") {
42398 outerWay = osmOldMultipolygonOuterMemberOfRelation(entity, graph);
42399 multipolygon = entity;
42400 } else if (entity.type === "way") {
42401 multipolygon = osmIsOldMultipolygonOuterMember(entity, graph);
42406 if (!multipolygon || !outerWay)
42408 return [new validationIssue({
42410 subtype: "old_multipolygon",
42411 severity: "warning",
42412 message: showMessage,
42413 reference: showReference,
42414 entityIds: [outerWay.id, multipolygon.id],
42415 dynamicFixes: () => {
42417 new validationIssueFix({
42418 autoArgs: [doUpgrade, _t("issues.fix.move_tags.annotation")],
42419 title: _t.append("issues.fix.move_tags.title"),
42420 onClick: (context) => {
42421 context.perform(doUpgrade, _t("issues.fix.move_tags.annotation"));
42427 function doUpgrade(graph2) {
42428 let currMultipolygon = graph2.hasEntity(multipolygon.id);
42429 let currOuterWay = graph2.hasEntity(outerWay.id);
42430 if (!currMultipolygon || !currOuterWay)
42432 currMultipolygon = currMultipolygon.mergeTags(currOuterWay.tags);
42433 graph2 = graph2.replace(currMultipolygon);
42434 return actionChangeTags(currOuterWay.id, {})(graph2);
42436 function showMessage(context) {
42437 let currMultipolygon = context.hasEntity(multipolygon.id);
42438 if (!currMultipolygon)
42441 "issues.old_multipolygon.message",
42442 { multipolygon: utilDisplayLabel(currMultipolygon, context.graph(), true) }
42445 function showReference(selection2) {
42446 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.old_multipolygon.reference"));
42449 let validation = function checkOutdatedTags(entity, graph) {
42450 let issues = oldMultipolygonIssues(entity, graph);
42451 if (!issues.length)
42452 issues = oldTagIssues(entity, graph);
42455 validation.type = type3;
42459 // modules/validations/private_data.js
42460 function validationPrivateData() {
42461 var type3 = "private_data";
42462 var privateBuildingValues = {
42468 semidetached_house: true,
42469 static_caravan: true
42480 var personalTags = {
42481 "contact:email": true,
42482 "contact:fax": true,
42483 "contact:phone": true,
42488 var validation = function checkPrivateData(entity) {
42489 var tags = entity.tags;
42490 if (!tags.building || !privateBuildingValues[tags.building])
42493 for (var k in tags) {
42496 if (!personalTags[k]) {
42497 keepTags[k] = tags[k];
42500 var tagDiff = utilTagDiff(tags, keepTags);
42501 if (!tagDiff.length)
42503 var fixID = tagDiff.length === 1 ? "remove_tag" : "remove_tags";
42504 return [new validationIssue({
42506 severity: "warning",
42507 message: showMessage,
42508 reference: showReference,
42509 entityIds: [entity.id],
42510 dynamicFixes: function() {
42512 new validationIssueFix({
42513 icon: "iD-operation-delete",
42514 title: _t.append("issues.fix." + fixID + ".title"),
42515 onClick: function(context) {
42516 context.perform(doUpgrade, _t("issues.fix.remove_tag.annotation"));
42522 function doUpgrade(graph) {
42523 var currEntity = graph.hasEntity(entity.id);
42526 var newTags = Object.assign({}, currEntity.tags);
42527 tagDiff.forEach(function(diff) {
42528 if (diff.type === "-") {
42529 delete newTags[diff.key];
42530 } else if (diff.type === "+") {
42531 newTags[diff.key] = diff.newVal;
42534 return actionChangeTags(currEntity.id, newTags)(graph);
42536 function showMessage(context) {
42537 var currEntity = context.hasEntity(this.entityIds[0]);
42541 "issues.private_data.contact.message",
42542 { feature: utilDisplayLabel(currEntity, context.graph()) }
42545 function showReference(selection2) {
42546 var enter = selection2.selectAll(".issue-reference").data([0]).enter();
42547 enter.append("div").attr("class", "issue-reference").call(_t.append("issues.private_data.reference"));
42548 enter.append("strong").call(_t.append("issues.suggested"));
42549 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) {
42550 var klass = d.type === "+" ? "add" : "remove";
42551 return "tagDiff-cell tagDiff-cell-" + klass;
42552 }).html(function(d) {
42557 validation.type = type3;
42561 // modules/validations/suspicious_name.js
42562 function validationSuspiciousName() {
42563 const type3 = "suspicious_name";
42564 const keysToTestForGenericValues = [
42579 let _waitingForNsi = false;
42580 function isGenericMatchInNsi(tags) {
42581 const nsi = services.nsi;
42583 _waitingForNsi = nsi.status() === "loading";
42584 if (!_waitingForNsi) {
42585 return nsi.isGenericName(tags);
42590 function nameMatchesRawTag(lowercaseName, tags) {
42591 for (let i2 = 0; i2 < keysToTestForGenericValues.length; i2++) {
42592 let key = keysToTestForGenericValues[i2];
42593 let val = tags[key];
42595 val = val.toLowerCase();
42596 if (key === lowercaseName || val === lowercaseName || key.replace(/\_/g, " ") === lowercaseName || val.replace(/\_/g, " ") === lowercaseName) {
42603 function isGenericName(name, tags) {
42604 name = name.toLowerCase();
42605 return nameMatchesRawTag(name, tags) || isGenericMatchInNsi(tags);
42607 function makeGenericNameIssue(entityId, nameKey, genericName, langCode) {
42608 return new validationIssue({
42610 subtype: "generic_name",
42611 severity: "warning",
42612 message: function(context) {
42613 let entity = context.hasEntity(this.entityIds[0]);
42616 let preset = _mainPresetIndex.match(entity, context.graph());
42617 let langName = langCode && _mainLocalizer.languageName(langCode);
42619 "issues.generic_name.message" + (langName ? "_language" : ""),
42620 { feature: preset.name(), name: genericName, language: langName }
42623 reference: showReference,
42624 entityIds: [entityId],
42625 hash: `${nameKey}=${genericName}`,
42626 dynamicFixes: function() {
42628 new validationIssueFix({
42629 icon: "iD-operation-delete",
42630 title: _t.append("issues.fix.remove_the_name.title"),
42631 onClick: function(context) {
42632 let entityId2 = this.issue.entityIds[0];
42633 let entity = context.entity(entityId2);
42634 let tags = Object.assign({}, entity.tags);
42635 delete tags[nameKey];
42637 actionChangeTags(entityId2, tags),
42638 _t("issues.fix.remove_generic_name.annotation")
42645 function showReference(selection2) {
42646 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
42649 function makeIncorrectNameIssue(entityId, nameKey, incorrectName, langCode) {
42650 return new validationIssue({
42652 subtype: "not_name",
42653 severity: "warning",
42654 message: function(context) {
42655 const entity = context.hasEntity(this.entityIds[0]);
42658 const preset = _mainPresetIndex.match(entity, context.graph());
42659 const langName = langCode && _mainLocalizer.languageName(langCode);
42661 "issues.incorrect_name.message" + (langName ? "_language" : ""),
42662 { feature: preset.name(), name: incorrectName, language: langName }
42665 reference: showReference,
42666 entityIds: [entityId],
42667 hash: `${nameKey}=${incorrectName}`,
42668 dynamicFixes: function() {
42670 new validationIssueFix({
42671 icon: "iD-operation-delete",
42672 title: _t.append("issues.fix.remove_the_name.title"),
42673 onClick: function(context) {
42674 const entityId2 = this.issue.entityIds[0];
42675 const entity = context.entity(entityId2);
42676 let tags = Object.assign({}, entity.tags);
42677 delete tags[nameKey];
42679 actionChangeTags(entityId2, tags),
42680 _t("issues.fix.remove_mistaken_name.annotation")
42687 function showReference(selection2) {
42688 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
42691 let validation = function checkGenericName(entity) {
42692 const tags = entity.tags;
42693 const hasWikidata = !!tags.wikidata || !!tags["brand:wikidata"] || !!tags["operator:wikidata"];
42697 const notNames2 = (tags["not:name"] || "").split(";");
42698 for (let key in tags) {
42699 const m = key.match(/^name(?:(?::)([a-zA-Z_-]+))?$/);
42702 const langCode = m.length >= 2 ? m[1] : null;
42703 const value = tags[key];
42704 if (notNames2.length) {
42705 for (let i2 in notNames2) {
42706 const notName = notNames2[i2];
42707 if (notName && value === notName) {
42708 issues.push(makeIncorrectNameIssue(entity.id, key, value, langCode));
42713 if (isGenericName(value, tags)) {
42714 issues.provisional = _waitingForNsi;
42715 issues.push(makeGenericNameIssue(entity.id, key, value, langCode));
42720 validation.type = type3;
42724 // modules/validations/unsquare_way.js
42725 function validationUnsquareWay(context) {
42726 var type3 = "unsquare_way";
42727 var DEFAULT_DEG_THRESHOLD = 5;
42728 var epsilon3 = 0.05;
42729 var nodeThreshold = 10;
42730 function isBuilding(entity, graph) {
42731 if (entity.type !== "way" || entity.geometry(graph) !== "area")
42733 return entity.tags.building && entity.tags.building !== "no";
42735 var validation = function checkUnsquareWay(entity, graph) {
42736 if (!isBuilding(entity, graph))
42738 if (entity.tags.nonsquare === "yes")
42740 var isClosed = entity.isClosed();
42743 var nodes = graph.childNodes(entity).slice();
42744 if (nodes.length > nodeThreshold + 1)
42746 var osm = services.osm;
42747 if (!osm || nodes.some(function(node) {
42748 return !osm.isDataLoaded(node.loc);
42751 var hasConnectedSquarableWays = nodes.some(function(node) {
42752 return graph.parentWays(node).some(function(way) {
42753 if (way.id === entity.id)
42755 if (isBuilding(way, graph))
42757 return graph.parentRelations(way).some(function(parentRelation) {
42758 return parentRelation.isMultipolygon() && parentRelation.tags.building && parentRelation.tags.building !== "no";
42762 if (hasConnectedSquarableWays)
42764 var storedDegreeThreshold = corePreferences("validate-square-degrees");
42765 var degreeThreshold = isNaN(storedDegreeThreshold) ? DEFAULT_DEG_THRESHOLD : parseFloat(storedDegreeThreshold);
42766 var points = nodes.map(function(node) {
42767 return context.projection(node.loc);
42769 if (!geoOrthoCanOrthogonalize(points, isClosed, epsilon3, degreeThreshold, true))
42772 if (!entity.tags.wikidata) {
42773 var autoAction = actionOrthogonalize(entity.id, context.projection, void 0, degreeThreshold);
42774 autoAction.transitionable = false;
42775 autoArgs = [autoAction, _t("operations.orthogonalize.annotation.feature", { n: 1 })];
42777 return [new validationIssue({
42779 subtype: "building",
42780 severity: "warning",
42781 message: function(context2) {
42782 var entity2 = context2.hasEntity(this.entityIds[0]);
42783 return entity2 ? _t.append("issues.unsquare_way.message", {
42784 feature: utilDisplayLabel(entity2, context2.graph())
42787 reference: showReference,
42788 entityIds: [entity.id],
42789 hash: degreeThreshold,
42790 dynamicFixes: function() {
42792 new validationIssueFix({
42793 icon: "iD-operation-orthogonalize",
42794 title: _t.append("issues.fix.square_feature.title"),
42796 onClick: function(context2, completionHandler) {
42797 var entityId = this.issue.entityIds[0];
42799 actionOrthogonalize(entityId, context2.projection, void 0, degreeThreshold),
42800 _t("operations.orthogonalize.annotation.feature", { n: 1 })
42802 window.setTimeout(function() {
42803 completionHandler();
42810 function showReference(selection2) {
42811 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unsquare_way.buildings.reference"));
42814 validation.type = type3;
42818 // modules/core/validator.js
42819 function coreValidator(context) {
42820 let dispatch10 = dispatch_default("validated", "focusedIssue");
42821 let validator = utilRebind({}, dispatch10, "on");
42823 let _disabledRules = {};
42824 let _ignoredIssueIDs = /* @__PURE__ */ new Set();
42825 let _resolvedIssueIDs = /* @__PURE__ */ new Set();
42826 let _baseCache = validationCache("base");
42827 let _headCache = validationCache("head");
42828 let _completeDiff = {};
42829 let _headIsCurrent = false;
42830 let _deferredRIC = {};
42831 let _deferredST = /* @__PURE__ */ new Set();
42834 const _errorOverrides = parseHashParam(context.initialHashParams.validationError);
42835 const _warningOverrides = parseHashParam(context.initialHashParams.validationWarning);
42836 const _disableOverrides = parseHashParam(context.initialHashParams.validationDisable);
42837 function parseHashParam(param) {
42839 let rules = (param || "").split(",");
42840 rules.forEach((rule) => {
42841 rule = rule.trim();
42842 const parts = rule.split("/", 2);
42843 const type3 = parts[0];
42844 const subtype = parts[1] || "*";
42845 if (!type3 || !subtype)
42847 result.push({ type: makeRegExp(type3), subtype: makeRegExp(subtype) });
42850 function makeRegExp(str2) {
42851 const escaped = str2.replace(/[-\/\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*");
42852 return new RegExp("^" + escaped + "$");
42855 validator.init = () => {
42856 Object.values(validations_exports).forEach((validation) => {
42857 if (typeof validation !== "function")
42859 const fn = validation(context);
42860 const key = fn.type;
42863 let disabledRules = corePreferences("validate-disabledRules");
42864 if (disabledRules) {
42865 disabledRules.split(",").forEach((k) => _disabledRules[k] = true);
42868 function reset(resetIgnored) {
42869 _baseCache.queue = [];
42870 _headCache.queue = [];
42871 Object.keys(_deferredRIC).forEach((key) => {
42872 window.cancelIdleCallback(key);
42873 _deferredRIC[key]();
42876 _deferredST.forEach(window.clearTimeout);
42877 _deferredST.clear();
42879 _ignoredIssueIDs.clear();
42880 _resolvedIssueIDs.clear();
42881 _baseCache = validationCache("base");
42882 _headCache = validationCache("head");
42883 _completeDiff = {};
42884 _headIsCurrent = false;
42886 validator.reset = () => {
42889 validator.resetIgnoredIssues = () => {
42890 _ignoredIssueIDs.clear();
42891 dispatch10.call("validated");
42893 validator.revalidateUnsquare = () => {
42894 revalidateUnsquare(_headCache);
42895 revalidateUnsquare(_baseCache);
42896 dispatch10.call("validated");
42898 function revalidateUnsquare(cache) {
42899 const checkUnsquareWay = _rules.unsquare_way;
42900 if (!cache.graph || typeof checkUnsquareWay !== "function")
42902 cache.uncacheIssuesOfType("unsquare_way");
42903 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");
42904 buildings.forEach((entity) => {
42905 const detected = checkUnsquareWay(entity, cache.graph);
42906 if (!detected.length)
42908 cache.cacheIssues(detected);
42911 validator.getIssues = (options2) => {
42912 const opts = Object.assign({ what: "all", where: "all", includeIgnored: false, includeDisabledRules: false }, options2);
42913 const view = context.map().extent();
42914 let seen = /* @__PURE__ */ new Set();
42916 if (_headCache.graph && _headCache.graph !== _baseCache.graph) {
42917 Object.values(_headCache.issuesByIssueID).forEach((issue) => {
42918 const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
42919 if (opts.what === "edited" && !userModified)
42921 if (!filter2(issue))
42923 seen.add(issue.id);
42924 results.push(issue);
42927 if (opts.what === "all") {
42928 Object.values(_baseCache.issuesByIssueID).forEach((issue) => {
42929 if (!filter2(issue))
42931 seen.add(issue.id);
42932 results.push(issue);
42936 function filter2(issue) {
42939 if (seen.has(issue.id))
42941 if (_resolvedIssueIDs.has(issue.id))
42943 if (opts.includeDisabledRules === "only" && !_disabledRules[issue.type])
42945 if (!opts.includeDisabledRules && _disabledRules[issue.type])
42947 if (opts.includeIgnored === "only" && !_ignoredIssueIDs.has(issue.id))
42949 if (!opts.includeIgnored && _ignoredIssueIDs.has(issue.id))
42951 if ((issue.entityIds || []).some((id2) => !context.hasEntity(id2)))
42953 if (opts.where === "visible") {
42954 const extent = issue.extent(context.graph());
42955 if (!view.intersects(extent))
42961 validator.getResolvedIssues = () => {
42962 return Array.from(_resolvedIssueIDs).map((issueID) => _baseCache.issuesByIssueID[issueID]).filter(Boolean);
42964 validator.focusIssue = (issue) => {
42965 const graph = context.graph();
42968 const issueExtent = issue.extent(graph);
42970 focusCenter = issueExtent.center();
42972 if (issue.entityIds && issue.entityIds.length) {
42973 selectID = issue.entityIds[0];
42974 if (selectID && selectID.charAt(0) === "r") {
42975 const ids = utilEntityAndDeepMemberIDs([selectID], graph);
42976 let nodeID = ids.find((id2) => id2.charAt(0) === "n" && graph.hasEntity(id2));
42978 const wayID = ids.find((id2) => id2.charAt(0) === "w" && graph.hasEntity(id2));
42980 nodeID = graph.entity(wayID).first();
42984 focusCenter = graph.entity(nodeID).loc;
42989 const setZoom = Math.max(context.map().zoom(), 19);
42990 context.map().unobscuredCenterZoomEase(focusCenter, setZoom);
42993 window.setTimeout(() => {
42994 context.enter(modeSelect(context, [selectID]));
42995 dispatch10.call("focusedIssue", this, issue);
42999 validator.getIssuesBySeverity = (options2) => {
43000 let groups = utilArrayGroupBy(validator.getIssues(options2), "severity");
43001 groups.error = groups.error || [];
43002 groups.warning = groups.warning || [];
43005 validator.getSharedEntityIssues = (entityIDs, options2) => {
43006 const orderedIssueTypes = [
43010 "mismatched_geometry",
43013 "disconnected_way",
43014 "impossible_oneway"
43016 const allIssues = validator.getIssues(options2);
43017 const forEntityIDs = new Set(entityIDs);
43018 return allIssues.filter((issue) => (issue.entityIds || []).some((entityID) => forEntityIDs.has(entityID))).sort((issue1, issue2) => {
43019 if (issue1.type === issue2.type) {
43020 return issue1.id < issue2.id ? -1 : 1;
43022 const index1 = orderedIssueTypes.indexOf(issue1.type);
43023 const index2 = orderedIssueTypes.indexOf(issue2.type);
43024 if (index1 !== -1 && index2 !== -1) {
43025 return index1 - index2;
43026 } else if (index1 === -1 && index2 === -1) {
43027 return issue1.type < issue2.type ? -1 : 1;
43029 return index1 !== -1 ? -1 : 1;
43033 validator.getEntityIssues = (entityID, options2) => {
43034 return validator.getSharedEntityIssues([entityID], options2);
43036 validator.getRuleKeys = () => {
43037 return Object.keys(_rules);
43039 validator.isRuleEnabled = (key) => {
43040 return !_disabledRules[key];
43042 validator.toggleRule = (key) => {
43043 if (_disabledRules[key]) {
43044 delete _disabledRules[key];
43046 _disabledRules[key] = true;
43048 corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
43049 validator.validate();
43051 validator.disableRules = (keys) => {
43052 _disabledRules = {};
43053 keys.forEach((k) => _disabledRules[k] = true);
43054 corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
43055 validator.validate();
43057 validator.ignoreIssue = (issueID) => {
43058 _ignoredIssueIDs.add(issueID);
43060 validator.validate = () => {
43061 const baseGraph = context.history().base();
43062 if (!_headCache.graph)
43063 _headCache.graph = baseGraph;
43064 if (!_baseCache.graph)
43065 _baseCache.graph = baseGraph;
43066 const prevGraph = _headCache.graph;
43067 const currGraph = context.graph();
43068 if (currGraph === prevGraph) {
43069 _headIsCurrent = true;
43070 dispatch10.call("validated");
43071 return Promise.resolve();
43073 if (_headPromise) {
43074 _headIsCurrent = false;
43075 return _headPromise;
43077 _headCache.graph = currGraph;
43078 _completeDiff = context.history().difference().complete();
43079 const incrementalDiff = coreDifference(prevGraph, currGraph);
43080 let entityIDs = Object.keys(incrementalDiff.complete());
43081 entityIDs = _headCache.withAllRelatedEntities(entityIDs);
43082 if (!entityIDs.size) {
43083 dispatch10.call("validated");
43084 return Promise.resolve();
43086 _headPromise = validateEntitiesAsync(entityIDs, _headCache).then(() => updateResolvedIssues(entityIDs)).then(() => dispatch10.call("validated")).catch(() => {
43088 _headPromise = null;
43089 if (!_headIsCurrent) {
43090 validator.validate();
43093 return _headPromise;
43095 context.history().on("restore.validator", validator.validate).on("undone.validator", validator.validate).on("redone.validator", validator.validate).on("reset.validator", () => {
43097 validator.validate();
43099 context.on("exit.validator", validator.validate);
43100 context.history().on("merge.validator", (entities) => {
43103 const baseGraph = context.history().base();
43104 if (!_headCache.graph)
43105 _headCache.graph = baseGraph;
43106 if (!_baseCache.graph)
43107 _baseCache.graph = baseGraph;
43108 let entityIDs = entities.map((entity) => entity.id);
43109 entityIDs = _baseCache.withAllRelatedEntities(entityIDs);
43110 validateEntitiesAsync(entityIDs, _baseCache);
43112 function validateEntity(entity, graph) {
43113 let result = { issues: [], provisional: false };
43114 Object.keys(_rules).forEach(runValidation);
43116 function runValidation(key) {
43117 const fn = _rules[key];
43118 if (typeof fn !== "function") {
43119 console.error("no such validation rule = " + key);
43122 let detected = fn(entity, graph);
43123 if (detected.provisional) {
43124 result.provisional = true;
43126 detected = detected.filter(applySeverityOverrides);
43127 result.issues = result.issues.concat(detected);
43128 function applySeverityOverrides(issue) {
43129 const type3 = issue.type;
43130 const subtype = issue.subtype || "";
43132 for (i2 = 0; i2 < _errorOverrides.length; i2++) {
43133 if (_errorOverrides[i2].type.test(type3) && _errorOverrides[i2].subtype.test(subtype)) {
43134 issue.severity = "error";
43138 for (i2 = 0; i2 < _warningOverrides.length; i2++) {
43139 if (_warningOverrides[i2].type.test(type3) && _warningOverrides[i2].subtype.test(subtype)) {
43140 issue.severity = "warning";
43144 for (i2 = 0; i2 < _disableOverrides.length; i2++) {
43145 if (_disableOverrides[i2].type.test(type3) && _disableOverrides[i2].subtype.test(subtype)) {
43153 function updateResolvedIssues(entityIDs) {
43154 entityIDs.forEach((entityID) => {
43155 const baseIssues = _baseCache.issuesByEntityID[entityID];
43158 baseIssues.forEach((issueID) => {
43159 const issue = _baseCache.issuesByIssueID[issueID];
43160 const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
43161 if (userModified && !_headCache.issuesByIssueID[issueID]) {
43162 _resolvedIssueIDs.add(issueID);
43164 _resolvedIssueIDs.delete(issueID);
43169 function validateEntitiesAsync(entityIDs, cache) {
43170 const jobs = Array.from(entityIDs).map((entityID) => {
43171 if (cache.queuedEntityIDs.has(entityID))
43173 cache.queuedEntityIDs.add(entityID);
43174 cache.uncacheEntityID(entityID);
43176 cache.queuedEntityIDs.delete(entityID);
43177 const graph = cache.graph;
43180 const entity = graph.hasEntity(entityID);
43183 const result = validateEntity(entity, graph);
43184 if (result.provisional) {
43185 cache.provisionalEntityIDs.add(entityID);
43187 cache.cacheIssues(result.issues);
43189 }).filter(Boolean);
43190 cache.queue = cache.queue.concat(utilArrayChunk(jobs, 100));
43191 if (cache.queuePromise)
43192 return cache.queuePromise;
43193 cache.queuePromise = processQueue(cache).then(() => revalidateProvisionalEntities(cache)).catch(() => {
43194 }).finally(() => cache.queuePromise = null);
43195 return cache.queuePromise;
43197 function revalidateProvisionalEntities(cache) {
43198 if (!cache.provisionalEntityIDs.size)
43200 const handle = window.setTimeout(() => {
43201 _deferredST.delete(handle);
43202 if (!cache.provisionalEntityIDs.size)
43204 validateEntitiesAsync(Array.from(cache.provisionalEntityIDs), cache);
43206 _deferredST.add(handle);
43208 function processQueue(cache) {
43209 if (!cache.queue.length)
43210 return Promise.resolve();
43211 const chunk = cache.queue.pop();
43212 return new Promise((resolvePromise, rejectPromise) => {
43213 const handle = window.requestIdleCallback(() => {
43214 delete _deferredRIC[handle];
43215 chunk.forEach((job) => job());
43218 _deferredRIC[handle] = rejectPromise;
43220 if (cache.queue.length % 25 === 0)
43221 dispatch10.call("validated");
43222 }).then(() => processQueue(cache));
43226 function validationCache(which) {
43231 queuePromise: null,
43232 queuedEntityIDs: /* @__PURE__ */ new Set(),
43233 provisionalEntityIDs: /* @__PURE__ */ new Set(),
43234 issuesByIssueID: {},
43235 issuesByEntityID: {}
43237 cache.cacheIssue = (issue) => {
43238 (issue.entityIds || []).forEach((entityID) => {
43239 if (!cache.issuesByEntityID[entityID]) {
43240 cache.issuesByEntityID[entityID] = /* @__PURE__ */ new Set();
43242 cache.issuesByEntityID[entityID].add(issue.id);
43244 cache.issuesByIssueID[issue.id] = issue;
43246 cache.uncacheIssue = (issue) => {
43247 (issue.entityIds || []).forEach((entityID) => {
43248 if (cache.issuesByEntityID[entityID]) {
43249 cache.issuesByEntityID[entityID].delete(issue.id);
43252 delete cache.issuesByIssueID[issue.id];
43254 cache.cacheIssues = (issues) => {
43255 issues.forEach(cache.cacheIssue);
43257 cache.uncacheIssues = (issues) => {
43258 issues.forEach(cache.uncacheIssue);
43260 cache.uncacheIssuesOfType = (type3) => {
43261 const issuesOfType = Object.values(cache.issuesByIssueID).filter((issue) => issue.type === type3);
43262 cache.uncacheIssues(issuesOfType);
43264 cache.uncacheEntityID = (entityID) => {
43265 const entityIssueIDs = cache.issuesByEntityID[entityID];
43266 if (entityIssueIDs) {
43267 entityIssueIDs.forEach((issueID) => {
43268 const issue = cache.issuesByIssueID[issueID];
43270 cache.uncacheIssue(issue);
43272 delete cache.issuesByIssueID[issueID];
43276 delete cache.issuesByEntityID[entityID];
43277 cache.provisionalEntityIDs.delete(entityID);
43279 cache.withAllRelatedEntities = (entityIDs) => {
43280 let result = /* @__PURE__ */ new Set();
43281 (entityIDs || []).forEach((entityID) => {
43282 result.add(entityID);
43283 const entityIssueIDs = cache.issuesByEntityID[entityID];
43284 if (entityIssueIDs) {
43285 entityIssueIDs.forEach((issueID) => {
43286 const issue = cache.issuesByIssueID[issueID];
43288 (issue.entityIds || []).forEach((relatedID) => result.add(relatedID));
43290 delete cache.issuesByIssueID[issueID];
43300 // modules/core/uploader.js
43301 function coreUploader(context) {
43302 var dispatch10 = dispatch_default(
43305 "willAttemptUpload",
43312 var _isSaving = false;
43313 var _conflicts = [];
43316 var _discardTags = {};
43317 _mainFileFetcher.get("discarded").then(function(d) {
43319 }).catch(function() {
43321 var uploader = utilRebind({}, dispatch10, "on");
43322 uploader.isSaving = function() {
43325 uploader.save = function(changeset, tryAgain, checkConflicts) {
43326 if (_isSaving && !tryAgain) {
43329 var osm = context.connection();
43332 if (!osm.authenticated()) {
43333 osm.authenticate(function(err) {
43335 uploader.save(changeset, tryAgain, checkConflicts);
43342 dispatch10.call("saveStarted", this);
43344 var history = context.history();
43347 _origChanges = history.changes(actionDiscardTags(history.difference(), _discardTags));
43349 history.perform(actionNoop());
43351 if (!checkConflicts) {
43354 performFullConflictCheck(changeset);
43357 function performFullConflictCheck(changeset) {
43358 var osm = context.connection();
43361 var history = context.history();
43362 var localGraph = context.graph();
43363 var remoteGraph = coreGraph(history.base(), true);
43364 var summary = history.difference().summary();
43366 for (var i2 = 0; i2 < summary.length; i2++) {
43367 var item = summary[i2];
43368 if (item.changeType === "modified") {
43369 _toCheck.push(item.entity.id);
43372 var _toLoad = withChildNodes(_toCheck, localGraph);
43374 var _toLoadCount = 0;
43375 var _toLoadTotal = _toLoad.length;
43376 if (_toCheck.length) {
43377 dispatch10.call("progressChanged", this, _toLoadCount, _toLoadTotal);
43378 _toLoad.forEach(function(id2) {
43379 _loaded[id2] = false;
43381 osm.loadMultiple(_toLoad, loaded);
43386 function withChildNodes(ids, graph) {
43387 var s = new Set(ids);
43388 ids.forEach(function(id2) {
43389 var entity = graph.entity(id2);
43390 if (entity.type !== "way")
43392 graph.childNodes(entity).forEach(function(child) {
43393 if (child.version !== void 0) {
43398 return Array.from(s);
43400 function loaded(err, result) {
43401 if (_errors.length)
43405 msg: err.message || err.responseText,
43406 details: [_t("save.status_code", { code: err.status })]
43408 didResultInErrors();
43411 result.data.forEach(function(entity) {
43412 remoteGraph.replace(entity);
43413 _loaded[entity.id] = true;
43414 _toLoad = _toLoad.filter(function(val) {
43415 return val !== entity.id;
43417 if (!entity.visible)
43420 if (entity.type === "way") {
43421 for (i3 = 0; i3 < entity.nodes.length; i3++) {
43422 id2 = entity.nodes[i3];
43423 if (_loaded[id2] === void 0) {
43424 _loaded[id2] = false;
43425 loadMore.push(id2);
43428 } else if (entity.type === "relation" && entity.isMultipolygon()) {
43429 for (i3 = 0; i3 < entity.members.length; i3++) {
43430 id2 = entity.members[i3].id;
43431 if (_loaded[id2] === void 0) {
43432 _loaded[id2] = false;
43433 loadMore.push(id2);
43438 _toLoadCount += result.data.length;
43439 _toLoadTotal += loadMore.length;
43440 dispatch10.call("progressChanged", this, _toLoadCount, _toLoadTotal);
43441 if (loadMore.length) {
43442 _toLoad.push.apply(_toLoad, loadMore);
43443 osm.loadMultiple(loadMore, loaded);
43445 if (!_toLoad.length) {
43451 function detectConflicts() {
43452 function choice(id2, text2, action) {
43456 action: function() {
43457 history.replace(action);
43461 function formatUser(d) {
43462 return '<a href="' + osm.userURL(d) + '" target="_blank">' + escape_default(d) + "</a>";
43464 function entityName(entity) {
43465 return utilDisplayName(entity) || utilDisplayType(entity.id) + " " + entity.id;
43467 function sameVersions(local, remote) {
43468 if (local.version !== remote.version)
43470 if (local.type === "way") {
43471 var children2 = utilArrayUnion(local.nodes, remote.nodes);
43472 for (var i3 = 0; i3 < children2.length; i3++) {
43473 var a = localGraph.hasEntity(children2[i3]);
43474 var b = remoteGraph.hasEntity(children2[i3]);
43475 if (a && b && a.version !== b.version)
43481 _toCheck.forEach(function(id2) {
43482 var local = localGraph.entity(id2);
43483 var remote = remoteGraph.entity(id2);
43484 if (sameVersions(local, remote))
43486 var merge3 = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags, formatUser);
43487 history.replace(merge3);
43488 var mergeConflicts = merge3.conflicts();
43489 if (!mergeConflicts.length)
43491 var forceLocal = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_local");
43492 var forceRemote = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_remote");
43493 var keepMine = _t("save.conflict." + (remote.visible ? "keep_local" : "restore"));
43494 var keepTheirs = _t("save.conflict." + (remote.visible ? "keep_remote" : "delete"));
43497 name: entityName(local),
43498 details: mergeConflicts,
43501 choice(id2, keepMine, forceLocal),
43502 choice(id2, keepTheirs, forceRemote)
43508 function upload(changeset) {
43509 var osm = context.connection();
43511 _errors.push({ msg: "No OSM Service" });
43513 if (_conflicts.length) {
43514 didResultInConflicts(changeset);
43515 } else if (_errors.length) {
43516 didResultInErrors();
43518 var history = context.history();
43519 var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
43520 if (changes.modified.length || changes.created.length || changes.deleted.length) {
43521 dispatch10.call("willAttemptUpload", this);
43522 osm.putChangeset(changeset, changes, uploadCallback);
43524 didResultInNoChanges();
43528 function uploadCallback(err, changeset) {
43530 if (err.status === 409) {
43531 uploader.save(changeset, true, true);
43534 msg: err.message || err.responseText,
43535 details: [_t("save.status_code", { code: err.status })]
43537 didResultInErrors();
43540 didResultInSuccess(changeset);
43543 function didResultInNoChanges() {
43544 dispatch10.call("resultNoChanges", this);
43548 function didResultInErrors() {
43549 context.history().pop();
43550 dispatch10.call("resultErrors", this, _errors);
43553 function didResultInConflicts(changeset) {
43554 _conflicts.sort(function(a, b) {
43555 return b.id.localeCompare(a.id);
43557 dispatch10.call("resultConflicts", this, changeset, _conflicts, _origChanges);
43560 function didResultInSuccess(changeset) {
43561 context.history().clearSaved();
43562 dispatch10.call("resultSuccess", this, changeset);
43563 window.setTimeout(function() {
43568 function endSave() {
43570 dispatch10.call("saveEnded", this);
43572 uploader.cancelConflictResolution = function() {
43573 context.history().pop();
43575 uploader.processResolvedConflicts = function(changeset) {
43576 var history = context.history();
43577 for (var i2 = 0; i2 < _conflicts.length; i2++) {
43578 if (_conflicts[i2].chosen === 1) {
43579 var entity = context.hasEntity(_conflicts[i2].id);
43580 if (entity && entity.type === "way") {
43581 var children2 = utilArrayUniq(entity.nodes);
43582 for (var j2 = 0; j2 < children2.length; j2++) {
43583 history.replace(actionRevert(children2[j2]));
43586 history.replace(actionRevert(_conflicts[i2].id));
43589 uploader.save(changeset, true, false);
43591 uploader.reset = function() {
43596 // modules/renderer/background_source.js
43597 var import_lodash2 = __toESM(require_lodash());
43599 // modules/util/IntervalTasksQueue.js
43600 var IntervalTasksQueue = class {
43601 constructor(intervalInMs) {
43602 this.intervalInMs = intervalInMs;
43603 this.pendingHandles = [];
43607 let taskTimeout = this.time;
43608 this.time += this.intervalInMs;
43609 this.pendingHandles.push(setTimeout(() => {
43610 this.time -= this.intervalInMs;
43615 this.pendingHandles.forEach((timeoutHandle) => {
43616 clearTimeout(timeoutHandle);
43618 this.pendingHandles = [];
43623 // modules/renderer/background_source.js
43624 var isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
43625 window.matchMedia(`
43626 (-webkit-min-device-pixel-ratio: 2), /* Safari */
43627 (min-resolution: 2dppx), /* standard */
43628 (min-resolution: 192dpi) /* fallback */
43629 `).addListener(function() {
43630 isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
43632 function localeDateString(s) {
43635 var options2 = { day: "numeric", month: "short", year: "numeric" };
43636 var d = new Date(s);
43637 if (isNaN(d.getTime()))
43639 return d.toLocaleDateString(_mainLocalizer.localeCode(), options2);
43641 function vintageRange(vintage) {
43643 if (vintage.start || vintage.end) {
43644 s = vintage.start || "?";
43645 if (vintage.start !== vintage.end) {
43646 s += " - " + (vintage.end || "?");
43651 function rendererBackgroundSource(data) {
43652 var source = Object.assign({}, data);
43653 var _offset = [0, 0];
43654 var _name = source.name;
43655 var _description = source.description;
43656 var _best = !!source.best;
43657 var _template = source.encrypted ? utilAesDecrypt(source.template) : source.template;
43658 source.tileSize = data.tileSize || 256;
43659 source.zoomExtent = data.zoomExtent || [0, 22];
43660 source.overzoom = data.overzoom !== false;
43661 source.offset = function(val) {
43662 if (!arguments.length)
43667 source.nudge = function(val, zoomlevel) {
43668 _offset[0] += val[0] / Math.pow(2, zoomlevel);
43669 _offset[1] += val[1] / Math.pow(2, zoomlevel);
43672 source.name = function() {
43673 var id_safe = source.id.replace(/\./g, "<TX_DOT>");
43674 return _t("imagery." + id_safe + ".name", { default: (0, import_lodash2.escape)(_name) });
43676 source.label = function() {
43677 var id_safe = source.id.replace(/\./g, "<TX_DOT>");
43678 return _t.append("imagery." + id_safe + ".name", { default: (0, import_lodash2.escape)(_name) });
43680 source.hasDescription = function() {
43681 var id_safe = source.id.replace(/\./g, "<TX_DOT>");
43682 var descriptionText = _mainLocalizer.tInfo("imagery." + id_safe + ".description", { default: (0, import_lodash2.escape)(_description) }).text;
43683 return descriptionText !== "";
43685 source.description = function() {
43686 var id_safe = source.id.replace(/\./g, "<TX_DOT>");
43687 return _t.append("imagery." + id_safe + ".description", { default: (0, import_lodash2.escape)(_description) });
43689 source.best = function() {
43692 source.area = function() {
43694 return Number.MAX_VALUE;
43695 var area = area_default({ type: "MultiPolygon", coordinates: [data.polygon] });
43696 return isNaN(area) ? 0 : area;
43698 source.imageryUsed = function() {
43699 return _name || source.id;
43701 source.template = function(val) {
43702 if (!arguments.length)
43704 if (source.id === "custom" || source.id === "Bing") {
43709 source.url = function(coord2) {
43710 var result = _template.replace(/#[\s\S]*/u, "");
43713 if (!source.type || source.id === "custom") {
43714 if (/SERVICE=WMS|\{(proj|wkid|bbox)\}/.test(result)) {
43715 source.type = "wms";
43716 source.projection = "EPSG:3857";
43717 } else if (/\{(x|y)\}/.test(result)) {
43718 source.type = "tms";
43719 } else if (/\{u\}/.test(result)) {
43720 source.type = "bing";
43723 if (source.type === "wms") {
43724 var tileToProjectedCoords = function(x, y, z) {
43725 var zoomSize = Math.pow(2, z);
43726 var lon = x / zoomSize * Math.PI * 2 - Math.PI;
43727 var lat = Math.atan(Math.sinh(Math.PI * (1 - 2 * y / zoomSize)));
43728 switch (source.projection) {
43731 x: lon * 180 / Math.PI,
43732 y: lat * 180 / Math.PI
43735 var mercCoords = mercatorRaw(lon, lat);
43737 x: 2003750834e-2 / Math.PI * mercCoords[0],
43738 y: 2003750834e-2 / Math.PI * mercCoords[1]
43742 var tileSize = source.tileSize;
43743 var projection2 = source.projection;
43744 var minXmaxY = tileToProjectedCoords(coord2[0], coord2[1], coord2[2]);
43745 var maxXminY = tileToProjectedCoords(coord2[0] + 1, coord2[1] + 1, coord2[2]);
43746 result = result.replace(/\{(\w+)\}/g, function(token, key) {
43752 return projection2;
43754 return projection2.replace(/^EPSG:/, "");
43756 if (projection2 === "EPSG:4326" && /VERSION=1.3|CRS={proj}/.test(source.template().toUpperCase())) {
43757 return maxXminY.y + "," + minXmaxY.x + "," + minXmaxY.y + "," + maxXminY.x;
43759 return minXmaxY.x + "," + maxXminY.y + "," + maxXminY.x + "," + minXmaxY.y;
43773 } else if (source.type === "tms") {
43774 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" : "");
43775 } else if (source.type === "bing") {
43776 result = result.replace("{u}", function() {
43778 for (var zoom = coord2[2]; zoom > 0; zoom--) {
43780 var mask = 1 << zoom - 1;
43781 if ((coord2[0] & mask) !== 0)
43783 if ((coord2[1] & mask) !== 0)
43790 result = result.replace(/\{switch:([^}]+)\}/, function(s, r) {
43791 var subdomains = r.split(",");
43792 return subdomains[(coord2[0] + coord2[1]) % subdomains.length];
43796 source.validZoom = function(z) {
43797 return source.zoomExtent[0] <= z && (source.overzoom || source.zoomExtent[1] > z);
43799 source.isLocatorOverlay = function() {
43800 return source.id === "mapbox_locator_overlay";
43802 source.isHidden = function() {
43803 return source.id === "DigitalGlobe-Premium-vintage" || source.id === "DigitalGlobe-Standard-vintage";
43805 source.copyrightNotices = function() {
43807 source.getMetadata = function(center, tileCoord, callback) {
43809 start: localeDateString(source.startDate),
43810 end: localeDateString(source.endDate)
43812 vintage.range = vintageRange(vintage);
43813 var metadata = { vintage };
43814 callback(null, metadata);
43818 rendererBackgroundSource.Bing = function(data, dispatch10) {
43819 data.template = "https://ecn.t{switch:0,1,2,3}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=1&pr=odbl&n=z";
43820 var bing = rendererBackgroundSource(data);
43821 var key = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
43822 const strictParam = "n";
43823 var url = "https://dev.virtualearth.net/REST/v1/Imagery/Metadata/AerialOSM?include=ImageryProviders&uriScheme=https&key=" + key;
43826 var providers = [];
43827 var taskQueue = new IntervalTasksQueue(250);
43828 var metadataLastZoom = -1;
43829 json_default(url).then(function(json) {
43830 let imageryResource = json.resourceSets[0].resources[0];
43831 let template = imageryResource.imageUrl;
43832 let subDomains = imageryResource.imageUrlSubdomains;
43833 let subDomainNumbers = subDomains.map((subDomain) => {
43834 return subDomain.substring(1);
43836 template = template.replace("{subdomain}", `t{switch:${subDomainNumbers}}`).replace("{quadkey}", "{u}");
43837 if (!new URLSearchParams(template).has(strictParam)) {
43838 template += `&${strictParam}=z`;
43840 bing.template(template);
43841 providers = imageryResource.imageryProviders.map(function(provider) {
43843 attribution: provider.attribution,
43844 areas: provider.coverageAreas.map(function(area) {
43846 zoom: [area.zoomMin, area.zoomMax],
43847 extent: geoExtent([area.bbox[1], area.bbox[0]], [area.bbox[3], area.bbox[2]])
43852 dispatch10.call("change");
43853 }).catch(function() {
43855 bing.copyrightNotices = function(zoom, extent) {
43856 zoom = Math.min(zoom, 21);
43857 return providers.filter(function(provider) {
43858 return provider.areas.some(function(area) {
43859 return extent.intersects(area.extent) && area.zoom[0] <= zoom && area.zoom[1] >= zoom;
43861 }).map(function(provider) {
43862 return provider.attribution;
43865 bing.getMetadata = function(center, tileCoord, callback) {
43866 var tileID = tileCoord.slice(0, 3).join("/");
43867 var zoom = Math.min(tileCoord[2], 21);
43868 var centerPoint = center[1] + "," + center[0];
43869 var url2 = "https://dev.virtualearth.net/REST/v1/Imagery/BasicMetadata/AerialOSM/" + centerPoint + "?zl=" + zoom + "&key=" + key;
43870 if (inflight[tileID])
43872 if (!cache[tileID]) {
43873 cache[tileID] = {};
43875 if (cache[tileID] && cache[tileID].metadata) {
43876 return callback(null, cache[tileID].metadata);
43878 inflight[tileID] = true;
43879 if (metadataLastZoom !== tileCoord[2]) {
43880 metadataLastZoom = tileCoord[2];
43883 taskQueue.enqueue(() => {
43884 json_default(url2).then(function(result) {
43885 delete inflight[tileID];
43887 throw new Error("Unknown Error");
43890 start: localeDateString(result.resourceSets[0].resources[0].vintageStart),
43891 end: localeDateString(result.resourceSets[0].resources[0].vintageEnd)
43893 vintage.range = vintageRange(vintage);
43894 var metadata = { vintage };
43895 cache[tileID].metadata = metadata;
43897 callback(null, metadata);
43898 }).catch(function(err) {
43899 delete inflight[tileID];
43901 callback(err.message);
43905 bing.terms_url = "https://blog.openstreetmap.org/2010/11/30/microsoft-imagery-details";
43908 rendererBackgroundSource.Esri = function(data) {
43909 if (data.template.match(/blankTile/) === null) {
43910 data.template = data.template + "?blankTile=false";
43912 var esri = rendererBackgroundSource(data);
43916 esri.fetchTilemap = function(center) {
43917 if (_prevCenter && geoSphericalDistance(center, _prevCenter) < 5e3)
43919 _prevCenter = center;
43921 var dummyUrl = esri.url([1, 2, 3]);
43922 var x = Math.floor((center[0] + 180) / 360 * Math.pow(2, z));
43923 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));
43924 var tilemapUrl = dummyUrl.replace(/tile\/[0-9]+\/[0-9]+\/[0-9]+\?blankTile=false/, "tilemap") + "/" + z + "/" + y + "/" + x + "/8/8";
43925 json_default(tilemapUrl).then(function(tilemap) {
43927 throw new Error("Unknown Error");
43929 var hasTiles = true;
43930 for (var i2 = 0; i2 < tilemap.data.length; i2++) {
43931 if (!tilemap.data[i2]) {
43936 esri.zoomExtent[1] = hasTiles ? 22 : 19;
43937 }).catch(function() {
43940 esri.getMetadata = function(center, tileCoord, callback) {
43941 if (esri.id !== "EsriWorldImagery") {
43942 return callback(null, {});
43944 var tileID = tileCoord.slice(0, 3).join("/");
43945 var zoom = Math.min(tileCoord[2], esri.zoomExtent[1]);
43946 var centerPoint = center[0] + "," + center[1];
43947 var unknown = _t("info_panels.background.unknown");
43950 if (inflight[tileID])
43952 var url = "https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/4/query";
43953 url += "?returnGeometry=false&geometry=" + centerPoint + "&inSR=4326&geometryType=esriGeometryPoint&outFields=*&f=json";
43954 if (!cache[tileID]) {
43955 cache[tileID] = {};
43957 if (cache[tileID] && cache[tileID].metadata) {
43958 return callback(null, cache[tileID].metadata);
43960 inflight[tileID] = true;
43961 json_default(url).then(function(result) {
43962 delete inflight[tileID];
43963 result = result.features.map((f2) => f2.attributes).filter((a) => a.MinMapLevel <= zoom && a.MaxMapLevel >= zoom)[0];
43965 throw new Error("Unknown Error");
43966 } else if (result.features && result.features.length < 1) {
43967 throw new Error("No Results");
43968 } else if (result.error && result.error.message) {
43969 throw new Error(result.error.message);
43971 var captureDate = localeDateString(result.SRC_DATE2);
43973 start: captureDate,
43979 source: clean2(result.NICE_NAME),
43980 description: clean2(result.NICE_DESC),
43981 resolution: clean2(+parseFloat(result.SRC_RES).toFixed(4)),
43982 accuracy: clean2(+parseFloat(result.SRC_ACC).toFixed(4))
43984 if (isFinite(metadata.resolution)) {
43985 metadata.resolution += " m";
43987 if (isFinite(metadata.accuracy)) {
43988 metadata.accuracy += " m";
43990 cache[tileID].metadata = metadata;
43992 callback(null, metadata);
43993 }).catch(function(err) {
43994 delete inflight[tileID];
43996 callback(err.message);
43998 function clean2(val) {
43999 return String(val).trim() || unknown;
44004 rendererBackgroundSource.None = function() {
44005 var source = rendererBackgroundSource({ id: "none", template: "" });
44006 source.name = function() {
44007 return _t("background.none");
44009 source.label = function() {
44010 return _t.append("background.none");
44012 source.imageryUsed = function() {
44015 source.area = function() {
44020 rendererBackgroundSource.Custom = function(template) {
44021 var source = rendererBackgroundSource({ id: "custom", template });
44022 source.name = function() {
44023 return _t("background.custom");
44025 source.label = function() {
44026 return _t.append("background.custom");
44028 source.imageryUsed = function() {
44029 var cleaned = source.template();
44030 if (cleaned.indexOf("?") !== -1) {
44031 var parts = cleaned.split("?", 2);
44032 var qs = utilStringQs(parts[1]);
44033 ["access_token", "connectId", "token"].forEach(function(param) {
44035 qs[param] = "{apikey}";
44038 cleaned = parts[0] + "?" + utilQsString(qs, true);
44040 cleaned = cleaned.replace(/token\/(\w+)/, "token/{apikey}").replace(/key=(\w+)/, "key={apikey}");
44041 return "Custom (" + cleaned + " )";
44043 source.area = function() {
44049 // node_modules/@turf/helpers/dist/es/index.js
44050 var earthRadius = 63710088e-1;
44052 centimeters: earthRadius * 100,
44053 centimetres: earthRadius * 100,
44054 degrees: earthRadius / 111325,
44055 feet: earthRadius * 3.28084,
44056 inches: earthRadius * 39.37,
44057 kilometers: earthRadius / 1e3,
44058 kilometres: earthRadius / 1e3,
44059 meters: earthRadius,
44060 metres: earthRadius,
44061 miles: earthRadius / 1609.344,
44062 millimeters: earthRadius * 1e3,
44063 millimetres: earthRadius * 1e3,
44064 nauticalmiles: earthRadius / 1852,
44066 yards: earthRadius * 1.0936
44068 var unitsFactors = {
44071 degrees: 1 / 111325,
44074 kilometers: 1 / 1e3,
44075 kilometres: 1 / 1e3,
44078 miles: 1 / 1609.344,
44081 nauticalmiles: 1 / 1852,
44082 radians: 1 / earthRadius,
44085 function feature2(geom, properties, options2) {
44086 if (options2 === void 0) {
44089 var feat = { type: "Feature" };
44090 if (options2.id === 0 || options2.id) {
44091 feat.id = options2.id;
44093 if (options2.bbox) {
44094 feat.bbox = options2.bbox;
44096 feat.properties = properties || {};
44097 feat.geometry = geom;
44100 function polygon(coordinates, properties, options2) {
44101 if (options2 === void 0) {
44104 for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) {
44105 var ring = coordinates_1[_i];
44106 if (ring.length < 4) {
44107 throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
44109 for (var j2 = 0; j2 < ring[ring.length - 1].length; j2++) {
44110 if (ring[ring.length - 1][j2] !== ring[0][j2]) {
44111 throw new Error("First and last Position are not equivalent.");
44119 return feature2(geom, properties, options2);
44121 function lineString(coordinates, properties, options2) {
44122 if (options2 === void 0) {
44125 if (coordinates.length < 2) {
44126 throw new Error("coordinates must be an array of two or more positions");
44129 type: "LineString",
44132 return feature2(geom, properties, options2);
44134 function multiLineString(coordinates, properties, options2) {
44135 if (options2 === void 0) {
44139 type: "MultiLineString",
44142 return feature2(geom, properties, options2);
44144 function multiPolygon(coordinates, properties, options2) {
44145 if (options2 === void 0) {
44149 type: "MultiPolygon",
44152 return feature2(geom, properties, options2);
44155 // node_modules/@turf/invariant/dist/es/index.js
44156 function getGeom(geojson) {
44157 if (geojson.type === "Feature") {
44158 return geojson.geometry;
44163 // node_modules/@turf/bbox-clip/dist/es/lib/lineclip.js
44164 function lineclip(points, bbox2, result) {
44165 var len = points.length, codeA = bitCode(points[0], bbox2), part = [], i2, codeB, lastCode;
44170 for (i2 = 1; i2 < len; i2++) {
44171 a = points[i2 - 1];
44173 codeB = lastCode = bitCode(b, bbox2);
44175 if (!(codeA | codeB)) {
44177 if (codeB !== lastCode) {
44179 if (i2 < len - 1) {
44183 } else if (i2 === len - 1) {
44187 } else if (codeA & codeB) {
44189 } else if (codeA) {
44190 a = intersect(a, b, codeA, bbox2);
44191 codeA = bitCode(a, bbox2);
44193 b = intersect(a, b, codeB, bbox2);
44194 codeB = bitCode(b, bbox2);
44203 function polygonclip(points, bbox2) {
44204 var result, edge, prev, prevInside, i2, p, inside;
44205 for (edge = 1; edge <= 8; edge *= 2) {
44207 prev = points[points.length - 1];
44208 prevInside = !(bitCode(prev, bbox2) & edge);
44209 for (i2 = 0; i2 < points.length; i2++) {
44211 inside = !(bitCode(p, bbox2) & edge);
44212 if (inside !== prevInside)
44213 result.push(intersect(prev, p, edge, bbox2));
44217 prevInside = inside;
44220 if (!points.length)
44225 function intersect(a, b, edge, bbox2) {
44226 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;
44228 function bitCode(p, bbox2) {
44230 if (p[0] < bbox2[0])
44232 else if (p[0] > bbox2[2])
44234 if (p[1] < bbox2[1])
44236 else if (p[1] > bbox2[3])
44241 // node_modules/@turf/bbox-clip/dist/es/index.js
44242 function bboxClip(feature3, bbox2) {
44243 var geom = getGeom(feature3);
44244 var type3 = geom.type;
44245 var properties = feature3.type === "Feature" ? feature3.properties : {};
44246 var coords = geom.coordinates;
44249 case "MultiLineString": {
44251 if (type3 === "LineString") {
44254 coords.forEach(function(line) {
44255 lineclip(line, bbox2, lines_1);
44257 if (lines_1.length === 1) {
44258 return lineString(lines_1[0], properties);
44260 return multiLineString(lines_1, properties);
44263 return polygon(clipPolygon(coords, bbox2), properties);
44264 case "MultiPolygon":
44265 return multiPolygon(coords.map(function(poly) {
44266 return clipPolygon(poly, bbox2);
44269 throw new Error("geometry " + type3 + " not supported");
44272 function clipPolygon(rings, bbox2) {
44274 for (var _i = 0, rings_1 = rings; _i < rings_1.length; _i++) {
44275 var ring = rings_1[_i];
44276 var clipped = polygonclip(ring, bbox2);
44277 if (clipped.length > 0) {
44278 if (clipped[0][0] !== clipped[clipped.length - 1][0] || clipped[0][1] !== clipped[clipped.length - 1][1]) {
44279 clipped.push(clipped[0]);
44281 if (clipped.length >= 4) {
44282 outRings.push(clipped);
44289 // node_modules/@turf/meta/dist/es/index.js
44290 function coordEach(geojson, callback, excludeWrapCoord) {
44291 if (geojson === null)
44293 var j2, k, l, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type3 = geojson.type, isFeatureCollection = type3 === "FeatureCollection", isFeature = type3 === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
44294 for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
44295 geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
44296 isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
44297 stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
44298 for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
44299 var multiFeatureIndex = 0;
44300 var geometryIndex = 0;
44301 geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
44302 if (geometry === null)
44304 coords = geometry.coordinates;
44305 var geomType = geometry.type;
44306 wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
44307 switch (geomType) {
44320 multiFeatureIndex++;
44324 for (j2 = 0; j2 < coords.length; j2++) {
44334 if (geomType === "MultiPoint")
44335 multiFeatureIndex++;
44337 if (geomType === "LineString")
44338 multiFeatureIndex++;
44341 case "MultiLineString":
44342 for (j2 = 0; j2 < coords.length; j2++) {
44343 for (k = 0; k < coords[j2].length - wrapShrink; k++) {
44354 if (geomType === "MultiLineString")
44355 multiFeatureIndex++;
44356 if (geomType === "Polygon")
44359 if (geomType === "Polygon")
44360 multiFeatureIndex++;
44362 case "MultiPolygon":
44363 for (j2 = 0; j2 < coords.length; j2++) {
44365 for (k = 0; k < coords[j2].length; k++) {
44366 for (l = 0; l < coords[j2][k].length - wrapShrink; l++) {
44379 multiFeatureIndex++;
44382 case "GeometryCollection":
44383 for (j2 = 0; j2 < geometry.geometries.length; j2++)
44384 if (coordEach(geometry.geometries[j2], callback, excludeWrapCoord) === false)
44388 throw new Error("Unknown Geometry Type");
44394 // node_modules/@turf/bbox/dist/es/index.js
44395 function bbox(geojson) {
44396 var result = [Infinity, Infinity, -Infinity, -Infinity];
44397 coordEach(geojson, function(coord2) {
44398 if (result[0] > coord2[0]) {
44399 result[0] = coord2[0];
44401 if (result[1] > coord2[1]) {
44402 result[1] = coord2[1];
44404 if (result[2] < coord2[0]) {
44405 result[2] = coord2[0];
44407 if (result[3] < coord2[1]) {
44408 result[3] = coord2[1];
44413 bbox["default"] = bbox;
44414 var es_default = bbox;
44416 // modules/renderer/background.js
44417 var import_which_polygon4 = __toESM(require_which_polygon());
44419 // modules/renderer/tile_layer.js
44420 function rendererTileLayer(context) {
44421 var transformProp = utilPrefixCSSProperty("Transform");
44422 var tiler8 = utilTiler();
44423 var _tileSize = 256;
44429 function tileSizeAtZoom(d, z) {
44430 var EPSILON = 2e-3;
44431 return _tileSize * Math.pow(2, z - d[2]) / _tileSize + EPSILON;
44433 function atZoom(t, distance) {
44434 var power = Math.pow(2, distance);
44436 Math.floor(t[0] * power),
44437 Math.floor(t[1] * power),
44441 function lookUp(d) {
44442 for (var up = -1; up > -d[2]; up--) {
44443 var tile = atZoom(d, up);
44444 if (_cache4[_source.url(tile)] !== false) {
44449 function uniqueBy(a, n2) {
44452 for (var i2 = 0; i2 < a.length; i2++) {
44453 if (seen[a[i2][n2]] === void 0) {
44455 seen[a[i2][n2]] = true;
44460 function addSource(d) {
44461 d.push(_source.url(d));
44464 function background(selection2) {
44465 _zoom = geoScaleToZoom(_projection.scale(), _tileSize);
44469 _source.offset()[0] * Math.pow(2, _zoom),
44470 _source.offset()[1] * Math.pow(2, _zoom)
44473 pixelOffset = [0, 0];
44476 _projection.translate()[0] + pixelOffset[0],
44477 _projection.translate()[1] + pixelOffset[1]
44479 tiler8.scale(_projection.scale() * 2 * Math.PI).translate(translate);
44481 _projection.scale() * Math.PI - translate[0],
44482 _projection.scale() * Math.PI - translate[1]
44484 render(selection2);
44486 function render(selection2) {
44490 var showDebug = context.getDebug("tile") && !_source.overlay;
44491 if (_source.validZoom(_zoom)) {
44492 tiler8.skipNullIsland(!!_source.overlay);
44493 tiler8().forEach(function(d) {
44497 if (typeof d[3] !== "string")
44500 if (_cache4[d[3]] === false && lookUp(d)) {
44501 requests.push(addSource(lookUp(d)));
44504 requests = uniqueBy(requests, 3).filter(function(r) {
44505 return _cache4[r[3]] !== false;
44508 function load(d3_event, d) {
44509 _cache4[d[3]] = true;
44510 select_default2(this).on("error", null).on("load", null).classed("tile-loaded", true);
44511 render(selection2);
44513 function error(d3_event, d) {
44514 _cache4[d[3]] = false;
44515 select_default2(this).on("error", null).on("load", null).remove();
44516 render(selection2);
44518 function imageTransform(d) {
44519 var ts = _tileSize * Math.pow(2, _zoom - d[2]);
44520 var scale = tileSizeAtZoom(d, _zoom);
44521 return "translate(" + (d[0] * ts - _tileOrigin[0]) + "px," + (d[1] * ts - _tileOrigin[1]) + "px) scale(" + scale + "," + scale + ")";
44523 function tileCenter(d) {
44524 var ts = _tileSize * Math.pow(2, _zoom - d[2]);
44526 d[0] * ts - _tileOrigin[0] + ts / 2,
44527 d[1] * ts - _tileOrigin[1] + ts / 2
44530 function debugTransform(d) {
44531 var coord2 = tileCenter(d);
44532 return "translate(" + coord2[0] + "px," + coord2[1] + "px)";
44534 var dims = tiler8.size();
44535 var mapCenter = [dims[0] / 2, dims[1] / 2];
44536 var minDist = Math.max(dims[0], dims[1]);
44538 requests.forEach(function(d) {
44539 var c = tileCenter(d);
44540 var dist = geoVecLength(c, mapCenter);
44541 if (dist < minDist) {
44546 var image = selection2.selectAll("img").data(requests, function(d) {
44549 image.exit().style(transformProp, imageTransform).classed("tile-removing", true).classed("tile-center", false).each(function() {
44550 var tile = select_default2(this);
44551 window.setTimeout(function() {
44552 if (tile.classed("tile-removing")) {
44557 image.enter().append("img").attr("class", "tile").attr("alt", "").attr("draggable", "false").style("width", _tileSize + "px").style("height", _tileSize + "px").attr("src", function(d) {
44559 }).on("error", error).on("load", load).merge(image).style(transformProp, imageTransform).classed("tile-debug", showDebug).classed("tile-removing", false).classed("tile-center", function(d) {
44560 return d === nearCenter;
44562 var debug2 = selection2.selectAll(".tile-label-debug").data(showDebug ? requests : [], function(d) {
44565 debug2.exit().remove();
44567 var debugEnter = debug2.enter().append("div").attr("class", "tile-label-debug");
44568 debugEnter.append("div").attr("class", "tile-label-debug-coord");
44569 debugEnter.append("div").attr("class", "tile-label-debug-vintage");
44570 debug2 = debug2.merge(debugEnter);
44571 debug2.style(transformProp, debugTransform);
44572 debug2.selectAll(".tile-label-debug-coord").text(function(d) {
44573 return d[2] + " / " + d[0] + " / " + d[1];
44575 debug2.selectAll(".tile-label-debug-vintage").each(function(d) {
44576 var span = select_default2(this);
44577 var center = context.projection.invert(tileCenter(d));
44578 _source.getMetadata(center, d, function(err, result) {
44579 if (result && result.vintage && result.vintage.range) {
44580 span.text(result.vintage.range);
44582 span.call(_t.append("info_panels.background.vintage"));
44583 span.append("span").text(": ");
44584 span.call(_t.append("info_panels.background.unknown"));
44590 background.projection = function(val) {
44591 if (!arguments.length)
44592 return _projection;
44596 background.dimensions = function(val) {
44597 if (!arguments.length)
44598 return tiler8.size();
44602 background.source = function(val) {
44603 if (!arguments.length)
44606 _tileSize = _source.tileSize;
44608 tiler8.tileSize(_source.tileSize).zoomExtent(_source.zoomExtent);
44614 // modules/renderer/background.js
44615 var _imageryIndex = null;
44616 function rendererBackground(context) {
44617 const dispatch10 = dispatch_default("change");
44618 const baseLayer = rendererTileLayer(context).projection(context.projection);
44619 let _checkedBlocklists = [];
44620 let _isValid = true;
44621 let _overlayLayers = [];
44622 let _brightness = 1;
44624 let _saturation = 1;
44625 let _sharpness = 1;
44626 function ensureImageryIndex() {
44627 return _mainFileFetcher.get("imagery").then((sources) => {
44629 return _imageryIndex;
44634 const features2 = sources.map((source) => {
44635 if (!source.polygon)
44637 const rings = source.polygon.map((ring) => [ring]);
44640 properties: { id: source.id },
44641 geometry: { type: "MultiPolygon", coordinates: rings }
44643 _imageryIndex.features[source.id] = feature3;
44645 }).filter(Boolean);
44646 _imageryIndex.query = (0, import_which_polygon4.default)({ type: "FeatureCollection", features: features2 });
44647 _imageryIndex.backgrounds = sources.map((source) => {
44648 if (source.type === "bing") {
44649 return rendererBackgroundSource.Bing(source, dispatch10);
44650 } else if (/^EsriWorldImagery/.test(source.id)) {
44651 return rendererBackgroundSource.Esri(source);
44653 return rendererBackgroundSource(source);
44656 _imageryIndex.backgrounds.unshift(rendererBackgroundSource.None());
44657 let template = corePreferences("background-custom-template") || "";
44658 const custom = rendererBackgroundSource.Custom(template);
44659 _imageryIndex.backgrounds.unshift(custom);
44660 return _imageryIndex;
44663 function background(selection2) {
44664 const currSource = baseLayer.source();
44665 if (context.map().zoom() > 18) {
44666 if (currSource && /^EsriWorldImagery/.test(currSource.id)) {
44667 const center = context.map().center();
44668 currSource.fetchTilemap(center);
44671 const sources = background.sources(context.map().extent());
44672 const wasValid = _isValid;
44673 _isValid = !!sources.filter((d) => d === currSource).length;
44674 if (wasValid !== _isValid) {
44675 background.updateImagery();
44677 let baseFilter = "";
44678 if (_brightness !== 1) {
44679 baseFilter += ` brightness(${_brightness})`;
44681 if (_contrast !== 1) {
44682 baseFilter += ` contrast(${_contrast})`;
44684 if (_saturation !== 1) {
44685 baseFilter += ` saturate(${_saturation})`;
44687 if (_sharpness < 1) {
44688 const blur = number_default(0.5, 5)(1 - _sharpness);
44689 baseFilter += ` blur(${blur}px)`;
44691 let base = selection2.selectAll(".layer-background").data([0]);
44692 base = base.enter().insert("div", ".layer-data").attr("class", "layer layer-background").merge(base);
44693 base.style("filter", baseFilter || null);
44694 let imagery = base.selectAll(".layer-imagery").data([0]);
44695 imagery.enter().append("div").attr("class", "layer layer-imagery").merge(imagery).call(baseLayer);
44696 let maskFilter = "";
44697 let mixBlendMode = "";
44698 if (_sharpness > 1) {
44699 mixBlendMode = "overlay";
44700 maskFilter = "saturate(0) blur(3px) invert(1)";
44701 let contrast = _sharpness - 1;
44702 maskFilter += ` contrast(${contrast})`;
44703 let brightness = number_default(1, 0.85)(_sharpness - 1);
44704 maskFilter += ` brightness(${brightness})`;
44706 let mask = base.selectAll(".layer-unsharp-mask").data(_sharpness > 1 ? [0] : []);
44707 mask.exit().remove();
44708 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);
44709 let overlays = selection2.selectAll(".layer-overlay").data(_overlayLayers, (d) => d.source().name());
44710 overlays.exit().remove();
44711 overlays.enter().insert("div", ".layer-data").attr("class", "layer layer-overlay").merge(overlays).each((layer, i2, nodes) => select_default2(nodes[i2]).call(layer));
44713 background.updateImagery = function() {
44714 let currSource = baseLayer.source();
44715 if (context.inIntro() || !currSource)
44717 let o = _overlayLayers.filter((d) => !d.source().isLocatorOverlay() && !d.source().isHidden()).map((d) => d.source().id).join(",");
44718 const meters = geoOffsetToMeters(currSource.offset());
44719 const EPSILON = 0.01;
44720 const x = +meters[0].toFixed(2);
44721 const y = +meters[1].toFixed(2);
44722 let hash = utilStringQs(window.location.hash);
44723 let id2 = currSource.id;
44724 if (id2 === "custom") {
44725 id2 = `custom:${currSource.template()}`;
44728 hash.background = id2;
44730 delete hash.background;
44735 delete hash.overlays;
44737 if (Math.abs(x) > EPSILON || Math.abs(y) > EPSILON) {
44738 hash.offset = `${x},${y}`;
44740 delete hash.offset;
44742 if (!window.mocha) {
44743 window.location.replace("#" + utilQsString(hash, true));
44745 let imageryUsed = [];
44746 let photoOverlaysUsed = [];
44747 const currUsed = currSource.imageryUsed();
44748 if (currUsed && _isValid) {
44749 imageryUsed.push(currUsed);
44751 _overlayLayers.filter((d) => !d.source().isLocatorOverlay() && !d.source().isHidden()).forEach((d) => imageryUsed.push(d.source().imageryUsed()));
44752 const dataLayer = context.layers().layer("data");
44753 if (dataLayer && dataLayer.enabled() && dataLayer.hasData()) {
44754 imageryUsed.push(dataLayer.getSrc());
44756 const photoOverlayLayers = {
44757 streetside: "Bing Streetside",
44758 mapillary: "Mapillary Images",
44759 "mapillary-map-features": "Mapillary Map Features",
44760 "mapillary-signs": "Mapillary Signs",
44761 kartaview: "KartaView Images"
44763 for (let layerID in photoOverlayLayers) {
44764 const layer = context.layers().layer(layerID);
44765 if (layer && layer.enabled()) {
44766 photoOverlaysUsed.push(layerID);
44767 imageryUsed.push(photoOverlayLayers[layerID]);
44770 context.history().imageryUsed(imageryUsed);
44771 context.history().photoOverlaysUsed(photoOverlaysUsed);
44773 background.sources = (extent, zoom, includeCurrent) => {
44774 if (!_imageryIndex)
44777 (_imageryIndex.query.bbox(extent.rectangle(), true) || []).forEach((d) => visible[d.id] = true);
44778 const currSource = baseLayer.source();
44779 const osm = context.connection();
44780 const blocklists = osm && osm.imageryBlocklists() || [];
44781 const blocklistChanged = blocklists.length !== _checkedBlocklists.length || blocklists.some((regex, index) => String(regex) !== _checkedBlocklists[index]);
44782 if (blocklistChanged) {
44783 _imageryIndex.backgrounds.forEach((source) => {
44784 source.isBlocked = blocklists.some((regex) => regex.test(source.template()));
44786 _checkedBlocklists = blocklists.map((regex) => String(regex));
44788 return _imageryIndex.backgrounds.filter((source) => {
44789 if (includeCurrent && currSource === source)
44791 if (source.isBlocked)
44793 if (!source.polygon)
44795 if (zoom && zoom < 6)
44797 return visible[source.id];
44800 background.dimensions = (val) => {
44803 baseLayer.dimensions(val);
44804 _overlayLayers.forEach((layer) => layer.dimensions(val));
44806 background.baseLayerSource = function(d) {
44807 if (!arguments.length)
44808 return baseLayer.source();
44809 const osm = context.connection();
44812 const blocklists = osm.imageryBlocklists();
44813 const template = d.template();
44817 for (let i2 = 0; i2 < blocklists.length; i2++) {
44818 regex = blocklists[i2];
44819 fail = regex.test(template);
44825 regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
44826 fail = regex.test(template);
44828 baseLayer.source(!fail ? d : background.findSource("none"));
44829 dispatch10.call("change");
44830 background.updateImagery();
44833 background.findSource = (id2) => {
44834 if (!id2 || !_imageryIndex)
44836 return _imageryIndex.backgrounds.find((d) => d.id && d.id === id2);
44838 background.bing = () => {
44839 background.baseLayerSource(background.findSource("Bing"));
44841 background.showsLayer = (d) => {
44842 const currSource = baseLayer.source();
44843 if (!d || !currSource)
44845 return d.id === currSource.id || _overlayLayers.some((layer) => d.id === layer.source().id);
44847 background.overlayLayerSources = () => {
44848 return _overlayLayers.map((layer) => layer.source());
44850 background.toggleOverlayLayer = (d) => {
44852 for (let i2 = 0; i2 < _overlayLayers.length; i2++) {
44853 layer = _overlayLayers[i2];
44854 if (layer.source() === d) {
44855 _overlayLayers.splice(i2, 1);
44856 dispatch10.call("change");
44857 background.updateImagery();
44861 layer = rendererTileLayer(context).source(d).projection(context.projection).dimensions(
44862 baseLayer.dimensions()
44864 _overlayLayers.push(layer);
44865 dispatch10.call("change");
44866 background.updateImagery();
44868 background.nudge = (d, zoom) => {
44869 const currSource = baseLayer.source();
44871 currSource.nudge(d, zoom);
44872 dispatch10.call("change");
44873 background.updateImagery();
44877 background.offset = function(d) {
44878 const currSource = baseLayer.source();
44879 if (!arguments.length) {
44880 return currSource && currSource.offset() || [0, 0];
44883 currSource.offset(d);
44884 dispatch10.call("change");
44885 background.updateImagery();
44889 background.brightness = function(d) {
44890 if (!arguments.length)
44891 return _brightness;
44893 if (context.mode())
44894 dispatch10.call("change");
44897 background.contrast = function(d) {
44898 if (!arguments.length)
44901 if (context.mode())
44902 dispatch10.call("change");
44905 background.saturation = function(d) {
44906 if (!arguments.length)
44907 return _saturation;
44909 if (context.mode())
44910 dispatch10.call("change");
44913 background.sharpness = function(d) {
44914 if (!arguments.length)
44917 if (context.mode())
44918 dispatch10.call("change");
44922 background.ensureLoaded = () => {
44924 return _loadPromise;
44925 return _loadPromise = ensureImageryIndex();
44927 background.init = () => {
44928 const loadPromise = background.ensureLoaded();
44929 const hash = utilStringQs(window.location.hash);
44930 const requestedBackground = hash.background || hash.layer;
44931 const lastUsedBackground = corePreferences("background-last-used");
44932 return loadPromise.then((imageryIndex) => {
44933 const extent = context.map().extent();
44934 const validBackgrounds = background.sources(extent).filter((d) => d.id !== "none" && d.id !== "custom");
44935 const first = validBackgrounds.length && validBackgrounds[0];
44936 const isLastUsedValid = !!validBackgrounds.find((d) => d.id && d.id === lastUsedBackground);
44938 if (!requestedBackground && extent) {
44939 const viewArea = extent.area();
44940 best = validBackgrounds.find((s) => {
44941 if (!s.best() || s.overlay)
44943 let bbox2 = es_default(bboxClip(
44944 { type: "MultiPolygon", coordinates: [s.polygon || [extent.polygon()]] },
44947 let area = geoExtent(bbox2.slice(0, 2), bbox2.slice(2, 4)).area();
44948 return area / viewArea > 0.5;
44951 if (requestedBackground && requestedBackground.indexOf("custom:") === 0) {
44952 const template = requestedBackground.replace(/^custom:/, "");
44953 const custom = background.findSource("custom");
44954 background.baseLayerSource(custom.template(template));
44955 corePreferences("background-custom-template", template);
44957 background.baseLayerSource(
44958 background.findSource(requestedBackground) || best || isLastUsedValid && background.findSource(lastUsedBackground) || background.findSource("Bing") || first || background.findSource("none")
44961 const locator = imageryIndex.backgrounds.find((d) => d.overlay && d.default);
44963 background.toggleOverlayLayer(locator);
44965 const overlays = (hash.overlays || "").split(",");
44966 overlays.forEach((overlay) => {
44967 overlay = background.findSource(overlay);
44969 background.toggleOverlayLayer(overlay);
44973 const gpx2 = context.layers().layer("data");
44975 gpx2.url(hash.gpx, ".gpx");
44979 const offset = hash.offset.replace(/;/g, ",").split(",").map((n2) => !isNaN(n2) && n2);
44980 if (offset.length === 2) {
44981 background.offset(geoMetersToOffset(offset));
44984 }).catch((err) => {
44985 console.error(err);
44988 return utilRebind(background, dispatch10, "on");
44991 // modules/renderer/features.js
44992 function rendererFeatures(context) {
44993 var dispatch10 = dispatch_default("change", "redraw");
44994 var features2 = utilRebind({}, dispatch10, "on");
44995 var _deferred2 = /* @__PURE__ */ new Set();
44996 var traffic_roads = {
44998 "motorway_link": true,
45000 "trunk_link": true,
45002 "primary_link": true,
45004 "secondary_link": true,
45006 "tertiary_link": true,
45007 "residential": true,
45008 "unclassified": true,
45009 "living_street": true
45011 var service_roads = {
45024 var _cullFactor = 1;
45030 var _forceVisible = {};
45031 function update() {
45032 if (!window.mocha) {
45033 var hash = utilStringQs(window.location.hash);
45034 var disabled = features2.disabled();
45035 if (disabled.length) {
45036 hash.disable_features = disabled.join(",");
45038 delete hash.disable_features;
45040 window.location.replace("#" + utilQsString(hash, true));
45041 corePreferences("disabled-features", disabled.join(","));
45043 _hidden = features2.hidden();
45044 dispatch10.call("change");
45045 dispatch10.call("redraw");
45047 function defineRule(k, filter2, max3) {
45048 var isEnabled = true;
45052 enabled: isEnabled,
45054 currentMax: max3 || Infinity,
45055 defaultMax: max3 || Infinity,
45056 enable: function() {
45057 this.enabled = true;
45058 this.currentMax = this.defaultMax;
45060 disable: function() {
45061 this.enabled = false;
45062 this.currentMax = 0;
45064 hidden: function() {
45065 return this.count === 0 && !this.enabled || this.count > this.currentMax * _cullFactor;
45067 autoHidden: function() {
45068 return this.hidden() && this.currentMax > 0;
45072 defineRule("points", function isPoint(tags, geometry) {
45073 return geometry === "point";
45075 defineRule("traffic_roads", function isTrafficRoad(tags) {
45076 return traffic_roads[tags.highway];
45078 defineRule("service_roads", function isServiceRoad(tags) {
45079 return service_roads[tags.highway];
45081 defineRule("paths", function isPath(tags) {
45082 return paths[tags.highway];
45084 defineRule("buildings", function isBuilding(tags) {
45085 return !!tags.building && tags.building !== "no" || tags.parking === "multi-storey" || tags.parking === "sheds" || tags.parking === "carports" || tags.parking === "garage_boxes";
45087 defineRule("building_parts", function isBuildingPart(tags) {
45088 return tags["building:part"];
45090 defineRule("indoor", function isIndoor(tags) {
45091 return tags.indoor;
45093 defineRule("landuse", function isLanduse(tags, geometry) {
45094 return geometry === "area" && !_rules.buildings.filter(tags) && !_rules.building_parts.filter(tags) && !_rules.indoor.filter(tags) && !_rules.water.filter(tags) && !_rules.pistes.filter(tags);
45096 defineRule("boundaries", function isBoundary(tags, geometry) {
45097 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);
45099 defineRule("water", function isWater(tags) {
45100 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";
45102 defineRule("rail", function isRail(tags) {
45103 return (!!tags.railway || tags.landuse === "railway") && !(traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]);
45105 defineRule("pistes", function isPiste(tags) {
45106 return tags["piste:type"];
45108 defineRule("aerialways", function isPiste(tags) {
45109 return tags.aerialway && tags.aerialway !== "yes" && tags.aerialway !== "station";
45111 defineRule("power", function isPower(tags) {
45112 return !!tags.power;
45114 defineRule("past_future", function isPastFuture(tags) {
45115 if (traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]) {
45118 var strings = Object.keys(tags);
45119 for (var i2 = 0; i2 < strings.length; i2++) {
45120 var s = strings[i2];
45121 if (osmLifecyclePrefixes[s] || osmLifecyclePrefixes[tags[s]])
45126 defineRule("others", function isOther(tags, geometry) {
45127 return geometry === "line" || geometry === "area";
45129 features2.features = function() {
45132 features2.keys = function() {
45135 features2.enabled = function(k) {
45136 if (!arguments.length) {
45137 return _keys.filter(function(k2) {
45138 return _rules[k2].enabled;
45141 return _rules[k] && _rules[k].enabled;
45143 features2.disabled = function(k) {
45144 if (!arguments.length) {
45145 return _keys.filter(function(k2) {
45146 return !_rules[k2].enabled;
45149 return _rules[k] && !_rules[k].enabled;
45151 features2.hidden = function(k) {
45152 if (!arguments.length) {
45153 return _keys.filter(function(k2) {
45154 return _rules[k2].hidden();
45157 return _rules[k] && _rules[k].hidden();
45159 features2.autoHidden = function(k) {
45160 if (!arguments.length) {
45161 return _keys.filter(function(k2) {
45162 return _rules[k2].autoHidden();
45165 return _rules[k] && _rules[k].autoHidden();
45167 features2.enable = function(k) {
45168 if (_rules[k] && !_rules[k].enabled) {
45169 _rules[k].enable();
45173 features2.enableAll = function() {
45174 var didEnable = false;
45175 for (var k in _rules) {
45176 if (!_rules[k].enabled) {
45178 _rules[k].enable();
45184 features2.disable = function(k) {
45185 if (_rules[k] && _rules[k].enabled) {
45186 _rules[k].disable();
45190 features2.disableAll = function() {
45191 var didDisable = false;
45192 for (var k in _rules) {
45193 if (_rules[k].enabled) {
45195 _rules[k].disable();
45201 features2.toggle = function(k) {
45204 return f2.enabled ? f2.disable() : f2.enable();
45209 features2.resetStats = function() {
45210 for (var i2 = 0; i2 < _keys.length; i2++) {
45211 _rules[_keys[i2]].count = 0;
45213 dispatch10.call("change");
45215 features2.gatherStats = function(d, resolver, dimensions) {
45216 var needsRedraw = false;
45217 var types = utilArrayGroupBy(d, "type");
45218 var entities = [].concat(types.relation || [], types.way || [], types.node || []);
45219 var currHidden, geometry, matches, i2, j2;
45220 for (i2 = 0; i2 < _keys.length; i2++) {
45221 _rules[_keys[i2]].count = 0;
45223 _cullFactor = dimensions[0] * dimensions[1] / 1e6;
45224 for (i2 = 0; i2 < entities.length; i2++) {
45225 geometry = entities[i2].geometry(resolver);
45226 matches = Object.keys(features2.getMatches(entities[i2], resolver, geometry));
45227 for (j2 = 0; j2 < matches.length; j2++) {
45228 _rules[matches[j2]].count++;
45231 currHidden = features2.hidden();
45232 if (currHidden !== _hidden) {
45233 _hidden = currHidden;
45234 needsRedraw = true;
45235 dispatch10.call("change");
45237 return needsRedraw;
45239 features2.stats = function() {
45240 for (var i2 = 0; i2 < _keys.length; i2++) {
45241 _stats[_keys[i2]] = _rules[_keys[i2]].count;
45245 features2.clear = function(d) {
45246 for (var i2 = 0; i2 < d.length; i2++) {
45247 features2.clearEntity(d[i2]);
45250 features2.clearEntity = function(entity) {
45251 delete _cache4[osmEntity.key(entity)];
45253 features2.reset = function() {
45254 Array.from(_deferred2).forEach(function(handle) {
45255 window.cancelIdleCallback(handle);
45256 _deferred2.delete(handle);
45260 function relationShouldBeChecked(relation) {
45261 return relation.tags.type === "boundary";
45263 features2.getMatches = function(entity, resolver, geometry) {
45264 if (geometry === "vertex" || geometry === "relation" && !relationShouldBeChecked(entity))
45266 var ent = osmEntity.key(entity);
45267 if (!_cache4[ent]) {
45270 if (!_cache4[ent].matches) {
45272 var hasMatch = false;
45273 for (var i2 = 0; i2 < _keys.length; i2++) {
45274 if (_keys[i2] === "others") {
45277 if (entity.type === "way") {
45278 var parents = features2.getParents(entity, resolver, geometry);
45279 if (parents.length === 1 && parents[0].isMultipolygon() || parents.length > 0 && parents.every(function(parent) {
45280 return parent.tags.type === "boundary";
45282 var pkey = osmEntity.key(parents[0]);
45283 if (_cache4[pkey] && _cache4[pkey].matches) {
45284 matches = Object.assign({}, _cache4[pkey].matches);
45290 if (_rules[_keys[i2]].filter(entity.tags, geometry)) {
45291 matches[_keys[i2]] = hasMatch = true;
45294 _cache4[ent].matches = matches;
45296 return _cache4[ent].matches;
45298 features2.getParents = function(entity, resolver, geometry) {
45299 if (geometry === "point")
45301 var ent = osmEntity.key(entity);
45302 if (!_cache4[ent]) {
45305 if (!_cache4[ent].parents) {
45307 if (geometry === "vertex") {
45308 parents = resolver.parentWays(entity);
45310 parents = resolver.parentRelations(entity);
45312 _cache4[ent].parents = parents;
45314 return _cache4[ent].parents;
45316 features2.isHiddenPreset = function(preset, geometry) {
45317 if (!_hidden.length)
45321 var test = preset.setTags({}, geometry);
45322 for (var key in _rules) {
45323 if (_rules[key].filter(test, geometry)) {
45324 if (_hidden.indexOf(key) !== -1) {
45332 features2.isHiddenFeature = function(entity, resolver, geometry) {
45333 if (!_hidden.length)
45335 if (!entity.version)
45337 if (_forceVisible[entity.id])
45339 var matches = Object.keys(features2.getMatches(entity, resolver, geometry));
45340 return matches.length && matches.every(function(k) {
45341 return features2.hidden(k);
45344 features2.isHiddenChild = function(entity, resolver, geometry) {
45345 if (!_hidden.length)
45347 if (!entity.version || geometry === "point")
45349 if (_forceVisible[entity.id])
45351 var parents = features2.getParents(entity, resolver, geometry);
45352 if (!parents.length)
45354 for (var i2 = 0; i2 < parents.length; i2++) {
45355 if (!features2.isHidden(parents[i2], resolver, parents[i2].geometry(resolver))) {
45361 features2.hasHiddenConnections = function(entity, resolver) {
45362 if (!_hidden.length)
45364 var childNodes, connections;
45365 if (entity.type === "midpoint") {
45366 childNodes = [resolver.entity(entity.edge[0]), resolver.entity(entity.edge[1])];
45369 childNodes = entity.nodes ? resolver.childNodes(entity) : [];
45370 connections = features2.getParents(entity, resolver, entity.geometry(resolver));
45372 connections = childNodes.reduce(function(result, e) {
45373 return resolver.isShared(e) ? utilArrayUnion(result, resolver.parentWays(e)) : result;
45375 return connections.some(function(e) {
45376 return features2.isHidden(e, resolver, e.geometry(resolver));
45379 features2.isHidden = function(entity, resolver, geometry) {
45380 if (!_hidden.length)
45382 if (!entity.version)
45384 var fn = geometry === "vertex" ? features2.isHiddenChild : features2.isHiddenFeature;
45385 return fn(entity, resolver, geometry);
45387 features2.filter = function(d, resolver) {
45388 if (!_hidden.length)
45391 for (var i2 = 0; i2 < d.length; i2++) {
45392 var entity = d[i2];
45393 if (!features2.isHidden(entity, resolver, entity.geometry(resolver))) {
45394 result.push(entity);
45399 features2.forceVisible = function(entityIDs) {
45400 if (!arguments.length)
45401 return Object.keys(_forceVisible);
45402 _forceVisible = {};
45403 for (var i2 = 0; i2 < entityIDs.length; i2++) {
45404 _forceVisible[entityIDs[i2]] = true;
45405 var entity = context.hasEntity(entityIDs[i2]);
45406 if (entity && entity.type === "relation") {
45407 for (var j2 in entity.members) {
45408 _forceVisible[entity.members[j2].id] = true;
45414 features2.init = function() {
45415 var storage = corePreferences("disabled-features");
45417 var storageDisabled = storage.replace(/;/g, ",").split(",");
45418 storageDisabled.forEach(features2.disable);
45420 var hash = utilStringQs(window.location.hash);
45421 if (hash.disable_features) {
45422 var hashDisabled = hash.disable_features.replace(/;/g, ",").split(",");
45423 hashDisabled.forEach(features2.disable);
45426 context.history().on("merge.features", function(newEntities) {
45429 var handle = window.requestIdleCallback(function() {
45430 var graph = context.graph();
45431 var types = utilArrayGroupBy(newEntities, "type");
45432 var entities = [].concat(types.relation || [], types.way || [], types.node || []);
45433 for (var i2 = 0; i2 < entities.length; i2++) {
45434 var geometry = entities[i2].geometry(graph);
45435 features2.getMatches(entities[i2], graph, geometry);
45438 _deferred2.add(handle);
45443 // modules/svg/areas.js
45444 var import_fast_deep_equal5 = __toESM(require_fast_deep_equal());
45446 // modules/svg/helpers.js
45447 function svgPassiveVertex(node, graph, activeID) {
45450 if (activeID === node.id)
45452 var parents = graph.parentWays(node);
45453 var i2, j2, nodes, isClosed, ix1, ix2, ix3, ix4, max3;
45454 for (i2 = 0; i2 < parents.length; i2++) {
45455 nodes = parents[i2].nodes;
45456 isClosed = parents[i2].isClosed();
45457 for (j2 = 0; j2 < nodes.length; j2++) {
45458 if (nodes[j2] === node.id) {
45464 max3 = nodes.length - 1;
45474 if (nodes[ix1] === activeID)
45476 else if (nodes[ix2] === activeID)
45478 else if (nodes[ix3] === activeID)
45480 else if (nodes[ix4] === activeID)
45482 else if (isClosed && nodes.indexOf(activeID) !== -1)
45489 function svgMarkerSegments(projection2, graph, dt, shouldReverse, bothDirections) {
45490 return function(entity) {
45494 var clip = identity_default2().clipExtent(projection2.clipExtent()).stream;
45495 var coordinates = graph.childNodes(entity).map(function(n2) {
45499 if (shouldReverse(entity)) {
45500 coordinates.reverse();
45503 type: "LineString",
45505 }, projection2.stream(clip({
45506 lineStart: function() {
45508 lineEnd: function() {
45511 point: function(x, y) {
45514 var span = geoVecLength(a, b) - offset;
45516 var heading = geoVecAngle(a, b);
45517 var dx = dt * Math.cos(heading);
45518 var dy = dt * Math.sin(heading);
45520 a[0] + offset * Math.cos(heading),
45521 a[1] + offset * Math.sin(heading)
45523 var coord2 = [a, p];
45524 for (span -= dt; span >= 0; span -= dt) {
45525 p = geoVecAdd(p, [dx, dy]);
45531 for (j2 = 0; j2 < coord2.length; j2++) {
45532 segment += (j2 === 0 ? "M" : "L") + coord2[j2][0] + "," + coord2[j2][1];
45534 segments.push({ id: entity.id, index: i2++, d: segment });
45535 if (bothDirections(entity)) {
45537 for (j2 = coord2.length - 1; j2 >= 0; j2--) {
45538 segment += (j2 === coord2.length - 1 ? "M" : "L") + coord2[j2][0] + "," + coord2[j2][1];
45540 segments.push({ id: entity.id, index: i2++, d: segment });
45551 function svgPath(projection2, graph, isArea) {
45553 var padding = isArea ? 65 : 5;
45554 var viewport = projection2.clipExtent();
45555 var paddedExtent = [
45556 [viewport[0][0] - padding, viewport[0][1] - padding],
45557 [viewport[1][0] + padding, viewport[1][1] + padding]
45559 var clip = identity_default2().clipExtent(paddedExtent).stream;
45560 var project = projection2.stream;
45561 var path = path_default().projection({ stream: function(output) {
45562 return project(clip(output));
45564 var svgpath = function(entity) {
45565 if (entity.id in cache) {
45566 return cache[entity.id];
45568 return cache[entity.id] = path(entity.asGeoJSON(graph));
45571 svgpath.geojson = function(d) {
45572 if (d.__featurehash__ !== void 0) {
45573 if (d.__featurehash__ in cache) {
45574 return cache[d.__featurehash__];
45576 return cache[d.__featurehash__] = path(d);
45584 function svgPointTransform(projection2) {
45585 var svgpoint = function(entity) {
45586 var pt = projection2(entity.loc);
45587 return "translate(" + pt[0] + "," + pt[1] + ")";
45589 svgpoint.geojson = function(d) {
45590 return svgpoint(d.properties.entity);
45594 function svgRelationMemberTags(graph) {
45595 return function(entity) {
45596 var tags = entity.tags;
45597 var shouldCopyMultipolygonTags = !entity.hasInterestingTags();
45598 graph.parentRelations(entity).forEach(function(relation) {
45599 var type3 = relation.tags.type;
45600 if (type3 === "multipolygon" && shouldCopyMultipolygonTags || type3 === "boundary") {
45601 tags = Object.assign({}, relation.tags, tags);
45607 function svgSegmentWay(way, graph, activeID) {
45608 if (activeID === void 0) {
45609 return graph.transient(way, "waySegments", getWaySegments);
45611 return getWaySegments();
45613 function getWaySegments() {
45614 var isActiveWay = way.nodes.indexOf(activeID) !== -1;
45615 var features2 = { passive: [], active: [] };
45619 for (var i2 = 0; i2 < way.nodes.length; i2++) {
45620 node = graph.entity(way.nodes[i2]);
45621 type3 = svgPassiveVertex(node, graph, activeID);
45622 end = { node, type: type3 };
45623 if (start2.type !== void 0) {
45624 if (start2.node.id === activeID || end.node.id === activeID) {
45625 } else if (isActiveWay && (start2.type === 2 || end.type === 2)) {
45626 pushActive(start2, end, i2);
45627 } else if (start2.type === 0 && end.type === 0) {
45628 pushActive(start2, end, i2);
45630 pushPassive(start2, end, i2);
45636 function pushActive(start3, end2, index) {
45637 features2.active.push({
45639 id: way.id + "-" + index + "-nope",
45644 nodes: [start3.node, end2.node],
45648 type: "LineString",
45649 coordinates: [start3.node.loc, end2.node.loc]
45653 function pushPassive(start3, end2, index) {
45654 features2.passive.push({
45656 id: way.id + "-" + index,
45660 nodes: [start3.node, end2.node],
45664 type: "LineString",
45665 coordinates: [start3.node.loc, end2.node.loc]
45672 // modules/svg/tag_classes.js
45673 function svgTagClasses() {
45696 var statuses = Object.keys(osmLifecyclePrefixes);
45697 var secondaries = [
45710 "public_transport",
45721 var _tags = function(entity) {
45722 return entity.tags;
45724 var tagClasses = function(selection2) {
45725 selection2.each(function tagClassesEach(entity) {
45726 var value = this.className;
45727 if (value.baseVal !== void 0) {
45728 value = value.baseVal;
45730 var t = _tags(entity);
45731 var computed = tagClasses.getClassesString(t, value);
45732 if (computed !== value) {
45733 select_default2(this).attr("class", computed);
45737 tagClasses.getClassesString = function(t, value) {
45738 var primary, status;
45740 var overrideGeometry;
45741 if (/\bstroke\b/.test(value)) {
45742 if (!!t.barrier && t.barrier !== "no") {
45743 overrideGeometry = "line";
45746 var classes = value.trim().split(/\s+/).filter(function(klass) {
45747 return klass.length && !/^tag-/.test(klass);
45748 }).map(function(klass) {
45749 return klass === "line" || klass === "area" ? overrideGeometry || klass : klass;
45751 for (i2 = 0; i2 < primaries.length; i2++) {
45754 if (!v || v === "no")
45756 if (k === "piste:type") {
45758 } else if (k === "building:part") {
45759 k = "building_part";
45762 if (statuses.indexOf(v) !== -1) {
45764 classes.push("tag-" + k);
45766 classes.push("tag-" + k);
45767 classes.push("tag-" + k + "-" + v);
45772 for (i2 = 0; i2 < statuses.length; i2++) {
45773 for (j2 = 0; j2 < primaries.length; j2++) {
45774 k = statuses[i2] + ":" + primaries[j2];
45776 if (!v || v === "no")
45778 status = statuses[i2];
45784 for (i2 = 0; i2 < statuses.length; i2++) {
45787 if (!v || v === "no")
45791 } else if (primary && primary === v) {
45793 } else if (!primary && primaries.indexOf(v) !== -1) {
45796 classes.push("tag-" + v);
45803 classes.push("tag-status");
45804 classes.push("tag-status-" + status);
45806 for (i2 = 0; i2 < secondaries.length; i2++) {
45807 k = secondaries[i2];
45809 if (!v || v === "no" || k === primary)
45811 classes.push("tag-" + k);
45812 classes.push("tag-" + k + "-" + v);
45814 if (primary === "highway" && !osmPathHighwayTagValues[t.highway] || primary === "aeroway") {
45815 var surface = t.highway === "track" ? "unpaved" : "paved";
45818 if (k in osmPavedTags) {
45819 surface = osmPavedTags[k][v] ? "paved" : "unpaved";
45821 if (k in osmSemipavedTags && !!osmSemipavedTags[k][v]) {
45822 surface = "semipaved";
45825 classes.push("tag-" + surface);
45827 var qid = t.wikidata || t["flag:wikidata"] || t["brand:wikidata"] || t["network:wikidata"] || t["operator:wikidata"];
45829 classes.push("tag-wikidata");
45831 return classes.join(" ").trim();
45833 tagClasses.tags = function(val) {
45834 if (!arguments.length)
45842 // modules/svg/tag_pattern.js
45845 grave_yard: "cemetery",
45846 fountain: "water_standing"
45850 { religion: "christian", pattern: "cemetery_christian" },
45851 { religion: "buddhist", pattern: "cemetery_buddhist" },
45852 { religion: "muslim", pattern: "cemetery_muslim" },
45853 { religion: "jewish", pattern: "cemetery_jewish" },
45854 { pattern: "cemetery" }
45856 construction: "construction",
45857 farmland: "farmland",
45858 farmyard: "farmyard",
45860 { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
45861 { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
45862 { leaf_type: "leafless", pattern: "forest_leafless" },
45863 { pattern: "forest" }
45865 grave_yard: "cemetery",
45867 landfill: "landfill",
45869 military: "construction",
45870 orchard: "orchard",
45872 vineyard: "vineyard"
45875 horse_riding: "farmyard"
45879 grassland: "grass",
45883 { water: "pond", pattern: "pond" },
45884 { water: "reservoir", pattern: "water_standing" },
45885 { pattern: "waves" }
45888 { wetland: "marsh", pattern: "wetland_marsh" },
45889 { wetland: "swamp", pattern: "wetland_swamp" },
45890 { wetland: "bog", pattern: "wetland_bog" },
45891 { wetland: "reedbed", pattern: "wetland_reedbed" },
45892 { pattern: "wetland" }
45895 { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
45896 { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
45897 { leaf_type: "leafless", pattern: "forest_leafless" },
45898 { pattern: "forest" }
45902 green: "golf_green",
45912 function svgTagPattern(tags) {
45913 if (tags.building && tags.building !== "no") {
45916 for (var tag in patterns) {
45917 var entityValue = tags[tag];
45920 if (typeof patterns[tag] === "string") {
45921 return "pattern-" + patterns[tag];
45923 var values = patterns[tag];
45924 for (var value in values) {
45925 if (entityValue !== value)
45927 var rules = values[value];
45928 if (typeof rules === "string") {
45929 return "pattern-" + rules;
45931 for (var ruleKey in rules) {
45932 var rule = rules[ruleKey];
45934 for (var criterion in rule) {
45935 if (criterion !== "pattern") {
45936 var v = tags[criterion];
45937 if (!v || v !== rule[criterion]) {
45944 return "pattern-" + rule.pattern;
45953 // modules/svg/areas.js
45954 function svgAreas(projection2, context) {
45955 function getPatternStyle(tags) {
45956 var imageID = svgTagPattern(tags);
45958 return 'url("#ideditor-' + imageID + '")';
45962 function drawTargets(selection2, graph, entities, filter2) {
45963 var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
45964 var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
45965 var getPath = svgPath(projection2).geojson;
45966 var activeID = context.activeID();
45967 var base = context.history().base();
45968 var data = { targets: [], nopes: [] };
45969 entities.forEach(function(way) {
45970 var features2 = svgSegmentWay(way, graph, activeID);
45971 data.targets.push.apply(data.targets, features2.passive);
45972 data.nopes.push.apply(data.nopes, features2.active);
45974 var targetData = data.targets.filter(getPath);
45975 var targets = selection2.selectAll(".area.target-allowed").filter(function(d) {
45976 return filter2(d.properties.entity);
45977 }).data(targetData, function key(d) {
45980 targets.exit().remove();
45981 var segmentWasEdited = function(d) {
45982 var wayID = d.properties.entity.id;
45983 if (!base.entities[wayID] || !(0, import_fast_deep_equal5.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
45986 return d.properties.nodes.some(function(n2) {
45987 return !base.entities[n2.id] || !(0, import_fast_deep_equal5.default)(graph.entities[n2.id].loc, base.entities[n2.id].loc);
45990 targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d) {
45991 return "way area target target-allowed " + targetClass + d.id;
45992 }).classed("segment-edited", segmentWasEdited);
45993 var nopeData = data.nopes.filter(getPath);
45994 var nopes = selection2.selectAll(".area.target-nope").filter(function(d) {
45995 return filter2(d.properties.entity);
45996 }).data(nopeData, function key(d) {
45999 nopes.exit().remove();
46000 nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d) {
46001 return "way area target target-nope " + nopeClass + d.id;
46002 }).classed("segment-edited", segmentWasEdited);
46004 function drawAreas(selection2, graph, entities, filter2) {
46005 var path = svgPath(projection2, graph, true);
46008 var base = context.history().base();
46009 for (var i2 = 0; i2 < entities.length; i2++) {
46010 var entity = entities[i2];
46011 if (entity.geometry(graph) !== "area")
46013 multipolygon = osmIsOldMultipolygonOuterMember(entity, graph);
46014 if (multipolygon) {
46015 areas[multipolygon.id] = {
46016 entity: multipolygon.mergeTags(entity.tags),
46017 area: Math.abs(entity.area(graph))
46019 } else if (!areas[entity.id]) {
46020 areas[entity.id] = {
46022 area: Math.abs(entity.area(graph))
46026 var fills = Object.values(areas).filter(function hasPath(a) {
46027 return path(a.entity);
46029 fills.sort(function areaSort(a, b) {
46030 return b.area - a.area;
46032 fills = fills.map(function(a) {
46035 var strokes = fills.filter(function(area) {
46036 return area.type === "way";
46044 var clipPaths = context.surface().selectAll("defs").selectAll(".clipPath-osm").filter(filter2).data(data.clip, osmEntity.key);
46045 clipPaths.exit().remove();
46046 var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-osm").attr("id", function(entity2) {
46047 return "ideditor-" + entity2.id + "-clippath";
46049 clipPathsEnter.append("path");
46050 clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", path);
46051 var drawLayer = selection2.selectAll(".layer-osm.areas");
46052 var touchLayer = selection2.selectAll(".layer-touch.areas");
46053 var areagroup = drawLayer.selectAll("g.areagroup").data(["fill", "shadow", "stroke"]);
46054 areagroup = areagroup.enter().append("g").attr("class", function(d) {
46055 return "areagroup area-" + d;
46056 }).merge(areagroup);
46057 var paths = areagroup.selectAll("path").filter(filter2).data(function(layer) {
46058 return data[layer];
46060 paths.exit().remove();
46061 var fillpaths = selection2.selectAll(".area-fill path.area").nodes();
46062 var bisect = bisector(function(node) {
46063 return -node.__data__.area(graph);
46065 function sortedByArea(entity2) {
46066 if (this._parent.__data__ === "fill") {
46067 return fillpaths[bisect(fillpaths, -entity2.area(graph))];
46070 paths = paths.enter().insert("path", sortedByArea).merge(paths).each(function(entity2) {
46071 var layer = this.parentNode.__data__;
46072 this.setAttribute("class", entity2.type + " area " + layer + " " + entity2.id);
46073 if (layer === "fill") {
46074 this.setAttribute("clip-path", "url(#ideditor-" + entity2.id + "-clippath)");
46075 this.style.fill = this.style.stroke = getPatternStyle(entity2.tags);
46077 }).classed("added", function(d) {
46078 return !base.entities[d.id];
46079 }).classed("geometry-edited", function(d) {
46080 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);
46081 }).classed("retagged", function(d) {
46082 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);
46083 }).call(svgTagClasses()).attr("d", path);
46084 touchLayer.call(drawTargets, graph, data.stroke, filter2);
46089 // modules/svg/data.js
46090 var import_fast_json_stable_stringify = __toESM(require_fast_json_stable_stringify());
46092 // node_modules/@tmcw/togeojson/dist/togeojson.es.mjs
46093 function $(element, tagName) {
46094 return Array.from(element.getElementsByTagName(tagName));
46096 function normalizeId(id2) {
46097 return id2[0] === "#" ? id2 : `#${id2}`;
46099 function $ns(element, tagName, ns) {
46100 return Array.from(element.getElementsByTagNameNS(ns, tagName));
46102 function nodeVal(node) {
46104 return node && node.textContent || "";
46106 function get1(node, tagName, callback) {
46107 const n2 = node.getElementsByTagName(tagName);
46108 const result = n2.length ? n2[0] : null;
46109 if (result && callback)
46113 function get3(node, tagName, callback) {
46114 const properties = {};
46117 const n2 = node.getElementsByTagName(tagName);
46118 const result = n2.length ? n2[0] : null;
46119 if (result && callback) {
46120 return callback(result, properties);
46124 function val1(node, tagName, callback) {
46125 const val = nodeVal(get1(node, tagName));
46126 if (val && callback)
46127 return callback(val) || {};
46130 function $num(node, tagName, callback) {
46131 const val = parseFloat(nodeVal(get1(node, tagName)));
46134 if (val && callback)
46135 return callback(val) || {};
46138 function num1(node, tagName, callback) {
46139 const val = parseFloat(nodeVal(get1(node, tagName)));
46142 if (val && callback)
46146 function getMulti(node, propertyNames) {
46147 const properties = {};
46148 for (const property of propertyNames) {
46149 val1(node, property, (val) => {
46150 properties[property] = val;
46155 function isElement(node) {
46156 return node?.nodeType === 1;
46158 function getLineStyle(node) {
46159 return get3(node, "line", (lineStyle) => {
46160 const val = Object.assign({}, val1(lineStyle, "color", (color2) => {
46161 return { stroke: `#${color2}` };
46162 }), $num(lineStyle, "opacity", (opacity) => {
46163 return { "stroke-opacity": opacity };
46164 }), $num(lineStyle, "width", (width) => {
46165 return { "stroke-width": width * 96 / 25.4 };
46170 function getExtensions(node) {
46174 for (const child of Array.from(node.childNodes)) {
46175 if (!isElement(child))
46177 const name = abbreviateName(child.nodeName);
46178 if (name === "gpxtpx:TrackPointExtension") {
46179 values = values.concat(getExtensions(child));
46181 const val = nodeVal(child);
46182 values.push([name, parseNumeric(val)]);
46187 function abbreviateName(name) {
46188 return ["heart", "gpxtpx:hr", "hr"].includes(name) ? "heart" : name;
46190 function parseNumeric(val) {
46191 const num = parseFloat(val);
46192 return isNaN(num) ? val : num;
46194 function coordPair$1(node) {
46196 parseFloat(node.getAttribute("lon") || ""),
46197 parseFloat(node.getAttribute("lat") || "")
46199 if (isNaN(ll[0]) || isNaN(ll[1])) {
46202 num1(node, "ele", (val) => {
46205 const time = get1(node, "time");
46208 time: time ? nodeVal(time) : null,
46209 extendedValues: getExtensions(get1(node, "extensions"))
46212 function extractProperties(node) {
46213 const properties = getMulti(node, [
46221 const extensions = Array.from(node.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/GpxExtensions/v3", "*"));
46222 for (const child of extensions) {
46223 if (child.parentNode?.parentNode === node) {
46224 properties[child.tagName.replace(":", "_")] = nodeVal(child);
46227 const links = $(node, "link");
46228 if (links.length) {
46229 properties.links = links.map((link2) => Object.assign({ href: link2.getAttribute("href") }, getMulti(link2, ["text", "type"])));
46233 function getPoints$1(node, pointname) {
46234 const pts = $(node, pointname);
46237 const extendedValues = {};
46238 for (let i2 = 0; i2 < pts.length; i2++) {
46239 const c = coordPair$1(pts[i2]);
46243 line.push(c.coordinates);
46245 times.push(c.time);
46246 for (const [name, val] of c.extendedValues) {
46247 const plural = name === "heart" ? name : name.replace("gpxtpx:", "") + "s";
46248 if (!extendedValues[plural]) {
46249 extendedValues[plural] = Array(pts.length).fill(null);
46251 extendedValues[plural][i2] = val;
46254 if (line.length < 2)
46262 function getRoute(node) {
46263 const line = getPoints$1(node, "rtept");
46268 properties: Object.assign({ _gpxType: "rte" }, extractProperties(node), getLineStyle(get1(node, "extensions"))),
46270 type: "LineString",
46271 coordinates: line.line
46275 function getTrack(node) {
46276 const segments = $(node, "trkseg");
46279 const extractedLines = [];
46280 for (const segment of segments) {
46281 const line = getPoints$1(segment, "trkpt");
46283 extractedLines.push(line);
46284 if (line.times && line.times.length)
46285 times.push(line.times);
46288 if (extractedLines.length === 0)
46290 const multi = extractedLines.length > 1;
46291 const properties = Object.assign({ _gpxType: "trk" }, extractProperties(node), getLineStyle(get1(node, "extensions")), times.length ? {
46292 coordinateProperties: {
46293 times: multi ? times : times[0]
46296 for (const line of extractedLines) {
46297 track.push(line.line);
46298 if (!properties.coordinateProperties) {
46299 properties.coordinateProperties = {};
46301 const props = properties.coordinateProperties;
46302 const entries = Object.entries(line.extendedValues);
46303 for (let i2 = 0; i2 < entries.length; i2++) {
46304 const [name, val] = entries[i2];
46306 if (!props[name]) {
46307 props[name] = extractedLines.map((line2) => new Array(line2.line.length).fill(null));
46309 props[name][i2] = val;
46318 geometry: multi ? {
46319 type: "MultiLineString",
46322 type: "LineString",
46323 coordinates: track[0]
46327 function getPoint(node) {
46328 const properties = Object.assign(extractProperties(node), getMulti(node, ["sym"]));
46329 const pair2 = coordPair$1(node);
46337 coordinates: pair2.coordinates
46341 function* gpxGen(node) {
46342 for (const track of $(node, "trk")) {
46343 const feature3 = getTrack(track);
46347 for (const route of $(node, "rte")) {
46348 const feature3 = getRoute(route);
46352 for (const waypoint of $(node, "wpt")) {
46353 const point2 = getPoint(waypoint);
46358 function gpx(node) {
46360 type: "FeatureCollection",
46361 features: Array.from(gpxGen(node))
46364 function fixColor(v, prefix) {
46365 const properties = {};
46366 const colorProp = prefix == "stroke" || prefix === "fill" ? prefix : prefix + "-color";
46367 if (v[0] === "#") {
46368 v = v.substring(1);
46370 if (v.length === 6 || v.length === 3) {
46371 properties[colorProp] = "#" + v;
46372 } else if (v.length === 8) {
46373 properties[prefix + "-opacity"] = parseInt(v.substring(0, 2), 16) / 255;
46374 properties[colorProp] = "#" + v.substring(6, 8) + v.substring(4, 6) + v.substring(2, 4);
46378 function numericProperty(node, source, target) {
46379 const properties = {};
46380 num1(node, source, (val) => {
46381 properties[target] = val;
46385 function getColor(node, output) {
46386 return get3(node, "color", (elem) => fixColor(nodeVal(elem), output));
46388 function extractIcon(node) {
46389 return get3(node, "IconStyle", (iconStyle) => {
46390 return Object.assign(getColor(iconStyle, "icon"), numericProperty(iconStyle, "scale", "icon-scale"), numericProperty(iconStyle, "heading", "icon-heading"), get3(iconStyle, "hotSpot", (hotspot) => {
46391 const left = parseFloat(hotspot.getAttribute("x") || "");
46392 const top = parseFloat(hotspot.getAttribute("y") || "");
46393 const xunits = hotspot.getAttribute("xunits") || "";
46394 const yunits = hotspot.getAttribute("yunits") || "";
46395 if (!isNaN(left) && !isNaN(top))
46397 "icon-offset": [left, top],
46398 "icon-offset-units": [xunits, yunits]
46401 }), get3(iconStyle, "Icon", (icon2, properties) => {
46402 val1(icon2, "href", (href) => {
46403 properties.icon = href;
46409 function extractLabel(node) {
46410 return get3(node, "LabelStyle", (labelStyle) => {
46411 return Object.assign(getColor(labelStyle, "label"), numericProperty(labelStyle, "scale", "label-scale"));
46414 function extractLine(node) {
46415 return get3(node, "LineStyle", (lineStyle) => {
46416 return Object.assign(getColor(lineStyle, "stroke"), numericProperty(lineStyle, "width", "stroke-width"));
46419 function extractPoly(node) {
46420 return get3(node, "PolyStyle", (polyStyle, properties) => {
46421 return Object.assign(properties, get3(polyStyle, "color", (elem) => fixColor(nodeVal(elem), "fill")), val1(polyStyle, "fill", (fill) => {
46423 return { "fill-opacity": 0 };
46424 }), val1(polyStyle, "outline", (outline) => {
46425 if (outline === "0")
46426 return { "stroke-opacity": 0 };
46430 function extractStyle(node) {
46431 return Object.assign({}, extractPoly(node), extractLine(node), extractLabel(node), extractIcon(node));
46433 var removeSpace = /\s*/g;
46434 var trimSpace = /^\s*|\s*$/g;
46435 var splitSpace = /\s+/;
46436 function coord1(value) {
46437 return value.replace(removeSpace, "").split(",").map(parseFloat).filter((num) => !isNaN(num)).slice(0, 3);
46439 function coord(value) {
46440 return value.replace(trimSpace, "").split(splitSpace).map(coord1).filter((coord2) => {
46441 return coord2.length >= 2;
46444 function gxCoords(node) {
46445 let elems = $(node, "coord");
46446 if (elems.length === 0) {
46447 elems = $ns(node, "coord", "*");
46449 const coordinates = elems.map((elem) => {
46450 return nodeVal(elem).split(" ").map(parseFloat);
46452 if (coordinates.length === 0) {
46456 geometry: coordinates.length > 2 ? {
46457 type: "LineString",
46461 coordinates: coordinates[0]
46463 times: $(node, "when").map((elem) => nodeVal(elem))
46466 function fixRing(ring) {
46467 if (ring.length === 0)
46469 const first = ring[0];
46470 const last = ring[ring.length - 1];
46472 for (let i2 = 0; i2 < Math.max(first.length, last.length); i2++) {
46473 if (first[i2] !== last[i2]) {
46479 return ring.concat([ring[0]]);
46490 function getCoordinates(node) {
46491 return nodeVal(get1(node, "coordinates"));
46493 function getGeometry(node) {
46494 const geometries = [];
46495 const coordTimes = [];
46496 for (const t of ["MultiGeometry", "MultiTrack", "gx:MultiTrack"]) {
46497 const elem = get1(node, t);
46499 return getGeometry(elem);
46502 for (const geoType of GEO_TYPES) {
46503 for (const geomNode of $(node, geoType)) {
46506 const coordinates = coord1(getCoordinates(geomNode));
46507 if (coordinates.length >= 2) {
46515 case "LineString": {
46516 const coordinates = coord(getCoordinates(geomNode));
46517 if (coordinates.length >= 2) {
46519 type: "LineString",
46527 for (const linearRing of $(geomNode, "LinearRing")) {
46528 const ring = fixRing(coord(getCoordinates(linearRing)));
46529 if (ring.length >= 4) {
46533 if (coords.length) {
46536 coordinates: coords
46543 const gx = gxCoords(geomNode);
46546 const { times, geometry } = gx;
46547 geometries.push(geometry);
46549 coordTimes.push(times);
46560 function extractExtendedData(node) {
46561 return get3(node, "ExtendedData", (extendedData, properties) => {
46562 for (const data of $(extendedData, "Data")) {
46563 properties[data.getAttribute("name") || ""] = nodeVal(get1(data, "value"));
46565 for (const simpleData of $(extendedData, "SimpleData")) {
46566 properties[simpleData.getAttribute("name") || ""] = nodeVal(simpleData);
46571 function geometryListToGeometry(geometries) {
46572 return geometries.length === 0 ? null : geometries.length === 1 ? geometries[0] : {
46573 type: "GeometryCollection",
46577 function extractTimeSpan(node) {
46578 return get3(node, "TimeSpan", (timeSpan) => {
46581 begin: nodeVal(get1(timeSpan, "begin")),
46582 end: nodeVal(get1(timeSpan, "end"))
46587 function extractTimeStamp(node) {
46588 return get3(node, "TimeStamp", (timeStamp) => {
46589 return { timestamp: nodeVal(get1(timeStamp, "when")) };
46592 function extractCascadedStyle(node, styleMap) {
46593 return val1(node, "styleUrl", (styleUrl) => {
46594 styleUrl = normalizeId(styleUrl);
46595 if (styleMap[styleUrl]) {
46596 return Object.assign({ styleUrl }, styleMap[styleUrl]);
46598 return { styleUrl };
46601 function getMaybeHTMLDescription(node) {
46602 const descriptionNode = get1(node, "description");
46603 for (const c of Array.from(descriptionNode?.childNodes || [])) {
46604 if (c.nodeType === 4) {
46615 function getPlacemark(node, styleMap) {
46616 const { coordTimes, geometries } = getGeometry(node);
46619 geometry: geometryListToGeometry(geometries),
46620 properties: Object.assign(getMulti(node, [
46627 ]), getMaybeHTMLDescription(node), extractCascadedStyle(node, styleMap), extractStyle(node), extractExtendedData(node), extractTimeSpan(node), extractTimeStamp(node), coordTimes.length ? {
46628 coordinateProperties: {
46629 times: coordTimes.length === 1 ? coordTimes[0] : coordTimes
46633 if (feature3.properties?.visibility !== void 0) {
46634 feature3.properties.visibility = feature3.properties.visibility !== "0";
46636 const id2 = node.getAttribute("id");
46637 if (id2 !== null && id2 !== "")
46641 function getStyleId(style) {
46642 let id2 = style.getAttribute("id");
46643 const parentNode = style.parentNode;
46644 if (!id2 && isElement(parentNode) && parentNode.localName === "CascadingStyle") {
46645 id2 = parentNode.getAttribute("kml:id") || parentNode.getAttribute("id");
46647 return normalizeId(id2 || "");
46649 function buildStyleMap(node) {
46650 const styleMap = {};
46651 for (const style of $(node, "Style")) {
46652 styleMap[getStyleId(style)] = extractStyle(style);
46654 for (const map2 of $(node, "StyleMap")) {
46655 const id2 = normalizeId(map2.getAttribute("id") || "");
46656 val1(map2, "styleUrl", (styleUrl) => {
46657 styleUrl = normalizeId(styleUrl);
46658 if (styleMap[styleUrl]) {
46659 styleMap[id2] = styleMap[styleUrl];
46665 function* kmlGen(node) {
46666 const styleMap = buildStyleMap(node);
46667 for (const placemark of $(node, "Placemark")) {
46668 const feature3 = getPlacemark(placemark, styleMap);
46673 function kml(node) {
46675 type: "FeatureCollection",
46676 features: Array.from(kmlGen(node))
46680 // modules/svg/data.js
46681 var _initialized = false;
46682 var _enabled = false;
46684 function svgData(projection2, context, dispatch10) {
46685 var throttledRedraw = throttle_default(function() {
46686 dispatch10.call("change");
46688 var _showLabels = true;
46689 var detected = utilDetect();
46690 var layer = select_default2(null);
46700 function over(d3_event) {
46701 d3_event.stopPropagation();
46702 d3_event.preventDefault();
46703 d3_event.dataTransfer.dropEffect = "copy";
46705 context.container().attr("dropzone", "copy").on("drop.svgData", function(d3_event) {
46706 d3_event.stopPropagation();
46707 d3_event.preventDefault();
46708 if (!detected.filedrop)
46710 drawData.fileList(d3_event.dataTransfer.files);
46711 }).on("dragenter.svgData", over).on("dragexit.svgData", over).on("dragover.svgData", over);
46712 _initialized = true;
46714 function getService() {
46715 if (services.vectorTile && !_vtService) {
46716 _vtService = services.vectorTile;
46717 _vtService.event.on("loadedData", throttledRedraw);
46718 } else if (!services.vectorTile && _vtService) {
46723 function showLayer() {
46725 layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
46726 dispatch10.call("change");
46729 function hideLayer() {
46730 throttledRedraw.cancel();
46731 layer.transition().duration(250).style("opacity", 0).on("end", layerOff);
46733 function layerOn() {
46734 layer.style("display", "block");
46736 function layerOff() {
46737 layer.selectAll(".viewfield-group").remove();
46738 layer.style("display", "none");
46740 function ensureIDs(gj) {
46743 if (gj.type === "FeatureCollection") {
46744 for (var i2 = 0; i2 < gj.features.length; i2++) {
46745 ensureFeatureID(gj.features[i2]);
46748 ensureFeatureID(gj);
46752 function ensureFeatureID(feature3) {
46755 feature3.__featurehash__ = utilHashcode((0, import_fast_json_stable_stringify.default)(feature3));
46758 function getFeatures(gj) {
46761 if (gj.type === "FeatureCollection") {
46762 return gj.features;
46767 function featureKey(d) {
46768 return d.__featurehash__;
46770 function isPolygon(d) {
46771 return d.geometry.type === "Polygon" || d.geometry.type === "MultiPolygon";
46773 function clipPathID(d) {
46774 return "ideditor-data-" + d.__featurehash__ + "-clippath";
46776 function featureClasses(d) {
46778 "data" + d.__featurehash__,
46780 isPolygon(d) ? "area" : "",
46781 d.__layerID__ || ""
46782 ].filter(Boolean).join(" ");
46784 function drawData(selection2) {
46785 var vtService = getService();
46786 var getPath = svgPath(projection2).geojson;
46787 var getAreaPath = svgPath(projection2, null, true).geojson;
46788 var hasData = drawData.hasData();
46789 layer = selection2.selectAll(".layer-mapdata").data(_enabled && hasData ? [0] : []);
46790 layer.exit().remove();
46791 layer = layer.enter().append("g").attr("class", "layer-mapdata").merge(layer);
46792 var surface = context.surface();
46793 if (!surface || surface.empty())
46795 var geoData, polygonData;
46796 if (_template && vtService) {
46797 var sourceID = _template;
46798 vtService.loadTiles(sourceID, _template, projection2);
46799 geoData = vtService.data(sourceID, projection2);
46801 geoData = getFeatures(_geojson);
46803 geoData = geoData.filter(getPath);
46804 polygonData = geoData.filter(isPolygon);
46805 var clipPaths = surface.selectAll("defs").selectAll(".clipPath-data").data(polygonData, featureKey);
46806 clipPaths.exit().remove();
46807 var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-data").attr("id", clipPathID);
46808 clipPathsEnter.append("path");
46809 clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", getAreaPath);
46810 var datagroups = layer.selectAll("g.datagroup").data(["fill", "shadow", "stroke"]);
46811 datagroups = datagroups.enter().append("g").attr("class", function(d) {
46812 return "datagroup datagroup-" + d;
46813 }).merge(datagroups);
46819 var paths = datagroups.selectAll("path").data(function(layer2) {
46820 return pathData[layer2];
46822 paths.exit().remove();
46823 paths = paths.enter().append("path").attr("class", function(d) {
46824 var datagroup = this.parentNode.__data__;
46825 return "pathdata " + datagroup + " " + featureClasses(d);
46826 }).attr("clip-path", function(d) {
46827 var datagroup = this.parentNode.__data__;
46828 return datagroup === "fill" ? "url(#" + clipPathID(d) + ")" : null;
46829 }).merge(paths).attr("d", function(d) {
46830 var datagroup = this.parentNode.__data__;
46831 return datagroup === "fill" ? getAreaPath(d) : getPath(d);
46833 layer.call(drawLabels, "label-halo", geoData).call(drawLabels, "label", geoData);
46834 function drawLabels(selection3, textClass, data) {
46835 var labelPath = path_default(projection2);
46836 var labelData = data.filter(function(d) {
46837 return _showLabels && d.properties && (d.properties.desc || d.properties.name);
46839 var labels = selection3.selectAll("text." + textClass).data(labelData, featureKey);
46840 labels.exit().remove();
46841 labels = labels.enter().append("text").attr("class", function(d) {
46842 return textClass + " " + featureClasses(d);
46843 }).merge(labels).text(function(d) {
46844 return d.properties.desc || d.properties.name;
46845 }).attr("x", function(d) {
46846 var centroid = labelPath.centroid(d);
46847 return centroid[0] + 11;
46848 }).attr("y", function(d) {
46849 var centroid = labelPath.centroid(d);
46850 return centroid[1];
46854 function getExtension(fileName) {
46857 var re2 = /\.(gpx|kml|(geo)?json)$/i;
46858 var match = fileName.toLowerCase().match(re2);
46859 return match && match.length && match[0];
46861 function xmlToDom(textdata) {
46862 return new DOMParser().parseFromString(textdata, "text/xml");
46864 function stringifyGeojsonProperties(feature3) {
46865 const properties = feature3.properties;
46866 for (const key in properties) {
46867 const property = properties[key];
46868 if (typeof property === "number" || typeof property === "boolean" || Array.isArray(property)) {
46869 properties[key] = property.toString();
46870 } else if (property === null) {
46871 properties[key] = "null";
46872 } else if (typeof property === "object") {
46873 properties[key] = JSON.stringify(property);
46877 drawData.setFile = function(extension, data) {
46883 switch (extension) {
46885 gj = gpx(xmlToDom(data));
46888 gj = kml(xmlToDom(data));
46892 gj = JSON.parse(data);
46893 if (gj.type === "FeatureCollection") {
46894 gj.features.forEach(stringifyGeojsonProperties);
46895 } else if (gj.type === "Feature") {
46896 stringifyGeojsonProperties(gj);
46901 if (Object.keys(gj).length) {
46902 _geojson = ensureIDs(gj);
46903 _src = extension + " data file";
46906 dispatch10.call("change");
46909 drawData.showLabels = function(val) {
46910 if (!arguments.length)
46911 return _showLabels;
46915 drawData.enabled = function(val) {
46916 if (!arguments.length)
46924 dispatch10.call("change");
46927 drawData.hasData = function() {
46928 var gj = _geojson || {};
46929 return !!(_template || Object.keys(gj).length);
46931 drawData.template = function(val, src) {
46932 if (!arguments.length)
46934 var osm = context.connection();
46936 var blocklists = osm.imageryBlocklists();
46940 for (var i2 = 0; i2 < blocklists.length; i2++) {
46941 regex = blocklists[i2];
46942 fail = regex.test(val);
46948 regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
46949 fail = regex.test(val);
46955 _src = src || "vectortile:" + val.split(/[?#]/)[0];
46956 dispatch10.call("change");
46959 drawData.geojson = function(gj, src) {
46960 if (!arguments.length)
46967 if (Object.keys(gj).length) {
46968 _geojson = ensureIDs(gj);
46969 _src = src || "unknown.geojson";
46971 dispatch10.call("change");
46974 drawData.fileList = function(fileList) {
46975 if (!arguments.length)
46978 _fileList = fileList;
46981 if (!fileList || !fileList.length)
46983 var f2 = fileList[0];
46984 var extension = getExtension(f2.name);
46985 var reader = new FileReader();
46986 reader.onload = function() {
46987 return function(e) {
46988 drawData.setFile(extension, e.target.result);
46991 reader.readAsText(f2);
46994 drawData.url = function(url, defaultExtension) {
46999 var testUrl = url.split(/[?#]/)[0];
47000 var extension = getExtension(testUrl) || defaultExtension;
47003 text_default3(url).then(function(data) {
47004 drawData.setFile(extension, data);
47005 }).catch(function() {
47008 drawData.template(url);
47012 drawData.getSrc = function() {
47015 drawData.fitZoom = function() {
47016 var features2 = getFeatures(_geojson);
47017 if (!features2.length)
47019 var map2 = context.map();
47020 var viewport = map2.trimmedExtent().polygon();
47021 var coords = features2.reduce(function(coords2, feature3) {
47022 var geom = feature3.geometry;
47025 var c = geom.coordinates;
47026 switch (geom.type) {
47032 case "MultiPolygon":
47033 c = utilArrayFlatten(c);
47035 case "MultiLineString":
47036 c = utilArrayFlatten(c);
47039 return utilArrayUnion(coords2, c);
47041 if (!geoPolygonIntersectsPolygon(viewport, coords, true)) {
47042 var extent = geoExtent(bounds_default({ type: "LineString", coordinates: coords }));
47043 map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
47051 // modules/svg/debug.js
47052 function svgDebug(projection2, context) {
47053 function drawDebug(selection2) {
47054 const showTile = context.getDebug("tile");
47055 const showCollision = context.getDebug("collision");
47056 const showImagery = context.getDebug("imagery");
47057 const showTouchTargets = context.getDebug("target");
47058 const showDownloaded = context.getDebug("downloaded");
47059 let debugData = [];
47061 debugData.push({ class: "red", label: "tile" });
47063 if (showCollision) {
47064 debugData.push({ class: "yellow", label: "collision" });
47067 debugData.push({ class: "orange", label: "imagery" });
47069 if (showTouchTargets) {
47070 debugData.push({ class: "pink", label: "touchTargets" });
47072 if (showDownloaded) {
47073 debugData.push({ class: "purple", label: "downloaded" });
47075 let legend = context.container().select(".main-content").selectAll(".debug-legend").data(debugData.length ? [0] : []);
47076 legend.exit().remove();
47077 legend = legend.enter().append("div").attr("class", "fillD debug-legend").merge(legend);
47078 let legendItems = legend.selectAll(".debug-legend-item").data(debugData, (d) => d.label);
47079 legendItems.exit().remove();
47080 legendItems.enter().append("span").attr("class", (d) => `debug-legend-item ${d.class}`).text((d) => d.label);
47081 let layer = selection2.selectAll(".layer-debug").data(showImagery || showDownloaded ? [0] : []);
47082 layer.exit().remove();
47083 layer = layer.enter().append("g").attr("class", "layer-debug").merge(layer);
47084 const extent = context.map().extent();
47085 _mainFileFetcher.get("imagery").then((d) => {
47086 const hits = showImagery && d.query.bbox(extent.rectangle(), true) || [];
47087 const features2 = hits.map((d2) => d2.features[d2.id]);
47088 let imagery = layer.selectAll("path.debug-imagery").data(features2);
47089 imagery.exit().remove();
47090 imagery.enter().append("path").attr("class", "debug-imagery debug orange");
47093 const osm = context.connection();
47094 let dataDownloaded = [];
47095 if (osm && showDownloaded) {
47096 const rtree = osm.caches("get").tile.rtree;
47097 dataDownloaded = rtree.all().map((bbox2) => {
47100 properties: { id: bbox2.id },
47104 [bbox2.minX, bbox2.minY],
47105 [bbox2.minX, bbox2.maxY],
47106 [bbox2.maxX, bbox2.maxY],
47107 [bbox2.maxX, bbox2.minY],
47108 [bbox2.minX, bbox2.minY]
47114 let downloaded = layer.selectAll("path.debug-downloaded").data(showDownloaded ? dataDownloaded : []);
47115 downloaded.exit().remove();
47116 downloaded.enter().append("path").attr("class", "debug-downloaded debug purple");
47117 layer.selectAll("path").attr("d", svgPath(projection2).geojson);
47119 drawDebug.enabled = function() {
47120 if (!arguments.length) {
47121 return context.getDebug("tile") || context.getDebug("collision") || context.getDebug("imagery") || context.getDebug("target") || context.getDebug("downloaded");
47129 // modules/svg/defs.js
47130 function svgDefs(context) {
47131 var _defsSelection = select_default2(null);
47132 var _spritesheetIds = [
47139 function drawDefs(selection2) {
47140 _defsSelection = selection2.append("defs");
47141 _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");
47142 function addSidedMarker(name, color2, offset) {
47143 _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);
47145 addSidedMarker("natural", "rgb(170, 170, 170)", 0);
47146 addSidedMarker("coastline", "#77dede", 1);
47147 addSidedMarker("waterway", "#77dede", 1);
47148 addSidedMarker("barrier", "#ddd", 1);
47149 addSidedMarker("man_made", "#fff", 0);
47150 _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");
47151 _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");
47152 var patterns2 = _defsSelection.selectAll("pattern").data([
47154 ["construction", "construction"],
47155 ["cemetery", "cemetery"],
47156 ["cemetery_christian", "cemetery_christian"],
47157 ["cemetery_buddhist", "cemetery_buddhist"],
47158 ["cemetery_muslim", "cemetery_muslim"],
47159 ["cemetery_jewish", "cemetery_jewish"],
47160 ["farmland", "farmland"],
47161 ["farmyard", "farmyard"],
47162 ["forest", "forest"],
47163 ["forest_broadleaved", "forest_broadleaved"],
47164 ["forest_needleleaved", "forest_needleleaved"],
47165 ["forest_leafless", "forest_leafless"],
47166 ["golf_green", "grass"],
47167 ["grass", "grass"],
47168 ["landfill", "landfill"],
47169 ["meadow", "grass"],
47170 ["orchard", "orchard"],
47172 ["quarry", "quarry"],
47173 ["scrub", "bushes"],
47174 ["vineyard", "vineyard"],
47175 ["water_standing", "lines"],
47176 ["waves", "waves"],
47177 ["wetland", "wetland"],
47178 ["wetland_marsh", "wetland_marsh"],
47179 ["wetland_swamp", "wetland_swamp"],
47180 ["wetland_bog", "wetland_bog"],
47181 ["wetland_reedbed", "wetland_reedbed"]
47182 ]).enter().append("pattern").attr("id", function(d) {
47183 return "ideditor-pattern-" + d[0];
47184 }).attr("width", 32).attr("height", 32).attr("patternUnits", "userSpaceOnUse");
47185 patterns2.append("rect").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("class", function(d) {
47186 return "pattern-color-" + d[0];
47188 patterns2.append("image").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("xlink:href", function(d) {
47189 return context.imagePath("pattern/" + d[1] + ".png");
47191 _defsSelection.selectAll("clipPath").data([12, 18, 20, 32, 45]).enter().append("clipPath").attr("id", function(d) {
47192 return "ideditor-clip-square-" + d;
47193 }).append("rect").attr("x", 0).attr("y", 0).attr("width", function(d) {
47195 }).attr("height", function(d) {
47198 addSprites(_spritesheetIds, true);
47200 function addSprites(ids, overrideColors) {
47201 _spritesheetIds = utilArrayUniq(_spritesheetIds.concat(ids));
47202 var spritesheets = _defsSelection.selectAll(".spritesheet").data(_spritesheetIds);
47203 spritesheets.enter().append("g").attr("class", function(d) {
47204 return "spritesheet spritesheet-" + d;
47205 }).each(function(d) {
47206 var url = context.imagePath(d + ".svg");
47207 var node = select_default2(this).node();
47208 svg(url).then(function(svg2) {
47210 select_default2(svg2.documentElement).attr("id", "ideditor-" + d).node()
47212 if (overrideColors && d !== "iD-sprite") {
47213 select_default2(node).selectAll("path").attr("fill", "currentColor");
47215 }).catch(function() {
47218 spritesheets.exit().remove();
47220 drawDefs.addSprites = addSprites;
47224 // modules/svg/keepRight.js
47225 var _layerEnabled = false;
47227 function svgKeepRight(projection2, context, dispatch10) {
47228 const throttledRedraw = throttle_default(() => dispatch10.call("change"), 1e3);
47229 const minZoom3 = 12;
47230 let touchLayer = select_default2(null);
47231 let drawLayer = select_default2(null);
47232 let layerVisible = false;
47233 function markerPath(selection2, klass) {
47234 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");
47236 function getService() {
47237 if (services.keepRight && !_qaService) {
47238 _qaService = services.keepRight;
47239 _qaService.on("loaded", throttledRedraw);
47240 } else if (!services.keepRight && _qaService) {
47245 function editOn() {
47246 if (!layerVisible) {
47247 layerVisible = true;
47248 drawLayer.style("display", "block");
47251 function editOff() {
47252 if (layerVisible) {
47253 layerVisible = false;
47254 drawLayer.style("display", "none");
47255 drawLayer.selectAll(".qaItem.keepRight").remove();
47256 touchLayer.selectAll(".qaItem.keepRight").remove();
47259 function layerOn() {
47261 drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch10.call("change"));
47263 function layerOff() {
47264 throttledRedraw.cancel();
47265 drawLayer.interrupt();
47266 touchLayer.selectAll(".qaItem.keepRight").remove();
47267 drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
47269 dispatch10.call("change");
47272 function updateMarkers() {
47273 if (!layerVisible || !_layerEnabled)
47275 const service = getService();
47276 const selectedID = context.selectedErrorID();
47277 const data = service ? service.getItems(projection2) : [];
47278 const getTransform = svgPointTransform(projection2);
47279 const markers = drawLayer.selectAll(".qaItem.keepRight").data(data, (d) => d.id);
47280 markers.exit().remove();
47281 const markersEnter = markers.enter().append("g").attr("class", (d) => `qaItem ${d.service} itemId-${d.id} itemType-${d.parentIssueType}`);
47282 markersEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
47283 markersEnter.append("path").call(markerPath, "shadow");
47284 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");
47285 markers.merge(markersEnter).sort(sortY).classed("selected", (d) => d.id === selectedID).attr("transform", getTransform);
47286 if (touchLayer.empty())
47288 const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
47289 const targets = touchLayer.selectAll(".qaItem.keepRight").data(data, (d) => d.id);
47290 targets.exit().remove();
47291 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);
47292 function sortY(a, b) {
47293 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];
47296 function drawKeepRight(selection2) {
47297 const service = getService();
47298 const surface = context.surface();
47299 if (surface && !surface.empty()) {
47300 touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
47302 drawLayer = selection2.selectAll(".layer-keepRight").data(service ? [0] : []);
47303 drawLayer.exit().remove();
47304 drawLayer = drawLayer.enter().append("g").attr("class", "layer-keepRight").style("display", _layerEnabled ? "block" : "none").merge(drawLayer);
47305 if (_layerEnabled) {
47306 if (service && ~~context.map().zoom() >= minZoom3) {
47308 service.loadIssues(projection2);
47315 drawKeepRight.enabled = function(val) {
47316 if (!arguments.length)
47317 return _layerEnabled;
47318 _layerEnabled = val;
47319 if (_layerEnabled) {
47323 if (context.selectedErrorID()) {
47324 context.enter(modeBrowse(context));
47327 dispatch10.call("change");
47330 drawKeepRight.supported = () => !!getService();
47331 return drawKeepRight;
47334 // modules/svg/geolocate.js
47335 function svgGeolocate(projection2) {
47336 var layer = select_default2(null);
47339 if (svgGeolocate.initialized)
47341 svgGeolocate.enabled = false;
47342 svgGeolocate.initialized = true;
47344 function showLayer() {
47345 layer.style("display", "block");
47347 function hideLayer() {
47348 layer.transition().duration(250).style("opacity", 0);
47350 function layerOn() {
47351 layer.style("opacity", 0).transition().duration(250).style("opacity", 1);
47353 function layerOff() {
47354 layer.style("display", "none");
47356 function transform2(d) {
47357 return svgPointTransform(projection2)(d);
47359 function accuracy(accuracy2, loc) {
47360 var degreesRadius = geoMetersToLat(accuracy2), tangentLoc = [loc[0], loc[1] + degreesRadius], projectedTangent = projection2(tangentLoc), projectedLoc = projection2([loc[0], loc[1]]);
47361 return Math.round(projectedLoc[1] - projectedTangent[1]).toString();
47363 function update() {
47364 var geolocation = { loc: [_position.coords.longitude, _position.coords.latitude] };
47365 var groups = layer.selectAll(".geolocations").selectAll(".geolocation").data([geolocation]);
47366 groups.exit().remove();
47367 var pointsEnter = groups.enter().append("g").attr("class", "geolocation");
47368 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");
47369 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");
47370 groups.merge(pointsEnter).attr("transform", transform2);
47371 layer.select(".geolocate-radius").attr("r", accuracy(_position.coords.accuracy, geolocation.loc));
47373 function drawLocation(selection2) {
47374 var enabled = svgGeolocate.enabled;
47375 layer = selection2.selectAll(".layer-geolocate").data([0]);
47376 layer.exit().remove();
47377 var layerEnter = layer.enter().append("g").attr("class", "layer-geolocate").style("display", enabled ? "block" : "none");
47378 layerEnter.append("g").attr("class", "geolocations");
47379 layer = layerEnter.merge(layer);
47386 drawLocation.enabled = function(position, enabled) {
47387 if (!arguments.length)
47388 return svgGeolocate.enabled;
47389 _position = position;
47390 svgGeolocate.enabled = enabled;
47391 if (svgGeolocate.enabled) {
47400 return drawLocation;
47403 // modules/svg/labels.js
47404 var import_rbush7 = __toESM(require_rbush_min());
47405 function svgLabels(projection2, context) {
47406 var path = path_default(projection2);
47407 var detected = utilDetect();
47408 var baselineHack = detected.ie || detected.browser.toLowerCase() === "edge" || detected.browser.toLowerCase() === "firefox" && detected.version >= 70;
47409 var _rdrawn = new import_rbush7.default();
47410 var _rskipped = new import_rbush7.default();
47411 var _textWidthCache = {};
47412 var _entitybboxes = {};
47414 ["line", "aeroway", "*", 12],
47415 ["line", "highway", "motorway", 12],
47416 ["line", "highway", "trunk", 12],
47417 ["line", "highway", "primary", 12],
47418 ["line", "highway", "secondary", 12],
47419 ["line", "highway", "tertiary", 12],
47420 ["line", "highway", "*", 12],
47421 ["line", "railway", "*", 12],
47422 ["line", "waterway", "*", 12],
47423 ["area", "aeroway", "*", 12],
47424 ["area", "amenity", "*", 12],
47425 ["area", "building", "*", 12],
47426 ["area", "historic", "*", 12],
47427 ["area", "leisure", "*", 12],
47428 ["area", "man_made", "*", 12],
47429 ["area", "natural", "*", 12],
47430 ["area", "shop", "*", 12],
47431 ["area", "tourism", "*", 12],
47432 ["area", "camp_site", "*", 12],
47433 ["point", "aeroway", "*", 10],
47434 ["point", "amenity", "*", 10],
47435 ["point", "building", "*", 10],
47436 ["point", "historic", "*", 10],
47437 ["point", "leisure", "*", 10],
47438 ["point", "man_made", "*", 10],
47439 ["point", "natural", "*", 10],
47440 ["point", "shop", "*", 10],
47441 ["point", "tourism", "*", 10],
47442 ["point", "camp_site", "*", 10],
47443 ["line", "ref", "*", 12],
47444 ["area", "ref", "*", 12],
47445 ["point", "ref", "*", 10],
47446 ["line", "name", "*", 12],
47447 ["area", "name", "*", 12],
47448 ["point", "name", "*", 10]
47450 function shouldSkipIcon(preset) {
47451 var noIcons = ["building", "landuse", "natural"];
47452 return noIcons.some(function(s) {
47453 return preset.id.indexOf(s) >= 0;
47456 function get4(array2, prop) {
47457 return function(d, i2) {
47458 return array2[i2][prop];
47461 function textWidth(text2, size, elem) {
47462 var c = _textWidthCache[size];
47464 c = _textWidthCache[size] = {};
47468 c[text2] = elem.getComputedTextLength();
47471 var str2 = encodeURIComponent(text2).match(/%[CDEFcdef]/g);
47472 if (str2 === null) {
47473 return size / 3 * 2 * text2.length;
47475 return size / 3 * (2 * text2.length + str2.length);
47479 function drawLinePaths(selection2, entities, filter2, classes, labels) {
47480 var paths = selection2.selectAll("path").filter(filter2).data(entities, osmEntity.key);
47481 paths.exit().remove();
47482 paths.enter().append("path").style("stroke-width", get4(labels, "font-size")).attr("id", function(d) {
47483 return "ideditor-labelpath-" + d.id;
47484 }).attr("class", classes).merge(paths).attr("d", get4(labels, "lineString"));
47486 function drawLineLabels(selection2, entities, filter2, classes, labels) {
47487 var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
47488 texts.exit().remove();
47489 texts.enter().append("text").attr("class", function(d, i2) {
47490 return classes + " " + labels[i2].classes + " " + d.id;
47491 }).attr("dy", baselineHack ? "0.35em" : null).append("textPath").attr("class", "textpath");
47492 selection2.selectAll("text." + classes).selectAll(".textpath").filter(filter2).data(entities, osmEntity.key).attr("startOffset", "50%").attr("xlink:href", function(d) {
47493 return "#ideditor-labelpath-" + d.id;
47494 }).text(utilDisplayNameForPath);
47496 function drawPointLabels(selection2, entities, filter2, classes, labels) {
47497 var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
47498 texts.exit().remove();
47499 texts.enter().append("text").attr("class", function(d, i2) {
47500 return classes + " " + labels[i2].classes + " " + d.id;
47501 }).merge(texts).attr("x", get4(labels, "x")).attr("y", get4(labels, "y")).style("text-anchor", get4(labels, "textAnchor")).text(utilDisplayName).each(function(d, i2) {
47502 textWidth(utilDisplayName(d), labels[i2].height, this);
47505 function drawAreaLabels(selection2, entities, filter2, classes, labels) {
47506 entities = entities.filter(hasText);
47507 labels = labels.filter(hasText);
47508 drawPointLabels(selection2, entities, filter2, classes, labels);
47509 function hasText(d, i2) {
47510 return labels[i2].hasOwnProperty("x") && labels[i2].hasOwnProperty("y");
47513 function drawAreaIcons(selection2, entities, filter2, classes, labels) {
47514 var icons = selection2.selectAll("use." + classes).filter(filter2).data(entities, osmEntity.key);
47515 icons.exit().remove();
47516 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) {
47517 var preset = _mainPresetIndex.match(d, context.graph());
47518 var picon = preset && preset.icon;
47519 return picon ? "#" + picon : "";
47522 function drawCollisionBoxes(selection2, rtree, which) {
47523 var classes = "debug " + which + " " + (which === "debug-skipped" ? "orange" : "yellow");
47525 if (context.getDebug("collision")) {
47526 gj = rtree.all().map(function(d) {
47527 return { type: "Polygon", coordinates: [[
47536 var boxes = selection2.selectAll("." + which).data(gj);
47537 boxes.exit().remove();
47538 boxes.enter().append("path").attr("class", classes).merge(boxes).attr("d", path_default());
47540 function drawLabels(selection2, graph, entities, filter2, dimensions, fullRedraw) {
47541 var wireframe = context.surface().classed("fill-wireframe");
47542 var zoom = geoScaleToZoom(projection2.scale());
47543 var labelable = [];
47544 var renderNodeAs = {};
47545 var i2, j2, k, entity, geometry;
47546 for (i2 = 0; i2 < labelStack.length; i2++) {
47547 labelable.push([]);
47552 _entitybboxes = {};
47554 for (i2 = 0; i2 < entities.length; i2++) {
47555 entity = entities[i2];
47556 var toRemove = [].concat(_entitybboxes[entity.id] || []).concat(_entitybboxes[entity.id + "I"] || []);
47557 for (j2 = 0; j2 < toRemove.length; j2++) {
47558 _rdrawn.remove(toRemove[j2]);
47559 _rskipped.remove(toRemove[j2]);
47563 for (i2 = 0; i2 < entities.length; i2++) {
47564 entity = entities[i2];
47565 geometry = entity.geometry(graph);
47566 if (geometry === "point" || geometry === "vertex" && isInterestingVertex(entity)) {
47567 var hasDirections = entity.directions(graph, projection2).length;
47569 if (!wireframe && geometry === "point" && !(zoom >= 18 && hasDirections)) {
47570 renderNodeAs[entity.id] = "point";
47571 markerPadding = 20;
47573 renderNodeAs[entity.id] = "vertex";
47576 var coord2 = projection2(entity.loc);
47577 var nodePadding = 10;
47579 minX: coord2[0] - nodePadding,
47580 minY: coord2[1] - nodePadding - markerPadding,
47581 maxX: coord2[0] + nodePadding,
47582 maxY: coord2[1] + nodePadding
47584 doInsert(bbox2, entity.id + "P");
47586 if (geometry === "vertex") {
47587 geometry = "point";
47589 var preset = geometry === "area" && _mainPresetIndex.match(entity, graph);
47590 var icon2 = preset && !shouldSkipIcon(preset) && preset.icon;
47591 if (!icon2 && !utilDisplayName(entity))
47593 for (k = 0; k < labelStack.length; k++) {
47594 var matchGeom = labelStack[k][0];
47595 var matchKey = labelStack[k][1];
47596 var matchVal = labelStack[k][2];
47597 var hasVal = entity.tags[matchKey];
47598 if (geometry === matchGeom && hasVal && (matchVal === "*" || matchVal === hasVal)) {
47599 labelable[k].push(entity);
47614 for (k = 0; k < labelable.length; k++) {
47615 var fontSize = labelStack[k][3];
47616 for (i2 = 0; i2 < labelable[k].length; i2++) {
47617 entity = labelable[k][i2];
47618 geometry = entity.geometry(graph);
47619 var getName = geometry === "line" ? utilDisplayNameForPath : utilDisplayName;
47620 var name = getName(entity);
47621 var width = name && textWidth(name, fontSize);
47623 if (geometry === "point" || geometry === "vertex") {
47626 var renderAs = renderNodeAs[entity.id];
47627 if (renderAs === "vertex" && zoom < 17)
47629 p = getPointLabel(entity, width, fontSize, renderAs);
47630 } else if (geometry === "line") {
47631 p = getLineLabel(entity, width, fontSize);
47632 } else if (geometry === "area") {
47633 p = getAreaLabel(entity, width, fontSize);
47636 if (geometry === "vertex") {
47637 geometry = "point";
47639 p.classes = geometry + " tag-" + labelStack[k][1];
47640 positions[geometry].push(p);
47641 labelled[geometry].push(entity);
47645 function isInterestingVertex(entity2) {
47646 var selectedIDs = context.selectedIDs();
47647 return entity2.hasInterestingTags() || entity2.isEndpoint(graph) || entity2.isConnected(graph) || selectedIDs.indexOf(entity2.id) !== -1 || graph.parentWays(entity2).some(function(parent) {
47648 return selectedIDs.indexOf(parent.id) !== -1;
47651 function getPointLabel(entity2, width2, height, geometry2) {
47652 var y = geometry2 === "point" ? -12 : 0;
47653 var pointOffsets = {
47654 ltr: [15, y, "start"],
47655 rtl: [-15, y, "end"]
47657 var textDirection = _mainLocalizer.textDirection();
47658 var coord3 = projection2(entity2.loc);
47659 var textPadding = 2;
47660 var offset = pointOffsets[textDirection];
47664 x: coord3[0] + offset[0],
47665 y: coord3[1] + offset[1],
47666 textAnchor: offset[2]
47669 if (textDirection === "rtl") {
47671 minX: p2.x - width2 - textPadding,
47672 minY: p2.y - height / 2 - textPadding,
47673 maxX: p2.x + textPadding,
47674 maxY: p2.y + height / 2 + textPadding
47678 minX: p2.x - textPadding,
47679 minY: p2.y - height / 2 - textPadding,
47680 maxX: p2.x + width2 + textPadding,
47681 maxY: p2.y + height / 2 + textPadding
47684 if (tryInsert([bbox3], entity2.id, true)) {
47688 function getLineLabel(entity2, width2, height) {
47689 var viewport = geoExtent(context.projection.clipExtent()).polygon();
47690 var points = graph.childNodes(entity2).map(function(node) {
47691 return projection2(node.loc);
47693 var length = geoPathLength(points);
47694 if (length < width2 + 20)
47696 var lineOffsets = [
47718 for (var i3 = 0; i3 < lineOffsets.length; i3++) {
47719 var offset = lineOffsets[i3];
47720 var middle = offset / 100 * length;
47721 var start2 = middle - width2 / 2;
47722 if (start2 < 0 || start2 + width2 > length)
47724 var sub = subpath(points, start2, start2 + width2);
47725 if (!sub || !geoPolygonIntersectsPolygon(viewport, sub, true)) {
47728 var isReverse = reverse(sub);
47730 sub = sub.reverse();
47733 var boxsize = (height + 2) / 2;
47734 for (var j3 = 0; j3 < sub.length - 1; j3++) {
47736 var b = sub[j3 + 1];
47737 var num = Math.max(1, Math.floor(geoVecLength(a, b) / boxsize / 2));
47738 for (var box = 0; box < num; box++) {
47739 var p2 = geoVecInterp(a, b, box / num);
47740 var x05 = p2[0] - boxsize - padding;
47741 var y05 = p2[1] - boxsize - padding;
47742 var x12 = p2[0] + boxsize + padding;
47743 var y12 = p2[1] + boxsize + padding;
47745 minX: Math.min(x05, x12),
47746 minY: Math.min(y05, y12),
47747 maxX: Math.max(x05, x12),
47748 maxY: Math.max(y05, y12)
47752 if (tryInsert(bboxes, entity2.id, false)) {
47754 "font-size": height + 2,
47755 lineString: lineString2(sub),
47756 startOffset: offset + "%"
47760 function reverse(p3) {
47761 var angle2 = Math.atan2(p3[1][1] - p3[0][1], p3[1][0] - p3[0][0]);
47762 return !(p3[0][0] < p3[p3.length - 1][0] && angle2 < Math.PI / 2 && angle2 > -Math.PI / 2);
47764 function lineString2(points2) {
47765 return "M" + points2.join("L");
47767 function subpath(points2, from, to) {
47769 var start3, end, i0, i1;
47770 for (var i4 = 0; i4 < points2.length - 1; i4++) {
47771 var a2 = points2[i4];
47772 var b2 = points2[i4 + 1];
47773 var current = geoVecLength(a2, b2);
47775 if (!start3 && sofar + current >= from) {
47776 portion = (from - sofar) / current;
47778 a2[0] + portion * (b2[0] - a2[0]),
47779 a2[1] + portion * (b2[1] - a2[1])
47783 if (!end && sofar + current >= to) {
47784 portion = (to - sofar) / current;
47786 a2[0] + portion * (b2[0] - a2[0]),
47787 a2[1] + portion * (b2[1] - a2[1])
47793 var result = points2.slice(i0, i1);
47794 result.unshift(start3);
47799 function getAreaLabel(entity2, width2, height) {
47800 var centroid = path.centroid(entity2.asGeoJSON(graph));
47801 var extent = entity2.extent(graph);
47802 var areaWidth = projection2(extent[1])[0] - projection2(extent[0])[0];
47803 if (isNaN(centroid[0]) || areaWidth < 20)
47805 var preset2 = _mainPresetIndex.match(entity2, context.graph());
47806 var picon = preset2 && preset2.icon;
47812 addLabel(iconSize + padding);
47820 function addIcon() {
47821 var iconX = centroid[0] - iconSize / 2;
47822 var iconY = centroid[1] - iconSize / 2;
47826 maxX: iconX + iconSize,
47827 maxY: iconY + iconSize
47829 if (tryInsert([bbox3], entity2.id + "I", true)) {
47830 p2.transform = "translate(" + iconX + "," + iconY + ")";
47835 function addLabel(yOffset) {
47836 if (width2 && areaWidth >= width2 + 20) {
47837 var labelX = centroid[0];
47838 var labelY = centroid[1] + yOffset;
47840 minX: labelX - width2 / 2 - padding,
47841 minY: labelY - height / 2 - padding,
47842 maxX: labelX + width2 / 2 + padding,
47843 maxY: labelY + height / 2 + padding
47845 if (tryInsert([bbox3], entity2.id, true)) {
47848 p2.textAnchor = "middle";
47849 p2.height = height;
47856 function doInsert(bbox3, id2) {
47858 var oldbox = _entitybboxes[id2];
47860 _rdrawn.remove(oldbox);
47862 _entitybboxes[id2] = bbox3;
47863 _rdrawn.insert(bbox3);
47865 function tryInsert(bboxes, id2, saveSkipped) {
47866 var skipped = false;
47867 for (var i3 = 0; i3 < bboxes.length; i3++) {
47868 var bbox3 = bboxes[i3];
47870 if (bbox3.minX < 0 || bbox3.minY < 0 || bbox3.maxX > dimensions[0] || bbox3.maxY > dimensions[1]) {
47874 if (_rdrawn.collides(bbox3)) {
47879 _entitybboxes[id2] = bboxes;
47882 _rskipped.load(bboxes);
47885 _rdrawn.load(bboxes);
47889 var layer = selection2.selectAll(".layer-osm.labels");
47890 layer.selectAll(".labels-group").data(["halo", "label", "debug"]).enter().append("g").attr("class", function(d) {
47891 return "labels-group " + d;
47893 var halo = layer.selectAll(".labels-group.halo");
47894 var label = layer.selectAll(".labels-group.label");
47895 var debug2 = layer.selectAll(".labels-group.debug");
47896 drawPointLabels(label, labelled.point, filter2, "pointlabel", positions.point);
47897 drawPointLabels(halo, labelled.point, filter2, "pointlabel-halo", positions.point);
47898 drawLinePaths(layer, labelled.line, filter2, "", positions.line);
47899 drawLineLabels(label, labelled.line, filter2, "linelabel", positions.line);
47900 drawLineLabels(halo, labelled.line, filter2, "linelabel-halo", positions.line);
47901 drawAreaLabels(label, labelled.area, filter2, "arealabel", positions.area);
47902 drawAreaLabels(halo, labelled.area, filter2, "arealabel-halo", positions.area);
47903 drawAreaIcons(label, labelled.area, filter2, "areaicon", positions.area);
47904 drawAreaIcons(halo, labelled.area, filter2, "areaicon-halo", positions.area);
47905 drawCollisionBoxes(debug2, _rskipped, "debug-skipped");
47906 drawCollisionBoxes(debug2, _rdrawn, "debug-drawn");
47907 layer.call(filterLabels);
47909 function filterLabels(selection2) {
47910 var drawLayer = selection2.selectAll(".layer-osm.labels");
47911 var layers = drawLayer.selectAll(".labels-group.halo, .labels-group.label");
47912 layers.selectAll(".nolabel").classed("nolabel", false);
47913 var mouse = context.map().mouse();
47914 var graph = context.graph();
47915 var selectedIDs = context.selectedIDs();
47920 bbox2 = { minX: mouse[0] - pad2, minY: mouse[1] - pad2, maxX: mouse[0] + pad2, maxY: mouse[1] + pad2 };
47921 var nearMouse = _rdrawn.search(bbox2).map(function(entity2) {
47924 ids.push.apply(ids, nearMouse);
47926 for (var i2 = 0; i2 < selectedIDs.length; i2++) {
47927 var entity = graph.hasEntity(selectedIDs[i2]);
47928 if (entity && entity.type === "node") {
47929 ids.push(selectedIDs[i2]);
47932 layers.selectAll(utilEntitySelector(ids)).classed("nolabel", true);
47933 var debug2 = selection2.selectAll(".labels-group.debug");
47935 if (context.getDebug("collision")) {
47939 [bbox2.minX, bbox2.minY],
47940 [bbox2.maxX, bbox2.minY],
47941 [bbox2.maxX, bbox2.maxY],
47942 [bbox2.minX, bbox2.maxY],
47943 [bbox2.minX, bbox2.minY]
47947 var box = debug2.selectAll(".debug-mouse").data(gj);
47948 box.exit().remove();
47949 box.enter().append("path").attr("class", "debug debug-mouse yellow").merge(box).attr("d", path_default());
47951 var throttleFilterLabels = throttle_default(filterLabels, 100);
47952 drawLabels.observe = function(selection2) {
47953 var listener = function() {
47954 throttleFilterLabels(selection2);
47956 selection2.on("mousemove.hidelabels", listener);
47957 context.on("enter.hidelabels", listener);
47959 drawLabels.off = function(selection2) {
47960 throttleFilterLabels.cancel();
47961 selection2.on("mousemove.hidelabels", null);
47962 context.on("enter.hidelabels", null);
47967 // modules/svg/improveOSM.js
47968 var _layerEnabled2 = false;
47970 function svgImproveOSM(projection2, context, dispatch10) {
47971 const throttledRedraw = throttle_default(() => dispatch10.call("change"), 1e3);
47972 const minZoom3 = 12;
47973 let touchLayer = select_default2(null);
47974 let drawLayer = select_default2(null);
47975 let layerVisible = false;
47976 function markerPath(selection2, klass) {
47977 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");
47979 function getService() {
47980 if (services.improveOSM && !_qaService2) {
47981 _qaService2 = services.improveOSM;
47982 _qaService2.on("loaded", throttledRedraw);
47983 } else if (!services.improveOSM && _qaService2) {
47984 _qaService2 = null;
47986 return _qaService2;
47988 function editOn() {
47989 if (!layerVisible) {
47990 layerVisible = true;
47991 drawLayer.style("display", "block");
47994 function editOff() {
47995 if (layerVisible) {
47996 layerVisible = false;
47997 drawLayer.style("display", "none");
47998 drawLayer.selectAll(".qaItem.improveOSM").remove();
47999 touchLayer.selectAll(".qaItem.improveOSM").remove();
48002 function layerOn() {
48004 drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch10.call("change"));
48006 function layerOff() {
48007 throttledRedraw.cancel();
48008 drawLayer.interrupt();
48009 touchLayer.selectAll(".qaItem.improveOSM").remove();
48010 drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
48012 dispatch10.call("change");
48015 function updateMarkers() {
48016 if (!layerVisible || !_layerEnabled2)
48018 const service = getService();
48019 const selectedID = context.selectedErrorID();
48020 const data = service ? service.getItems(projection2) : [];
48021 const getTransform = svgPointTransform(projection2);
48022 const markers = drawLayer.selectAll(".qaItem.improveOSM").data(data, (d) => d.id);
48023 markers.exit().remove();
48024 const markersEnter = markers.enter().append("g").attr("class", (d) => `qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`);
48025 markersEnter.append("polygon").call(markerPath, "shadow");
48026 markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
48027 markersEnter.append("polygon").attr("fill", "currentColor").call(markerPath, "qaItem-fill");
48028 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 : "");
48029 markers.merge(markersEnter).sort(sortY).classed("selected", (d) => d.id === selectedID).attr("transform", getTransform);
48030 if (touchLayer.empty())
48032 const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
48033 const targets = touchLayer.selectAll(".qaItem.improveOSM").data(data, (d) => d.id);
48034 targets.exit().remove();
48035 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);
48036 function sortY(a, b) {
48037 return a.id === selectedID ? 1 : b.id === selectedID ? -1 : b.loc[1] - a.loc[1];
48040 function drawImproveOSM(selection2) {
48041 const service = getService();
48042 const surface = context.surface();
48043 if (surface && !surface.empty()) {
48044 touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
48046 drawLayer = selection2.selectAll(".layer-improveOSM").data(service ? [0] : []);
48047 drawLayer.exit().remove();
48048 drawLayer = drawLayer.enter().append("g").attr("class", "layer-improveOSM").style("display", _layerEnabled2 ? "block" : "none").merge(drawLayer);
48049 if (_layerEnabled2) {
48050 if (service && ~~context.map().zoom() >= minZoom3) {
48052 service.loadIssues(projection2);
48059 drawImproveOSM.enabled = function(val) {
48060 if (!arguments.length)
48061 return _layerEnabled2;
48062 _layerEnabled2 = val;
48063 if (_layerEnabled2) {
48067 if (context.selectedErrorID()) {
48068 context.enter(modeBrowse(context));
48071 dispatch10.call("change");
48074 drawImproveOSM.supported = () => !!getService();
48075 return drawImproveOSM;
48078 // modules/svg/osmose.js
48079 var _layerEnabled3 = false;
48081 function svgOsmose(projection2, context, dispatch10) {
48082 const throttledRedraw = throttle_default(() => dispatch10.call("change"), 1e3);
48083 const minZoom3 = 12;
48084 let touchLayer = select_default2(null);
48085 let drawLayer = select_default2(null);
48086 let layerVisible = false;
48087 function markerPath(selection2, klass) {
48088 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");
48090 function getService() {
48091 if (services.osmose && !_qaService3) {
48092 _qaService3 = services.osmose;
48093 _qaService3.on("loaded", throttledRedraw);
48094 } else if (!services.osmose && _qaService3) {
48095 _qaService3 = null;
48097 return _qaService3;
48099 function editOn() {
48100 if (!layerVisible) {
48101 layerVisible = true;
48102 drawLayer.style("display", "block");
48105 function editOff() {
48106 if (layerVisible) {
48107 layerVisible = false;
48108 drawLayer.style("display", "none");
48109 drawLayer.selectAll(".qaItem.osmose").remove();
48110 touchLayer.selectAll(".qaItem.osmose").remove();
48113 function layerOn() {
48115 drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch10.call("change"));
48117 function layerOff() {
48118 throttledRedraw.cancel();
48119 drawLayer.interrupt();
48120 touchLayer.selectAll(".qaItem.osmose").remove();
48121 drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
48123 dispatch10.call("change");
48126 function updateMarkers() {
48127 if (!layerVisible || !_layerEnabled3)
48129 const service = getService();
48130 const selectedID = context.selectedErrorID();
48131 const data = service ? service.getItems(projection2) : [];
48132 const getTransform = svgPointTransform(projection2);
48133 const markers = drawLayer.selectAll(".qaItem.osmose").data(data, (d) => d.id);
48134 markers.exit().remove();
48135 const markersEnter = markers.enter().append("g").attr("class", (d) => `qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`);
48136 markersEnter.append("polygon").call(markerPath, "shadow");
48137 markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
48138 markersEnter.append("polygon").attr("fill", (d) => service.getColor(d.item)).call(markerPath, "qaItem-fill");
48139 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 : "");
48140 markers.merge(markersEnter).sort(sortY).classed("selected", (d) => d.id === selectedID).attr("transform", getTransform);
48141 if (touchLayer.empty())
48143 const fillClass = context.getDebug("target") ? "pink" : "nocolor";
48144 const targets = touchLayer.selectAll(".qaItem.osmose").data(data, (d) => d.id);
48145 targets.exit().remove();
48146 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);
48147 function sortY(a, b) {
48148 return a.id === selectedID ? 1 : b.id === selectedID ? -1 : b.loc[1] - a.loc[1];
48151 function drawOsmose(selection2) {
48152 const service = getService();
48153 const surface = context.surface();
48154 if (surface && !surface.empty()) {
48155 touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
48157 drawLayer = selection2.selectAll(".layer-osmose").data(service ? [0] : []);
48158 drawLayer.exit().remove();
48159 drawLayer = drawLayer.enter().append("g").attr("class", "layer-osmose").style("display", _layerEnabled3 ? "block" : "none").merge(drawLayer);
48160 if (_layerEnabled3) {
48161 if (service && ~~context.map().zoom() >= minZoom3) {
48163 service.loadIssues(projection2);
48170 drawOsmose.enabled = function(val) {
48171 if (!arguments.length)
48172 return _layerEnabled3;
48173 _layerEnabled3 = val;
48174 if (_layerEnabled3) {
48175 getService().loadStrings().then(layerOn).catch((err) => {
48180 if (context.selectedErrorID()) {
48181 context.enter(modeBrowse(context));
48184 dispatch10.call("change");
48187 drawOsmose.supported = () => !!getService();
48191 // modules/svg/streetside.js
48192 function svgStreetside(projection2, context, dispatch10) {
48193 var throttledRedraw = throttle_default(function() {
48194 dispatch10.call("change");
48197 var minMarkerZoom = 16;
48198 var minViewfieldZoom = 18;
48199 var layer = select_default2(null);
48200 var _viewerYaw = 0;
48201 var _selectedSequence = null;
48204 if (svgStreetside.initialized)
48206 svgStreetside.enabled = false;
48207 svgStreetside.initialized = true;
48209 function getService() {
48210 if (services.streetside && !_streetside) {
48211 _streetside = services.streetside;
48212 _streetside.event.on("viewerChanged.svgStreetside", viewerChanged).on("loadedImages.svgStreetside", throttledRedraw);
48213 } else if (!services.streetside && _streetside) {
48214 _streetside = null;
48216 return _streetside;
48218 function showLayer() {
48219 var service = getService();
48223 layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
48224 dispatch10.call("change");
48227 function hideLayer() {
48228 throttledRedraw.cancel();
48229 layer.transition().duration(250).style("opacity", 0).on("end", editOff);
48231 function editOn() {
48232 layer.style("display", "block");
48234 function editOff() {
48235 layer.selectAll(".viewfield-group").remove();
48236 layer.style("display", "none");
48238 function click(d3_event, d) {
48239 var service = getService();
48242 if (d.sequenceKey !== _selectedSequence) {
48245 _selectedSequence = d.sequenceKey;
48246 service.ensureViewerLoaded(context).then(function() {
48247 service.selectImage(context, d.key).yaw(_viewerYaw).showViewer(context);
48249 context.map().centerEase(d.loc);
48251 function mouseover(d3_event, d) {
48252 var service = getService();
48254 service.setStyles(context, d);
48256 function mouseout() {
48257 var service = getService();
48259 service.setStyles(context, null);
48261 function transform2(d) {
48262 var t = svgPointTransform(projection2)(d);
48263 var rot = d.ca + _viewerYaw;
48265 t += " rotate(" + Math.floor(rot) + ",0,0)";
48269 function viewerChanged() {
48270 var service = getService();
48273 var viewer = service.viewer();
48276 _viewerYaw = viewer.getYaw();
48277 if (context.map().isTransformed())
48279 layer.selectAll(".viewfield-group.currentView").attr("transform", transform2);
48281 function filterBubbles(bubbles) {
48282 var fromDate = context.photos().fromDate();
48283 var toDate = context.photos().toDate();
48284 var usernames = context.photos().usernames();
48286 var fromTimestamp = new Date(fromDate).getTime();
48287 bubbles = bubbles.filter(function(bubble) {
48288 return new Date(bubble.captured_at).getTime() >= fromTimestamp;
48292 var toTimestamp = new Date(toDate).getTime();
48293 bubbles = bubbles.filter(function(bubble) {
48294 return new Date(bubble.captured_at).getTime() <= toTimestamp;
48298 bubbles = bubbles.filter(function(bubble) {
48299 return usernames.indexOf(bubble.captured_by) !== -1;
48304 function filterSequences(sequences) {
48305 var fromDate = context.photos().fromDate();
48306 var toDate = context.photos().toDate();
48307 var usernames = context.photos().usernames();
48309 var fromTimestamp = new Date(fromDate).getTime();
48310 sequences = sequences.filter(function(sequences2) {
48311 return new Date(sequences2.properties.captured_at).getTime() >= fromTimestamp;
48315 var toTimestamp = new Date(toDate).getTime();
48316 sequences = sequences.filter(function(sequences2) {
48317 return new Date(sequences2.properties.captured_at).getTime() <= toTimestamp;
48321 sequences = sequences.filter(function(sequences2) {
48322 return usernames.indexOf(sequences2.properties.captured_by) !== -1;
48327 function update() {
48328 var viewer = context.container().select(".photoviewer");
48329 var selected = viewer.empty() ? void 0 : viewer.datum();
48330 var z = ~~context.map().zoom();
48331 var showMarkers = z >= minMarkerZoom;
48332 var showViewfields = z >= minViewfieldZoom;
48333 var service = getService();
48334 var sequences = [];
48336 if (context.photos().showsPanoramic()) {
48337 sequences = service ? service.sequences(projection2) : [];
48338 bubbles = service && showMarkers ? service.bubbles(projection2) : [];
48339 sequences = filterSequences(sequences);
48340 bubbles = filterBubbles(bubbles);
48342 var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d) {
48343 return d.properties.key;
48345 traces.exit().remove();
48346 traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
48347 var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(bubbles, function(d) {
48348 return d.key + (d.sequenceKey ? "v1" : "v0");
48350 groups.exit().remove();
48351 var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
48352 groupsEnter.append("g").attr("class", "viewfield-scale");
48353 var markers = groups.merge(groupsEnter).sort(function(a, b) {
48354 return a === selected ? 1 : b === selected ? -1 : b.loc[1] - a.loc[1];
48355 }).attr("transform", transform2).select(".viewfield-scale");
48356 markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
48357 var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
48358 viewfields.exit().remove();
48359 viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
48360 function viewfieldPath() {
48361 var d = this.parentNode.__data__;
48363 return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
48365 return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
48369 function drawImages(selection2) {
48370 var enabled = svgStreetside.enabled;
48371 var service = getService();
48372 layer = selection2.selectAll(".layer-streetside-images").data(service ? [0] : []);
48373 layer.exit().remove();
48374 var layerEnter = layer.enter().append("g").attr("class", "layer-streetside-images").style("display", enabled ? "block" : "none");
48375 layerEnter.append("g").attr("class", "sequences");
48376 layerEnter.append("g").attr("class", "markers");
48377 layer = layerEnter.merge(layer);
48379 if (service && ~~context.map().zoom() >= minZoom3) {
48382 service.loadBubbles(projection2);
48388 drawImages.enabled = function(_) {
48389 if (!arguments.length)
48390 return svgStreetside.enabled;
48391 svgStreetside.enabled = _;
48392 if (svgStreetside.enabled) {
48394 context.photos().on("change.streetside", update);
48397 context.photos().on("change.streetside", null);
48399 dispatch10.call("change");
48402 drawImages.supported = function() {
48403 return !!getService();
48409 // modules/svg/mapillary_images.js
48410 function svgMapillaryImages(projection2, context, dispatch10) {
48411 const throttledRedraw = throttle_default(function() {
48412 dispatch10.call("change");
48414 const minZoom3 = 12;
48415 const minMarkerZoom = 16;
48416 const minViewfieldZoom = 18;
48417 let layer = select_default2(null);
48420 if (svgMapillaryImages.initialized)
48422 svgMapillaryImages.enabled = false;
48423 svgMapillaryImages.initialized = true;
48425 function getService() {
48426 if (services.mapillary && !_mapillary) {
48427 _mapillary = services.mapillary;
48428 _mapillary.event.on("loadedImages", throttledRedraw);
48429 } else if (!services.mapillary && _mapillary) {
48434 function showLayer() {
48435 const service = getService();
48439 layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
48440 dispatch10.call("change");
48443 function hideLayer() {
48444 throttledRedraw.cancel();
48445 layer.transition().duration(250).style("opacity", 0).on("end", editOff);
48447 function editOn() {
48448 layer.style("display", "block");
48450 function editOff() {
48451 layer.selectAll(".viewfield-group").remove();
48452 layer.style("display", "none");
48454 function click(d3_event, image) {
48455 const service = getService();
48458 service.ensureViewerLoaded(context).then(function() {
48459 service.selectImage(context, image.id).showViewer(context);
48461 context.map().centerEase(image.loc);
48463 function mouseover(d3_event, image) {
48464 const service = getService();
48466 service.setStyles(context, image);
48468 function mouseout() {
48469 const service = getService();
48471 service.setStyles(context, null);
48473 function transform2(d) {
48474 let t = svgPointTransform(projection2)(d);
48476 t += " rotate(" + Math.floor(d.ca) + ",0,0)";
48480 function filterImages(images) {
48481 const showsPano = context.photos().showsPanoramic();
48482 const showsFlat = context.photos().showsFlat();
48483 const fromDate = context.photos().fromDate();
48484 const toDate = context.photos().toDate();
48485 if (!showsPano || !showsFlat) {
48486 images = images.filter(function(image) {
48493 images = images.filter(function(image) {
48494 return new Date(image.captured_at).getTime() >= new Date(fromDate).getTime();
48498 images = images.filter(function(image) {
48499 return new Date(image.captured_at).getTime() <= new Date(toDate).getTime();
48504 function filterSequences(sequences) {
48505 const showsPano = context.photos().showsPanoramic();
48506 const showsFlat = context.photos().showsFlat();
48507 const fromDate = context.photos().fromDate();
48508 const toDate = context.photos().toDate();
48509 if (!showsPano || !showsFlat) {
48510 sequences = sequences.filter(function(sequence) {
48511 if (sequence.properties.hasOwnProperty("is_pano")) {
48512 if (sequence.properties.is_pano)
48520 sequences = sequences.filter(function(sequence) {
48521 return new Date(sequence.properties.captured_at).getTime() >= new Date(fromDate).getTime().toString();
48525 sequences = sequences.filter(function(sequence) {
48526 return new Date(sequence.properties.captured_at).getTime() <= new Date(toDate).getTime().toString();
48531 function update() {
48532 const z = ~~context.map().zoom();
48533 const showMarkers = z >= minMarkerZoom;
48534 const showViewfields = z >= minViewfieldZoom;
48535 const service = getService();
48536 let sequences = service ? service.sequences(projection2) : [];
48537 let images = service && showMarkers ? service.images(projection2) : [];
48538 images = filterImages(images);
48539 sequences = filterSequences(sequences, service);
48540 service.filterViewer(context);
48541 let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d) {
48542 return d.properties.id;
48544 traces.exit().remove();
48545 traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
48546 const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d) {
48549 groups.exit().remove();
48550 const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
48551 groupsEnter.append("g").attr("class", "viewfield-scale");
48552 const markers = groups.merge(groupsEnter).sort(function(a, b) {
48553 return b.loc[1] - a.loc[1];
48554 }).attr("transform", transform2).select(".viewfield-scale");
48555 markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
48556 const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
48557 viewfields.exit().remove();
48558 viewfields.enter().insert("path", "circle").attr("class", "viewfield").classed("pano", function() {
48559 return this.parentNode.__data__.is_pano;
48560 }).attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
48561 function viewfieldPath() {
48562 if (this.parentNode.__data__.is_pano) {
48563 return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
48565 return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
48569 function drawImages(selection2) {
48570 const enabled = svgMapillaryImages.enabled;
48571 const service = getService();
48572 layer = selection2.selectAll(".layer-mapillary").data(service ? [0] : []);
48573 layer.exit().remove();
48574 const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary").style("display", enabled ? "block" : "none");
48575 layerEnter.append("g").attr("class", "sequences");
48576 layerEnter.append("g").attr("class", "markers");
48577 layer = layerEnter.merge(layer);
48579 if (service && ~~context.map().zoom() >= minZoom3) {
48582 service.loadImages(projection2);
48588 drawImages.enabled = function(_) {
48589 if (!arguments.length)
48590 return svgMapillaryImages.enabled;
48591 svgMapillaryImages.enabled = _;
48592 if (svgMapillaryImages.enabled) {
48594 context.photos().on("change.mapillary_images", update);
48597 context.photos().on("change.mapillary_images", null);
48599 dispatch10.call("change");
48602 drawImages.supported = function() {
48603 return !!getService();
48609 // modules/svg/mapillary_position.js
48610 function svgMapillaryPosition(projection2, context) {
48611 const throttledRedraw = throttle_default(function() {
48614 const minZoom3 = 12;
48615 const minViewfieldZoom = 18;
48616 let layer = select_default2(null);
48618 let viewerCompassAngle;
48620 if (svgMapillaryPosition.initialized)
48622 svgMapillaryPosition.initialized = true;
48624 function getService() {
48625 if (services.mapillary && !_mapillary) {
48626 _mapillary = services.mapillary;
48627 _mapillary.event.on("imageChanged", throttledRedraw);
48628 _mapillary.event.on("bearingChanged", function(e) {
48629 viewerCompassAngle = e.bearing;
48630 if (context.map().isTransformed())
48632 layer.selectAll(".viewfield-group.currentView").filter(function(d) {
48634 }).attr("transform", transform2);
48636 } else if (!services.mapillary && _mapillary) {
48641 function editOn() {
48642 layer.style("display", "block");
48644 function editOff() {
48645 layer.selectAll(".viewfield-group").remove();
48646 layer.style("display", "none");
48648 function transform2(d) {
48649 let t = svgPointTransform(projection2)(d);
48650 if (d.is_pano && viewerCompassAngle !== null && isFinite(viewerCompassAngle)) {
48651 t += " rotate(" + Math.floor(viewerCompassAngle) + ",0,0)";
48653 t += " rotate(" + Math.floor(d.ca) + ",0,0)";
48657 function update() {
48658 const z = ~~context.map().zoom();
48659 const showViewfields = z >= minViewfieldZoom;
48660 const service = getService();
48661 const image = service && service.getActiveImage();
48662 const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(image ? [image] : [], function(d) {
48665 groups.exit().remove();
48666 const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group currentView highlighted");
48667 groupsEnter.append("g").attr("class", "viewfield-scale");
48668 const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
48669 markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
48670 const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
48671 viewfields.exit().remove();
48672 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");
48674 function drawImages(selection2) {
48675 const service = getService();
48676 layer = selection2.selectAll(".layer-mapillary-position").data(service ? [0] : []);
48677 layer.exit().remove();
48678 const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary-position");
48679 layerEnter.append("g").attr("class", "markers");
48680 layer = layerEnter.merge(layer);
48681 if (service && ~~context.map().zoom() >= minZoom3) {
48688 drawImages.enabled = function() {
48692 drawImages.supported = function() {
48693 return !!getService();
48699 // modules/svg/mapillary_signs.js
48700 function svgMapillarySigns(projection2, context, dispatch10) {
48701 const throttledRedraw = throttle_default(function() {
48702 dispatch10.call("change");
48704 const minZoom3 = 12;
48705 let layer = select_default2(null);
48708 if (svgMapillarySigns.initialized)
48710 svgMapillarySigns.enabled = false;
48711 svgMapillarySigns.initialized = true;
48713 function getService() {
48714 if (services.mapillary && !_mapillary) {
48715 _mapillary = services.mapillary;
48716 _mapillary.event.on("loadedSigns", throttledRedraw);
48717 } else if (!services.mapillary && _mapillary) {
48722 function showLayer() {
48723 const service = getService();
48726 service.loadSignResources(context);
48729 function hideLayer() {
48730 throttledRedraw.cancel();
48733 function editOn() {
48734 layer.style("display", "block");
48736 function editOff() {
48737 layer.selectAll(".icon-sign").remove();
48738 layer.style("display", "none");
48740 function click(d3_event, d) {
48741 const service = getService();
48744 context.map().centerEase(d.loc);
48745 const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
48746 service.getDetections(d.id).then((detections) => {
48747 if (detections.length) {
48748 const imageId = detections[0].image.id;
48749 if (imageId === selectedImageId) {
48750 service.highlightDetection(detections[0]).selectImage(context, imageId);
48752 service.ensureViewerLoaded(context).then(function() {
48753 service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
48759 function filterData(detectedFeatures) {
48760 var fromDate = context.photos().fromDate();
48761 var toDate = context.photos().toDate();
48763 var fromTimestamp = new Date(fromDate).getTime();
48764 detectedFeatures = detectedFeatures.filter(function(feature3) {
48765 return new Date(feature3.last_seen_at).getTime() >= fromTimestamp;
48769 var toTimestamp = new Date(toDate).getTime();
48770 detectedFeatures = detectedFeatures.filter(function(feature3) {
48771 return new Date(feature3.first_seen_at).getTime() <= toTimestamp;
48774 return detectedFeatures;
48776 function update() {
48777 const service = getService();
48778 let data = service ? service.signs(projection2) : [];
48779 data = filterData(data);
48780 const transform2 = svgPointTransform(projection2);
48781 const signs = layer.selectAll(".icon-sign").data(data, function(d) {
48784 signs.exit().remove();
48785 const enter = signs.enter().append("g").attr("class", "icon-sign icon-detected").on("click", click);
48786 enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d) {
48787 return "#" + d.value;
48789 enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
48790 signs.merge(enter).attr("transform", transform2);
48792 function drawSigns(selection2) {
48793 const enabled = svgMapillarySigns.enabled;
48794 const service = getService();
48795 layer = selection2.selectAll(".layer-mapillary-signs").data(service ? [0] : []);
48796 layer.exit().remove();
48797 layer = layer.enter().append("g").attr("class", "layer-mapillary-signs layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
48799 if (service && ~~context.map().zoom() >= minZoom3) {
48802 service.loadSigns(projection2);
48803 service.showSignDetections(true);
48807 } else if (service) {
48808 service.showSignDetections(false);
48811 drawSigns.enabled = function(_) {
48812 if (!arguments.length)
48813 return svgMapillarySigns.enabled;
48814 svgMapillarySigns.enabled = _;
48815 if (svgMapillarySigns.enabled) {
48817 context.photos().on("change.mapillary_signs", update);
48820 context.photos().on("change.mapillary_signs", null);
48822 dispatch10.call("change");
48825 drawSigns.supported = function() {
48826 return !!getService();
48832 // modules/svg/mapillary_map_features.js
48833 function svgMapillaryMapFeatures(projection2, context, dispatch10) {
48834 const throttledRedraw = throttle_default(function() {
48835 dispatch10.call("change");
48837 const minZoom3 = 12;
48838 let layer = select_default2(null);
48841 if (svgMapillaryMapFeatures.initialized)
48843 svgMapillaryMapFeatures.enabled = false;
48844 svgMapillaryMapFeatures.initialized = true;
48846 function getService() {
48847 if (services.mapillary && !_mapillary) {
48848 _mapillary = services.mapillary;
48849 _mapillary.event.on("loadedMapFeatures", throttledRedraw);
48850 } else if (!services.mapillary && _mapillary) {
48855 function showLayer() {
48856 const service = getService();
48859 service.loadObjectResources(context);
48862 function hideLayer() {
48863 throttledRedraw.cancel();
48866 function editOn() {
48867 layer.style("display", "block");
48869 function editOff() {
48870 layer.selectAll(".icon-map-feature").remove();
48871 layer.style("display", "none");
48873 function click(d3_event, d) {
48874 const service = getService();
48877 context.map().centerEase(d.loc);
48878 const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
48879 service.getDetections(d.id).then((detections) => {
48880 if (detections.length) {
48881 const imageId = detections[0].image.id;
48882 if (imageId === selectedImageId) {
48883 service.highlightDetection(detections[0]).selectImage(context, imageId);
48885 service.ensureViewerLoaded(context).then(function() {
48886 service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
48892 function filterData(detectedFeatures) {
48893 const fromDate = context.photos().fromDate();
48894 const toDate = context.photos().toDate();
48896 detectedFeatures = detectedFeatures.filter(function(feature3) {
48897 return new Date(feature3.last_seen_at).getTime() >= new Date(fromDate).getTime();
48901 detectedFeatures = detectedFeatures.filter(function(feature3) {
48902 return new Date(feature3.first_seen_at).getTime() <= new Date(toDate).getTime();
48905 return detectedFeatures;
48907 function update() {
48908 const service = getService();
48909 let data = service ? service.mapFeatures(projection2) : [];
48910 data = filterData(data);
48911 const transform2 = svgPointTransform(projection2);
48912 const mapFeatures = layer.selectAll(".icon-map-feature").data(data, function(d) {
48915 mapFeatures.exit().remove();
48916 const enter = mapFeatures.enter().append("g").attr("class", "icon-map-feature icon-detected").on("click", click);
48917 enter.append("title").text(function(d) {
48918 var id2 = d.value.replace(/--/g, ".").replace(/-/g, "_");
48919 return _t("mapillary_map_features." + id2);
48921 enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d) {
48922 if (d.value === "object--billboard") {
48923 return "#object--sign--advertisement";
48925 return "#" + d.value;
48927 enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
48928 mapFeatures.merge(enter).attr("transform", transform2);
48930 function drawMapFeatures(selection2) {
48931 const enabled = svgMapillaryMapFeatures.enabled;
48932 const service = getService();
48933 layer = selection2.selectAll(".layer-mapillary-map-features").data(service ? [0] : []);
48934 layer.exit().remove();
48935 layer = layer.enter().append("g").attr("class", "layer-mapillary-map-features layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
48937 if (service && ~~context.map().zoom() >= minZoom3) {
48940 service.loadMapFeatures(projection2);
48941 service.showFeatureDetections(true);
48945 } else if (service) {
48946 service.showFeatureDetections(false);
48949 drawMapFeatures.enabled = function(_) {
48950 if (!arguments.length)
48951 return svgMapillaryMapFeatures.enabled;
48952 svgMapillaryMapFeatures.enabled = _;
48953 if (svgMapillaryMapFeatures.enabled) {
48955 context.photos().on("change.mapillary_map_features", update);
48958 context.photos().on("change.mapillary_map_features", null);
48960 dispatch10.call("change");
48963 drawMapFeatures.supported = function() {
48964 return !!getService();
48967 return drawMapFeatures;
48970 // modules/svg/kartaview_images.js
48971 function svgKartaviewImages(projection2, context, dispatch10) {
48972 var throttledRedraw = throttle_default(function() {
48973 dispatch10.call("change");
48976 var minMarkerZoom = 16;
48977 var minViewfieldZoom = 18;
48978 var layer = select_default2(null);
48981 if (svgKartaviewImages.initialized)
48983 svgKartaviewImages.enabled = false;
48984 svgKartaviewImages.initialized = true;
48986 function getService() {
48987 if (services.kartaview && !_kartaview) {
48988 _kartaview = services.kartaview;
48989 _kartaview.event.on("loadedImages", throttledRedraw);
48990 } else if (!services.kartaview && _kartaview) {
48995 function showLayer() {
48996 var service = getService();
49000 layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
49001 dispatch10.call("change");
49004 function hideLayer() {
49005 throttledRedraw.cancel();
49006 layer.transition().duration(250).style("opacity", 0).on("end", editOff);
49008 function editOn() {
49009 layer.style("display", "block");
49011 function editOff() {
49012 layer.selectAll(".viewfield-group").remove();
49013 layer.style("display", "none");
49015 function click(d3_event, d) {
49016 var service = getService();
49019 service.ensureViewerLoaded(context).then(function() {
49020 service.selectImage(context, d.key).showViewer(context);
49022 context.map().centerEase(d.loc);
49024 function mouseover(d3_event, d) {
49025 var service = getService();
49027 service.setStyles(context, d);
49029 function mouseout() {
49030 var service = getService();
49032 service.setStyles(context, null);
49034 function transform2(d) {
49035 var t = svgPointTransform(projection2)(d);
49037 t += " rotate(" + Math.floor(d.ca) + ",0,0)";
49041 function filterImages(images) {
49042 var fromDate = context.photos().fromDate();
49043 var toDate = context.photos().toDate();
49044 var usernames = context.photos().usernames();
49046 var fromTimestamp = new Date(fromDate).getTime();
49047 images = images.filter(function(item) {
49048 return new Date(item.captured_at).getTime() >= fromTimestamp;
49052 var toTimestamp = new Date(toDate).getTime();
49053 images = images.filter(function(item) {
49054 return new Date(item.captured_at).getTime() <= toTimestamp;
49058 images = images.filter(function(item) {
49059 return usernames.indexOf(item.captured_by) !== -1;
49064 function filterSequences(sequences) {
49065 var fromDate = context.photos().fromDate();
49066 var toDate = context.photos().toDate();
49067 var usernames = context.photos().usernames();
49069 var fromTimestamp = new Date(fromDate).getTime();
49070 sequences = sequences.filter(function(image) {
49071 return new Date(image.properties.captured_at).getTime() >= fromTimestamp;
49075 var toTimestamp = new Date(toDate).getTime();
49076 sequences = sequences.filter(function(image) {
49077 return new Date(image.properties.captured_at).getTime() <= toTimestamp;
49081 sequences = sequences.filter(function(image) {
49082 return usernames.indexOf(image.properties.captured_by) !== -1;
49087 function update() {
49088 var viewer = context.container().select(".photoviewer");
49089 var selected = viewer.empty() ? void 0 : viewer.datum();
49090 var z = ~~context.map().zoom();
49091 var showMarkers = z >= minMarkerZoom;
49092 var showViewfields = z >= minViewfieldZoom;
49093 var service = getService();
49094 var sequences = [];
49096 if (context.photos().showsFlat()) {
49097 sequences = service ? service.sequences(projection2) : [];
49098 images = service && showMarkers ? service.images(projection2) : [];
49099 sequences = filterSequences(sequences);
49100 images = filterImages(images);
49102 var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d) {
49103 return d.properties.key;
49105 traces.exit().remove();
49106 traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
49107 var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d) {
49110 groups.exit().remove();
49111 var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
49112 groupsEnter.append("g").attr("class", "viewfield-scale");
49113 var markers = groups.merge(groupsEnter).sort(function(a, b) {
49114 return a === selected ? 1 : b === selected ? -1 : b.loc[1] - a.loc[1];
49115 }).attr("transform", transform2).select(".viewfield-scale");
49116 markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
49117 var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
49118 viewfields.exit().remove();
49119 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");
49121 function drawImages(selection2) {
49122 var enabled = svgKartaviewImages.enabled, service = getService();
49123 layer = selection2.selectAll(".layer-kartaview").data(service ? [0] : []);
49124 layer.exit().remove();
49125 var layerEnter = layer.enter().append("g").attr("class", "layer-kartaview").style("display", enabled ? "block" : "none");
49126 layerEnter.append("g").attr("class", "sequences");
49127 layerEnter.append("g").attr("class", "markers");
49128 layer = layerEnter.merge(layer);
49130 if (service && ~~context.map().zoom() >= minZoom3) {
49133 service.loadImages(projection2);
49139 drawImages.enabled = function(_) {
49140 if (!arguments.length)
49141 return svgKartaviewImages.enabled;
49142 svgKartaviewImages.enabled = _;
49143 if (svgKartaviewImages.enabled) {
49145 context.photos().on("change.kartaview_images", update);
49148 context.photos().on("change.kartaview_images", null);
49150 dispatch10.call("change");
49153 drawImages.supported = function() {
49154 return !!getService();
49160 // modules/svg/osm.js
49161 function svgOsm(projection2, context, dispatch10) {
49162 var enabled = true;
49163 function drawOsm(selection2) {
49164 selection2.selectAll(".layer-osm").data(["covered", "areas", "lines", "points", "labels"]).enter().append("g").attr("class", function(d) {
49165 return "layer-osm " + d;
49167 selection2.selectAll(".layer-osm.points").selectAll(".points-group").data(["points", "midpoints", "vertices", "turns"]).enter().append("g").attr("class", function(d) {
49168 return "points-group " + d;
49171 function showLayer() {
49172 var layer = context.surface().selectAll(".data-layer.osm");
49174 layer.classed("disabled", false).style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
49175 dispatch10.call("change");
49178 function hideLayer() {
49179 var layer = context.surface().selectAll(".data-layer.osm");
49181 layer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
49182 layer.classed("disabled", true);
49183 dispatch10.call("change");
49186 drawOsm.enabled = function(val) {
49187 if (!arguments.length)
49195 dispatch10.call("change");
49201 // modules/svg/notes.js
49202 var _notesEnabled = false;
49204 function svgNotes(projection2, context, dispatch10) {
49206 dispatch10 = dispatch_default("change");
49208 var throttledRedraw = throttle_default(function() {
49209 dispatch10.call("change");
49212 var touchLayer = select_default2(null);
49213 var drawLayer = select_default2(null);
49214 var _notesVisible = false;
49215 function markerPath(selection2, klass) {
49216 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");
49218 function getService() {
49219 if (services.osm && !_osmService) {
49220 _osmService = services.osm;
49221 _osmService.on("loadedNotes", throttledRedraw);
49222 } else if (!services.osm && _osmService) {
49223 _osmService = null;
49225 return _osmService;
49227 function editOn() {
49228 if (!_notesVisible) {
49229 _notesVisible = true;
49230 drawLayer.style("display", "block");
49233 function editOff() {
49234 if (_notesVisible) {
49235 _notesVisible = false;
49236 drawLayer.style("display", "none");
49237 drawLayer.selectAll(".note").remove();
49238 touchLayer.selectAll(".note").remove();
49241 function layerOn() {
49243 drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
49244 dispatch10.call("change");
49247 function layerOff() {
49248 throttledRedraw.cancel();
49249 drawLayer.interrupt();
49250 touchLayer.selectAll(".note").remove();
49251 drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
49253 dispatch10.call("change");
49256 function updateMarkers() {
49257 if (!_notesVisible || !_notesEnabled)
49259 var service = getService();
49260 var selectedID = context.selectedNoteID();
49261 var data = service ? service.notes(projection2) : [];
49262 var getTransform = svgPointTransform(projection2);
49263 var notes = drawLayer.selectAll(".note").data(data, function(d) {
49264 return d.status + d.id;
49266 notes.exit().remove();
49267 var notesEnter = notes.enter().append("g").attr("class", function(d) {
49268 return "note note-" + d.id + " " + d.status;
49269 }).classed("new", function(d) {
49272 notesEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
49273 notesEnter.append("path").call(markerPath, "shadow");
49274 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");
49275 notesEnter.selectAll(".icon-annotation").data(function(d) {
49277 }).enter().append("use").attr("class", "icon-annotation").attr("width", "10px").attr("height", "10px").attr("x", "-3px").attr("y", "-19px").attr("xlink:href", function(d) {
49279 return "#iD-icon-plus";
49280 if (d.status === "open")
49281 return "#iD-icon-close";
49282 return "#iD-icon-apply";
49284 notes.merge(notesEnter).sort(sortY).classed("selected", function(d) {
49285 var mode = context.mode();
49286 var isMoving = mode && mode.id === "drag-note";
49287 return !isMoving && d.id === selectedID;
49288 }).attr("transform", getTransform);
49289 if (touchLayer.empty())
49291 var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
49292 var targets = touchLayer.selectAll(".note").data(data, function(d) {
49295 targets.exit().remove();
49296 targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", function(d) {
49297 var newClass = d.id < 0 ? "new" : "";
49298 return "note target note-" + d.id + " " + fillClass + newClass;
49299 }).attr("transform", getTransform);
49300 function sortY(a, b) {
49301 if (a.id === selectedID)
49303 if (b.id === selectedID)
49305 return b.loc[1] - a.loc[1];
49308 function drawNotes(selection2) {
49309 var service = getService();
49310 var surface = context.surface();
49311 if (surface && !surface.empty()) {
49312 touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
49314 drawLayer = selection2.selectAll(".layer-notes").data(service ? [0] : []);
49315 drawLayer.exit().remove();
49316 drawLayer = drawLayer.enter().append("g").attr("class", "layer-notes").style("display", _notesEnabled ? "block" : "none").merge(drawLayer);
49317 if (_notesEnabled) {
49318 if (service && ~~context.map().zoom() >= minZoom3) {
49320 service.loadNotes(projection2);
49327 drawNotes.enabled = function(val) {
49328 if (!arguments.length)
49329 return _notesEnabled;
49330 _notesEnabled = val;
49331 if (_notesEnabled) {
49335 if (context.selectedNoteID()) {
49336 context.enter(modeBrowse(context));
49339 dispatch10.call("change");
49345 // modules/svg/touch.js
49346 function svgTouch() {
49347 function drawTouch(selection2) {
49348 selection2.selectAll(".layer-touch").data(["areas", "lines", "points", "turns", "markers"]).enter().append("g").attr("class", function(d) {
49349 return "layer-touch " + d;
49355 // modules/util/dimensions.js
49356 function refresh(selection2, node) {
49357 var cr = node.getBoundingClientRect();
49358 var prop = [cr.width, cr.height];
49359 selection2.property("__dimensions__", prop);
49362 function utilGetDimensions(selection2, force) {
49363 if (!selection2 || selection2.empty()) {
49366 var node = selection2.node(), cached = selection2.property("__dimensions__");
49367 return !cached || force ? refresh(selection2, node) : cached;
49369 function utilSetDimensions(selection2, dimensions) {
49370 if (!selection2 || selection2.empty()) {
49373 var node = selection2.node();
49374 if (dimensions === null) {
49375 refresh(selection2, node);
49378 return selection2.property("__dimensions__", [dimensions[0], dimensions[1]]).attr("width", dimensions[0]).attr("height", dimensions[1]);
49381 // modules/svg/layers.js
49382 function svgLayers(projection2, context) {
49383 var dispatch10 = dispatch_default("change");
49384 var svg2 = select_default2(null);
49386 { id: "osm", layer: svgOsm(projection2, context, dispatch10) },
49387 { id: "notes", layer: svgNotes(projection2, context, dispatch10) },
49388 { id: "data", layer: svgData(projection2, context, dispatch10) },
49389 { id: "keepRight", layer: svgKeepRight(projection2, context, dispatch10) },
49390 { id: "improveOSM", layer: svgImproveOSM(projection2, context, dispatch10) },
49391 { id: "osmose", layer: svgOsmose(projection2, context, dispatch10) },
49392 { id: "streetside", layer: svgStreetside(projection2, context, dispatch10) },
49393 { id: "mapillary", layer: svgMapillaryImages(projection2, context, dispatch10) },
49394 { id: "mapillary-position", layer: svgMapillaryPosition(projection2, context, dispatch10) },
49395 { id: "mapillary-map-features", layer: svgMapillaryMapFeatures(projection2, context, dispatch10) },
49396 { id: "mapillary-signs", layer: svgMapillarySigns(projection2, context, dispatch10) },
49397 { id: "kartaview", layer: svgKartaviewImages(projection2, context, dispatch10) },
49398 { id: "debug", layer: svgDebug(projection2, context, dispatch10) },
49399 { id: "geolocate", layer: svgGeolocate(projection2, context, dispatch10) },
49400 { id: "touch", layer: svgTouch(projection2, context, dispatch10) }
49402 function drawLayers(selection2) {
49403 svg2 = selection2.selectAll(".surface").data([0]);
49404 svg2 = svg2.enter().append("svg").attr("class", "surface").merge(svg2);
49405 var defs = svg2.selectAll(".surface-defs").data([0]);
49406 defs.enter().append("defs").attr("class", "surface-defs");
49407 var groups = svg2.selectAll(".data-layer").data(_layers);
49408 groups.exit().remove();
49409 groups.enter().append("g").attr("class", function(d) {
49410 return "data-layer " + d.id;
49411 }).merge(groups).each(function(d) {
49412 select_default2(this).call(d.layer);
49415 drawLayers.all = function() {
49418 drawLayers.layer = function(id2) {
49419 var obj = _layers.find(function(o) {
49420 return o.id === id2;
49422 return obj && obj.layer;
49424 drawLayers.only = function(what) {
49425 var arr = [].concat(what);
49426 var all = _layers.map(function(layer) {
49429 return drawLayers.remove(utilArrayDifference(all, arr));
49431 drawLayers.remove = function(what) {
49432 var arr = [].concat(what);
49433 arr.forEach(function(id2) {
49434 _layers = _layers.filter(function(o) {
49435 return o.id !== id2;
49438 dispatch10.call("change");
49441 drawLayers.add = function(what) {
49442 var arr = [].concat(what);
49443 arr.forEach(function(obj) {
49444 if ("id" in obj && "layer" in obj) {
49448 dispatch10.call("change");
49451 drawLayers.dimensions = function(val) {
49452 if (!arguments.length)
49453 return utilGetDimensions(svg2);
49454 utilSetDimensions(svg2, val);
49457 return utilRebind(drawLayers, dispatch10, "on");
49460 // modules/svg/lines.js
49461 var import_fast_deep_equal6 = __toESM(require_fast_deep_equal());
49462 function svgLines(projection2, context) {
49463 var detected = utilDetect();
49464 var highway_stack = {
49478 function drawTargets(selection2, graph, entities, filter2) {
49479 var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
49480 var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
49481 var getPath = svgPath(projection2).geojson;
49482 var activeID = context.activeID();
49483 var base = context.history().base();
49484 var data = { targets: [], nopes: [] };
49485 entities.forEach(function(way) {
49486 var features2 = svgSegmentWay(way, graph, activeID);
49487 data.targets.push.apply(data.targets, features2.passive);
49488 data.nopes.push.apply(data.nopes, features2.active);
49490 var targetData = data.targets.filter(getPath);
49491 var targets = selection2.selectAll(".line.target-allowed").filter(function(d) {
49492 return filter2(d.properties.entity);
49493 }).data(targetData, function key(d) {
49496 targets.exit().remove();
49497 var segmentWasEdited = function(d) {
49498 var wayID = d.properties.entity.id;
49499 if (!base.entities[wayID] || !(0, import_fast_deep_equal6.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
49502 return d.properties.nodes.some(function(n2) {
49503 return !base.entities[n2.id] || !(0, import_fast_deep_equal6.default)(graph.entities[n2.id].loc, base.entities[n2.id].loc);
49506 targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d) {
49507 return "way line target target-allowed " + targetClass + d.id;
49508 }).classed("segment-edited", segmentWasEdited);
49509 var nopeData = data.nopes.filter(getPath);
49510 var nopes = selection2.selectAll(".line.target-nope").filter(function(d) {
49511 return filter2(d.properties.entity);
49512 }).data(nopeData, function key(d) {
49515 nopes.exit().remove();
49516 nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d) {
49517 return "way line target target-nope " + nopeClass + d.id;
49518 }).classed("segment-edited", segmentWasEdited);
49520 function drawLines(selection2, graph, entities, filter2) {
49521 var base = context.history().base();
49522 function waystack(a, b) {
49523 var selected = context.selectedIDs();
49524 var scoreA = selected.indexOf(a.id) !== -1 ? 20 : 0;
49525 var scoreB = selected.indexOf(b.id) !== -1 ? 20 : 0;
49526 if (a.tags.highway) {
49527 scoreA -= highway_stack[a.tags.highway];
49529 if (b.tags.highway) {
49530 scoreB -= highway_stack[b.tags.highway];
49532 return scoreA - scoreB;
49534 function drawLineGroup(selection3, klass, isSelected) {
49535 var mode = context.mode();
49536 var isDrawing = mode && /^draw/.test(mode.id);
49537 var selectedClass = !isDrawing && isSelected ? "selected " : "";
49538 var lines = selection3.selectAll("path").filter(filter2).data(getPathData(isSelected), osmEntity.key);
49539 lines.exit().remove();
49540 lines.enter().append("path").attr("class", function(d) {
49541 var prefix = "way line";
49542 if (!d.hasInterestingTags()) {
49543 var parentRelations = graph.parentRelations(d);
49544 var parentMultipolygons = parentRelations.filter(function(relation) {
49545 return relation.isMultipolygon();
49547 if (parentMultipolygons.length > 0 && parentRelations.length === parentMultipolygons.length) {
49548 prefix = "relation area";
49551 var oldMPClass = oldMultiPolygonOuters[d.id] ? "old-multipolygon " : "";
49552 return prefix + " " + klass + " " + selectedClass + oldMPClass + d.id;
49553 }).classed("added", function(d) {
49554 return !base.entities[d.id];
49555 }).classed("geometry-edited", function(d) {
49556 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);
49557 }).classed("retagged", function(d) {
49558 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);
49559 }).call(svgTagClasses()).merge(lines).sort(waystack).attr("d", getPath).call(svgTagClasses().tags(svgRelationMemberTags(graph)));
49562 function getPathData(isSelected) {
49563 return function() {
49564 var layer = this.parentNode.__data__;
49565 var data = pathdata[layer] || [];
49566 return data.filter(function(d) {
49568 return context.selectedIDs().indexOf(d.id) !== -1;
49570 return context.selectedIDs().indexOf(d.id) === -1;
49575 function addMarkers(layergroup, pathclass, groupclass, groupdata, marker) {
49576 var markergroup = layergroup.selectAll("g." + groupclass).data([pathclass]);
49577 markergroup = markergroup.enter().append("g").attr("class", groupclass).merge(markergroup);
49578 var markers = markergroup.selectAll("path").filter(filter2).data(
49580 return groupdata[this.parentNode.__data__] || [];
49583 return [d.id, d.index];
49586 markers.exit().remove();
49587 markers = markers.enter().append("path").attr("class", pathclass).merge(markers).attr("marker-mid", marker).attr("d", function(d) {
49591 markers.each(function() {
49592 this.parentNode.insertBefore(this, this);
49596 var getPath = svgPath(projection2, graph);
49598 var onewaydata = {};
49599 var sideddata = {};
49600 var oldMultiPolygonOuters = {};
49601 for (var i2 = 0; i2 < entities.length; i2++) {
49602 var entity = entities[i2];
49603 var outer = osmOldMultipolygonOuterMember(entity, graph);
49605 ways.push(entity.mergeTags(outer.tags));
49606 oldMultiPolygonOuters[outer.id] = true;
49607 } else if (entity.geometry(graph) === "line" || entity.geometry(graph) === "area" && entity.sidednessIdentifier && entity.sidednessIdentifier() === "coastline") {
49611 ways = ways.filter(getPath);
49612 var pathdata = utilArrayGroupBy(ways, function(way) {
49613 return way.layer();
49615 Object.keys(pathdata).forEach(function(k) {
49616 var v = pathdata[k];
49617 var onewayArr = v.filter(function(d) {
49618 return d.isOneWay();
49620 var onewaySegments = svgMarkerSegments(
49624 function shouldReverse(entity2) {
49625 return entity2.tags.oneway === "-1";
49627 function bothDirections(entity2) {
49628 return entity2.tags.oneway === "reversible" || entity2.tags.oneway === "alternating";
49631 onewaydata[k] = utilArrayFlatten(onewayArr.map(onewaySegments));
49632 var sidedArr = v.filter(function(d) {
49633 return d.isSided();
49635 var sidedSegments = svgMarkerSegments(
49639 function shouldReverse() {
49642 function bothDirections() {
49646 sideddata[k] = utilArrayFlatten(sidedArr.map(sidedSegments));
49648 var covered = selection2.selectAll(".layer-osm.covered");
49649 var uncovered = selection2.selectAll(".layer-osm.lines");
49650 var touchLayer = selection2.selectAll(".layer-touch.lines");
49651 [covered, uncovered].forEach(function(selection3) {
49652 var range3 = selection3 === covered ? range(-10, 0) : range(0, 11);
49653 var layergroup = selection3.selectAll("g.layergroup").data(range3);
49654 layergroup = layergroup.enter().append("g").attr("class", function(d) {
49655 return "layergroup layer" + String(d);
49656 }).merge(layergroup);
49657 layergroup.selectAll("g.linegroup").data(["shadow", "casing", "stroke", "shadow-highlighted", "casing-highlighted", "stroke-highlighted"]).enter().append("g").attr("class", function(d) {
49658 return "linegroup line-" + d;
49660 layergroup.selectAll("g.line-shadow").call(drawLineGroup, "shadow", false);
49661 layergroup.selectAll("g.line-casing").call(drawLineGroup, "casing", false);
49662 layergroup.selectAll("g.line-stroke").call(drawLineGroup, "stroke", false);
49663 layergroup.selectAll("g.line-shadow-highlighted").call(drawLineGroup, "shadow", true);
49664 layergroup.selectAll("g.line-casing-highlighted").call(drawLineGroup, "casing", true);
49665 layergroup.selectAll("g.line-stroke-highlighted").call(drawLineGroup, "stroke", true);
49666 addMarkers(layergroup, "oneway", "onewaygroup", onewaydata, "url(#ideditor-oneway-marker)");
49672 function marker(d) {
49673 var category = graph.entity(d.id).sidednessIdentifier();
49674 return "url(#ideditor-sided-marker-" + category + ")";
49678 touchLayer.call(drawTargets, graph, ways, filter2);
49683 // modules/svg/midpoints.js
49684 function svgMidpoints(projection2, context) {
49685 var targetRadius = 8;
49686 function drawTargets(selection2, graph, entities, filter2) {
49687 var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
49688 var getTransform = svgPointTransform(projection2).geojson;
49689 var data = entities.map(function(midpoint) {
49699 coordinates: midpoint.loc
49703 var targets = selection2.selectAll(".midpoint.target").filter(function(d) {
49704 return filter2(d.properties.entity);
49705 }).data(data, function key(d) {
49708 targets.exit().remove();
49709 targets.enter().append("circle").attr("r", targetRadius).merge(targets).attr("class", function(d) {
49710 return "node midpoint target " + fillClass + d.id;
49711 }).attr("transform", getTransform);
49713 function drawMidpoints(selection2, graph, entities, filter2, extent) {
49714 var drawLayer = selection2.selectAll(".layer-osm.points .points-group.midpoints");
49715 var touchLayer = selection2.selectAll(".layer-touch.points");
49716 var mode = context.mode();
49717 if (mode && mode.id !== "select" || !context.map().withinEditableZoom()) {
49718 drawLayer.selectAll(".midpoint").remove();
49719 touchLayer.selectAll(".midpoint.target").remove();
49722 var poly = extent.polygon();
49723 var midpoints = {};
49724 for (var i2 = 0; i2 < entities.length; i2++) {
49725 var entity = entities[i2];
49726 if (entity.type !== "way")
49728 if (!filter2(entity))
49730 if (context.selectedIDs().indexOf(entity.id) < 0)
49732 var nodes = graph.childNodes(entity);
49733 for (var j2 = 0; j2 < nodes.length - 1; j2++) {
49735 var b = nodes[j2 + 1];
49736 var id2 = [a.id, b.id].sort().join("-");
49737 if (midpoints[id2]) {
49738 midpoints[id2].parents.push(entity);
49739 } else if (geoVecLength(projection2(a.loc), projection2(b.loc)) > 40) {
49740 var point2 = geoVecInterp(a.loc, b.loc, 0.5);
49742 if (extent.intersects(point2)) {
49745 for (var k = 0; k < 4; k++) {
49746 point2 = geoLineIntersection([a.loc, b.loc], [poly[k], poly[k + 1]]);
49747 if (point2 && geoVecLength(projection2(a.loc), projection2(point2)) > 20 && geoVecLength(projection2(b.loc), projection2(point2)) > 20) {
49758 edge: [a.id, b.id],
49765 function midpointFilter(d) {
49766 if (midpoints[d.id])
49768 for (var i3 = 0; i3 < d.parents.length; i3++) {
49769 if (filter2(d.parents[i3])) {
49775 var groups = drawLayer.selectAll(".midpoint").filter(midpointFilter).data(Object.values(midpoints), function(d) {
49778 groups.exit().remove();
49779 var enter = groups.enter().insert("g", ":first-child").attr("class", "midpoint");
49780 enter.append("polygon").attr("points", "-6,8 10,0 -6,-8").attr("class", "shadow");
49781 enter.append("polygon").attr("points", "-3,4 5,0 -3,-4").attr("class", "fill");
49782 groups = groups.merge(enter).attr("transform", function(d) {
49783 var translate = svgPointTransform(projection2);
49784 var a2 = graph.entity(d.edge[0]);
49785 var b2 = graph.entity(d.edge[1]);
49786 var angle2 = geoAngle(a2, b2, projection2) * (180 / Math.PI);
49787 return translate(d) + " rotate(" + angle2 + ")";
49788 }).call(svgTagClasses().tags(
49790 return d.parents[0].tags;
49793 groups.select("polygon.shadow");
49794 groups.select("polygon.fill");
49795 touchLayer.call(drawTargets, graph, Object.values(midpoints), midpointFilter);
49797 return drawMidpoints;
49800 // modules/svg/points.js
49801 var import_fast_deep_equal7 = __toESM(require_fast_deep_equal());
49802 function svgPoints(projection2, context) {
49803 function markerPath(selection2, klass) {
49804 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");
49806 function sortY(a, b) {
49807 return b.loc[1] - a.loc[1];
49809 function fastEntityKey(d) {
49810 var mode = context.mode();
49811 var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
49812 return isMoving ? d.id : osmEntity.key(d);
49814 function drawTargets(selection2, graph, entities, filter2) {
49815 var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
49816 var getTransform = svgPointTransform(projection2).geojson;
49817 var activeID = context.activeID();
49819 entities.forEach(function(node) {
49820 if (activeID === node.id)
49829 geometry: node.asGeoJSON()
49832 var targets = selection2.selectAll(".point.target").filter(function(d) {
49833 return filter2(d.properties.entity);
49834 }).data(data, function key(d) {
49837 targets.exit().remove();
49838 targets.enter().append("rect").attr("x", -10).attr("y", -26).attr("width", 20).attr("height", 30).merge(targets).attr("class", function(d) {
49839 return "node point target " + fillClass + d.id;
49840 }).attr("transform", getTransform);
49842 function drawPoints(selection2, graph, entities, filter2) {
49843 var wireframe = context.surface().classed("fill-wireframe");
49844 var zoom = geoScaleToZoom(projection2.scale());
49845 var base = context.history().base();
49846 function renderAsPoint(entity) {
49847 return entity.geometry(graph) === "point" && !(zoom >= 18 && entity.directions(graph, projection2).length);
49849 var points = wireframe ? [] : entities.filter(renderAsPoint);
49850 points.sort(sortY);
49851 var drawLayer = selection2.selectAll(".layer-osm.points .points-group.points");
49852 var touchLayer = selection2.selectAll(".layer-touch.points");
49853 var groups = drawLayer.selectAll("g.point").filter(filter2).data(points, fastEntityKey);
49854 groups.exit().remove();
49855 var enter = groups.enter().append("g").attr("class", function(d) {
49856 return "node point " + d.id;
49858 enter.append("path").call(markerPath, "shadow");
49859 enter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
49860 enter.append("path").call(markerPath, "stroke");
49861 enter.append("use").attr("transform", "translate(-5.5, -20)").attr("class", "icon").attr("width", "12px").attr("height", "12px");
49862 groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("added", function(d) {
49863 return !base.entities[d.id];
49864 }).classed("moved", function(d) {
49865 return base.entities[d.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d.id].loc, base.entities[d.id].loc);
49866 }).classed("retagged", function(d) {
49867 return base.entities[d.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d.id].tags, base.entities[d.id].tags);
49868 }).call(svgTagClasses());
49869 groups.select(".shadow");
49870 groups.select(".stroke");
49871 groups.select(".icon").attr("xlink:href", function(entity) {
49872 var preset = _mainPresetIndex.match(entity, graph);
49873 var picon = preset && preset.icon;
49874 return picon ? "#" + picon : "";
49876 touchLayer.call(drawTargets, graph, points, filter2);
49881 // modules/svg/turns.js
49882 function svgTurns(projection2, context) {
49883 function icon2(turn) {
49884 var u = turn.u ? "-u" : "";
49886 return "#iD-turn-no" + u;
49888 return "#iD-turn-only" + u;
49889 return "#iD-turn-yes" + u;
49891 function drawTurns(selection2, graph, turns) {
49892 function turnTransform(d) {
49894 var toWay = graph.entity(d.to.way);
49895 var toPoints = graph.childNodes(toWay).map(function(n2) {
49897 }).map(projection2);
49898 var toLength = geoPathLength(toPoints);
49899 var mid = toLength / 2;
49900 var toNode = graph.entity(d.to.node);
49901 var toVertex = graph.entity(d.to.vertex);
49902 var a = geoAngle(toVertex, toNode, projection2);
49903 var o = projection2(toVertex.loc);
49904 var r = d.u ? 0 : !toWay.__via ? pxRadius : Math.min(mid, pxRadius);
49905 return "translate(" + (r * Math.cos(a) + o[0]) + "," + (r * Math.sin(a) + o[1]) + ") rotate(" + a * 180 / Math.PI + ")";
49907 var drawLayer = selection2.selectAll(".layer-osm.points .points-group.turns");
49908 var touchLayer = selection2.selectAll(".layer-touch.turns");
49909 var groups = drawLayer.selectAll("g.turn").data(turns, function(d) {
49912 groups.exit().remove();
49913 var groupsEnter = groups.enter().append("g").attr("class", function(d) {
49914 return "turn " + d.key;
49916 var turnsEnter = groupsEnter.filter(function(d) {
49919 turnsEnter.append("rect").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
49920 turnsEnter.append("use").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
49921 var uEnter = groupsEnter.filter(function(d) {
49924 uEnter.append("circle").attr("r", "16");
49925 uEnter.append("use").attr("transform", "translate(-16, -16)").attr("width", "32").attr("height", "32");
49926 groups = groups.merge(groupsEnter).attr("opacity", function(d) {
49927 return d.direct === false ? "0.7" : null;
49928 }).attr("transform", turnTransform);
49929 groups.select("use").attr("xlink:href", icon2);
49930 groups.select("rect");
49931 groups.select("circle");
49932 var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
49933 groups = touchLayer.selectAll("g.turn").data(turns, function(d) {
49936 groups.exit().remove();
49937 groupsEnter = groups.enter().append("g").attr("class", function(d) {
49938 return "turn " + d.key;
49940 turnsEnter = groupsEnter.filter(function(d) {
49943 turnsEnter.append("rect").attr("class", "target " + fillClass).attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
49944 uEnter = groupsEnter.filter(function(d) {
49947 uEnter.append("circle").attr("class", "target " + fillClass).attr("r", "16");
49948 groups = groups.merge(groupsEnter).attr("transform", turnTransform);
49949 groups.select("rect");
49950 groups.select("circle");
49956 // modules/svg/vertices.js
49957 var import_fast_deep_equal8 = __toESM(require_fast_deep_equal());
49958 function svgVertices(projection2, context) {
49960 shadow: [6, 7.5, 7.5, 12],
49961 stroke: [2.5, 3.5, 3.5, 8],
49962 fill: [1, 1.5, 1.5, 1.5]
49964 var _currHoverTarget;
49965 var _currPersistent = {};
49966 var _currHover = {};
49967 var _prevHover = {};
49968 var _currSelected = {};
49969 var _prevSelected = {};
49971 function sortY(a, b) {
49972 return b.loc[1] - a.loc[1];
49974 function fastEntityKey(d) {
49975 var mode = context.mode();
49976 var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
49977 return isMoving ? d.id : osmEntity.key(d);
49979 function draw(selection2, graph, vertices, sets2, filter2) {
49980 sets2 = sets2 || { selected: {}, important: {}, hovered: {} };
49982 var directions = {};
49983 var wireframe = context.surface().classed("fill-wireframe");
49984 var zoom = geoScaleToZoom(projection2.scale());
49985 var z = zoom < 17 ? 0 : zoom < 18 ? 1 : 2;
49986 var activeID = context.activeID();
49987 var base = context.history().base();
49988 function getIcon(d) {
49989 var entity = graph.entity(d.id);
49990 if (entity.id in icons)
49991 return icons[entity.id];
49992 icons[entity.id] = entity.hasInterestingTags() && _mainPresetIndex.match(entity, graph).icon;
49993 return icons[entity.id];
49995 function getDirections(entity) {
49996 if (entity.id in directions)
49997 return directions[entity.id];
49998 var angles = entity.directions(graph, projection2);
49999 directions[entity.id] = angles.length ? angles : false;
50002 function updateAttributes(selection3) {
50003 ["shadow", "stroke", "fill"].forEach(function(klass) {
50004 var rads = radiuses[klass];
50005 selection3.selectAll("." + klass).each(function(entity) {
50006 var i2 = z && getIcon(entity);
50007 var r = rads[i2 ? 3 : z];
50008 if (entity.id !== activeID && entity.isEndpoint(graph) && !entity.isConnected(graph)) {
50011 if (klass === "shadow") {
50012 _radii[entity.id] = r;
50014 select_default2(this).attr("r", r).attr("visibility", i2 && klass === "fill" ? "hidden" : null);
50018 vertices.sort(sortY);
50019 var groups = selection2.selectAll("g.vertex").filter(filter2).data(vertices, fastEntityKey);
50020 groups.exit().remove();
50021 var enter = groups.enter().append("g").attr("class", function(d) {
50022 return "node vertex " + d.id;
50024 enter.append("circle").attr("class", "shadow");
50025 enter.append("circle").attr("class", "stroke");
50026 enter.filter(function(d) {
50027 return d.hasInterestingTags();
50028 }).append("circle").attr("class", "fill");
50029 groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("sibling", function(d) {
50030 return d.id in sets2.selected;
50031 }).classed("shared", function(d) {
50032 return graph.isShared(d);
50033 }).classed("endpoint", function(d) {
50034 return d.isEndpoint(graph);
50035 }).classed("added", function(d) {
50036 return !base.entities[d.id];
50037 }).classed("moved", function(d) {
50038 return base.entities[d.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d.id].loc, base.entities[d.id].loc);
50039 }).classed("retagged", function(d) {
50040 return base.entities[d.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d.id].tags, base.entities[d.id].tags);
50041 }).call(updateAttributes);
50042 var iconUse = groups.selectAll(".icon").data(function data(d) {
50043 return zoom >= 17 && getIcon(d) ? [d] : [];
50045 iconUse.exit().remove();
50046 iconUse.enter().append("use").attr("class", "icon").attr("width", "12px").attr("height", "12px").attr("transform", "translate(-6, -6)").attr("xlink:href", function(d) {
50047 var picon = getIcon(d);
50048 return picon ? "#" + picon : "";
50050 var dgroups = groups.selectAll(".viewfieldgroup").data(function data(d) {
50051 return zoom >= 18 && getDirections(d) ? [d] : [];
50053 dgroups.exit().remove();
50054 dgroups = dgroups.enter().insert("g", ".shadow").attr("class", "viewfieldgroup").merge(dgroups);
50055 var viewfields = dgroups.selectAll(".viewfield").data(getDirections, function key(d) {
50056 return osmEntity.key(d);
50058 viewfields.exit().remove();
50059 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) {
50060 return "rotate(" + d + ")";
50063 function drawTargets(selection2, graph, entities, filter2) {
50064 var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
50065 var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
50066 var getTransform = svgPointTransform(projection2).geojson;
50067 var activeID = context.activeID();
50068 var data = { targets: [], nopes: [] };
50069 entities.forEach(function(node) {
50070 if (activeID === node.id)
50072 var vertexType = svgPassiveVertex(node, graph, activeID);
50073 if (vertexType !== 0) {
50074 data.targets.push({
50081 geometry: node.asGeoJSON()
50086 id: node.id + "-nope",
50092 geometry: node.asGeoJSON()
50096 var targets = selection2.selectAll(".vertex.target-allowed").filter(function(d) {
50097 return filter2(d.properties.entity);
50098 }).data(data.targets, function key(d) {
50101 targets.exit().remove();
50102 targets.enter().append("circle").attr("r", function(d) {
50103 return _radii[d.id] || radiuses.shadow[3];
50104 }).merge(targets).attr("class", function(d) {
50105 return "node vertex target target-allowed " + targetClass + d.id;
50106 }).attr("transform", getTransform);
50107 var nopes = selection2.selectAll(".vertex.target-nope").filter(function(d) {
50108 return filter2(d.properties.entity);
50109 }).data(data.nopes, function key(d) {
50112 nopes.exit().remove();
50113 nopes.enter().append("circle").attr("r", function(d) {
50114 return _radii[d.properties.entity.id] || radiuses.shadow[3];
50115 }).merge(nopes).attr("class", function(d) {
50116 return "node vertex target target-nope " + nopeClass + d.id;
50117 }).attr("transform", getTransform);
50119 function renderAsVertex(entity, graph, wireframe, zoom) {
50120 var geometry = entity.geometry(graph);
50121 return geometry === "vertex" || geometry === "point" && (wireframe || zoom >= 18 && entity.directions(graph, projection2).length);
50123 function isEditedNode(node, base, head) {
50124 var baseNode = base.entities[node.id];
50125 var headNode = head.entities[node.id];
50126 return !headNode || !baseNode || !(0, import_fast_deep_equal8.default)(headNode.tags, baseNode.tags) || !(0, import_fast_deep_equal8.default)(headNode.loc, baseNode.loc);
50128 function getSiblingAndChildVertices(ids, graph, wireframe, zoom) {
50131 function addChildVertices(entity) {
50132 if (seenIds[entity.id])
50134 seenIds[entity.id] = true;
50135 var geometry = entity.geometry(graph);
50136 if (!context.features().isHiddenFeature(entity, graph, geometry)) {
50138 if (entity.type === "way") {
50139 for (i2 = 0; i2 < entity.nodes.length; i2++) {
50140 var child = graph.hasEntity(entity.nodes[i2]);
50142 addChildVertices(child);
50145 } else if (entity.type === "relation") {
50146 for (i2 = 0; i2 < entity.members.length; i2++) {
50147 var member = graph.hasEntity(entity.members[i2].id);
50149 addChildVertices(member);
50152 } else if (renderAsVertex(entity, graph, wireframe, zoom)) {
50153 results[entity.id] = entity;
50157 ids.forEach(function(id2) {
50158 var entity = graph.hasEntity(id2);
50161 if (entity.type === "node") {
50162 if (renderAsVertex(entity, graph, wireframe, zoom)) {
50163 results[entity.id] = entity;
50164 graph.parentWays(entity).forEach(function(entity2) {
50165 addChildVertices(entity2);
50169 addChildVertices(entity);
50174 function drawVertices(selection2, graph, entities, filter2, extent, fullRedraw) {
50175 var wireframe = context.surface().classed("fill-wireframe");
50176 var visualDiff = context.surface().classed("highlight-edited");
50177 var zoom = geoScaleToZoom(projection2.scale());
50178 var mode = context.mode();
50179 var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
50180 var base = context.history().base();
50181 var drawLayer = selection2.selectAll(".layer-osm.points .points-group.vertices");
50182 var touchLayer = selection2.selectAll(".layer-touch.points");
50184 _currPersistent = {};
50187 for (var i2 = 0; i2 < entities.length; i2++) {
50188 var entity = entities[i2];
50189 var geometry = entity.geometry(graph);
50191 if (geometry === "point" && renderAsVertex(entity, graph, wireframe, zoom)) {
50192 _currPersistent[entity.id] = entity;
50194 } else if (geometry === "vertex" && (entity.hasInterestingTags() || entity.isEndpoint(graph) || entity.isConnected(graph) || visualDiff && isEditedNode(entity, base, graph))) {
50195 _currPersistent[entity.id] = entity;
50198 if (!keep && !fullRedraw) {
50199 delete _currPersistent[entity.id];
50203 persistent: _currPersistent,
50204 selected: _currSelected,
50205 hovered: _currHover
50207 var all = Object.assign({}, isMoving ? _currHover : {}, _currSelected, _currPersistent);
50208 var filterRendered = function(d) {
50209 return d.id in _currPersistent || d.id in _currSelected || d.id in _currHover || filter2(d);
50211 drawLayer.call(draw, graph, currentVisible(all), sets2, filterRendered);
50212 var filterTouch = function(d) {
50213 return isMoving ? true : filterRendered(d);
50215 touchLayer.call(drawTargets, graph, currentVisible(all), filterTouch);
50216 function currentVisible(which) {
50217 return Object.keys(which).map(graph.hasEntity, graph).filter(function(entity2) {
50218 return entity2 && entity2.intersects(extent, graph);
50222 drawVertices.drawSelected = function(selection2, graph, extent) {
50223 var wireframe = context.surface().classed("fill-wireframe");
50224 var zoom = geoScaleToZoom(projection2.scale());
50225 _prevSelected = _currSelected || {};
50226 if (context.map().isInWideSelection()) {
50227 _currSelected = {};
50228 context.selectedIDs().forEach(function(id2) {
50229 var entity = graph.hasEntity(id2);
50232 if (entity.type === "node") {
50233 if (renderAsVertex(entity, graph, wireframe, zoom)) {
50234 _currSelected[entity.id] = entity;
50239 _currSelected = getSiblingAndChildVertices(context.selectedIDs(), graph, wireframe, zoom);
50241 var filter2 = function(d) {
50242 return d.id in _prevSelected;
50244 drawVertices(selection2, graph, Object.values(_prevSelected), filter2, extent, false);
50246 drawVertices.drawHover = function(selection2, graph, target, extent) {
50247 if (target === _currHoverTarget)
50249 var wireframe = context.surface().classed("fill-wireframe");
50250 var zoom = geoScaleToZoom(projection2.scale());
50251 _prevHover = _currHover || {};
50252 _currHoverTarget = target;
50253 var entity = target && target.properties && target.properties.entity;
50255 _currHover = getSiblingAndChildVertices([entity.id], graph, wireframe, zoom);
50259 var filter2 = function(d) {
50260 return d.id in _prevHover;
50262 drawVertices(selection2, graph, Object.values(_prevHover), filter2, extent, false);
50264 return drawVertices;
50267 // modules/util/bind_once.js
50268 function utilBindOnce(target, type3, listener, capture) {
50269 var typeOnce = type3 + ".once";
50271 target.on(typeOnce, null);
50272 listener.apply(this, arguments);
50274 target.on(typeOnce, one2, capture);
50278 // modules/util/zoom_pan.js
50279 function defaultFilter3(d3_event) {
50280 return !d3_event.ctrlKey && !d3_event.button;
50282 function defaultExtent2() {
50284 if (e instanceof SVGElement) {
50285 e = e.ownerSVGElement || e;
50286 if (e.hasAttribute("viewBox")) {
50287 e = e.viewBox.baseVal;
50288 return [[e.x, e.y], [e.x + e.width, e.y + e.height]];
50290 return [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]];
50292 return [[0, 0], [e.clientWidth, e.clientHeight]];
50294 function defaultWheelDelta2(d3_event) {
50295 return -d3_event.deltaY * (d3_event.deltaMode === 1 ? 0.05 : d3_event.deltaMode ? 1 : 2e-3);
50297 function defaultConstrain2(transform2, extent, translateExtent) {
50298 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];
50299 return transform2.translate(
50300 dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
50301 dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
50304 function utilZoomPan() {
50305 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;
50306 function zoom(selection2) {
50307 selection2.on("pointerdown.zoom", pointerdown).on("wheel.zoom", wheeled).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
50308 select_default2(window).on("pointermove.zoompan", pointermove).on("pointerup.zoompan pointercancel.zoompan", pointerup);
50310 zoom.transform = function(collection, transform2, point2) {
50311 var selection2 = collection.selection ? collection.selection() : collection;
50312 if (collection !== selection2) {
50313 schedule(collection, transform2, point2);
50315 selection2.interrupt().each(function() {
50316 gesture(this, arguments).start(null).zoom(null, null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end(null);
50320 zoom.scaleBy = function(selection2, k, p) {
50321 zoom.scaleTo(selection2, function() {
50322 var k0 = _transform.k, k1 = typeof k === "function" ? k.apply(this, arguments) : k;
50326 zoom.scaleTo = function(selection2, k, p) {
50327 zoom.transform(selection2, function() {
50328 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;
50329 return constrain(translate(scale(t0, k1), p02, p1), e, translateExtent);
50332 zoom.translateBy = function(selection2, x, y) {
50333 zoom.transform(selection2, function() {
50334 return constrain(_transform.translate(
50335 typeof x === "function" ? x.apply(this, arguments) : x,
50336 typeof y === "function" ? y.apply(this, arguments) : y
50337 ), extent.apply(this, arguments), translateExtent);
50340 zoom.translateTo = function(selection2, x, y, p) {
50341 zoom.transform(selection2, function() {
50342 var e = extent.apply(this, arguments), t = _transform, p02 = !p ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p;
50343 return constrain(identity2.translate(p02[0], p02[1]).scale(t.k).translate(
50344 typeof x === "function" ? -x.apply(this, arguments) : -x,
50345 typeof y === "function" ? -y.apply(this, arguments) : -y
50346 ), e, translateExtent);
50349 function scale(transform2, k) {
50350 k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));
50351 return k === transform2.k ? transform2 : new Transform(k, transform2.x, transform2.y);
50353 function translate(transform2, p02, p1) {
50354 var x = p02[0] - p1[0] * transform2.k, y = p02[1] - p1[1] * transform2.k;
50355 return x === transform2.x && y === transform2.y ? transform2 : new Transform(transform2.k, x, y);
50357 function centroid(extent2) {
50358 return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
50360 function schedule(transition2, transform2, point2) {
50361 transition2.on("start.zoom", function() {
50362 gesture(this, arguments).start(null);
50363 }).on("interrupt.zoom end.zoom", function() {
50364 gesture(this, arguments).end(null);
50365 }).tween("zoom", function() {
50366 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));
50367 return function(t) {
50373 t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k);
50375 g.zoom(null, null, t);
50379 function gesture(that, args, clean2) {
50380 return !clean2 && _activeGesture || new Gesture(that, args);
50382 function Gesture(that, args) {
50386 this.extent = extent.apply(that, args);
50388 Gesture.prototype = {
50389 start: function(d3_event) {
50390 if (++this.active === 1) {
50391 _activeGesture = this;
50392 dispatch10.call("start", this, d3_event);
50396 zoom: function(d3_event, key, transform2) {
50397 if (this.mouse && key !== "mouse")
50398 this.mouse[1] = transform2.invert(this.mouse[0]);
50399 if (this.pointer0 && key !== "touch")
50400 this.pointer0[1] = transform2.invert(this.pointer0[0]);
50401 if (this.pointer1 && key !== "touch")
50402 this.pointer1[1] = transform2.invert(this.pointer1[0]);
50403 _transform = transform2;
50404 dispatch10.call("zoom", this, d3_event, key, transform2);
50407 end: function(d3_event) {
50408 if (--this.active === 0) {
50409 _activeGesture = null;
50410 dispatch10.call("end", this, d3_event);
50415 function wheeled(d3_event) {
50416 if (!filter2.apply(this, arguments))
50418 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);
50420 if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {
50421 g.mouse[1] = t.invert(g.mouse[0] = p);
50423 clearTimeout(g.wheel);
50425 g.mouse = [p, t.invert(p)];
50426 interrupt_default(this);
50429 d3_event.preventDefault();
50430 d3_event.stopImmediatePropagation();
50431 g.wheel = setTimeout(wheelidled, _wheelDelay);
50432 g.zoom(d3_event, "mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
50433 function wheelidled() {
50438 var _downPointerIDs = /* @__PURE__ */ new Set();
50439 var _pointerLocGetter;
50440 function pointerdown(d3_event) {
50441 _downPointerIDs.add(d3_event.pointerId);
50442 if (!filter2.apply(this, arguments))
50444 var g = gesture(this, arguments, _downPointerIDs.size === 1);
50446 d3_event.stopImmediatePropagation();
50447 _pointerLocGetter = utilFastMouse(this);
50448 var loc = _pointerLocGetter(d3_event);
50449 var p = [loc, _transform.invert(loc), d3_event.pointerId];
50453 } else if (!g.pointer1 && g.pointer0[2] !== p[2]) {
50457 interrupt_default(this);
50461 function pointermove(d3_event) {
50462 if (!_downPointerIDs.has(d3_event.pointerId))
50464 if (!_activeGesture || !_pointerLocGetter)
50466 var g = gesture(this, arguments);
50467 var isPointer0 = g.pointer0 && g.pointer0[2] === d3_event.pointerId;
50468 var isPointer1 = !isPointer0 && g.pointer1 && g.pointer1[2] === d3_event.pointerId;
50469 if ((isPointer0 || isPointer1) && "buttons" in d3_event && !d3_event.buttons) {
50471 _downPointerIDs.delete(g.pointer0[2]);
50473 _downPointerIDs.delete(g.pointer1[2]);
50477 d3_event.preventDefault();
50478 d3_event.stopImmediatePropagation();
50479 var loc = _pointerLocGetter(d3_event);
50482 g.pointer0[0] = loc;
50483 else if (isPointer1)
50484 g.pointer1[0] = loc;
50487 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;
50488 t = scale(t, Math.sqrt(dp / dl));
50489 p = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
50490 l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
50491 } else if (g.pointer0) {
50497 g.zoom(d3_event, "touch", constrain(translate(t, p, l), g.extent, translateExtent));
50499 function pointerup(d3_event) {
50500 if (!_downPointerIDs.has(d3_event.pointerId))
50502 _downPointerIDs.delete(d3_event.pointerId);
50503 if (!_activeGesture)
50505 var g = gesture(this, arguments);
50506 d3_event.stopImmediatePropagation();
50507 if (g.pointer0 && g.pointer0[2] === d3_event.pointerId)
50509 else if (g.pointer1 && g.pointer1[2] === d3_event.pointerId)
50511 if (g.pointer1 && !g.pointer0) {
50512 g.pointer0 = g.pointer1;
50516 g.pointer0[1] = _transform.invert(g.pointer0[0]);
50521 zoom.wheelDelta = function(_) {
50522 return arguments.length ? (wheelDelta = utilFunctor(+_), zoom) : wheelDelta;
50524 zoom.filter = function(_) {
50525 return arguments.length ? (filter2 = utilFunctor(!!_), zoom) : filter2;
50527 zoom.extent = function(_) {
50528 return arguments.length ? (extent = utilFunctor([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
50530 zoom.scaleExtent = function(_) {
50531 return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];
50533 zoom.translateExtent = function(_) {
50534 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]]];
50536 zoom.constrain = function(_) {
50537 return arguments.length ? (constrain = _, zoom) : constrain;
50539 zoom.interpolate = function(_) {
50540 return arguments.length ? (interpolate = _, zoom) : interpolate;
50542 zoom._transform = function(_) {
50543 return arguments.length ? (_transform = _, zoom) : _transform;
50545 return utilRebind(zoom, dispatch10, "on");
50548 // modules/util/double_up.js
50549 function utilDoubleUp() {
50550 var dispatch10 = dispatch_default("doubleUp");
50551 var _maxTimespan = 500;
50552 var _maxDistance = 20;
50554 function pointerIsValidFor(loc) {
50555 return new Date().getTime() - _pointer.startTime <= _maxTimespan && geoVecLength(_pointer.startLoc, loc) <= _maxDistance;
50557 function pointerdown(d3_event) {
50558 if (d3_event.ctrlKey || d3_event.button === 2)
50560 var loc = [d3_event.clientX, d3_event.clientY];
50561 if (_pointer && !pointerIsValidFor(loc)) {
50567 startTime: new Date().getTime(),
50569 pointerId: d3_event.pointerId
50572 _pointer.pointerId = d3_event.pointerId;
50575 function pointerup(d3_event) {
50576 if (d3_event.ctrlKey || d3_event.button === 2)
50578 if (!_pointer || _pointer.pointerId !== d3_event.pointerId)
50580 _pointer.upCount += 1;
50581 if (_pointer.upCount === 2) {
50582 var loc = [d3_event.clientX, d3_event.clientY];
50583 if (pointerIsValidFor(loc)) {
50584 var locInThis = utilFastMouse(this)(d3_event);
50585 dispatch10.call("doubleUp", this, d3_event, locInThis);
50590 function doubleUp(selection2) {
50591 if ("PointerEvent" in window) {
50592 selection2.on("pointerdown.doubleUp", pointerdown).on("pointerup.doubleUp", pointerup);
50594 selection2.on("dblclick.doubleUp", function(d3_event) {
50595 dispatch10.call("doubleUp", this, d3_event, utilFastMouse(this)(d3_event));
50599 doubleUp.off = function(selection2) {
50600 selection2.on("pointerdown.doubleUp", null).on("pointerup.doubleUp", null).on("dblclick.doubleUp", null);
50602 return utilRebind(doubleUp, dispatch10, "on");
50605 // modules/renderer/map.js
50606 var TILESIZE = 256;
50609 var kMin = geoZoomToScale(minZoom2, TILESIZE);
50610 var kMax = geoZoomToScale(maxZoom, TILESIZE);
50611 function clamp(num, min3, max3) {
50612 return Math.max(min3, Math.min(num, max3));
50614 function rendererMap(context) {
50615 var dispatch10 = dispatch_default(
50618 "crossEditableZoom",
50620 "changeHighlighting",
50623 var projection2 = context.projection;
50624 var curtainProjection = context.curtainProjection;
50632 var _selection = select_default2(null);
50633 var supersurface = select_default2(null);
50634 var wrapper = select_default2(null);
50635 var surface = select_default2(null);
50636 var _dimensions = [1, 1];
50637 var _dblClickZoomEnabled = true;
50638 var _redrawEnabled = true;
50639 var _gestureTransformStart;
50640 var _transformStart = projection2.transform();
50641 var _transformLast;
50642 var _isTransformed = false;
50644 var _getMouseCoords;
50645 var _lastPointerEvent;
50646 var _lastWithinEditableZoom;
50647 var _pointerDown = false;
50648 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
50649 var _zoomerPannerFunction = "PointerEvent" in window ? utilZoomPan : zoom_default2;
50650 var _zoomerPanner = _zoomerPannerFunction().scaleExtent([kMin, kMax]).interpolate(value_default).filter(zoomEventFilter).on("zoom.map", zoomPan).on("start.map", function(d3_event) {
50651 _pointerDown = d3_event && (d3_event.type === "pointerdown" || d3_event.sourceEvent && d3_event.sourceEvent.type === "pointerdown");
50652 }).on("end.map", function() {
50653 _pointerDown = false;
50655 var _doubleUpHandler = utilDoubleUp();
50656 var scheduleRedraw = throttle_default(redraw, 750);
50657 function cancelPendingRedraw() {
50658 scheduleRedraw.cancel();
50660 function map2(selection2) {
50661 _selection = selection2;
50662 context.on("change.map", immediateRedraw);
50663 var osm = context.connection();
50665 osm.on("change.map", immediateRedraw);
50667 function didUndoOrRedo(targetTransform) {
50668 var mode = context.mode().id;
50669 if (mode !== "browse" && mode !== "select")
50671 if (targetTransform) {
50672 map2.transformEase(targetTransform);
50675 context.history().on("merge.map", function() {
50677 }).on("change.map", immediateRedraw).on("undone.map", function(stack, fromStack) {
50678 didUndoOrRedo(fromStack.transform);
50679 }).on("redone.map", function(stack) {
50680 didUndoOrRedo(stack.transform);
50682 context.background().on("change.map", immediateRedraw);
50683 context.features().on("redraw.map", immediateRedraw);
50684 drawLayers.on("change.map", function() {
50685 context.background().updateImagery();
50688 selection2.on("wheel.map mousewheel.map", function(d3_event) {
50689 d3_event.preventDefault();
50690 }).call(_zoomerPanner).call(_zoomerPanner.transform, projection2.transform()).on("dblclick.zoom", null);
50691 map2.supersurface = supersurface = selection2.append("div").attr("class", "supersurface").call(utilSetTransform, 0, 0);
50692 wrapper = supersurface.append("div").attr("class", "layer layer-data");
50693 map2.surface = surface = wrapper.call(drawLayers).selectAll(".surface");
50694 surface.call(drawLabels.observe).call(_doubleUpHandler).on(_pointerPrefix + "down.zoom", function(d3_event) {
50695 _lastPointerEvent = d3_event;
50696 if (d3_event.button === 2) {
50697 d3_event.stopPropagation();
50699 }, true).on(_pointerPrefix + "up.zoom", function(d3_event) {
50700 _lastPointerEvent = d3_event;
50701 if (resetTransform()) {
50704 }).on(_pointerPrefix + "move.map", function(d3_event) {
50705 _lastPointerEvent = d3_event;
50706 }).on(_pointerPrefix + "over.vertices", function(d3_event) {
50707 if (map2.editableDataEnabled() && !_isTransformed) {
50708 var hover = d3_event.target.__data__;
50709 surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
50710 dispatch10.call("drawn", this, { full: false });
50712 }).on(_pointerPrefix + "out.vertices", function(d3_event) {
50713 if (map2.editableDataEnabled() && !_isTransformed) {
50714 var hover = d3_event.relatedTarget && d3_event.relatedTarget.__data__;
50715 surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
50716 dispatch10.call("drawn", this, { full: false });
50719 var detected = utilDetect();
50720 if ("GestureEvent" in window && !detected.isMobileWebKit) {
50721 surface.on("gesturestart.surface", function(d3_event) {
50722 d3_event.preventDefault();
50723 _gestureTransformStart = projection2.transform();
50724 }).on("gesturechange.surface", gestureChange);
50727 _doubleUpHandler.on("doubleUp.map", function(d3_event, p02) {
50728 if (!_dblClickZoomEnabled)
50730 if (typeof d3_event.target.__data__ === "object" && !select_default2(d3_event.target).classed("fill"))
50732 var zoomOut2 = d3_event.shiftKey;
50733 var t = projection2.transform();
50734 var p1 = t.invert(p02);
50735 t = t.scale(zoomOut2 ? 0.5 : 2);
50736 t.x = p02[0] - p1[0] * t.k;
50737 t.y = p02[1] - p1[1] * t.k;
50738 map2.transformEase(t);
50740 context.on("enter.map", function() {
50741 if (!map2.editableDataEnabled(true))
50743 if (_isTransformed)
50745 var graph = context.graph();
50746 var selectedAndParents = {};
50747 context.selectedIDs().forEach(function(id2) {
50748 var entity = graph.hasEntity(id2);
50750 selectedAndParents[entity.id] = entity;
50751 if (entity.type === "node") {
50752 graph.parentWays(entity).forEach(function(parent) {
50753 selectedAndParents[parent.id] = parent;
50758 var data = Object.values(selectedAndParents);
50759 var filter2 = function(d) {
50760 return d.id in selectedAndParents;
50762 data = context.features().filter(data, graph);
50763 surface.call(drawVertices.drawSelected, graph, map2.extent()).call(drawLines, graph, data, filter2).call(drawAreas, graph, data, filter2).call(drawMidpoints, graph, data, filter2, map2.trimmedExtent());
50764 dispatch10.call("drawn", this, { full: false });
50767 map2.dimensions(utilGetDimensions(selection2));
50769 function zoomEventFilter(d3_event) {
50770 if (d3_event.type === "mousedown") {
50771 var hasOrphan = false;
50772 var listeners = window.__on;
50773 for (var i2 = 0; i2 < listeners.length; i2++) {
50774 var listener = listeners[i2];
50775 if (listener.name === "zoom" && listener.type === "mouseup") {
50781 var event = window.CustomEvent;
50783 event = new event("mouseup");
50785 event = window.document.createEvent("Event");
50786 event.initEvent("mouseup", false, false);
50788 event.view = window;
50789 window.dispatchEvent(event);
50792 return d3_event.button !== 2;
50794 function pxCenter() {
50795 return [_dimensions[0] / 2, _dimensions[1] / 2];
50797 function drawEditable(difference, extent) {
50798 var mode = context.mode();
50799 var graph = context.graph();
50800 var features2 = context.features();
50801 var all = context.history().intersects(map2.extent());
50802 var fullRedraw = false;
50806 var applyFeatureLayerFilters = true;
50807 if (map2.isInWideSelection()) {
50809 utilEntityAndDeepMemberIDs(mode.selectedIDs(), context.graph()).forEach(function(id2) {
50810 var entity = context.hasEntity(id2);
50815 filter2 = utilFunctor(true);
50816 applyFeatureLayerFilters = false;
50817 } else if (difference) {
50818 var complete = difference.complete(map2.extent());
50819 data = Object.values(complete).filter(Boolean);
50820 set3 = new Set(Object.keys(complete));
50821 filter2 = function(d) {
50822 return set3.has(d.id);
50824 features2.clear(data);
50826 if (features2.gatherStats(all, graph, _dimensions)) {
50830 data = context.history().intersects(map2.extent().intersection(extent));
50831 set3 = new Set(data.map(function(entity) {
50834 filter2 = function(d) {
50835 return set3.has(d.id);
50840 filter2 = utilFunctor(true);
50843 if (applyFeatureLayerFilters) {
50844 data = features2.filter(data, graph);
50846 context.features().resetStats();
50848 if (mode && mode.id === "select") {
50849 surface.call(drawVertices.drawSelected, graph, map2.extent());
50851 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);
50852 dispatch10.call("drawn", this, { full: true });
50854 map2.init = function() {
50855 drawLayers = svgLayers(projection2, context);
50856 drawPoints = svgPoints(projection2, context);
50857 drawVertices = svgVertices(projection2, context);
50858 drawLines = svgLines(projection2, context);
50859 drawAreas = svgAreas(projection2, context);
50860 drawMidpoints = svgMidpoints(projection2, context);
50861 drawLabels = svgLabels(projection2, context);
50863 function editOff() {
50864 context.features().resetStats();
50865 surface.selectAll(".layer-osm *").remove();
50866 surface.selectAll(".layer-touch:not(.markers) *").remove();
50870 "select-note": true,
50871 "select-data": true,
50872 "select-error": true
50874 var mode = context.mode();
50875 if (mode && !allowed[mode.id]) {
50876 context.enter(modeBrowse(context));
50878 dispatch10.call("drawn", this, { full: true });
50880 function gestureChange(d3_event) {
50882 e.preventDefault();
50886 clientX: e.clientX,
50887 clientY: e.clientY,
50888 screenX: e.screenX,
50889 screenY: e.screenY,
50893 var e22 = new WheelEvent("wheel", props);
50894 e22._scale = e.scale;
50895 e22._rotation = e.rotation;
50896 _selection.node().dispatchEvent(e22);
50898 function zoomPan(event, key, transform2) {
50899 var source = event && event.sourceEvent || event;
50900 var eventTransform = transform2 || event && event.transform;
50901 var x = eventTransform.x;
50902 var y = eventTransform.y;
50903 var k = eventTransform.k;
50904 if (source && source.type === "wheel") {
50907 var detected = utilDetect();
50908 var dX = source.deltaX;
50909 var dY = source.deltaY;
50914 if (source.deltaMode === 1) {
50915 var lines = Math.abs(source.deltaY);
50916 var sign2 = source.deltaY > 0 ? 1 : -1;
50917 dY = sign2 * clamp(
50918 Math.exp((lines - 1) * 0.75) * 4.000244140625,
50922 if (detected.os !== "mac") {
50925 t0 = _isTransformed ? _transformLast : _transformStart;
50926 p02 = _getMouseCoords(source);
50927 p1 = t0.invert(p02);
50928 k2 = t0.k * Math.pow(2, -dY / 500);
50929 k2 = clamp(k2, kMin, kMax);
50930 x2 = p02[0] - p1[0] * k2;
50931 y2 = p02[1] - p1[1] * k2;
50932 } else if (source._scale) {
50933 t0 = _gestureTransformStart;
50934 p02 = _getMouseCoords(source);
50935 p1 = t0.invert(p02);
50936 k2 = t0.k * source._scale;
50937 k2 = clamp(k2, kMin, kMax);
50938 x2 = p02[0] - p1[0] * k2;
50939 y2 = p02[1] - p1[1] * k2;
50940 } else if (source.ctrlKey && !isInteger(dY)) {
50942 t0 = _isTransformed ? _transformLast : _transformStart;
50943 p02 = _getMouseCoords(source);
50944 p1 = t0.invert(p02);
50945 k2 = t0.k * Math.pow(2, -dY / 500);
50946 k2 = clamp(k2, kMin, kMax);
50947 x2 = p02[0] - p1[0] * k2;
50948 y2 = p02[1] - p1[1] * k2;
50949 } else if ((source.altKey || source.shiftKey) && isInteger(dY)) {
50950 t0 = _isTransformed ? _transformLast : _transformStart;
50951 p02 = _getMouseCoords(source);
50952 p1 = t0.invert(p02);
50953 k2 = t0.k * Math.pow(2, -dY / 500);
50954 k2 = clamp(k2, kMin, kMax);
50955 x2 = p02[0] - p1[0] * k2;
50956 y2 = p02[1] - p1[1] * k2;
50957 } else if (detected.os === "mac" && detected.browser !== "Firefox" && !source.ctrlKey && isInteger(dX) && isInteger(dY)) {
50958 p1 = projection2.translate();
50961 k2 = projection2.scale();
50962 k2 = clamp(k2, kMin, kMax);
50964 if (x2 !== x || y2 !== y || k2 !== k) {
50968 eventTransform = identity2.translate(x2, y2).scale(k2);
50969 if (_zoomerPanner._transform) {
50970 _zoomerPanner._transform(eventTransform);
50972 _selection.node().__zoom = eventTransform;
50976 if (_transformStart.x === x && _transformStart.y === y && _transformStart.k === k) {
50979 if (geoScaleToZoom(k, TILESIZE) < _minzoom) {
50980 surface.interrupt();
50981 dispatch10.call("hitMinZoom", this, map2);
50982 setCenterZoom(map2.center(), context.minEditableZoom(), 0, true);
50984 dispatch10.call("move", this, map2);
50987 projection2.transform(eventTransform);
50988 var withinEditableZoom = map2.withinEditableZoom();
50989 if (_lastWithinEditableZoom !== withinEditableZoom) {
50990 if (_lastWithinEditableZoom !== void 0) {
50991 dispatch10.call("crossEditableZoom", this, withinEditableZoom);
50993 _lastWithinEditableZoom = withinEditableZoom;
50995 var scale = k / _transformStart.k;
50996 var tX = (x / scale - _transformStart.x) * scale;
50997 var tY = (y / scale - _transformStart.y) * scale;
50998 if (context.inIntro()) {
50999 curtainProjection.transform({
51006 _lastPointerEvent = event;
51008 _isTransformed = true;
51009 _transformLast = eventTransform;
51010 utilSetTransform(supersurface, tX, tY, scale);
51012 dispatch10.call("move", this, map2);
51013 function isInteger(val) {
51014 return typeof val === "number" && isFinite(val) && Math.floor(val) === val;
51017 function resetTransform() {
51018 if (!_isTransformed)
51020 utilSetTransform(supersurface, 0, 0);
51021 _isTransformed = false;
51022 if (context.inIntro()) {
51023 curtainProjection.transform(projection2.transform());
51027 function redraw(difference, extent) {
51028 if (surface.empty() || !_redrawEnabled)
51030 if (resetTransform()) {
51031 difference = extent = void 0;
51033 var zoom = map2.zoom();
51034 var z = String(~~zoom);
51035 if (surface.attr("data-zoom") !== z) {
51036 surface.attr("data-zoom", z);
51038 var lat = map2.center()[1];
51039 var lowzoom = linear3().domain([-60, 0, 60]).range([17, 18.5, 17]).clamp(true);
51040 surface.classed("low-zoom", zoom <= lowzoom(lat));
51042 supersurface.call(context.background());
51043 wrapper.call(drawLayers);
51045 if (map2.editableDataEnabled() || map2.isInWideSelection()) {
51046 context.loadTiles(projection2);
51047 drawEditable(difference, extent);
51051 _transformStart = projection2.transform();
51054 var immediateRedraw = function(difference, extent) {
51055 if (!difference && !extent)
51056 cancelPendingRedraw();
51057 redraw(difference, extent);
51059 map2.lastPointerEvent = function() {
51060 return _lastPointerEvent;
51062 map2.mouse = function(d3_event) {
51063 var event = d3_event || _lastPointerEvent;
51066 while (s = event.sourceEvent) {
51069 return _getMouseCoords(event);
51073 map2.mouseCoordinates = function() {
51074 var coord2 = map2.mouse() || pxCenter();
51075 return projection2.invert(coord2);
51077 map2.dblclickZoomEnable = function(val) {
51078 if (!arguments.length)
51079 return _dblClickZoomEnabled;
51080 _dblClickZoomEnabled = val;
51083 map2.redrawEnable = function(val) {
51084 if (!arguments.length)
51085 return _redrawEnabled;
51086 _redrawEnabled = val;
51089 map2.isTransformed = function() {
51090 return _isTransformed;
51092 function setTransform(t2, duration, force) {
51093 var t = projection2.transform();
51094 if (!force && t2.k === t.k && t2.x === t.x && t2.y === t.y)
51097 _selection.transition().duration(duration).on("start", function() {
51099 }).call(_zoomerPanner.transform, identity2.translate(t2.x, t2.y).scale(t2.k));
51101 projection2.transform(t2);
51102 _transformStart = t2;
51103 _selection.call(_zoomerPanner.transform, _transformStart);
51107 function setCenterZoom(loc2, z2, duration, force) {
51108 var c = map2.center();
51109 var z = map2.zoom();
51110 if (loc2[0] === c[0] && loc2[1] === c[1] && z2 === z && !force)
51112 var proj = geoRawMercator().transform(projection2.transform());
51113 var k2 = clamp(geoZoomToScale(z2, TILESIZE), kMin, kMax);
51115 var t = proj.translate();
51116 var point2 = proj(loc2);
51117 var center = pxCenter();
51118 t[0] += center[0] - point2[0];
51119 t[1] += center[1] - point2[1];
51120 return setTransform(identity2.translate(t[0], t[1]).scale(k2), duration, force);
51122 map2.pan = function(delta, duration) {
51123 var t = projection2.translate();
51124 var k = projection2.scale();
51128 _selection.transition().duration(duration).on("start", function() {
51130 }).call(_zoomerPanner.transform, identity2.translate(t[0], t[1]).scale(k));
51132 projection2.translate(t);
51133 _transformStart = projection2.transform();
51134 _selection.call(_zoomerPanner.transform, _transformStart);
51135 dispatch10.call("move", this, map2);
51140 map2.dimensions = function(val) {
51141 if (!arguments.length)
51142 return _dimensions;
51144 drawLayers.dimensions(_dimensions);
51145 context.background().dimensions(_dimensions);
51146 projection2.clipExtent([[0, 0], _dimensions]);
51147 _getMouseCoords = utilFastMouse(supersurface.node());
51151 function zoomIn(delta) {
51152 setCenterZoom(map2.center(), ~~map2.zoom() + delta, 250, true);
51154 function zoomOut(delta) {
51155 setCenterZoom(map2.center(), ~~map2.zoom() - delta, 250, true);
51157 map2.zoomIn = function() {
51160 map2.zoomInFurther = function() {
51163 map2.canZoomIn = function() {
51164 return map2.zoom() < maxZoom;
51166 map2.zoomOut = function() {
51169 map2.zoomOutFurther = function() {
51172 map2.canZoomOut = function() {
51173 return map2.zoom() > minZoom2;
51175 map2.center = function(loc2) {
51176 if (!arguments.length) {
51177 return projection2.invert(pxCenter());
51179 if (setCenterZoom(loc2, map2.zoom())) {
51180 dispatch10.call("move", this, map2);
51185 map2.unobscuredCenterZoomEase = function(loc, zoom) {
51186 var offset = map2.unobscuredOffsetPx();
51187 var proj = geoRawMercator().transform(projection2.transform());
51188 proj.scale(geoZoomToScale(zoom, TILESIZE));
51189 var locPx = proj(loc);
51190 var offsetLocPx = [locPx[0] + offset[0], locPx[1] + offset[1]];
51191 var offsetLoc = proj.invert(offsetLocPx);
51192 map2.centerZoomEase(offsetLoc, zoom);
51194 map2.unobscuredOffsetPx = function() {
51195 var openPane = context.container().select(".map-panes .map-pane.shown");
51196 if (!openPane.empty()) {
51197 return [openPane.node().offsetWidth / 2, 0];
51201 map2.zoom = function(z2) {
51202 if (!arguments.length) {
51203 return Math.max(geoScaleToZoom(projection2.scale(), TILESIZE), 0);
51205 if (z2 < _minzoom) {
51206 surface.interrupt();
51207 dispatch10.call("hitMinZoom", this, map2);
51208 z2 = context.minEditableZoom();
51210 if (setCenterZoom(map2.center(), z2)) {
51211 dispatch10.call("move", this, map2);
51216 map2.centerZoom = function(loc2, z2) {
51217 if (setCenterZoom(loc2, z2)) {
51218 dispatch10.call("move", this, map2);
51223 map2.zoomTo = function(entity) {
51224 var extent = entity.extent(context.graph());
51225 if (!isFinite(extent.area()))
51227 var z2 = clamp(map2.trimmedExtentZoom(extent), 0, 20);
51228 return map2.centerZoom(extent.center(), z2);
51230 map2.centerEase = function(loc2, duration) {
51231 duration = duration || 250;
51232 setCenterZoom(loc2, map2.zoom(), duration);
51235 map2.zoomEase = function(z2, duration) {
51236 duration = duration || 250;
51237 setCenterZoom(map2.center(), z2, duration, false);
51240 map2.centerZoomEase = function(loc2, z2, duration) {
51241 duration = duration || 250;
51242 setCenterZoom(loc2, z2, duration, false);
51245 map2.transformEase = function(t2, duration) {
51246 duration = duration || 250;
51247 setTransform(t2, duration, false);
51250 map2.zoomToEase = function(obj, duration) {
51252 if (Array.isArray(obj)) {
51253 obj.forEach(function(entity) {
51254 var entityExtent = entity.extent(context.graph());
51256 extent = entityExtent;
51258 extent = extent.extend(entityExtent);
51262 extent = obj.extent(context.graph());
51264 if (!isFinite(extent.area()))
51266 var z2 = clamp(map2.trimmedExtentZoom(extent), 0, 20);
51267 return map2.centerZoomEase(extent.center(), z2, duration);
51269 map2.startEase = function() {
51270 utilBindOnce(surface, _pointerPrefix + "down.ease", function() {
51275 map2.cancelEase = function() {
51276 _selection.interrupt();
51279 map2.extent = function(val) {
51280 if (!arguments.length) {
51281 return new geoExtent(
51282 projection2.invert([0, _dimensions[1]]),
51283 projection2.invert([_dimensions[0], 0])
51286 var extent = geoExtent(val);
51287 map2.centerZoom(extent.center(), map2.extentZoom(extent));
51290 map2.trimmedExtent = function(val) {
51291 if (!arguments.length) {
51295 return new geoExtent(
51296 projection2.invert([pad2, _dimensions[1] - footerY - pad2]),
51297 projection2.invert([_dimensions[0] - pad2, headerY + pad2])
51300 var extent = geoExtent(val);
51301 map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
51304 function calcExtentZoom(extent, dim) {
51305 var tl = projection2([extent[0][0], extent[1][1]]);
51306 var br = projection2([extent[1][0], extent[0][1]]);
51307 var hFactor = (br[0] - tl[0]) / dim[0];
51308 var vFactor = (br[1] - tl[1]) / dim[1];
51309 var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
51310 var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
51311 var newZoom = map2.zoom() - Math.max(hZoomDiff, vZoomDiff);
51314 map2.extentZoom = function(val) {
51315 return calcExtentZoom(geoExtent(val), _dimensions);
51317 map2.trimmedExtentZoom = function(val) {
51320 var trimmed = [_dimensions[0] - trimX, _dimensions[1] - trimY];
51321 return calcExtentZoom(geoExtent(val), trimmed);
51323 map2.withinEditableZoom = function() {
51324 return map2.zoom() >= context.minEditableZoom();
51326 map2.isInWideSelection = function() {
51327 return !map2.withinEditableZoom() && context.selectedIDs().length;
51329 map2.editableDataEnabled = function(skipZoomCheck) {
51330 var layer = context.layers().layer("osm");
51331 if (!layer || !layer.enabled())
51333 return skipZoomCheck || map2.withinEditableZoom();
51335 map2.notesEditable = function() {
51336 var layer = context.layers().layer("notes");
51337 if (!layer || !layer.enabled())
51339 return map2.withinEditableZoom();
51341 map2.minzoom = function(val) {
51342 if (!arguments.length)
51347 map2.toggleHighlightEdited = function() {
51348 surface.classed("highlight-edited", !surface.classed("highlight-edited"));
51350 dispatch10.call("changeHighlighting", this);
51352 map2.areaFillOptions = ["wireframe", "partial", "full"];
51353 map2.activeAreaFill = function(val) {
51354 if (!arguments.length)
51355 return corePreferences("area-fill") || "partial";
51356 corePreferences("area-fill", val);
51357 if (val !== "wireframe") {
51358 corePreferences("area-fill-toggle", val);
51362 dispatch10.call("changeAreaFill", this);
51365 map2.toggleWireframe = function() {
51366 var activeFill = map2.activeAreaFill();
51367 if (activeFill === "wireframe") {
51368 activeFill = corePreferences("area-fill-toggle") || "partial";
51370 activeFill = "wireframe";
51372 map2.activeAreaFill(activeFill);
51374 function updateAreaFill() {
51375 var activeFill = map2.activeAreaFill();
51376 map2.areaFillOptions.forEach(function(opt) {
51377 surface.classed("fill-" + opt, Boolean(opt === activeFill));
51380 map2.layers = () => drawLayers;
51381 map2.doubleUpHandler = function() {
51382 return _doubleUpHandler;
51384 return utilRebind(map2, dispatch10, "on");
51387 // modules/renderer/photos.js
51388 function rendererPhotos(context) {
51389 var dispatch10 = dispatch_default("change");
51390 var _layerIDs = ["streetside", "mapillary", "mapillary-map-features", "mapillary-signs", "kartaview"];
51391 var _allPhotoTypes = ["flat", "panoramic"];
51392 var _shownPhotoTypes = _allPhotoTypes.slice();
51393 var _dateFilters = ["fromDate", "toDate"];
51397 function photos() {
51399 function updateStorage() {
51402 var hash = utilStringQs(window.location.hash);
51403 var enabled = context.layers().all().filter(function(d) {
51404 return _layerIDs.indexOf(d.id) !== -1 && d.layer && d.layer.supported() && d.layer.enabled();
51405 }).map(function(d) {
51408 if (enabled.length) {
51409 hash.photo_overlay = enabled.join(",");
51411 delete hash.photo_overlay;
51413 window.location.replace("#" + utilQsString(hash, true));
51415 photos.overlayLayerIDs = function() {
51418 photos.allPhotoTypes = function() {
51419 return _allPhotoTypes;
51421 photos.dateFilters = function() {
51422 return _dateFilters;
51424 photos.dateFilterValue = function(val) {
51425 return val === _dateFilters[0] ? _fromDate : _toDate;
51427 photos.setDateFilter = function(type3, val, updateUrl) {
51428 var date = val && new Date(val);
51429 if (date && !isNaN(date)) {
51430 val = date.toISOString().slice(0, 10);
51434 if (type3 === _dateFilters[0]) {
51436 if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
51437 _toDate = _fromDate;
51440 if (type3 === _dateFilters[1]) {
51442 if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
51443 _fromDate = _toDate;
51446 dispatch10.call("change", this);
51449 if (_fromDate || _toDate) {
51450 rangeString = (_fromDate || "") + "_" + (_toDate || "");
51452 setUrlFilterValue("photo_dates", rangeString);
51455 photos.setUsernameFilter = function(val, updateUrl) {
51456 if (val && typeof val === "string")
51457 val = val.replace(/;/g, ",").split(",");
51459 val = val.map((d) => d.trim()).filter(Boolean);
51465 dispatch10.call("change", this);
51469 hashString = _usernames.join(",");
51471 setUrlFilterValue("photo_username", hashString);
51474 function setUrlFilterValue(property, val) {
51475 if (!window.mocha) {
51476 var hash = utilStringQs(window.location.hash);
51478 if (hash[property] === val)
51480 hash[property] = val;
51482 if (!(property in hash))
51484 delete hash[property];
51486 window.location.replace("#" + utilQsString(hash, true));
51489 function showsLayer(id2) {
51490 var layer = context.layers().layer(id2);
51491 return layer && layer.supported() && layer.enabled();
51493 photos.shouldFilterByDate = function() {
51494 return showsLayer("mapillary") || showsLayer("kartaview") || showsLayer("streetside");
51496 photos.shouldFilterByPhotoType = function() {
51497 return showsLayer("mapillary") || showsLayer("streetside") && showsLayer("kartaview");
51499 photos.shouldFilterByUsername = function() {
51500 return !showsLayer("mapillary") && showsLayer("kartaview") && !showsLayer("streetside");
51502 photos.showsPhotoType = function(val) {
51503 if (!photos.shouldFilterByPhotoType())
51505 return _shownPhotoTypes.indexOf(val) !== -1;
51507 photos.showsFlat = function() {
51508 return photos.showsPhotoType("flat");
51510 photos.showsPanoramic = function() {
51511 return photos.showsPhotoType("panoramic");
51513 photos.fromDate = function() {
51516 photos.toDate = function() {
51519 photos.togglePhotoType = function(val) {
51520 var index = _shownPhotoTypes.indexOf(val);
51521 if (index !== -1) {
51522 _shownPhotoTypes.splice(index, 1);
51524 _shownPhotoTypes.push(val);
51526 dispatch10.call("change", this);
51529 photos.usernames = function() {
51532 photos.init = function() {
51533 var hash = utilStringQs(window.location.hash);
51534 if (hash.photo_dates) {
51535 var parts = /^(.*)[–_](.*)$/g.exec(hash.photo_dates.trim());
51536 this.setDateFilter("fromDate", parts && parts.length >= 2 && parts[1], false);
51537 this.setDateFilter("toDate", parts && parts.length >= 3 && parts[2], false);
51539 if (hash.photo_username) {
51540 this.setUsernameFilter(hash.photo_username, false);
51542 if (hash.photo_overlay) {
51543 var hashOverlayIDs = hash.photo_overlay.replace(/;/g, ",").split(",");
51544 hashOverlayIDs.forEach(function(id2) {
51545 if (id2 === "openstreetcam")
51547 var layer2 = _layerIDs.indexOf(id2) !== -1 && context.layers().layer(id2);
51548 if (layer2 && !layer2.enabled())
51549 layer2.enabled(true);
51553 var photoIds = hash.photo.replace(/;/g, ",").split(",");
51554 var photoId = photoIds.length && photoIds[0].trim();
51555 var results = /(.*)\/(.*)/g.exec(photoId);
51556 if (results && results.length >= 3) {
51557 var serviceId = results[1];
51558 if (serviceId === "openstreetcam")
51559 serviceId = "kartaview";
51560 var photoKey = results[2];
51561 var service = services[serviceId];
51562 if (service && service.ensureViewerLoaded) {
51563 var layer = _layerIDs.indexOf(serviceId) !== -1 && context.layers().layer(serviceId);
51564 if (layer && !layer.enabled())
51565 layer.enabled(true);
51566 var baselineTime = Date.now();
51567 service.on("loadedImages.rendererPhotos", function() {
51568 if (Date.now() - baselineTime > 45e3) {
51569 service.on("loadedImages.rendererPhotos", null);
51572 if (!service.cachedImage(photoKey))
51574 service.on("loadedImages.rendererPhotos", null);
51575 service.ensureViewerLoaded(context).then(function() {
51576 service.selectImage(context, photoKey).showViewer(context);
51582 context.layers().on("change.rendererPhotos", updateStorage);
51584 return utilRebind(photos, dispatch10, "on");
51587 // modules/ui/account.js
51588 function uiAccount(context) {
51589 const osm = context.connection();
51590 function updateUserDetails(selection2) {
51593 if (!osm.authenticated()) {
51594 render(selection2, null);
51596 osm.userDetails((err, user) => render(selection2, user));
51599 function render(selection2, user) {
51600 let userInfo = selection2.select(".userInfo");
51601 let loginLogout = selection2.select(".loginLogout");
51603 userInfo.html("").classed("hide", false);
51604 let userLink = userInfo.append("a").attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
51605 if (user.image_url) {
51606 userLink.append("img").attr("class", "icon pre-text user-icon").attr("src", user.image_url);
51608 userLink.call(svgIcon("#iD-icon-avatar", "pre-text light"));
51610 userLink.append("span").attr("class", "label").html(user.display_name);
51611 loginLogout.classed("hide", false).select("a").text(_t("logout")).on("click", (e) => {
51612 e.preventDefault();
51617 userInfo.html("").classed("hide", true);
51618 loginLogout.classed("hide", false).select("a").text(_t("login")).on("click", (e) => {
51619 e.preventDefault();
51620 osm.authenticate();
51624 function tryLogout() {
51627 const url = osm.getUrlRoot() + "/logout?referer=%2Flogin";
51633 ["left", window.screen.width / 2 - w / 2],
51634 ["top", window.screen.height / 2 - h / 2]
51635 ].map((x) => x.join("=")).join(",");
51636 window.open(url, "_blank", settings);
51638 return function(selection2) {
51641 selection2.append("li").attr("class", "userInfo").classed("hide", true);
51642 selection2.append("li").attr("class", "loginLogout").classed("hide", true).append("a").attr("href", "#");
51643 osm.on("change.account", () => updateUserDetails(selection2));
51644 updateUserDetails(selection2);
51648 // modules/ui/attribution.js
51649 function uiAttribution(context) {
51650 let _selection = select_default2(null);
51651 function render(selection2, data, klass) {
51652 let div = selection2.selectAll(`.${klass}`).data([0]);
51653 div = div.enter().append("div").attr("class", klass).merge(div);
51654 let attributions = div.selectAll(".attribution").data(data, (d) => d.id);
51655 attributions.exit().remove();
51656 attributions = attributions.enter().append("span").attr("class", "attribution").each((d, i2, nodes) => {
51657 let attribution = select_default2(nodes[i2]);
51658 if (d.terms_html) {
51659 attribution.html(d.terms_html);
51663 attribution = attribution.append("a").attr("href", d.terms_url).attr("target", "_blank");
51665 const sourceID = d.id.replace(/\./g, "<TX_DOT>");
51666 const terms_text = _t(
51667 `imagery.${sourceID}.attribution.text`,
51668 { default: d.terms_text || d.id || d.name() }
51670 if (d.icon && !d.overlay) {
51671 attribution.append("img").attr("class", "source-image").attr("src", d.icon);
51673 attribution.append("span").attr("class", "attribution-text").text(terms_text);
51674 }).merge(attributions);
51675 let copyright = attributions.selectAll(".copyright-notice").data((d) => {
51676 let notice = d.copyrightNotices(context.map().zoom(), context.map().extent());
51677 return notice ? [notice] : [];
51679 copyright.exit().remove();
51680 copyright = copyright.enter().append("span").attr("class", "copyright-notice").merge(copyright);
51681 copyright.text(String);
51683 function update() {
51684 let baselayer = context.background().baseLayerSource();
51685 _selection.call(render, baselayer ? [baselayer] : [], "base-layer-attribution");
51686 const z = context.map().zoom();
51687 let overlays = context.background().overlayLayerSources() || [];
51688 _selection.call(render, overlays.filter((s) => s.validZoom(z)), "overlay-layer-attribution");
51690 return function(selection2) {
51691 _selection = selection2;
51692 context.background().on("change.attribution", update);
51693 context.map().on("move.attribution", throttle_default(update, 400, { leading: false }));
51698 // modules/ui/contributors.js
51699 function uiContributors(context) {
51700 var osm = context.connection(), debouncedUpdate = debounce_default(function() {
51702 }, 1e3), limit = 4, hidden = false, wrap2 = select_default2(null);
51703 function update() {
51706 var users = {}, entities = context.history().intersects(context.map().extent());
51707 entities.forEach(function(entity) {
51708 if (entity && entity.user)
51709 users[entity.user] = true;
51711 var u = Object.keys(users), subset = u.slice(0, u.length > limit ? limit - 1 : limit);
51712 wrap2.html("").call(svgIcon("#iD-icon-nearby", "pre-text light"));
51713 var userList = select_default2(document.createElement("span"));
51714 userList.selectAll().data(subset).enter().append("a").attr("class", "user-link").attr("href", function(d) {
51715 return osm.userURL(d);
51716 }).attr("target", "_blank").text(String);
51717 if (u.length > limit) {
51718 var count = select_default2(document.createElement("span"));
51719 var othersNum = u.length - limit + 1;
51720 count.append("a").attr("target", "_blank").attr("href", function() {
51721 return osm.changesetsURL(context.map().center(), context.map().zoom());
51722 }).text(othersNum);
51723 wrap2.append("span").html(_t.html("contributors.truncated_list", { n: othersNum, users: { html: userList.html() }, count: { html: count.html() } }));
51725 wrap2.append("span").html(_t.html("contributors.list", { users: { html: userList.html() } }));
51729 wrap2.transition().style("opacity", 0);
51730 } else if (hidden) {
51731 wrap2.transition().style("opacity", 1);
51734 return function(selection2) {
51737 wrap2 = selection2;
51739 osm.on("loaded.contributors", debouncedUpdate);
51740 context.map().on("move.contributors", debouncedUpdate);
51744 // modules/ui/popover.js
51745 var _popoverID = 0;
51746 function uiPopover(klass) {
51747 var _id = _popoverID++;
51748 var _anchorSelection = select_default2(null);
51749 var popover = function(selection2) {
51750 _anchorSelection = selection2;
51751 selection2.each(setup);
51753 var _animation = utilFunctor(false);
51754 var _placement = utilFunctor("top");
51755 var _alignment = utilFunctor("center");
51756 var _scrollContainer = utilFunctor(select_default2(null));
51758 var _displayType = utilFunctor("");
51759 var _hasArrow = utilFunctor(true);
51760 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
51761 popover.displayType = function(val) {
51762 if (arguments.length) {
51763 _displayType = utilFunctor(val);
51766 return _displayType;
51769 popover.hasArrow = function(val) {
51770 if (arguments.length) {
51771 _hasArrow = utilFunctor(val);
51777 popover.placement = function(val) {
51778 if (arguments.length) {
51779 _placement = utilFunctor(val);
51785 popover.alignment = function(val) {
51786 if (arguments.length) {
51787 _alignment = utilFunctor(val);
51793 popover.scrollContainer = function(val) {
51794 if (arguments.length) {
51795 _scrollContainer = utilFunctor(val);
51798 return _scrollContainer;
51801 popover.content = function(val) {
51802 if (arguments.length) {
51809 popover.isShown = function() {
51810 var popoverSelection = _anchorSelection.select(".popover-" + _id);
51811 return !popoverSelection.empty() && popoverSelection.classed("in");
51813 popover.show = function() {
51814 _anchorSelection.each(show);
51816 popover.updateContent = function() {
51817 _anchorSelection.each(updateContent);
51819 popover.hide = function() {
51820 _anchorSelection.each(hide);
51822 popover.toggle = function() {
51823 _anchorSelection.each(toggle);
51825 popover.destroy = function(selection2, selector) {
51826 selector = selector || ".popover-" + _id;
51827 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() {
51828 return this.getAttribute("data-original-title") || this.getAttribute("title");
51829 }).attr("data-original-title", null).selectAll(selector).remove();
51831 popover.destroyAny = function(selection2) {
51832 selection2.call(popover.destroy, ".popover");
51835 var anchor = select_default2(this);
51836 var animate = _animation.apply(this, arguments);
51837 var popoverSelection = anchor.selectAll(".popover-" + _id).data([0]);
51838 var enter = popoverSelection.enter().append("div").attr("class", "popover popover-" + _id + " " + (klass ? klass : "")).classed("arrowed", _hasArrow.apply(this, arguments));
51839 enter.append("div").attr("class", "popover-arrow");
51840 enter.append("div").attr("class", "popover-inner");
51841 popoverSelection = enter.merge(popoverSelection);
51843 popoverSelection.classed("fade", true);
51845 var display = _displayType.apply(this, arguments);
51846 if (display === "hover") {
51847 var _lastNonMouseEnterTime;
51848 anchor.on(_pointerPrefix + "enter.popover", function(d3_event) {
51849 if (d3_event.pointerType) {
51850 if (d3_event.pointerType !== "mouse") {
51851 _lastNonMouseEnterTime = d3_event.timeStamp;
51853 } else if (_lastNonMouseEnterTime && d3_event.timeStamp - _lastNonMouseEnterTime < 1500) {
51857 if (d3_event.buttons !== 0)
51859 show.apply(this, arguments);
51860 }).on(_pointerPrefix + "leave.popover", function() {
51861 hide.apply(this, arguments);
51862 }).on("focus.popover", function() {
51863 show.apply(this, arguments);
51864 }).on("blur.popover", function() {
51865 hide.apply(this, arguments);
51867 } else if (display === "clickFocus") {
51868 anchor.on(_pointerPrefix + "down.popover", function(d3_event) {
51869 d3_event.preventDefault();
51870 d3_event.stopPropagation();
51871 }).on(_pointerPrefix + "up.popover", function(d3_event) {
51872 d3_event.preventDefault();
51873 d3_event.stopPropagation();
51874 }).on("click.popover", toggle);
51875 popoverSelection.attr("tabindex", 0).on("blur.popover", function() {
51876 anchor.each(function() {
51877 hide.apply(this, arguments);
51883 var anchor = select_default2(this);
51884 var popoverSelection = anchor.selectAll(".popover-" + _id);
51885 if (popoverSelection.empty()) {
51886 anchor.call(popover.destroy);
51887 anchor.each(setup);
51888 popoverSelection = anchor.selectAll(".popover-" + _id);
51890 popoverSelection.classed("in", true);
51891 var displayType = _displayType.apply(this, arguments);
51892 if (displayType === "clickFocus") {
51893 anchor.classed("active", true);
51894 popoverSelection.node().focus();
51896 anchor.each(updateContent);
51898 function updateContent() {
51899 var anchor = select_default2(this);
51901 anchor.selectAll(".popover-" + _id + " > .popover-inner").call(_content.apply(this, arguments));
51903 updatePosition.apply(this, arguments);
51904 updatePosition.apply(this, arguments);
51905 updatePosition.apply(this, arguments);
51907 function updatePosition() {
51908 var anchor = select_default2(this);
51909 var popoverSelection = anchor.selectAll(".popover-" + _id);
51910 var scrollContainer = _scrollContainer && _scrollContainer.apply(this, arguments);
51911 var scrollNode = scrollContainer && !scrollContainer.empty() && scrollContainer.node();
51912 var scrollLeft = scrollNode ? scrollNode.scrollLeft : 0;
51913 var scrollTop = scrollNode ? scrollNode.scrollTop : 0;
51914 var placement = _placement.apply(this, arguments);
51915 popoverSelection.classed("left", false).classed("right", false).classed("top", false).classed("bottom", false).classed(placement, true);
51916 var alignment = _alignment.apply(this, arguments);
51917 var alignFactor = 0.5;
51918 if (alignment === "leading") {
51920 } else if (alignment === "trailing") {
51923 var anchorFrame = getFrame(anchor.node());
51924 var popoverFrame = getFrame(popoverSelection.node());
51926 switch (placement) {
51929 x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
51930 y: anchorFrame.y - popoverFrame.h
51935 x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
51936 y: anchorFrame.y + anchorFrame.h
51941 x: anchorFrame.x - popoverFrame.w,
51942 y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
51947 x: anchorFrame.x + anchorFrame.w,
51948 y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
51953 if (scrollNode && (placement === "top" || placement === "bottom")) {
51954 var initialPosX = position.x;
51955 if (position.x + popoverFrame.w > scrollNode.offsetWidth - 10) {
51956 position.x = scrollNode.offsetWidth - 10 - popoverFrame.w;
51957 } else if (position.x < 10) {
51960 var arrow = anchor.selectAll(".popover-" + _id + " > .popover-arrow");
51961 var arrowPosX = Math.min(Math.max(popoverFrame.w / 2 - (position.x - initialPosX), 10), popoverFrame.w - 10);
51962 arrow.style("left", ~~arrowPosX + "px");
51964 popoverSelection.style("left", ~~position.x + "px").style("top", ~~position.y + "px");
51966 popoverSelection.style("left", null).style("top", null);
51968 function getFrame(node) {
51969 var positionStyle = select_default2(node).style("position");
51970 if (positionStyle === "absolute" || positionStyle === "static") {
51972 x: node.offsetLeft - scrollLeft,
51973 y: node.offsetTop - scrollTop,
51974 w: node.offsetWidth,
51975 h: node.offsetHeight
51981 w: node.offsetWidth,
51982 h: node.offsetHeight
51988 var anchor = select_default2(this);
51989 if (_displayType.apply(this, arguments) === "clickFocus") {
51990 anchor.classed("active", false);
51992 anchor.selectAll(".popover-" + _id).classed("in", false);
51994 function toggle() {
51995 if (select_default2(this).select(".popover-" + _id).classed("in")) {
51996 hide.apply(this, arguments);
51998 show.apply(this, arguments);
52004 // modules/ui/tooltip.js
52005 function uiTooltip(klass) {
52006 var tooltip = uiPopover((klass || "") + " tooltip").displayType("hover");
52007 var _title = function() {
52008 var title = this.getAttribute("data-original-title");
52012 title = this.getAttribute("title");
52013 this.removeAttribute("title");
52014 this.setAttribute("data-original-title", title);
52018 var _heading = utilFunctor(null);
52019 var _keys = utilFunctor(null);
52020 tooltip.title = function(val) {
52021 if (!arguments.length)
52023 _title = utilFunctor(val);
52026 tooltip.heading = function(val) {
52027 if (!arguments.length)
52029 _heading = utilFunctor(val);
52032 tooltip.keys = function(val) {
52033 if (!arguments.length)
52035 _keys = utilFunctor(val);
52038 tooltip.content(function() {
52039 var heading = _heading.apply(this, arguments);
52040 var text2 = _title.apply(this, arguments);
52041 var keys = _keys.apply(this, arguments);
52042 var headingCallback = typeof heading === "function" ? heading : (s) => s.text(heading);
52043 var textCallback = typeof text2 === "function" ? text2 : (s) => s.text(text2);
52044 return function(selection2) {
52045 var headingSelect = selection2.selectAll(".tooltip-heading").data(heading ? [heading] : []);
52046 headingSelect.exit().remove();
52047 headingSelect.enter().append("div").attr("class", "tooltip-heading").merge(headingSelect).text("").call(headingCallback);
52048 var textSelect = selection2.selectAll(".tooltip-text").data(text2 ? [text2] : []);
52049 textSelect.exit().remove();
52050 textSelect.enter().append("div").attr("class", "tooltip-text").merge(textSelect).text("").call(textCallback);
52051 var keyhintWrap = selection2.selectAll(".keyhint-wrap").data(keys && keys.length ? [0] : []);
52052 keyhintWrap.exit().remove();
52053 var keyhintWrapEnter = keyhintWrap.enter().append("div").attr("class", "keyhint-wrap");
52054 keyhintWrapEnter.append("span").call(_t.append("tooltip_keyhint"));
52055 keyhintWrap = keyhintWrapEnter.merge(keyhintWrap);
52056 keyhintWrap.selectAll("kbd.shortcut").data(keys && keys.length ? keys : []).enter().append("kbd").attr("class", "shortcut").text(function(d) {
52064 // modules/ui/edit_menu.js
52065 function uiEditMenu(context) {
52066 var dispatch10 = dispatch_default("toggled");
52067 var _menu = select_default2(null);
52068 var _operations = [];
52069 var _anchorLoc = [0, 0];
52070 var _anchorLocLonLat = [0, 0];
52071 var _triggerType = "";
52072 var _vpTopMargin = 85;
52073 var _vpBottomMargin = 45;
52074 var _vpSideMargin = 35;
52075 var _menuTop = false;
52078 var _verticalPadding = 4;
52079 var _tooltipWidth = 210;
52080 var _menuSideMargin = 10;
52081 var _tooltips = [];
52082 var editMenu = function(selection2) {
52083 var isTouchMenu = _triggerType.includes("touch") || _triggerType.includes("pen");
52084 var ops = _operations.filter(function(op) {
52085 return !isTouchMenu || !op.mouseOnly;
52090 _menuTop = isTouchMenu;
52091 var showLabels = isTouchMenu;
52092 var buttonHeight = showLabels ? 32 : 34;
52094 _menuWidth = 52 + Math.min(120, 6 * Math.max.apply(Math, ops.map(function(op) {
52095 return op.title.length;
52100 _menuHeight = _verticalPadding * 2 + ops.length * buttonHeight;
52101 _menu = selection2.append("div").attr("class", "edit-menu").classed("touch-menu", isTouchMenu).style("padding", _verticalPadding + "px 0");
52102 var buttons = _menu.selectAll(".edit-menu-item").data(ops);
52103 var buttonsEnter = buttons.enter().append("button").attr("class", function(d) {
52104 return "edit-menu-item edit-menu-item-" + d.id;
52105 }).style("height", buttonHeight + "px").on("click", click).on("pointerup", pointerup).on("pointerdown mousedown", function pointerdown(d3_event) {
52106 d3_event.stopPropagation();
52107 }).on("mouseenter.highlight", function(d3_event, d) {
52108 if (!d.relatedEntityIds || select_default2(this).classed("disabled"))
52110 utilHighlightEntities(d.relatedEntityIds(), true, context);
52111 }).on("mouseleave.highlight", function(d3_event, d) {
52112 if (!d.relatedEntityIds)
52114 utilHighlightEntities(d.relatedEntityIds(), false, context);
52116 buttonsEnter.each(function(d) {
52117 var tooltip = uiTooltip().heading(() => d.title).title(d.tooltip).keys([d.keys[0]]);
52118 _tooltips.push(tooltip);
52119 select_default2(this).call(tooltip).append("div").attr("class", "icon-wrap").call(svgIcon(d.icon && d.icon() || "#iD-operation-" + d.id, "operation"));
52122 buttonsEnter.append("span").attr("class", "label").html(function(d) {
52126 buttonsEnter.merge(buttons).classed("disabled", function(d) {
52127 return d.disabled();
52130 var initialScale = context.projection.scale();
52131 context.map().on("move.edit-menu", function() {
52132 if (initialScale !== context.projection.scale()) {
52135 }).on("drawn.edit-menu", function(info) {
52139 var lastPointerUpType;
52140 function pointerup(d3_event) {
52141 lastPointerUpType = d3_event.pointerType;
52143 function click(d3_event, operation) {
52144 d3_event.stopPropagation();
52145 if (operation.relatedEntityIds) {
52146 utilHighlightEntities(operation.relatedEntityIds(), false, context);
52148 if (operation.disabled()) {
52149 if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
52150 context.ui().flash.duration(4e3).iconName("#iD-operation-" + operation.id).iconClass("operation disabled").label(operation.tooltip())();
52153 if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
52154 context.ui().flash.duration(2e3).iconName("#iD-operation-" + operation.id).iconClass("operation").label(operation.annotation() || operation.title)();
52159 lastPointerUpType = null;
52161 dispatch10.call("toggled", this, true);
52163 function updatePosition() {
52164 if (!_menu || _menu.empty())
52166 var anchorLoc = context.projection(_anchorLocLonLat);
52167 var viewport = context.surfaceRect();
52168 if (anchorLoc[0] < 0 || anchorLoc[0] > viewport.width || anchorLoc[1] < 0 || anchorLoc[1] > viewport.height) {
52172 var menuLeft = displayOnLeft(viewport);
52173 var offset = [0, 0];
52174 offset[0] = menuLeft ? -1 * (_menuSideMargin + _menuWidth) : _menuSideMargin;
52176 if (anchorLoc[1] - _menuHeight < _vpTopMargin) {
52177 offset[1] = -anchorLoc[1] + _vpTopMargin;
52179 offset[1] = -_menuHeight;
52182 if (anchorLoc[1] + _menuHeight > viewport.height - _vpBottomMargin) {
52183 offset[1] = -anchorLoc[1] - _menuHeight + viewport.height - _vpBottomMargin;
52188 var origin = geoVecAdd(anchorLoc, offset);
52189 _menu.style("left", origin[0] + "px").style("top", origin[1] + "px");
52190 var tooltipSide = tooltipPosition(viewport, menuLeft);
52191 _tooltips.forEach(function(tooltip) {
52192 tooltip.placement(tooltipSide);
52194 function displayOnLeft(viewport2) {
52195 if (_mainLocalizer.textDirection() === "ltr") {
52196 if (anchorLoc[0] + _menuSideMargin + _menuWidth > viewport2.width - _vpSideMargin) {
52201 if (anchorLoc[0] - _menuSideMargin - _menuWidth < _vpSideMargin) {
52207 function tooltipPosition(viewport2, menuLeft2) {
52208 if (_mainLocalizer.textDirection() === "ltr") {
52212 if (anchorLoc[0] + _menuSideMargin + _menuWidth + _tooltipWidth > viewport2.width - _vpSideMargin) {
52220 if (anchorLoc[0] - _menuSideMargin - _menuWidth - _tooltipWidth < _vpSideMargin) {
52227 editMenu.close = function() {
52228 context.map().on("move.edit-menu", null).on("drawn.edit-menu", null);
52231 dispatch10.call("toggled", this, false);
52233 editMenu.anchorLoc = function(val) {
52234 if (!arguments.length)
52237 _anchorLocLonLat = context.projection.invert(_anchorLoc);
52240 editMenu.triggerType = function(val) {
52241 if (!arguments.length)
52242 return _triggerType;
52243 _triggerType = val;
52246 editMenu.operations = function(val) {
52247 if (!arguments.length)
52248 return _operations;
52252 return utilRebind(editMenu, dispatch10, "on");
52255 // modules/ui/feature_info.js
52256 function uiFeatureInfo(context) {
52257 function update(selection2) {
52258 var features2 = context.features();
52259 var stats = features2.stats();
52261 var hiddenList = features2.hidden().map(function(k) {
52264 return _t.append("inspector.title_count", {
52265 title: _t("feature." + k + ".description"),
52270 }).filter(Boolean);
52271 selection2.text("");
52272 if (hiddenList.length) {
52273 var tooltipBehavior = uiTooltip().placement("top").title(function() {
52274 return (selection3) => {
52275 hiddenList.forEach((hiddenFeature) => {
52276 selection3.append("div").call(hiddenFeature);
52280 selection2.append("a").attr("class", "chip").attr("href", "#").call(_t.append("feature_info.hidden_warning", { count })).call(tooltipBehavior).on("click", function(d3_event) {
52281 tooltipBehavior.hide();
52282 d3_event.preventDefault();
52283 context.ui().togglePanes(context.container().select(".map-panes .map-data-pane"));
52286 selection2.classed("hide", !hiddenList.length);
52288 return function(selection2) {
52289 update(selection2);
52290 context.features().on("change.feature_info", function() {
52291 update(selection2);
52296 // modules/ui/flash.js
52297 function uiFlash(context) {
52299 var _duration = 2e3;
52300 var _iconName = "#iD-icon-no";
52301 var _iconClass = "disabled";
52302 var _label = (s) => s.text("");
52305 _flashTimer.stop();
52307 context.container().select(".main-footer-wrap").classed("footer-hide", true).classed("footer-show", false);
52308 context.container().select(".flash-wrap").classed("footer-hide", false).classed("footer-show", true);
52309 var content = context.container().select(".flash-wrap").selectAll(".flash-content").data([0]);
52310 var contentEnter = content.enter().append("div").attr("class", "flash-content");
52311 var iconEnter = contentEnter.append("svg").attr("class", "flash-icon icon").append("g").attr("transform", "translate(10,10)");
52312 iconEnter.append("circle").attr("r", 9);
52313 iconEnter.append("use").attr("transform", "translate(-7,-7)").attr("width", "14").attr("height", "14");
52314 contentEnter.append("div").attr("class", "flash-text");
52315 content = content.merge(contentEnter);
52316 content.selectAll(".flash-icon").attr("class", "icon flash-icon " + (_iconClass || ""));
52317 content.selectAll(".flash-icon use").attr("xlink:href", _iconName);
52318 content.selectAll(".flash-text").attr("class", "flash-text").call(_label);
52319 _flashTimer = timeout_default(function() {
52320 _flashTimer = null;
52321 context.container().select(".main-footer-wrap").classed("footer-hide", false).classed("footer-show", true);
52322 context.container().select(".flash-wrap").classed("footer-hide", true).classed("footer-show", false);
52326 flash.duration = function(_) {
52327 if (!arguments.length)
52332 flash.label = function(_) {
52333 if (!arguments.length)
52335 if (typeof _ !== "function") {
52336 _label = (selection2) => selection2.text(_);
52338 _label = (selection2) => selection2.text("").call(_);
52342 flash.iconName = function(_) {
52343 if (!arguments.length)
52348 flash.iconClass = function(_) {
52349 if (!arguments.length)
52357 // modules/ui/full_screen.js
52358 function uiFullScreen(context) {
52359 var element = context.container().node();
52360 function getFullScreenFn() {
52361 if (element.requestFullscreen) {
52362 return element.requestFullscreen;
52363 } else if (element.msRequestFullscreen) {
52364 return element.msRequestFullscreen;
52365 } else if (element.mozRequestFullScreen) {
52366 return element.mozRequestFullScreen;
52367 } else if (element.webkitRequestFullscreen) {
52368 return element.webkitRequestFullscreen;
52371 function getExitFullScreenFn() {
52372 if (document.exitFullscreen) {
52373 return document.exitFullscreen;
52374 } else if (document.msExitFullscreen) {
52375 return document.msExitFullscreen;
52376 } else if (document.mozCancelFullScreen) {
52377 return document.mozCancelFullScreen;
52378 } else if (document.webkitExitFullscreen) {
52379 return document.webkitExitFullscreen;
52382 function isFullScreen() {
52383 return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
52385 function isSupported() {
52386 return !!getFullScreenFn();
52388 function fullScreen(d3_event) {
52389 d3_event.preventDefault();
52390 if (!isFullScreen()) {
52391 getFullScreenFn().apply(element);
52393 getExitFullScreenFn().apply(document);
52396 return function() {
52397 if (!isSupported())
52399 var detected = utilDetect();
52400 var keys = detected.os === "mac" ? [uiCmd("\u2303\u2318F"), "f11"] : ["f11"];
52401 context.keybinding().on(keys, fullScreen);
52405 // modules/ui/geolocate.js
52406 function uiGeolocate(context) {
52407 var _geolocationOptions = {
52408 enableHighAccuracy: false,
52411 var _locating = uiLoading(context).message(_t.html("geolocate.locating")).blocking(true);
52412 var _layer = context.layers().layer("geolocate");
52416 var _button = select_default2(null);
52418 if (context.inIntro())
52420 if (!_layer.enabled() && !_locating.isShown()) {
52421 _timeoutID = setTimeout(error, 1e4);
52422 context.container().call(_locating);
52423 navigator.geolocation.getCurrentPosition(success, error, _geolocationOptions);
52426 _layer.enabled(null, false);
52427 updateButtonState();
52430 function zoomTo() {
52431 context.enter(modeBrowse(context));
52432 var map2 = context.map();
52433 _layer.enabled(_position, true);
52434 updateButtonState();
52435 map2.centerZoomEase(_extent.center(), Math.min(20, map2.extentZoom(_extent)));
52437 function success(geolocation) {
52438 _position = geolocation;
52439 var coords = _position.coords;
52440 _extent = geoExtent([coords.longitude, coords.latitude]).padByMeters(coords.accuracy);
52448 context.ui().flash.label(_t.append("geolocate.location_unavailable")).iconName("#iD-icon-geolocate")();
52452 function finish() {
52455 clearTimeout(_timeoutID);
52457 _timeoutID = void 0;
52459 function updateButtonState() {
52460 _button.classed("active", _layer.enabled());
52461 _button.attr("aria-pressed", _layer.enabled());
52463 return function(selection2) {
52464 if (!navigator.geolocation || !navigator.geolocation.getCurrentPosition)
52466 _button = selection2.append("button").on("click", click).attr("aria-pressed", false).call(svgIcon("#iD-icon-geolocate", "light")).call(
52467 uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _t.append("geolocate.title")).keys([_t("geolocate.key")])
52469 context.keybinding().on(_t("geolocate.key"), click);
52473 // modules/ui/panels/background.js
52474 function uiPanelBackground(context) {
52475 var background = context.background();
52476 var _currSourceName = null;
52477 var _metadata = {};
52478 var _metadataKeys = [
52486 var debouncedRedraw = debounce_default(redraw, 250);
52487 function redraw(selection2) {
52488 var source = background.baseLayerSource();
52491 var isDG = source.id.match(/^DigitalGlobe/i) !== null;
52492 var sourceLabel = source.label();
52493 if (_currSourceName !== sourceLabel) {
52494 _currSourceName = sourceLabel;
52497 selection2.text("");
52498 var list = selection2.append("ul").attr("class", "background-info");
52499 list.append("li").call(_currSourceName);
52500 _metadataKeys.forEach(function(k) {
52501 if (isDG && k === "vintage")
52503 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]);
52505 debouncedGetMetadata(selection2);
52506 var toggleTiles = context.getDebug("tile") ? "hide_tiles" : "show_tiles";
52507 selection2.append("a").call(_t.append("info_panels.background." + toggleTiles)).attr("href", "#").attr("class", "button button-toggle-tiles").on("click", function(d3_event) {
52508 d3_event.preventDefault();
52509 context.setDebug("tile", !context.getDebug("tile"));
52510 selection2.call(redraw);
52513 var key = source.id + "-vintage";
52514 var sourceVintage = context.background().findSource(key);
52515 var showsVintage = context.background().showsLayer(sourceVintage);
52516 var toggleVintage = showsVintage ? "hide_vintage" : "show_vintage";
52517 selection2.append("a").call(_t.append("info_panels.background." + toggleVintage)).attr("href", "#").attr("class", "button button-toggle-vintage").on("click", function(d3_event) {
52518 d3_event.preventDefault();
52519 context.background().toggleOverlayLayer(sourceVintage);
52520 selection2.call(redraw);
52523 ["DigitalGlobe-Premium", "DigitalGlobe-Standard"].forEach(function(layerId) {
52524 if (source.id !== layerId) {
52525 var key2 = layerId + "-vintage";
52526 var sourceVintage2 = context.background().findSource(key2);
52527 if (context.background().showsLayer(sourceVintage2)) {
52528 context.background().toggleOverlayLayer(sourceVintage2);
52533 var debouncedGetMetadata = debounce_default(getMetadata, 250);
52534 function getMetadata(selection2) {
52535 var tile = context.container().select(".layer-background img.tile-center");
52538 var sourceName = _currSourceName;
52539 var d = tile.datum();
52540 var zoom = d && d.length >= 3 && d[2] || Math.floor(context.map().zoom());
52541 var center = context.map().center();
52542 _metadata.zoom = String(zoom);
52543 selection2.selectAll(".background-info-list-zoom").classed("hide", false).selectAll(".background-info-span-zoom").text(_metadata.zoom);
52544 if (!d || !d.length >= 3)
52546 background.baseLayerSource().getMetadata(center, d, function(err, result) {
52547 if (err || _currSourceName !== sourceName)
52549 var vintage = result.vintage;
52550 _metadata.vintage = vintage && vintage.range || _t("info_panels.background.unknown");
52551 selection2.selectAll(".background-info-list-vintage").classed("hide", false).selectAll(".background-info-span-vintage").text(_metadata.vintage);
52552 _metadataKeys.forEach(function(k) {
52553 if (k === "zoom" || k === "vintage")
52555 var val = result[k];
52556 _metadata[k] = val;
52557 selection2.selectAll(".background-info-list-" + k).classed("hide", !val).selectAll(".background-info-span-" + k).text(val);
52561 var panel = function(selection2) {
52562 selection2.call(redraw);
52563 context.map().on("drawn.info-background", function() {
52564 selection2.call(debouncedRedraw);
52565 }).on("move.info-background", function() {
52566 selection2.call(debouncedGetMetadata);
52569 panel.off = function() {
52570 context.map().on("drawn.info-background", null).on("move.info-background", null);
52572 panel.id = "background";
52573 panel.label = _t.append("info_panels.background.title");
52574 panel.key = _t("info_panels.background.key");
52578 // modules/ui/panels/history.js
52579 function uiPanelHistory(context) {
52581 function displayTimestamp(timestamp) {
52583 return _t("info_panels.history.unknown");
52592 var d = new Date(timestamp);
52593 if (isNaN(d.getTime()))
52594 return _t("info_panels.history.unknown");
52595 return d.toLocaleString(_mainLocalizer.localeCode(), options2);
52597 function displayUser(selection2, userName) {
52599 selection2.append("span").call(_t.append("info_panels.history.unknown"));
52602 selection2.append("span").attr("class", "user-name").text(userName);
52603 var links = selection2.append("div").attr("class", "links");
52605 links.append("a").attr("class", "user-osm-link").attr("href", osm.userURL(userName)).attr("target", "_blank").call(_t.append("info_panels.history.profile_link"));
52607 links.append("a").attr("class", "user-hdyc-link").attr("href", "https://hdyc.neis-one.org/?" + userName).attr("target", "_blank").attr("tabindex", -1).text("HDYC");
52609 function displayChangeset(selection2, changeset) {
52611 selection2.append("span").call(_t.append("info_panels.history.unknown"));
52614 selection2.append("span").attr("class", "changeset-id").text(changeset);
52615 var links = selection2.append("div").attr("class", "links");
52617 links.append("a").attr("class", "changeset-osm-link").attr("href", osm.changesetURL(changeset)).attr("target", "_blank").call(_t.append("info_panels.history.changeset_link"));
52619 links.append("a").attr("class", "changeset-osmcha-link").attr("href", "https://osmcha.org/changesets/" + changeset).attr("target", "_blank").text("OSMCha");
52620 links.append("a").attr("class", "changeset-achavi-link").attr("href", "https://overpass-api.de/achavi/?changeset=" + changeset).attr("target", "_blank").text("Achavi");
52622 function redraw(selection2) {
52623 var selectedNoteID = context.selectedNoteID();
52624 osm = context.connection();
52625 var selected, note, entity;
52626 if (selectedNoteID && osm) {
52627 selected = [_t.html("note.note") + " " + selectedNoteID];
52628 note = osm.getNote(selectedNoteID);
52630 selected = context.selectedIDs().filter(function(e) {
52631 return context.hasEntity(e);
52633 if (selected.length) {
52634 entity = context.entity(selected[0]);
52637 var singular = selected.length === 1 ? selected[0] : null;
52638 selection2.html("");
52640 selection2.append("h4").attr("class", "history-heading").html(singular);
52642 selection2.append("h4").attr("class", "history-heading").call(_t.append("info_panels.selected", { n: selected.length }));
52647 selection2.call(redrawEntity, entity);
52649 selection2.call(redrawNote, note);
52652 function redrawNote(selection2, note) {
52653 if (!note || note.isNew()) {
52654 selection2.append("div").call(_t.append("info_panels.history.note_no_history"));
52657 var list = selection2.append("ul");
52658 list.append("li").call(_t.append("info_panels.history.note_comments", { suffix: ":" })).append("span").text(note.comments.length);
52659 if (note.comments.length) {
52660 list.append("li").call(_t.append("info_panels.history.note_created_date", { suffix: ":" })).append("span").text(displayTimestamp(note.comments[0].date));
52661 list.append("li").call(_t.append("info_panels.history.note_created_user", { suffix: ":" })).call(displayUser, note.comments[0].user);
52664 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"));
52667 function redrawEntity(selection2, entity) {
52668 if (!entity || entity.isNew()) {
52669 selection2.append("div").call(_t.append("info_panels.history.no_history"));
52672 var links = selection2.append("div").attr("class", "links");
52674 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"));
52676 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");
52677 var list = selection2.append("ul");
52678 list.append("li").call(_t.append("info_panels.history.version", { suffix: ":" })).append("span").text(entity.version);
52679 list.append("li").call(_t.append("info_panels.history.last_edit", { suffix: ":" })).append("span").text(displayTimestamp(entity.timestamp));
52680 list.append("li").call(_t.append("info_panels.history.edited_by", { suffix: ":" })).call(displayUser, entity.user);
52681 list.append("li").call(_t.append("info_panels.history.changeset", { suffix: ":" })).call(displayChangeset, entity.changeset);
52683 var panel = function(selection2) {
52684 selection2.call(redraw);
52685 context.map().on("drawn.info-history", function() {
52686 selection2.call(redraw);
52688 context.on("enter.info-history", function() {
52689 selection2.call(redraw);
52692 panel.off = function() {
52693 context.map().on("drawn.info-history", null);
52694 context.on("enter.info-history", null);
52696 panel.id = "history";
52697 panel.label = _t.append("info_panels.history.title");
52698 panel.key = _t("info_panels.history.key");
52702 // modules/util/units.js
52703 var OSM_PRECISION = 7;
52704 function displayLength(m, isImperial) {
52705 var d = m * (isImperial ? 3.28084 : 1);
52717 unit2 = "kilometers";
52722 return _t("units." + unit2, {
52723 quantity: d.toLocaleString(_mainLocalizer.localeCode(), {
52724 maximumSignificantDigits: 4
52728 function displayArea(m2, isImperial) {
52729 var locale2 = _mainLocalizer.localeCode();
52730 var d = m2 * (isImperial ? 10.7639111056 : 1);
52735 if (d >= 6969600) {
52737 unit1 = "square_miles";
52740 unit1 = "square_feet";
52742 if (d > 4356 && d < 4356e4) {
52749 unit1 = "square_kilometers";
52752 unit1 = "square_meters";
52754 if (d > 1e3 && d < 1e7) {
52756 unit2 = "hectares";
52759 area = _t("units." + unit1, {
52760 quantity: d1.toLocaleString(locale2, {
52761 maximumSignificantDigits: 4
52765 return _t("units.area_pair", {
52767 area2: _t("units." + unit2, {
52768 quantity: d2.toLocaleString(locale2, {
52769 maximumSignificantDigits: 2
52777 function wrap(x, min3, max3) {
52778 var d = max3 - min3;
52779 return ((x - min3) % d + d) % d + min3;
52781 function clamp2(x, min3, max3) {
52782 return Math.max(min3, Math.min(x, max3));
52784 function displayCoordinate(deg, pos, neg) {
52785 var locale2 = _mainLocalizer.localeCode();
52786 var min3 = (Math.abs(deg) - Math.floor(Math.abs(deg))) * 60;
52787 var sec = (min3 - Math.floor(min3)) * 60;
52788 var displayDegrees = _t("units.arcdegrees", {
52789 quantity: Math.floor(Math.abs(deg)).toLocaleString(locale2)
52791 var displayCoordinate2;
52792 if (Math.floor(sec) > 0) {
52793 displayCoordinate2 = displayDegrees + _t("units.arcminutes", {
52794 quantity: Math.floor(min3).toLocaleString(locale2)
52795 }) + _t("units.arcseconds", {
52796 quantity: Math.round(sec).toLocaleString(locale2)
52798 } else if (Math.floor(min3) > 0) {
52799 displayCoordinate2 = displayDegrees + _t("units.arcminutes", {
52800 quantity: Math.round(min3).toLocaleString(locale2)
52803 displayCoordinate2 = _t("units.arcdegrees", {
52804 quantity: Math.round(Math.abs(deg)).toLocaleString(locale2)
52808 return displayCoordinate2;
52810 return _t("units.coordinate", {
52811 coordinate: displayCoordinate2,
52812 direction: _t("units." + (deg > 0 ? pos : neg))
52816 function dmsCoordinatePair(coord2) {
52817 return _t("units.coordinate_pair", {
52818 latitude: displayCoordinate(clamp2(coord2[1], -90, 90), "north", "south"),
52819 longitude: displayCoordinate(wrap(coord2[0], -180, 180), "east", "west")
52822 function decimalCoordinatePair(coord2) {
52823 return _t("units.coordinate_pair", {
52824 latitude: clamp2(coord2[1], -90, 90).toFixed(OSM_PRECISION),
52825 longitude: wrap(coord2[0], -180, 180).toFixed(OSM_PRECISION)
52829 // modules/ui/panels/location.js
52830 function uiPanelLocation(context) {
52831 var currLocation = "";
52832 function redraw(selection2) {
52833 selection2.html("");
52834 var list = selection2.append("ul");
52835 var coord2 = context.map().mouseCoordinates();
52836 if (coord2.some(isNaN)) {
52837 coord2 = context.map().center();
52839 list.append("li").text(dmsCoordinatePair(coord2)).append("li").text(decimalCoordinatePair(coord2));
52840 selection2.append("div").attr("class", "location-info").text(currLocation || " ");
52841 debouncedGetLocation(selection2, coord2);
52843 var debouncedGetLocation = debounce_default(getLocation, 250);
52844 function getLocation(selection2, coord2) {
52845 if (!services.geocoder) {
52846 currLocation = _t("info_panels.location.unknown_location");
52847 selection2.selectAll(".location-info").text(currLocation);
52849 services.geocoder.reverse(coord2, function(err, result) {
52850 currLocation = result ? result.display_name : _t("info_panels.location.unknown_location");
52851 selection2.selectAll(".location-info").text(currLocation);
52855 var panel = function(selection2) {
52856 selection2.call(redraw);
52857 context.surface().on(("PointerEvent" in window ? "pointer" : "mouse") + "move.info-location", function() {
52858 selection2.call(redraw);
52861 panel.off = function() {
52862 context.surface().on(".info-location", null);
52864 panel.id = "location";
52865 panel.label = _t.append("info_panels.location.title");
52866 panel.key = _t("info_panels.location.key");
52870 // modules/ui/panels/measurement.js
52871 function uiPanelMeasurement(context) {
52872 function radiansToMeters(r) {
52873 return r * 63710071809e-4;
52875 function steradiansToSqmeters(r) {
52876 return r / (4 * Math.PI) * 510065621724e3;
52878 function toLineString(feature3) {
52879 if (feature3.type === "LineString")
52881 var result = { type: "LineString", coordinates: [] };
52882 if (feature3.type === "Polygon") {
52883 result.coordinates = feature3.coordinates[0];
52884 } else if (feature3.type === "MultiPolygon") {
52885 result.coordinates = feature3.coordinates[0][0];
52889 var _isImperial = !_mainLocalizer.usesMetric();
52890 function redraw(selection2) {
52891 var graph = context.graph();
52892 var selectedNoteID = context.selectedNoteID();
52893 var osm = services.osm;
52894 var localeCode = _mainLocalizer.localeCode();
52896 var center, location, centroid;
52897 var closed, geometry;
52898 var totalNodeCount, length = 0, area = 0, distance;
52899 if (selectedNoteID && osm) {
52900 var note = osm.getNote(selectedNoteID);
52901 heading = _t.html("note.note") + " " + selectedNoteID;
52902 location = note.loc;
52905 var selectedIDs = context.selectedIDs().filter(function(id2) {
52906 return context.hasEntity(id2);
52908 var selected = selectedIDs.map(function(id2) {
52909 return context.entity(id2);
52911 heading = selected.length === 1 ? selected[0].id : _t.html("info_panels.selected", { n: selected.length });
52912 if (selected.length) {
52913 var extent = geoExtent();
52914 for (var i2 in selected) {
52915 var entity = selected[i2];
52916 extent._extend(entity.extent(graph));
52917 geometry = entity.geometry(graph);
52918 if (geometry === "line" || geometry === "area") {
52919 closed = entity.type === "relation" || entity.isClosed() && !entity.isDegenerate();
52920 var feature3 = entity.asGeoJSON(graph);
52921 length += radiansToMeters(length_default(toLineString(feature3)));
52922 centroid = path_default(context.projection).centroid(entity.asGeoJSON(graph));
52923 centroid = centroid && context.projection.invert(centroid);
52924 if (!centroid || !isFinite(centroid[0]) || !isFinite(centroid[1])) {
52925 centroid = entity.extent(graph).center();
52928 area += steradiansToSqmeters(entity.area(graph));
52932 if (selected.length > 1) {
52937 if (selected.length === 2 && selected[0].type === "node" && selected[1].type === "node") {
52938 distance = geoSphericalDistance(selected[0].loc, selected[1].loc);
52940 if (selected.length === 1 && selected[0].type === "node") {
52941 location = selected[0].loc;
52943 totalNodeCount = utilGetAllNodes(selectedIDs, context.graph()).length;
52945 if (!location && !centroid) {
52946 center = extent.center();
52950 selection2.html("");
52952 selection2.append("h4").attr("class", "measurement-heading").html(heading);
52954 var list = selection2.append("ul");
52957 list.append("li").call(_t.append("info_panels.measurement.geometry", { suffix: ":" })).append("span").html(
52958 closed ? _t.html("info_panels.measurement.closed_" + geometry) : _t.html("geometry." + geometry)
52961 if (totalNodeCount) {
52962 list.append("li").call(_t.append("info_panels.measurement.node_count", { suffix: ":" })).append("span").text(totalNodeCount.toLocaleString(localeCode));
52965 list.append("li").call(_t.append("info_panels.measurement.area", { suffix: ":" })).append("span").text(displayArea(area, _isImperial));
52968 list.append("li").call(_t.append("info_panels.measurement." + (closed ? "perimeter" : "length"), { suffix: ":" })).append("span").text(displayLength(length, _isImperial));
52970 if (typeof distance === "number") {
52971 list.append("li").call(_t.append("info_panels.measurement.distance", { suffix: ":" })).append("span").text(displayLength(distance, _isImperial));
52974 coordItem = list.append("li").call(_t.append("info_panels.measurement.location", { suffix: ":" }));
52975 coordItem.append("span").text(dmsCoordinatePair(location));
52976 coordItem.append("span").text(decimalCoordinatePair(location));
52979 coordItem = list.append("li").call(_t.append("info_panels.measurement.centroid", { suffix: ":" }));
52980 coordItem.append("span").text(dmsCoordinatePair(centroid));
52981 coordItem.append("span").text(decimalCoordinatePair(centroid));
52984 coordItem = list.append("li").call(_t.append("info_panels.measurement.center", { suffix: ":" }));
52985 coordItem.append("span").text(dmsCoordinatePair(center));
52986 coordItem.append("span").text(decimalCoordinatePair(center));
52988 if (length || area || typeof distance === "number") {
52989 var toggle = _isImperial ? "imperial" : "metric";
52990 selection2.append("a").call(_t.append("info_panels.measurement." + toggle)).attr("href", "#").attr("class", "button button-toggle-units").on("click", function(d3_event) {
52991 d3_event.preventDefault();
52992 _isImperial = !_isImperial;
52993 selection2.call(redraw);
52997 var panel = function(selection2) {
52998 selection2.call(redraw);
52999 context.map().on("drawn.info-measurement", function() {
53000 selection2.call(redraw);
53002 context.on("enter.info-measurement", function() {
53003 selection2.call(redraw);
53006 panel.off = function() {
53007 context.map().on("drawn.info-measurement", null);
53008 context.on("enter.info-measurement", null);
53010 panel.id = "measurement";
53011 panel.label = _t.append("info_panels.measurement.title");
53012 panel.key = _t("info_panels.measurement.key");
53016 // modules/ui/panels/index.js
53017 var uiInfoPanels = {
53018 background: uiPanelBackground,
53019 history: uiPanelHistory,
53020 location: uiPanelLocation,
53021 measurement: uiPanelMeasurement
53024 // modules/ui/info.js
53025 function uiInfo(context) {
53026 var ids = Object.keys(uiInfoPanels);
53027 var wasActive = ["measurement"];
53030 ids.forEach(function(k) {
53032 panels[k] = uiInfoPanels[k](context);
53036 function info(selection2) {
53037 function redraw() {
53038 var activeids = ids.filter(function(k) {
53041 var containers = infoPanels.selectAll(".panel-container").data(activeids, function(k) {
53044 containers.exit().style("opacity", 1).transition().duration(200).style("opacity", 0).on("end", function(d) {
53045 select_default2(this).call(panels[d].off).remove();
53047 var enter = containers.enter().append("div").attr("class", function(d) {
53048 return "fillD2 panel-container panel-container-" + d;
53050 enter.style("opacity", 0).transition().duration(200).style("opacity", 1);
53051 var title = enter.append("div").attr("class", "panel-title fillD2");
53052 title.append("h3").each(function(d) {
53053 return panels[d].label(select_default2(this));
53055 title.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function(d3_event, d) {
53056 d3_event.stopImmediatePropagation();
53057 d3_event.preventDefault();
53059 }).call(svgIcon("#iD-icon-close"));
53060 enter.append("div").attr("class", function(d) {
53061 return "panel-content panel-content-" + d;
53063 infoPanels.selectAll(".panel-content").each(function(d) {
53064 select_default2(this).call(panels[d]);
53067 info.toggle = function(which) {
53068 var activeids = ids.filter(function(k) {
53072 active[which] = !active[which];
53073 if (activeids.length === 1 && activeids[0] === which) {
53074 wasActive = [which];
53076 context.container().select("." + which + "-panel-toggle-item").classed("active", active[which]).select("input").property("checked", active[which]);
53078 if (activeids.length) {
53079 wasActive = activeids;
53080 activeids.forEach(function(k) {
53084 wasActive.forEach(function(k) {
53091 var infoPanels = selection2.selectAll(".info-panels").data([0]);
53092 infoPanels = infoPanels.enter().append("div").attr("class", "info-panels").merge(infoPanels);
53094 context.keybinding().on(uiCmd("\u2318" + _t("info_panels.key")), function(d3_event) {
53095 d3_event.stopImmediatePropagation();
53096 d3_event.preventDefault();
53099 ids.forEach(function(k) {
53100 var key = _t("info_panels." + k + ".key", { default: null });
53103 context.keybinding().on(uiCmd("\u2318\u21E7" + key), function(d3_event) {
53104 d3_event.stopImmediatePropagation();
53105 d3_event.preventDefault();
53113 // modules/ui/intro/helper.js
53114 function pointBox(loc, context) {
53115 var rect = context.surfaceRect();
53116 var point2 = context.curtainProjection(loc);
53118 left: point2[0] + rect.left - 40,
53119 top: point2[1] + rect.top - 60,
53124 function pad(locOrBox, padding, context) {
53126 if (locOrBox instanceof Array) {
53127 var rect = context.surfaceRect();
53128 var point2 = context.curtainProjection(locOrBox);
53130 left: point2[0] + rect.left,
53131 top: point2[1] + rect.top
53137 left: box.left - padding,
53138 top: box.top - padding,
53139 width: (box.width || 0) + 2 * padding,
53140 height: (box.width || 0) + 2 * padding
53143 function icon(name, svgklass, useklass) {
53144 return '<svg class="icon ' + (svgklass || "") + '"><use xlink:href="' + name + '"' + (useklass ? ' class="' + useklass + '"' : "") + "></use></svg>";
53146 var helpStringReplacements;
53147 function helpHtml(id2, replacements) {
53148 if (!helpStringReplacements) {
53149 helpStringReplacements = {
53150 point_icon: icon("#iD-icon-point", "inline"),
53151 line_icon: icon("#iD-icon-line", "inline"),
53152 area_icon: icon("#iD-icon-area", "inline"),
53153 note_icon: icon("#iD-icon-note", "inline add-note"),
53154 plus: icon("#iD-icon-plus", "inline"),
53155 minus: icon("#iD-icon-minus", "inline"),
53156 layers_icon: icon("#iD-icon-layers", "inline"),
53157 data_icon: icon("#iD-icon-data", "inline"),
53158 inspect: icon("#iD-icon-inspect", "inline"),
53159 help_icon: icon("#iD-icon-help", "inline"),
53160 undo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo", "inline"),
53161 redo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-undo" : "#iD-icon-redo", "inline"),
53162 save_icon: icon("#iD-icon-save", "inline"),
53163 circularize_icon: icon("#iD-operation-circularize", "inline operation"),
53164 continue_icon: icon("#iD-operation-continue", "inline operation"),
53165 copy_icon: icon("#iD-operation-copy", "inline operation"),
53166 delete_icon: icon("#iD-operation-delete", "inline operation"),
53167 disconnect_icon: icon("#iD-operation-disconnect", "inline operation"),
53168 downgrade_icon: icon("#iD-operation-downgrade", "inline operation"),
53169 extract_icon: icon("#iD-operation-extract", "inline operation"),
53170 merge_icon: icon("#iD-operation-merge", "inline operation"),
53171 move_icon: icon("#iD-operation-move", "inline operation"),
53172 orthogonalize_icon: icon("#iD-operation-orthogonalize", "inline operation"),
53173 paste_icon: icon("#iD-operation-paste", "inline operation"),
53174 reflect_long_icon: icon("#iD-operation-reflect-long", "inline operation"),
53175 reflect_short_icon: icon("#iD-operation-reflect-short", "inline operation"),
53176 reverse_icon: icon("#iD-operation-reverse", "inline operation"),
53177 rotate_icon: icon("#iD-operation-rotate", "inline operation"),
53178 split_icon: icon("#iD-operation-split", "inline operation"),
53179 straighten_icon: icon("#iD-operation-straighten", "inline operation"),
53180 leftclick: icon("#iD-walkthrough-mouse-left", "inline operation"),
53181 rightclick: icon("#iD-walkthrough-mouse-right", "inline operation"),
53182 mousewheel_icon: icon("#iD-walkthrough-mousewheel", "inline operation"),
53183 tap_icon: icon("#iD-walkthrough-tap", "inline operation"),
53184 doubletap_icon: icon("#iD-walkthrough-doubletap", "inline operation"),
53185 longpress_icon: icon("#iD-walkthrough-longpress", "inline operation"),
53186 touchdrag_icon: icon("#iD-walkthrough-touchdrag", "inline operation"),
53187 pinch_icon: icon("#iD-walkthrough-pinch-apart", "inline operation"),
53188 shift: uiCmd.display("\u21E7"),
53189 alt: uiCmd.display("\u2325"),
53190 return: uiCmd.display("\u21B5"),
53191 esc: _t.html("shortcuts.key.esc"),
53192 space: _t.html("shortcuts.key.space"),
53193 add_note_key: _t.html("modes.add_note.key"),
53194 help_key: _t.html("help.key"),
53195 shortcuts_key: _t.html("shortcuts.toggle.key"),
53196 save: _t.html("save.title"),
53197 undo: _t.html("undo.title"),
53198 redo: _t.html("redo.title"),
53199 upload: _t.html("commit.save"),
53200 point: _t.html("modes.add_point.title"),
53201 line: _t.html("modes.add_line.title"),
53202 area: _t.html("modes.add_area.title"),
53203 note: _t.html("modes.add_note.label"),
53204 circularize: _t.html("operations.circularize.title"),
53205 continue: _t.html("operations.continue.title"),
53206 copy: _t.html("operations.copy.title"),
53207 delete: _t.html("operations.delete.title"),
53208 disconnect: _t.html("operations.disconnect.title"),
53209 downgrade: _t.html("operations.downgrade.title"),
53210 extract: _t.html("operations.extract.title"),
53211 merge: _t.html("operations.merge.title"),
53212 move: _t.html("operations.move.title"),
53213 orthogonalize: _t.html("operations.orthogonalize.title"),
53214 paste: _t.html("operations.paste.title"),
53215 reflect_long: _t.html("operations.reflect.title.long"),
53216 reflect_short: _t.html("operations.reflect.title.short"),
53217 reverse: _t.html("operations.reverse.title"),
53218 rotate: _t.html("operations.rotate.title"),
53219 split: _t.html("operations.split.title"),
53220 straighten: _t.html("operations.straighten.title"),
53221 map_data: _t.html("map_data.title"),
53222 osm_notes: _t.html("map_data.layers.notes.title"),
53223 fields: _t.html("inspector.fields"),
53224 tags: _t.html("inspector.tags"),
53225 relations: _t.html("inspector.relations"),
53226 new_relation: _t.html("inspector.new_relation"),
53227 turn_restrictions: _t.html("_tagging.presets.fields.restrictions.label"),
53228 background_settings: _t.html("background.description"),
53229 imagery_offset: _t.html("background.fix_misalignment"),
53230 start_the_walkthrough: _t.html("splash.walkthrough"),
53231 help: _t.html("help.title"),
53232 ok: _t.html("intro.ok")
53234 for (var key in helpStringReplacements) {
53235 helpStringReplacements[key] = { html: helpStringReplacements[key] };
53239 if (replacements) {
53240 reps = Object.assign(replacements, helpStringReplacements);
53242 reps = helpStringReplacements;
53244 return _t.html(id2, reps).replace(/\`(.*?)\`/g, "<kbd>$1</kbd>");
53246 function slugify(text2) {
53247 return text2.toString().toLowerCase().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
53249 var missingStrings = {};
53250 function checkKey(key, text2) {
53251 if (_t(key, { default: void 0 }) === void 0) {
53252 if (missingStrings.hasOwnProperty(key))
53254 missingStrings[key] = text2;
53255 var missing = key + ": " + text2;
53256 if (typeof console !== "undefined")
53257 console.log(missing);
53260 function localize(obj) {
53262 var name = obj.tags && obj.tags.name;
53264 key = "intro.graph.name." + slugify(name);
53265 obj.tags.name = _t(key, { default: name });
53266 checkKey(key, name);
53268 var street = obj.tags && obj.tags["addr:street"];
53270 key = "intro.graph.name." + slugify(street);
53271 obj.tags["addr:street"] = _t(key, { default: street });
53272 checkKey(key, street);
53287 addrTags.forEach(function(k) {
53288 var key2 = "intro.graph." + k;
53289 var tag = "addr:" + k;
53290 var val = obj.tags && obj.tags[tag];
53291 var str2 = _t(key2, { default: val });
53293 if (str2.match(/^<.*>$/) !== null) {
53294 delete obj.tags[tag];
53296 obj.tags[tag] = str2;
53303 function isMostlySquare(points) {
53304 var threshold = 15;
53305 var lowerBound = Math.cos((90 - threshold) * Math.PI / 180);
53306 var upperBound = Math.cos(threshold * Math.PI / 180);
53307 for (var i2 = 0; i2 < points.length; i2++) {
53308 var a = points[(i2 - 1 + points.length) % points.length];
53309 var origin = points[i2];
53310 var b = points[(i2 + 1) % points.length];
53311 var dotp = geoVecNormalizedDot(a, b, origin);
53312 var mag = Math.abs(dotp);
53313 if (mag > lowerBound && mag < upperBound) {
53319 function selectMenuItem(context, operation) {
53320 return context.container().select(".edit-menu .edit-menu-item-" + operation);
53322 function transitionTime(point1, point2) {
53323 var distance = geoSphericalDistance(point1, point2);
53324 if (distance === 0) {
53326 } else if (distance < 80) {
53333 // modules/ui/toggle.js
53334 function uiToggle(show, callback) {
53335 return function(selection2) {
53336 selection2.style("opacity", show ? 0 : 1).classed("hide", false).transition().style("opacity", show ? 1 : 0).on("end", function() {
53337 select_default2(this).classed("hide", !show).style("opacity", null);
53339 callback.apply(this);
53344 // modules/ui/curtain.js
53345 function uiCurtain(containerNode) {
53346 var surface = select_default2(null), tooltip = select_default2(null), darkness = select_default2(null);
53347 function curtain(selection2) {
53348 surface = selection2.append("svg").attr("class", "curtain").style("top", 0).style("left", 0);
53349 darkness = surface.append("path").attr("x", 0).attr("y", 0).attr("class", "curtain-darkness");
53350 select_default2(window).on("resize.curtain", resize);
53351 tooltip = selection2.append("div").attr("class", "tooltip");
53352 tooltip.append("div").attr("class", "popover-arrow");
53353 tooltip.append("div").attr("class", "popover-inner");
53355 function resize() {
53356 surface.attr("width", containerNode.clientWidth).attr("height", containerNode.clientHeight);
53357 curtain.cut(darkness.datum());
53360 curtain.reveal = function(box, html2, options2) {
53361 options2 = options2 || {};
53362 if (typeof box === "string") {
53363 box = select_default2(box).node();
53365 if (box && box.getBoundingClientRect) {
53366 box = copyBox(box.getBoundingClientRect());
53367 var containerRect = containerNode.getBoundingClientRect();
53368 box.top -= containerRect.top;
53369 box.left -= containerRect.left;
53371 if (box && options2.padding) {
53372 box.top -= options2.padding;
53373 box.left -= options2.padding;
53374 box.bottom += options2.padding;
53375 box.right += options2.padding;
53376 box.height += options2.padding * 2;
53377 box.width += options2.padding * 2;
53380 if (options2.tooltipBox) {
53381 tooltipBox = options2.tooltipBox;
53382 if (typeof tooltipBox === "string") {
53383 tooltipBox = select_default2(tooltipBox).node();
53385 if (tooltipBox && tooltipBox.getBoundingClientRect) {
53386 tooltipBox = copyBox(tooltipBox.getBoundingClientRect());
53391 if (tooltipBox && html2) {
53392 if (html2.indexOf("**") !== -1) {
53393 if (html2.indexOf("<span") === 0) {
53394 html2 = html2.replace(/^(<span.*?>)(.+?)(\*\*)/, "$1<span>$2</span>$3");
53396 html2 = html2.replace(/^(.+?)(\*\*)/, "<span>$1</span>$2");
53398 html2 = html2.replace(/\*\*(.*?)\*\*/g, '<span class="instruction">$1</span>');
53400 html2 = html2.replace(/\*(.*?)\*/g, "<em>$1</em>");
53401 html2 = html2.replace(/\{br\}/g, "<br/><br/>");
53402 if (options2.buttonText && options2.buttonCallback) {
53403 html2 += '<div class="button-section"><button href="#" class="button action">' + options2.buttonText + "</button></div>";
53405 var classes = "curtain-tooltip popover tooltip arrowed in " + (options2.tooltipClass || "");
53406 tooltip.classed(classes, true).selectAll(".popover-inner").html(html2);
53407 if (options2.buttonText && options2.buttonCallback) {
53408 var button = tooltip.selectAll(".button-section .button.action");
53409 button.on("click", function(d3_event) {
53410 d3_event.preventDefault();
53411 options2.buttonCallback();
53414 var tip = copyBox(tooltip.node().getBoundingClientRect()), w = containerNode.clientWidth, h = containerNode.clientHeight, tooltipWidth = 200, tooltipArrow = 5, side, pos;
53415 if (options2.tooltipClass === "intro-mouse") {
53418 if (tooltipBox.top + tooltipBox.height > h) {
53419 tooltipBox.height -= tooltipBox.top + tooltipBox.height - h;
53421 if (tooltipBox.left + tooltipBox.width > w) {
53422 tooltipBox.width -= tooltipBox.left + tooltipBox.width - w;
53424 if (tooltipBox.top + tooltipBox.height < 100) {
53427 tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
53428 tooltipBox.top + tooltipBox.height
53430 } else if (tooltipBox.top > h - 140) {
53433 tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
53434 tooltipBox.top - tip.height
53437 var tipY = tooltipBox.top + tooltipBox.height / 2 - tip.height / 2;
53438 if (_mainLocalizer.textDirection() === "rtl") {
53439 if (tooltipBox.left - tooltipWidth - tooltipArrow < 70) {
53441 pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
53444 pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
53447 if (tooltipBox.left + tooltipBox.width + tooltipArrow + tooltipWidth > w - 70) {
53449 pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
53452 pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
53456 if (options2.duration !== 0 || !tooltip.classed(side)) {
53457 tooltip.call(uiToggle(true));
53459 tooltip.style("top", pos[1] + "px").style("left", pos[0] + "px").attr("class", classes + " " + side);
53461 if (side === "left" || side === "right") {
53463 shiftY = 60 - pos[1];
53464 } else if (pos[1] + tip.height > h - 100) {
53465 shiftY = h - pos[1] - tip.height - 100;
53468 tooltip.selectAll(".popover-inner").style("top", shiftY + "px");
53470 tooltip.classed("in", false).call(uiToggle(false));
53472 curtain.cut(box, options2.duration);
53475 curtain.cut = function(datum2, duration) {
53476 darkness.datum(datum2).interrupt();
53478 if (duration === 0) {
53479 selection2 = darkness;
53481 selection2 = darkness.transition().duration(duration || 600).ease(linear2);
53483 selection2.attr("d", function(d) {
53484 var containerWidth = containerNode.clientWidth;
53485 var containerHeight = containerNode.clientHeight;
53486 var string = "M 0,0 L 0," + containerHeight + " L " + containerWidth + "," + containerHeight + "L" + containerWidth + ",0 Z";
53489 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";
53492 curtain.remove = function() {
53495 select_default2(window).on("resize.curtain", null);
53497 function copyBox(src) {
53501 bottom: src.bottom,
53510 // modules/ui/intro/welcome.js
53511 function uiIntroWelcome(context, reveal) {
53512 var dispatch10 = dispatch_default("done");
53514 title: "intro.welcome.title"
53516 function welcome() {
53517 context.map().centerZoom([-85.63591, 41.94285], 19);
53519 ".intro-nav-wrap .chapter-welcome",
53520 helpHtml("intro.welcome.welcome"),
53521 { buttonText: _t.html("intro.ok"), buttonCallback: practice }
53524 function practice() {
53526 ".intro-nav-wrap .chapter-welcome",
53527 helpHtml("intro.welcome.practice"),
53528 { buttonText: _t.html("intro.ok"), buttonCallback: words }
53533 ".intro-nav-wrap .chapter-welcome",
53534 helpHtml("intro.welcome.words"),
53535 { buttonText: _t.html("intro.ok"), buttonCallback: chapters }
53538 function chapters() {
53539 dispatch10.call("done");
53541 ".intro-nav-wrap .chapter-navigation",
53542 helpHtml("intro.welcome.chapters", { next: _t("intro.navigation.title") })
53545 chapter.enter = function() {
53548 chapter.exit = function() {
53549 context.container().select(".curtain-tooltip.intro-mouse").selectAll(".counter").remove();
53551 chapter.restart = function() {
53555 return utilRebind(chapter, dispatch10, "on");
53558 // modules/ui/intro/navigation.js
53559 function uiIntroNavigation(context, reveal) {
53560 var dispatch10 = dispatch_default("done");
53562 var hallId = "n2061";
53563 var townHall = [-85.63591, 41.94285];
53564 var springStreetId = "w397";
53565 var springStreetEndId = "n1834";
53566 var springStreet = [-85.63582, 41.94255];
53567 var onewayField = _mainPresetIndex.field("oneway");
53568 var maxspeedField = _mainPresetIndex.field("maxspeed");
53570 title: "intro.navigation.title"
53572 function timeout2(f2, t) {
53573 timeouts.push(window.setTimeout(f2, t));
53575 function eventCancel(d3_event) {
53576 d3_event.stopPropagation();
53577 d3_event.preventDefault();
53579 function isTownHallSelected() {
53580 var ids = context.selectedIDs();
53581 return ids.length === 1 && ids[0] === hallId;
53583 function dragMap() {
53584 context.enter(modeBrowse(context));
53585 context.history().reset("initial");
53586 var msec = transitionTime(townHall, context.map().center());
53588 reveal(null, null, { duration: 0 });
53590 context.map().centerZoomEase(townHall, 19, msec);
53591 timeout2(function() {
53592 var centerStart = context.map().center();
53593 var textId = context.lastPointerType() === "mouse" ? "drag" : "drag_touch";
53594 var dragString = helpHtml("intro.navigation.map_info") + "{br}" + helpHtml("intro.navigation." + textId);
53595 reveal(".surface", dragString);
53596 context.map().on("drawn.intro", function() {
53597 reveal(".surface", dragString, { duration: 0 });
53599 context.map().on("move.intro", function() {
53600 var centerNow = context.map().center();
53601 if (centerStart[0] !== centerNow[0] || centerStart[1] !== centerNow[1]) {
53602 context.map().on("move.intro", null);
53603 timeout2(function() {
53604 continueTo(zoomMap);
53609 function continueTo(nextStep) {
53610 context.map().on("move.intro drawn.intro", null);
53614 function zoomMap() {
53615 var zoomStart = context.map().zoom();
53616 var textId = context.lastPointerType() === "mouse" ? "zoom" : "zoom_touch";
53617 var zoomString = helpHtml("intro.navigation." + textId);
53618 reveal(".surface", zoomString);
53619 context.map().on("drawn.intro", function() {
53620 reveal(".surface", zoomString, { duration: 0 });
53622 context.map().on("move.intro", function() {
53623 if (context.map().zoom() !== zoomStart) {
53624 context.map().on("move.intro", null);
53625 timeout2(function() {
53626 continueTo(features2);
53630 function continueTo(nextStep) {
53631 context.map().on("move.intro drawn.intro", null);
53635 function features2() {
53636 var onClick = function() {
53637 continueTo(pointsLinesAreas);
53641 helpHtml("intro.navigation.features"),
53642 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53644 context.map().on("drawn.intro", function() {
53647 helpHtml("intro.navigation.features"),
53648 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53651 function continueTo(nextStep) {
53652 context.map().on("drawn.intro", null);
53656 function pointsLinesAreas() {
53657 var onClick = function() {
53658 continueTo(nodesWays);
53662 helpHtml("intro.navigation.points_lines_areas"),
53663 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53665 context.map().on("drawn.intro", function() {
53668 helpHtml("intro.navigation.points_lines_areas"),
53669 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53672 function continueTo(nextStep) {
53673 context.map().on("drawn.intro", null);
53677 function nodesWays() {
53678 var onClick = function() {
53679 continueTo(clickTownHall);
53683 helpHtml("intro.navigation.nodes_ways"),
53684 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53686 context.map().on("drawn.intro", function() {
53689 helpHtml("intro.navigation.nodes_ways"),
53690 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53693 function continueTo(nextStep) {
53694 context.map().on("drawn.intro", null);
53698 function clickTownHall() {
53699 context.enter(modeBrowse(context));
53700 context.history().reset("initial");
53701 var entity = context.hasEntity(hallId);
53704 reveal(null, null, { duration: 0 });
53705 context.map().centerZoomEase(entity.loc, 19, 500);
53706 timeout2(function() {
53707 var entity2 = context.hasEntity(hallId);
53710 var box = pointBox(entity2.loc, context);
53711 var textId = context.lastPointerType() === "mouse" ? "click_townhall" : "tap_townhall";
53712 reveal(box, helpHtml("intro.navigation." + textId));
53713 context.map().on("move.intro drawn.intro", function() {
53714 var entity3 = context.hasEntity(hallId);
53717 var box2 = pointBox(entity3.loc, context);
53718 reveal(box2, helpHtml("intro.navigation." + textId), { duration: 0 });
53720 context.on("enter.intro", function() {
53721 if (isTownHallSelected())
53722 continueTo(selectedTownHall);
53725 context.history().on("change.intro", function() {
53726 if (!context.hasEntity(hallId)) {
53727 continueTo(clickTownHall);
53730 function continueTo(nextStep) {
53731 context.on("enter.intro", null);
53732 context.map().on("move.intro drawn.intro", null);
53733 context.history().on("change.intro", null);
53737 function selectedTownHall() {
53738 if (!isTownHallSelected())
53739 return clickTownHall();
53740 var entity = context.hasEntity(hallId);
53742 return clickTownHall();
53743 var box = pointBox(entity.loc, context);
53744 var onClick = function() {
53745 continueTo(editorTownHall);
53749 helpHtml("intro.navigation.selected_townhall"),
53750 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53752 context.map().on("move.intro drawn.intro", function() {
53753 var entity2 = context.hasEntity(hallId);
53756 var box2 = pointBox(entity2.loc, context);
53759 helpHtml("intro.navigation.selected_townhall"),
53760 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53763 context.history().on("change.intro", function() {
53764 if (!context.hasEntity(hallId)) {
53765 continueTo(clickTownHall);
53768 function continueTo(nextStep) {
53769 context.map().on("move.intro drawn.intro", null);
53770 context.history().on("change.intro", null);
53774 function editorTownHall() {
53775 if (!isTownHallSelected())
53776 return clickTownHall();
53777 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
53778 var onClick = function() {
53779 continueTo(presetTownHall);
53782 ".entity-editor-pane",
53783 helpHtml("intro.navigation.editor_townhall"),
53784 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53786 context.on("exit.intro", function() {
53787 continueTo(clickTownHall);
53789 context.history().on("change.intro", function() {
53790 if (!context.hasEntity(hallId)) {
53791 continueTo(clickTownHall);
53794 function continueTo(nextStep) {
53795 context.on("exit.intro", null);
53796 context.history().on("change.intro", null);
53797 context.container().select(".inspector-wrap").on("wheel.intro", null);
53801 function presetTownHall() {
53802 if (!isTownHallSelected())
53803 return clickTownHall();
53804 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
53805 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
53806 var entity = context.entity(context.selectedIDs()[0]);
53807 var preset = _mainPresetIndex.match(entity, context.graph());
53808 var onClick = function() {
53809 continueTo(fieldsTownHall);
53812 ".entity-editor-pane .section-feature-type",
53813 helpHtml("intro.navigation.preset_townhall", { preset: preset.name() }),
53814 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53816 context.on("exit.intro", function() {
53817 continueTo(clickTownHall);
53819 context.history().on("change.intro", function() {
53820 if (!context.hasEntity(hallId)) {
53821 continueTo(clickTownHall);
53824 function continueTo(nextStep) {
53825 context.on("exit.intro", null);
53826 context.history().on("change.intro", null);
53827 context.container().select(".inspector-wrap").on("wheel.intro", null);
53831 function fieldsTownHall() {
53832 if (!isTownHallSelected())
53833 return clickTownHall();
53834 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
53835 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
53836 var onClick = function() {
53837 continueTo(closeTownHall);
53840 ".entity-editor-pane .section-preset-fields",
53841 helpHtml("intro.navigation.fields_townhall"),
53842 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53844 context.on("exit.intro", function() {
53845 continueTo(clickTownHall);
53847 context.history().on("change.intro", function() {
53848 if (!context.hasEntity(hallId)) {
53849 continueTo(clickTownHall);
53852 function continueTo(nextStep) {
53853 context.on("exit.intro", null);
53854 context.history().on("change.intro", null);
53855 context.container().select(".inspector-wrap").on("wheel.intro", null);
53859 function closeTownHall() {
53860 if (!isTownHallSelected())
53861 return clickTownHall();
53862 var selector = ".entity-editor-pane button.close svg use";
53863 var href = select_default2(selector).attr("href") || "#iD-icon-close";
53865 ".entity-editor-pane",
53866 helpHtml("intro.navigation.close_townhall", { button: { html: icon(href, "inline") } })
53868 context.on("exit.intro", function() {
53869 continueTo(searchStreet);
53871 context.history().on("change.intro", function() {
53872 var selector2 = ".entity-editor-pane button.close svg use";
53873 var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
53875 ".entity-editor-pane",
53876 helpHtml("intro.navigation.close_townhall", { button: { html: icon(href2, "inline") } }),
53880 function continueTo(nextStep) {
53881 context.on("exit.intro", null);
53882 context.history().on("change.intro", null);
53886 function searchStreet() {
53887 context.enter(modeBrowse(context));
53888 context.history().reset("initial");
53889 var msec = transitionTime(springStreet, context.map().center());
53891 reveal(null, null, { duration: 0 });
53893 context.map().centerZoomEase(springStreet, 19, msec);
53894 timeout2(function() {
53896 ".search-header input",
53897 helpHtml("intro.navigation.search_street", { name: _t("intro.graph.name.spring-street") })
53899 context.container().select(".search-header input").on("keyup.intro", checkSearchResult);
53902 function checkSearchResult() {
53903 var first = context.container().select(".feature-list-item:nth-child(0n+2)");
53904 var firstName = first.select(".entity-name");
53905 var name = _t("intro.graph.name.spring-street");
53906 if (!firstName.empty() && firstName.html() === name) {
53909 helpHtml("intro.navigation.choose_street", { name }),
53912 context.on("exit.intro", function() {
53913 continueTo(selectedStreet);
53915 context.container().select(".search-header input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
53917 function continueTo(nextStep) {
53918 context.on("exit.intro", null);
53919 context.container().select(".search-header input").on("keydown.intro", null).on("keyup.intro", null);
53923 function selectedStreet() {
53924 if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
53925 return searchStreet();
53927 var onClick = function() {
53928 continueTo(editorStreet);
53930 var entity = context.entity(springStreetEndId);
53931 var box = pointBox(entity.loc, context);
53935 helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
53936 { duration: 600, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53938 timeout2(function() {
53939 context.map().on("move.intro drawn.intro", function() {
53940 var entity2 = context.hasEntity(springStreetEndId);
53943 var box2 = pointBox(entity2.loc, context);
53947 helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
53948 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53952 context.on("enter.intro", function(mode) {
53953 if (!context.hasEntity(springStreetId)) {
53954 return continueTo(searchStreet);
53956 var ids = context.selectedIDs();
53957 if (mode.id !== "select" || !ids.length || ids[0] !== springStreetId) {
53958 context.enter(modeSelect(context, [springStreetId]));
53961 context.history().on("change.intro", function() {
53962 if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
53963 timeout2(function() {
53964 continueTo(searchStreet);
53968 function continueTo(nextStep) {
53969 context.map().on("move.intro drawn.intro", null);
53970 context.on("enter.intro", null);
53971 context.history().on("change.intro", null);
53975 function editorStreet() {
53976 var selector = ".entity-editor-pane button.close svg use";
53977 var href = select_default2(selector).attr("href") || "#iD-icon-close";
53978 reveal(".entity-editor-pane", helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
53979 button: { html: icon(href, "inline") },
53980 field1: onewayField.title(),
53981 field2: maxspeedField.title()
53983 context.on("exit.intro", function() {
53986 context.history().on("change.intro", function() {
53987 var selector2 = ".entity-editor-pane button.close svg use";
53988 var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
53990 ".entity-editor-pane",
53991 helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
53992 button: { html: icon(href2, "inline") },
53993 field1: onewayField.title(),
53994 field2: maxspeedField.title()
53999 function continueTo(nextStep) {
54000 context.on("exit.intro", null);
54001 context.history().on("change.intro", null);
54006 dispatch10.call("done");
54009 helpHtml("intro.navigation.play", { next: _t("intro.points.title") }),
54011 tooltipBox: ".intro-nav-wrap .chapter-point",
54012 buttonText: _t.html("intro.ok"),
54013 buttonCallback: function() {
54014 reveal(".ideditor");
54019 chapter.enter = function() {
54022 chapter.exit = function() {
54023 timeouts.forEach(window.clearTimeout);
54024 context.on("enter.intro exit.intro", null);
54025 context.map().on("move.intro drawn.intro", null);
54026 context.history().on("change.intro", null);
54027 context.container().select(".inspector-wrap").on("wheel.intro", null);
54028 context.container().select(".search-header input").on("keydown.intro keyup.intro", null);
54030 chapter.restart = function() {
54034 return utilRebind(chapter, dispatch10, "on");
54037 // modules/ui/intro/point.js
54038 function uiIntroPoint(context, reveal) {
54039 var dispatch10 = dispatch_default("done");
54041 var intersection = [-85.63279, 41.94394];
54042 var building = [-85.632422, 41.944045];
54043 var cafePreset = _mainPresetIndex.item("amenity/cafe");
54044 var _pointID = null;
54046 title: "intro.points.title"
54048 function timeout2(f2, t) {
54049 timeouts.push(window.setTimeout(f2, t));
54051 function eventCancel(d3_event) {
54052 d3_event.stopPropagation();
54053 d3_event.preventDefault();
54055 function addPoint() {
54056 context.enter(modeBrowse(context));
54057 context.history().reset("initial");
54058 var msec = transitionTime(intersection, context.map().center());
54060 reveal(null, null, { duration: 0 });
54062 context.map().centerZoomEase(intersection, 19, msec);
54063 timeout2(function() {
54064 var tooltip = reveal(
54065 "button.add-point",
54066 helpHtml("intro.points.points_info") + "{br}" + helpHtml("intro.points.add_point")
54069 tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-points");
54070 context.on("enter.intro", function(mode) {
54071 if (mode.id !== "add-point")
54073 continueTo(placePoint);
54076 function continueTo(nextStep) {
54077 context.on("enter.intro", null);
54081 function placePoint() {
54082 if (context.mode().id !== "add-point") {
54083 return chapter.restart();
54085 var pointBox2 = pad(building, 150, context);
54086 var textId = context.lastPointerType() === "mouse" ? "place_point" : "place_point_touch";
54087 reveal(pointBox2, helpHtml("intro.points." + textId));
54088 context.map().on("move.intro drawn.intro", function() {
54089 pointBox2 = pad(building, 150, context);
54090 reveal(pointBox2, helpHtml("intro.points." + textId), { duration: 0 });
54092 context.on("enter.intro", function(mode) {
54093 if (mode.id !== "select")
54094 return chapter.restart();
54095 _pointID = context.mode().selectedIDs()[0];
54096 continueTo(searchPreset);
54098 function continueTo(nextStep) {
54099 context.map().on("move.intro drawn.intro", null);
54100 context.on("enter.intro", null);
54104 function searchPreset() {
54105 if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
54108 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
54109 context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
54111 ".preset-search-input",
54112 helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
54114 context.on("enter.intro", function(mode) {
54115 if (!_pointID || !context.hasEntity(_pointID)) {
54116 return continueTo(addPoint);
54118 var ids = context.selectedIDs();
54119 if (mode.id !== "select" || !ids.length || ids[0] !== _pointID) {
54120 context.enter(modeSelect(context, [_pointID]));
54121 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
54122 context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
54124 ".preset-search-input",
54125 helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
54127 context.history().on("change.intro", null);
54130 function checkPresetSearch() {
54131 var first = context.container().select(".preset-list-item:first-child");
54132 if (first.classed("preset-amenity-cafe")) {
54133 context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
54135 first.select(".preset-list-button").node(),
54136 helpHtml("intro.points.choose_cafe", { preset: cafePreset.name() }),
54139 context.history().on("change.intro", function() {
54140 continueTo(aboutFeatureEditor);
54144 function continueTo(nextStep) {
54145 context.on("enter.intro", null);
54146 context.history().on("change.intro", null);
54147 context.container().select(".inspector-wrap").on("wheel.intro", null);
54148 context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
54152 function aboutFeatureEditor() {
54153 if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
54156 timeout2(function() {
54157 reveal(".entity-editor-pane", helpHtml("intro.points.feature_editor"), {
54158 tooltipClass: "intro-points-describe",
54159 buttonText: _t.html("intro.ok"),
54160 buttonCallback: function() {
54161 continueTo(addName);
54165 context.on("exit.intro", function() {
54166 continueTo(reselectPoint);
54168 function continueTo(nextStep) {
54169 context.on("exit.intro", null);
54173 function addName() {
54174 if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
54177 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
54178 var addNameString = helpHtml("intro.points.fields_info") + "{br}" + helpHtml("intro.points.add_name");
54179 timeout2(function() {
54180 var entity = context.entity(_pointID);
54181 if (entity.tags.name) {
54182 var tooltip = reveal(".entity-editor-pane", addNameString, {
54183 tooltipClass: "intro-points-describe",
54184 buttonText: _t.html("intro.ok"),
54185 buttonCallback: function() {
54186 continueTo(addCloseEditor);
54189 tooltip.select(".instruction").style("display", "none");
54192 ".entity-editor-pane",
54194 { tooltipClass: "intro-points-describe" }
54198 context.history().on("change.intro", function() {
54199 continueTo(addCloseEditor);
54201 context.on("exit.intro", function() {
54202 continueTo(reselectPoint);
54204 function continueTo(nextStep) {
54205 context.on("exit.intro", null);
54206 context.history().on("change.intro", null);
54210 function addCloseEditor() {
54211 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
54212 var selector = ".entity-editor-pane button.close svg use";
54213 var href = select_default2(selector).attr("href") || "#iD-icon-close";
54214 context.on("exit.intro", function() {
54215 continueTo(reselectPoint);
54218 ".entity-editor-pane",
54219 helpHtml("intro.points.add_close", { button: { html: icon(href, "inline") } })
54221 function continueTo(nextStep) {
54222 context.on("exit.intro", null);
54226 function reselectPoint() {
54228 return chapter.restart();
54229 var entity = context.hasEntity(_pointID);
54231 return chapter.restart();
54232 var oldPreset = _mainPresetIndex.match(entity, context.graph());
54233 context.replace(actionChangePreset(_pointID, oldPreset, cafePreset));
54234 context.enter(modeBrowse(context));
54235 var msec = transitionTime(entity.loc, context.map().center());
54237 reveal(null, null, { duration: 0 });
54239 context.map().centerEase(entity.loc, msec);
54240 timeout2(function() {
54241 var box = pointBox(entity.loc, context);
54242 reveal(box, helpHtml("intro.points.reselect"), { duration: 600 });
54243 timeout2(function() {
54244 context.map().on("move.intro drawn.intro", function() {
54245 var entity2 = context.hasEntity(_pointID);
54247 return chapter.restart();
54248 var box2 = pointBox(entity2.loc, context);
54249 reveal(box2, helpHtml("intro.points.reselect"), { duration: 0 });
54252 context.on("enter.intro", function(mode) {
54253 if (mode.id !== "select")
54255 continueTo(updatePoint);
54258 function continueTo(nextStep) {
54259 context.map().on("move.intro drawn.intro", null);
54260 context.on("enter.intro", null);
54264 function updatePoint() {
54265 if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
54266 return continueTo(reselectPoint);
54268 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
54269 context.on("exit.intro", function() {
54270 continueTo(reselectPoint);
54272 context.history().on("change.intro", function() {
54273 continueTo(updateCloseEditor);
54275 timeout2(function() {
54277 ".entity-editor-pane",
54278 helpHtml("intro.points.update"),
54279 { tooltipClass: "intro-points-describe" }
54282 function continueTo(nextStep) {
54283 context.on("exit.intro", null);
54284 context.history().on("change.intro", null);
54288 function updateCloseEditor() {
54289 if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
54290 return continueTo(reselectPoint);
54292 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
54293 context.on("exit.intro", function() {
54294 continueTo(rightClickPoint);
54296 timeout2(function() {
54298 ".entity-editor-pane",
54299 helpHtml("intro.points.update_close", { button: { html: icon("#iD-icon-close", "inline") } })
54302 function continueTo(nextStep) {
54303 context.on("exit.intro", null);
54307 function rightClickPoint() {
54309 return chapter.restart();
54310 var entity = context.hasEntity(_pointID);
54312 return chapter.restart();
54313 context.enter(modeBrowse(context));
54314 var box = pointBox(entity.loc, context);
54315 var textId = context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch";
54316 reveal(box, helpHtml("intro.points." + textId), { duration: 600 });
54317 timeout2(function() {
54318 context.map().on("move.intro", function() {
54319 var entity2 = context.hasEntity(_pointID);
54321 return chapter.restart();
54322 var box2 = pointBox(entity2.loc, context);
54323 reveal(box2, helpHtml("intro.points." + textId), { duration: 0 });
54326 context.on("enter.intro", function(mode) {
54327 if (mode.id !== "select")
54329 var ids = context.selectedIDs();
54330 if (ids.length !== 1 || ids[0] !== _pointID)
54332 timeout2(function() {
54333 var node = selectMenuItem(context, "delete").node();
54336 continueTo(enterDelete);
54339 function continueTo(nextStep) {
54340 context.on("enter.intro", null);
54341 context.map().on("move.intro", null);
54345 function enterDelete() {
54347 return chapter.restart();
54348 var entity = context.hasEntity(_pointID);
54350 return chapter.restart();
54351 var node = selectMenuItem(context, "delete").node();
54353 return continueTo(rightClickPoint);
54357 helpHtml("intro.points.delete"),
54360 timeout2(function() {
54361 context.map().on("move.intro", function() {
54364 helpHtml("intro.points.delete"),
54365 { duration: 0, padding: 50 }
54369 context.on("exit.intro", function() {
54371 return chapter.restart();
54372 var entity2 = context.hasEntity(_pointID);
54374 return continueTo(rightClickPoint);
54376 context.history().on("change.intro", function(changed) {
54377 if (changed.deleted().length) {
54381 function continueTo(nextStep) {
54382 context.map().on("move.intro", null);
54383 context.history().on("change.intro", null);
54384 context.on("exit.intro", null);
54389 context.history().on("change.intro", function() {
54393 ".top-toolbar button.undo-button",
54394 helpHtml("intro.points.undo")
54396 function continueTo(nextStep) {
54397 context.history().on("change.intro", null);
54402 dispatch10.call("done");
54405 helpHtml("intro.points.play", { next: _t("intro.areas.title") }),
54407 tooltipBox: ".intro-nav-wrap .chapter-area",
54408 buttonText: _t.html("intro.ok"),
54409 buttonCallback: function() {
54410 reveal(".ideditor");
54415 chapter.enter = function() {
54418 chapter.exit = function() {
54419 timeouts.forEach(window.clearTimeout);
54420 context.on("enter.intro exit.intro", null);
54421 context.map().on("move.intro drawn.intro", null);
54422 context.history().on("change.intro", null);
54423 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
54424 context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
54426 chapter.restart = function() {
54430 return utilRebind(chapter, dispatch10, "on");
54433 // modules/ui/intro/area.js
54434 function uiIntroArea(context, reveal) {
54435 var dispatch10 = dispatch_default("done");
54436 var playground = [-85.63552, 41.94159];
54437 var playgroundPreset = _mainPresetIndex.item("leisure/playground");
54438 var nameField = _mainPresetIndex.field("name");
54439 var descriptionField = _mainPresetIndex.field("description");
54443 title: "intro.areas.title"
54445 function timeout2(f2, t) {
54446 timeouts.push(window.setTimeout(f2, t));
54448 function eventCancel(d3_event) {
54449 d3_event.stopPropagation();
54450 d3_event.preventDefault();
54452 function revealPlayground(center, text2, options2) {
54453 var padding = 180 * Math.pow(2, context.map().zoom() - 19.5);
54454 var box = pad(center, padding, context);
54455 reveal(box, text2, options2);
54457 function addArea() {
54458 context.enter(modeBrowse(context));
54459 context.history().reset("initial");
54461 var msec = transitionTime(playground, context.map().center());
54463 reveal(null, null, { duration: 0 });
54465 context.map().centerZoomEase(playground, 19, msec);
54466 timeout2(function() {
54467 var tooltip = reveal(
54469 helpHtml("intro.areas.add_playground")
54471 tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-areas");
54472 context.on("enter.intro", function(mode) {
54473 if (mode.id !== "add-area")
54475 continueTo(startPlayground);
54478 function continueTo(nextStep) {
54479 context.on("enter.intro", null);
54483 function startPlayground() {
54484 if (context.mode().id !== "add-area") {
54485 return chapter.restart();
54488 context.map().zoomEase(19.5, 500);
54489 timeout2(function() {
54490 var textId = context.lastPointerType() === "mouse" ? "starting_node_click" : "starting_node_tap";
54491 var startDrawString = helpHtml("intro.areas.start_playground") + helpHtml("intro.areas." + textId);
54497 timeout2(function() {
54498 context.map().on("move.intro drawn.intro", function() {
54505 context.on("enter.intro", function(mode) {
54506 if (mode.id !== "draw-area")
54507 return chapter.restart();
54508 continueTo(continuePlayground);
54512 function continueTo(nextStep) {
54513 context.map().on("move.intro drawn.intro", null);
54514 context.on("enter.intro", null);
54518 function continuePlayground() {
54519 if (context.mode().id !== "draw-area") {
54520 return chapter.restart();
54525 helpHtml("intro.areas.continue_playground"),
54528 timeout2(function() {
54529 context.map().on("move.intro drawn.intro", function() {
54532 helpHtml("intro.areas.continue_playground"),
54537 context.on("enter.intro", function(mode) {
54538 if (mode.id === "draw-area") {
54539 var entity = context.hasEntity(context.selectedIDs()[0]);
54540 if (entity && entity.nodes.length >= 6) {
54541 return continueTo(finishPlayground);
54545 } else if (mode.id === "select") {
54546 _areaID = context.selectedIDs()[0];
54547 return continueTo(searchPresets);
54549 return chapter.restart();
54552 function continueTo(nextStep) {
54553 context.map().on("move.intro drawn.intro", null);
54554 context.on("enter.intro", null);
54558 function finishPlayground() {
54559 if (context.mode().id !== "draw-area") {
54560 return chapter.restart();
54563 var finishString = helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.areas.finish_playground");
54569 timeout2(function() {
54570 context.map().on("move.intro drawn.intro", function() {
54578 context.on("enter.intro", function(mode) {
54579 if (mode.id === "draw-area") {
54581 } else if (mode.id === "select") {
54582 _areaID = context.selectedIDs()[0];
54583 return continueTo(searchPresets);
54585 return chapter.restart();
54588 function continueTo(nextStep) {
54589 context.map().on("move.intro drawn.intro", null);
54590 context.on("enter.intro", null);
54594 function searchPresets() {
54595 if (!_areaID || !context.hasEntity(_areaID)) {
54598 var ids = context.selectedIDs();
54599 if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
54600 context.enter(modeSelect(context, [_areaID]));
54602 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
54603 timeout2(function() {
54604 context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
54605 context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
54607 ".preset-search-input",
54608 helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
54611 context.on("enter.intro", function(mode) {
54612 if (!_areaID || !context.hasEntity(_areaID)) {
54613 return continueTo(addArea);
54615 var ids2 = context.selectedIDs();
54616 if (mode.id !== "select" || !ids2.length || ids2[0] !== _areaID) {
54617 context.enter(modeSelect(context, [_areaID]));
54618 context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
54619 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
54620 context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
54622 ".preset-search-input",
54623 helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
54625 context.history().on("change.intro", null);
54628 function checkPresetSearch() {
54629 var first = context.container().select(".preset-list-item:first-child");
54630 if (first.classed("preset-leisure-playground")) {
54632 first.select(".preset-list-button").node(),
54633 helpHtml("intro.areas.choose_playground", { preset: playgroundPreset.name() }),
54636 context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
54637 context.history().on("change.intro", function() {
54638 continueTo(clickAddField);
54642 function continueTo(nextStep) {
54643 context.container().select(".inspector-wrap").on("wheel.intro", null);
54644 context.on("enter.intro", null);
54645 context.history().on("change.intro", null);
54646 context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
54650 function clickAddField() {
54651 if (!_areaID || !context.hasEntity(_areaID)) {
54654 var ids = context.selectedIDs();
54655 if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
54656 return searchPresets();
54658 if (!context.container().select(".form-field-description").empty()) {
54659 return continueTo(describePlayground);
54661 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
54662 timeout2(function() {
54663 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
54664 var entity = context.entity(_areaID);
54665 if (entity.tags.description) {
54666 return continueTo(play);
54668 var box = context.container().select(".more-fields").node().getBoundingClientRect();
54669 if (box.top > 300) {
54670 var pane = context.container().select(".entity-editor-pane .inspector-body");
54671 var start2 = pane.node().scrollTop;
54672 var end = start2 + (box.top - 300);
54673 pane.transition().duration(250).tween("scroll.inspector", function() {
54675 var i2 = number_default(start2, end);
54676 return function(t) {
54677 node.scrollTop = i2(t);
54681 timeout2(function() {
54683 ".more-fields .combobox-input",
54684 helpHtml("intro.areas.add_field", {
54685 name: nameField.title(),
54686 description: descriptionField.title()
54690 context.container().select(".more-fields .combobox-input").on("click.intro", function() {
54692 watcher = window.setInterval(function() {
54693 if (!context.container().select("div.combobox").empty()) {
54694 window.clearInterval(watcher);
54695 continueTo(chooseDescriptionField);
54701 context.on("exit.intro", function() {
54702 return continueTo(searchPresets);
54704 function continueTo(nextStep) {
54705 context.container().select(".inspector-wrap").on("wheel.intro", null);
54706 context.container().select(".more-fields .combobox-input").on("click.intro", null);
54707 context.on("exit.intro", null);
54711 function chooseDescriptionField() {
54712 if (!_areaID || !context.hasEntity(_areaID)) {
54715 var ids = context.selectedIDs();
54716 if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
54717 return searchPresets();
54719 if (!context.container().select(".form-field-description").empty()) {
54720 return continueTo(describePlayground);
54722 if (context.container().select("div.combobox").empty()) {
54723 return continueTo(clickAddField);
54726 watcher = window.setInterval(function() {
54727 if (context.container().select("div.combobox").empty()) {
54728 window.clearInterval(watcher);
54729 timeout2(function() {
54730 if (context.container().select(".form-field-description").empty()) {
54731 continueTo(retryChooseDescription);
54733 continueTo(describePlayground);
54740 helpHtml("intro.areas.choose_field", { field: descriptionField.title() }),
54743 context.on("exit.intro", function() {
54744 return continueTo(searchPresets);
54746 function continueTo(nextStep) {
54748 window.clearInterval(watcher);
54749 context.on("exit.intro", null);
54753 function describePlayground() {
54754 if (!_areaID || !context.hasEntity(_areaID)) {
54757 var ids = context.selectedIDs();
54758 if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
54759 return searchPresets();
54761 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
54762 if (context.container().select(".form-field-description").empty()) {
54763 return continueTo(retryChooseDescription);
54765 context.on("exit.intro", function() {
54769 ".entity-editor-pane",
54770 helpHtml("intro.areas.describe_playground", { button: { html: icon("#iD-icon-close", "inline") } }),
54773 function continueTo(nextStep) {
54774 context.on("exit.intro", null);
54778 function retryChooseDescription() {
54779 if (!_areaID || !context.hasEntity(_areaID)) {
54782 var ids = context.selectedIDs();
54783 if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
54784 return searchPresets();
54786 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
54788 ".entity-editor-pane",
54789 helpHtml("intro.areas.retry_add_field", { field: descriptionField.title() }),
54791 buttonText: _t.html("intro.ok"),
54792 buttonCallback: function() {
54793 continueTo(clickAddField);
54797 context.on("exit.intro", function() {
54798 return continueTo(searchPresets);
54800 function continueTo(nextStep) {
54801 context.on("exit.intro", null);
54806 dispatch10.call("done");
54809 helpHtml("intro.areas.play", { next: _t("intro.lines.title") }),
54811 tooltipBox: ".intro-nav-wrap .chapter-line",
54812 buttonText: _t.html("intro.ok"),
54813 buttonCallback: function() {
54814 reveal(".ideditor");
54819 chapter.enter = function() {
54822 chapter.exit = function() {
54823 timeouts.forEach(window.clearTimeout);
54824 context.on("enter.intro exit.intro", null);
54825 context.map().on("move.intro drawn.intro", null);
54826 context.history().on("change.intro", null);
54827 context.container().select(".inspector-wrap").on("wheel.intro", null);
54828 context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
54829 context.container().select(".more-fields .combobox-input").on("click.intro", null);
54831 chapter.restart = function() {
54835 return utilRebind(chapter, dispatch10, "on");
54838 // modules/ui/intro/line.js
54839 function uiIntroLine(context, reveal) {
54840 var dispatch10 = dispatch_default("done");
54842 var _tulipRoadID = null;
54843 var flowerRoadID = "w646";
54844 var tulipRoadStart = [-85.6297754121684, 41.95805253325314];
54845 var tulipRoadMidpoint = [-85.62975395449628, 41.95787501510204];
54846 var tulipRoadIntersection = [-85.62974496187628, 41.95742515554585];
54847 var roadCategory = _mainPresetIndex.item("category-road_minor");
54848 var residentialPreset = _mainPresetIndex.item("highway/residential");
54849 var woodRoadID = "w525";
54850 var woodRoadEndID = "n2862";
54851 var woodRoadAddNode = [-85.62390110349587, 41.95397111462291];
54852 var woodRoadDragEndpoint = [-85.623867390213, 41.95466987786487];
54853 var woodRoadDragMidpoint = [-85.62386254803509, 41.95430395953872];
54854 var washingtonStreetID = "w522";
54855 var twelfthAvenueID = "w1";
54856 var eleventhAvenueEndID = "n3550";
54857 var twelfthAvenueEndID = "n5";
54858 var _washingtonSegmentID = null;
54859 var eleventhAvenueEnd = context.entity(eleventhAvenueEndID).loc;
54860 var twelfthAvenueEnd = context.entity(twelfthAvenueEndID).loc;
54861 var deleteLinesLoc = [-85.6219395542764, 41.95228033922477];
54862 var twelfthAvenue = [-85.62219310052491, 41.952505413152956];
54864 title: "intro.lines.title"
54866 function timeout2(f2, t) {
54867 timeouts.push(window.setTimeout(f2, t));
54869 function eventCancel(d3_event) {
54870 d3_event.stopPropagation();
54871 d3_event.preventDefault();
54873 function addLine() {
54874 context.enter(modeBrowse(context));
54875 context.history().reset("initial");
54876 var msec = transitionTime(tulipRoadStart, context.map().center());
54878 reveal(null, null, { duration: 0 });
54880 context.map().centerZoomEase(tulipRoadStart, 18.5, msec);
54881 timeout2(function() {
54882 var tooltip = reveal(
54884 helpHtml("intro.lines.add_line")
54886 tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-lines");
54887 context.on("enter.intro", function(mode) {
54888 if (mode.id !== "add-line")
54890 continueTo(startLine);
54893 function continueTo(nextStep) {
54894 context.on("enter.intro", null);
54898 function startLine() {
54899 if (context.mode().id !== "add-line")
54900 return chapter.restart();
54901 _tulipRoadID = null;
54902 var padding = 70 * Math.pow(2, context.map().zoom() - 18);
54903 var box = pad(tulipRoadStart, padding, context);
54904 box.height = box.height + 100;
54905 var textId = context.lastPointerType() === "mouse" ? "start_line" : "start_line_tap";
54906 var startLineString = helpHtml("intro.lines.missing_road") + "{br}" + helpHtml("intro.lines.line_draw_info") + helpHtml("intro.lines." + textId);
54907 reveal(box, startLineString);
54908 context.map().on("move.intro drawn.intro", function() {
54909 padding = 70 * Math.pow(2, context.map().zoom() - 18);
54910 box = pad(tulipRoadStart, padding, context);
54911 box.height = box.height + 100;
54912 reveal(box, startLineString, { duration: 0 });
54914 context.on("enter.intro", function(mode) {
54915 if (mode.id !== "draw-line")
54916 return chapter.restart();
54917 continueTo(drawLine);
54919 function continueTo(nextStep) {
54920 context.map().on("move.intro drawn.intro", null);
54921 context.on("enter.intro", null);
54925 function drawLine() {
54926 if (context.mode().id !== "draw-line")
54927 return chapter.restart();
54928 _tulipRoadID = context.mode().selectedIDs()[0];
54929 context.map().centerEase(tulipRoadMidpoint, 500);
54930 timeout2(function() {
54931 var padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
54932 var box = pad(tulipRoadMidpoint, padding, context);
54933 box.height = box.height * 2;
54936 helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") })
54938 context.map().on("move.intro drawn.intro", function() {
54939 padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
54940 box = pad(tulipRoadMidpoint, padding, context);
54941 box.height = box.height * 2;
54944 helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") }),
54949 context.history().on("change.intro", function() {
54950 if (isLineConnected()) {
54951 continueTo(continueLine);
54954 context.on("enter.intro", function(mode) {
54955 if (mode.id === "draw-line") {
54957 } else if (mode.id === "select") {
54958 continueTo(retryIntersect);
54961 return chapter.restart();
54964 function continueTo(nextStep) {
54965 context.map().on("move.intro drawn.intro", null);
54966 context.history().on("change.intro", null);
54967 context.on("enter.intro", null);
54971 function isLineConnected() {
54972 var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
54975 var drawNodes = context.graph().childNodes(entity);
54976 return drawNodes.some(function(node) {
54977 return context.graph().parentWays(node).some(function(parent) {
54978 return parent.id === flowerRoadID;
54982 function retryIntersect() {
54983 select_default2(window).on("pointerdown.intro mousedown.intro", eventCancel, true);
54984 var box = pad(tulipRoadIntersection, 80, context);
54987 helpHtml("intro.lines.retry_intersect", { name: _t("intro.graph.name.flower-street") })
54989 timeout2(chapter.restart, 3e3);
54991 function continueLine() {
54992 if (context.mode().id !== "draw-line")
54993 return chapter.restart();
54994 var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
54996 return chapter.restart();
54997 context.map().centerEase(tulipRoadIntersection, 500);
54998 var continueLineText = helpHtml("intro.lines.continue_line") + "{br}" + helpHtml("intro.lines.finish_line_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.lines.finish_road");
54999 reveal(".surface", continueLineText);
55000 context.on("enter.intro", function(mode) {
55001 if (mode.id === "draw-line") {
55003 } else if (mode.id === "select") {
55004 return continueTo(chooseCategoryRoad);
55006 return chapter.restart();
55009 function continueTo(nextStep) {
55010 context.on("enter.intro", null);
55014 function chooseCategoryRoad() {
55015 if (context.mode().id !== "select")
55016 return chapter.restart();
55017 context.on("exit.intro", function() {
55018 return chapter.restart();
55020 var button = context.container().select(".preset-category-road_minor .preset-list-button");
55021 if (button.empty())
55022 return chapter.restart();
55023 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
55024 timeout2(function() {
55025 context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
55028 helpHtml("intro.lines.choose_category_road", { category: roadCategory.name() })
55030 button.on("click.intro", function() {
55031 continueTo(choosePresetResidential);
55034 function continueTo(nextStep) {
55035 context.container().select(".inspector-wrap").on("wheel.intro", null);
55036 context.container().select(".preset-list-button").on("click.intro", null);
55037 context.on("exit.intro", null);
55041 function choosePresetResidential() {
55042 if (context.mode().id !== "select")
55043 return chapter.restart();
55044 context.on("exit.intro", function() {
55045 return chapter.restart();
55047 var subgrid = context.container().select(".preset-category-road_minor .subgrid");
55048 if (subgrid.empty())
55049 return chapter.restart();
55050 subgrid.selectAll(":not(.preset-highway-residential) .preset-list-button").on("click.intro", function() {
55051 continueTo(retryPresetResidential);
55053 subgrid.selectAll(".preset-highway-residential .preset-list-button").on("click.intro", function() {
55054 continueTo(nameRoad);
55056 timeout2(function() {
55059 helpHtml("intro.lines.choose_preset_residential", { preset: residentialPreset.name() }),
55060 { tooltipBox: ".preset-highway-residential .preset-list-button", duration: 300 }
55063 function continueTo(nextStep) {
55064 context.container().select(".preset-list-button").on("click.intro", null);
55065 context.on("exit.intro", null);
55069 function retryPresetResidential() {
55070 if (context.mode().id !== "select")
55071 return chapter.restart();
55072 context.on("exit.intro", function() {
55073 return chapter.restart();
55075 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
55076 timeout2(function() {
55077 var button = context.container().select(".entity-editor-pane .preset-list-button");
55080 helpHtml("intro.lines.retry_preset_residential", { preset: residentialPreset.name() })
55082 button.on("click.intro", function() {
55083 continueTo(chooseCategoryRoad);
55086 function continueTo(nextStep) {
55087 context.container().select(".inspector-wrap").on("wheel.intro", null);
55088 context.container().select(".preset-list-button").on("click.intro", null);
55089 context.on("exit.intro", null);
55093 function nameRoad() {
55094 context.on("exit.intro", function() {
55095 continueTo(didNameRoad);
55097 timeout2(function() {
55099 ".entity-editor-pane",
55100 helpHtml("intro.lines.name_road", { button: { html: icon("#iD-icon-close", "inline") } }),
55101 { tooltipClass: "intro-lines-name_road" }
55104 function continueTo(nextStep) {
55105 context.on("exit.intro", null);
55109 function didNameRoad() {
55110 context.history().checkpoint("doneAddLine");
55111 timeout2(function() {
55112 reveal(".surface", helpHtml("intro.lines.did_name_road"), {
55113 buttonText: _t.html("intro.ok"),
55114 buttonCallback: function() {
55115 continueTo(updateLine);
55119 function continueTo(nextStep) {
55123 function updateLine() {
55124 context.history().reset("doneAddLine");
55125 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
55126 return chapter.restart();
55128 var msec = transitionTime(woodRoadDragMidpoint, context.map().center());
55130 reveal(null, null, { duration: 0 });
55132 context.map().centerZoomEase(woodRoadDragMidpoint, 19, msec);
55133 timeout2(function() {
55134 var padding = 250 * Math.pow(2, context.map().zoom() - 19);
55135 var box = pad(woodRoadDragMidpoint, padding, context);
55136 var advance = function() {
55137 continueTo(addNode);
55141 helpHtml("intro.lines.update_line"),
55142 { buttonText: _t.html("intro.ok"), buttonCallback: advance }
55144 context.map().on("move.intro drawn.intro", function() {
55145 var padding2 = 250 * Math.pow(2, context.map().zoom() - 19);
55146 var box2 = pad(woodRoadDragMidpoint, padding2, context);
55149 helpHtml("intro.lines.update_line"),
55150 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
55154 function continueTo(nextStep) {
55155 context.map().on("move.intro drawn.intro", null);
55159 function addNode() {
55160 context.history().reset("doneAddLine");
55161 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
55162 return chapter.restart();
55164 var padding = 40 * Math.pow(2, context.map().zoom() - 19);
55165 var box = pad(woodRoadAddNode, padding, context);
55166 var addNodeString = helpHtml("intro.lines.add_node" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
55167 reveal(box, addNodeString);
55168 context.map().on("move.intro drawn.intro", function() {
55169 var padding2 = 40 * Math.pow(2, context.map().zoom() - 19);
55170 var box2 = pad(woodRoadAddNode, padding2, context);
55171 reveal(box2, addNodeString, { duration: 0 });
55173 context.history().on("change.intro", function(changed) {
55174 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
55175 return continueTo(updateLine);
55177 if (changed.created().length === 1) {
55178 timeout2(function() {
55179 continueTo(startDragEndpoint);
55183 context.on("enter.intro", function(mode) {
55184 if (mode.id !== "select") {
55185 continueTo(updateLine);
55188 function continueTo(nextStep) {
55189 context.map().on("move.intro drawn.intro", null);
55190 context.history().on("change.intro", null);
55191 context.on("enter.intro", null);
55195 function startDragEndpoint() {
55196 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
55197 return continueTo(updateLine);
55199 var padding = 100 * Math.pow(2, context.map().zoom() - 19);
55200 var box = pad(woodRoadDragEndpoint, padding, context);
55201 var startDragString = helpHtml("intro.lines.start_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch")) + helpHtml("intro.lines.drag_to_intersection");
55202 reveal(box, startDragString);
55203 context.map().on("move.intro drawn.intro", function() {
55204 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
55205 return continueTo(updateLine);
55207 var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
55208 var box2 = pad(woodRoadDragEndpoint, padding2, context);
55209 reveal(box2, startDragString, { duration: 0 });
55210 var entity = context.entity(woodRoadEndID);
55211 if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) <= 4) {
55212 continueTo(finishDragEndpoint);
55215 function continueTo(nextStep) {
55216 context.map().on("move.intro drawn.intro", null);
55220 function finishDragEndpoint() {
55221 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
55222 return continueTo(updateLine);
55224 var padding = 100 * Math.pow(2, context.map().zoom() - 19);
55225 var box = pad(woodRoadDragEndpoint, padding, context);
55226 var finishDragString = helpHtml("intro.lines.spot_looks_good") + helpHtml("intro.lines.finish_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
55227 reveal(box, finishDragString);
55228 context.map().on("move.intro drawn.intro", function() {
55229 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
55230 return continueTo(updateLine);
55232 var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
55233 var box2 = pad(woodRoadDragEndpoint, padding2, context);
55234 reveal(box2, finishDragString, { duration: 0 });
55235 var entity = context.entity(woodRoadEndID);
55236 if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) > 4) {
55237 continueTo(startDragEndpoint);
55240 context.on("enter.intro", function() {
55241 continueTo(startDragMidpoint);
55243 function continueTo(nextStep) {
55244 context.map().on("move.intro drawn.intro", null);
55245 context.on("enter.intro", null);
55249 function startDragMidpoint() {
55250 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
55251 return continueTo(updateLine);
55253 if (context.selectedIDs().indexOf(woodRoadID) === -1) {
55254 context.enter(modeSelect(context, [woodRoadID]));
55256 var padding = 80 * Math.pow(2, context.map().zoom() - 19);
55257 var box = pad(woodRoadDragMidpoint, padding, context);
55258 reveal(box, helpHtml("intro.lines.start_drag_midpoint"));
55259 context.map().on("move.intro drawn.intro", function() {
55260 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
55261 return continueTo(updateLine);
55263 var padding2 = 80 * Math.pow(2, context.map().zoom() - 19);
55264 var box2 = pad(woodRoadDragMidpoint, padding2, context);
55265 reveal(box2, helpHtml("intro.lines.start_drag_midpoint"), { duration: 0 });
55267 context.history().on("change.intro", function(changed) {
55268 if (changed.created().length === 1) {
55269 continueTo(continueDragMidpoint);
55272 context.on("enter.intro", function(mode) {
55273 if (mode.id !== "select") {
55274 context.enter(modeSelect(context, [woodRoadID]));
55277 function continueTo(nextStep) {
55278 context.map().on("move.intro drawn.intro", null);
55279 context.history().on("change.intro", null);
55280 context.on("enter.intro", null);
55284 function continueDragMidpoint() {
55285 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
55286 return continueTo(updateLine);
55288 var padding = 100 * Math.pow(2, context.map().zoom() - 19);
55289 var box = pad(woodRoadDragEndpoint, padding, context);
55291 var advance = function() {
55292 context.history().checkpoint("doneUpdateLine");
55293 continueTo(deleteLines);
55297 helpHtml("intro.lines.continue_drag_midpoint"),
55298 { buttonText: _t.html("intro.ok"), buttonCallback: advance }
55300 context.map().on("move.intro drawn.intro", function() {
55301 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
55302 return continueTo(updateLine);
55304 var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
55305 var box2 = pad(woodRoadDragEndpoint, padding2, context);
55306 box2.height += 400;
55309 helpHtml("intro.lines.continue_drag_midpoint"),
55310 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
55313 function continueTo(nextStep) {
55314 context.map().on("move.intro drawn.intro", null);
55318 function deleteLines() {
55319 context.history().reset("doneUpdateLine");
55320 context.enter(modeBrowse(context));
55321 if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
55322 return chapter.restart();
55324 var msec = transitionTime(deleteLinesLoc, context.map().center());
55326 reveal(null, null, { duration: 0 });
55328 context.map().centerZoomEase(deleteLinesLoc, 18, msec);
55329 timeout2(function() {
55330 var padding = 200 * Math.pow(2, context.map().zoom() - 18);
55331 var box = pad(deleteLinesLoc, padding, context);
55334 var advance = function() {
55335 continueTo(rightClickIntersection);
55339 helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
55340 { buttonText: _t.html("intro.ok"), buttonCallback: advance }
55342 context.map().on("move.intro drawn.intro", function() {
55343 var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
55344 var box2 = pad(deleteLinesLoc, padding2, context);
55346 box2.height += 400;
55349 helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
55350 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
55353 context.history().on("change.intro", function() {
55354 timeout2(function() {
55355 continueTo(deleteLines);
55359 function continueTo(nextStep) {
55360 context.map().on("move.intro drawn.intro", null);
55361 context.history().on("change.intro", null);
55365 function rightClickIntersection() {
55366 context.history().reset("doneUpdateLine");
55367 context.enter(modeBrowse(context));
55368 context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
55369 var rightClickString = helpHtml("intro.lines.split_street", {
55370 street1: _t("intro.graph.name.11th-avenue"),
55371 street2: _t("intro.graph.name.washington-street")
55372 }) + helpHtml("intro.lines." + (context.lastPointerType() === "mouse" ? "rightclick_intersection" : "edit_menu_intersection_touch"));
55373 timeout2(function() {
55374 var padding = 60 * Math.pow(2, context.map().zoom() - 18);
55375 var box = pad(eleventhAvenueEnd, padding, context);
55376 reveal(box, rightClickString);
55377 context.map().on("move.intro drawn.intro", function() {
55378 var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
55379 var box2 = pad(eleventhAvenueEnd, padding2, context);
55386 context.on("enter.intro", function(mode) {
55387 if (mode.id !== "select")
55389 var ids = context.selectedIDs();
55390 if (ids.length !== 1 || ids[0] !== eleventhAvenueEndID)
55392 timeout2(function() {
55393 var node = selectMenuItem(context, "split").node();
55396 continueTo(splitIntersection);
55399 context.history().on("change.intro", function() {
55400 timeout2(function() {
55401 continueTo(deleteLines);
55405 function continueTo(nextStep) {
55406 context.map().on("move.intro drawn.intro", null);
55407 context.on("enter.intro", null);
55408 context.history().on("change.intro", null);
55412 function splitIntersection() {
55413 if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
55414 return continueTo(deleteLines);
55416 var node = selectMenuItem(context, "split").node();
55418 return continueTo(rightClickIntersection);
55420 var wasChanged = false;
55421 _washingtonSegmentID = null;
55425 "intro.lines.split_intersection",
55426 { street: _t("intro.graph.name.washington-street") }
55430 context.map().on("move.intro drawn.intro", function() {
55431 var node2 = selectMenuItem(context, "split").node();
55432 if (!wasChanged && !node2) {
55433 return continueTo(rightClickIntersection);
55438 "intro.lines.split_intersection",
55439 { street: _t("intro.graph.name.washington-street") }
55441 { duration: 0, padding: 50 }
55444 context.history().on("change.intro", function(changed) {
55446 timeout2(function() {
55447 if (context.history().undoAnnotation() === _t("operations.split.annotation.line", { n: 1 })) {
55448 _washingtonSegmentID = changed.created()[0].id;
55449 continueTo(didSplit);
55451 _washingtonSegmentID = null;
55452 continueTo(retrySplit);
55456 function continueTo(nextStep) {
55457 context.map().on("move.intro drawn.intro", null);
55458 context.history().on("change.intro", null);
55462 function retrySplit() {
55463 context.enter(modeBrowse(context));
55464 context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
55465 var advance = function() {
55466 continueTo(rightClickIntersection);
55468 var padding = 60 * Math.pow(2, context.map().zoom() - 18);
55469 var box = pad(eleventhAvenueEnd, padding, context);
55472 helpHtml("intro.lines.retry_split"),
55473 { buttonText: _t.html("intro.ok"), buttonCallback: advance }
55475 context.map().on("move.intro drawn.intro", function() {
55476 var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
55477 var box2 = pad(eleventhAvenueEnd, padding2, context);
55480 helpHtml("intro.lines.retry_split"),
55481 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
55484 function continueTo(nextStep) {
55485 context.map().on("move.intro drawn.intro", null);
55489 function didSplit() {
55490 if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
55491 return continueTo(rightClickIntersection);
55493 var ids = context.selectedIDs();
55494 var string = "intro.lines.did_split_" + (ids.length > 1 ? "multi" : "single");
55495 var street = _t("intro.graph.name.washington-street");
55496 var padding = 200 * Math.pow(2, context.map().zoom() - 18);
55497 var box = pad(twelfthAvenue, padding, context);
55498 box.width = box.width / 2;
55501 helpHtml(string, { street1: street, street2: street }),
55504 timeout2(function() {
55505 context.map().centerZoomEase(twelfthAvenue, 18, 500);
55506 context.map().on("move.intro drawn.intro", function() {
55507 var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
55508 var box2 = pad(twelfthAvenue, padding2, context);
55509 box2.width = box2.width / 2;
55512 helpHtml(string, { street1: street, street2: street }),
55517 context.on("enter.intro", function() {
55518 var ids2 = context.selectedIDs();
55519 if (ids2.length === 1 && ids2[0] === _washingtonSegmentID) {
55520 continueTo(multiSelect);
55523 context.history().on("change.intro", function() {
55524 if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
55525 return continueTo(rightClickIntersection);
55528 function continueTo(nextStep) {
55529 context.map().on("move.intro drawn.intro", null);
55530 context.on("enter.intro", null);
55531 context.history().on("change.intro", null);
55535 function multiSelect() {
55536 if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
55537 return continueTo(rightClickIntersection);
55539 var ids = context.selectedIDs();
55540 var hasWashington = ids.indexOf(_washingtonSegmentID) !== -1;
55541 var hasTwelfth = ids.indexOf(twelfthAvenueID) !== -1;
55542 if (hasWashington && hasTwelfth) {
55543 return continueTo(multiRightClick);
55544 } else if (!hasWashington && !hasTwelfth) {
55545 return continueTo(didSplit);
55547 context.map().centerZoomEase(twelfthAvenue, 18, 500);
55548 timeout2(function() {
55549 var selected, other, padding, box;
55550 if (hasWashington) {
55551 selected = _t("intro.graph.name.washington-street");
55552 other = _t("intro.graph.name.12th-avenue");
55553 padding = 60 * Math.pow(2, context.map().zoom() - 18);
55554 box = pad(twelfthAvenueEnd, padding, context);
55557 selected = _t("intro.graph.name.12th-avenue");
55558 other = _t("intro.graph.name.washington-street");
55559 padding = 200 * Math.pow(2, context.map().zoom() - 18);
55560 box = pad(twelfthAvenue, padding, context);
55566 "intro.lines.multi_select",
55567 { selected, other1: other }
55568 ) + " " + helpHtml(
55569 "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
55570 { selected, other2: other }
55573 context.map().on("move.intro drawn.intro", function() {
55574 if (hasWashington) {
55575 selected = _t("intro.graph.name.washington-street");
55576 other = _t("intro.graph.name.12th-avenue");
55577 padding = 60 * Math.pow(2, context.map().zoom() - 18);
55578 box = pad(twelfthAvenueEnd, padding, context);
55581 selected = _t("intro.graph.name.12th-avenue");
55582 other = _t("intro.graph.name.washington-street");
55583 padding = 200 * Math.pow(2, context.map().zoom() - 18);
55584 box = pad(twelfthAvenue, padding, context);
55590 "intro.lines.multi_select",
55591 { selected, other1: other }
55592 ) + " " + helpHtml(
55593 "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
55594 { selected, other2: other }
55599 context.on("enter.intro", function() {
55600 continueTo(multiSelect);
55602 context.history().on("change.intro", function() {
55603 if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
55604 return continueTo(rightClickIntersection);
55608 function continueTo(nextStep) {
55609 context.map().on("move.intro drawn.intro", null);
55610 context.on("enter.intro", null);
55611 context.history().on("change.intro", null);
55615 function multiRightClick() {
55616 if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
55617 return continueTo(rightClickIntersection);
55619 var padding = 200 * Math.pow(2, context.map().zoom() - 18);
55620 var box = pad(twelfthAvenue, padding, context);
55621 var rightClickString = helpHtml("intro.lines.multi_select_success") + helpHtml("intro.lines.multi_" + (context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch"));
55622 reveal(box, rightClickString);
55623 context.map().on("move.intro drawn.intro", function() {
55624 var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
55625 var box2 = pad(twelfthAvenue, padding2, context);
55626 reveal(box2, rightClickString, { duration: 0 });
55628 context.ui().editMenu().on("toggled.intro", function(open) {
55631 timeout2(function() {
55632 var ids = context.selectedIDs();
55633 if (ids.length === 2 && ids.indexOf(twelfthAvenueID) !== -1 && ids.indexOf(_washingtonSegmentID) !== -1) {
55634 var node = selectMenuItem(context, "delete").node();
55637 continueTo(multiDelete);
55638 } else if (ids.length === 1 && ids.indexOf(_washingtonSegmentID) !== -1) {
55639 return continueTo(multiSelect);
55641 return continueTo(didSplit);
55645 context.history().on("change.intro", function() {
55646 if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
55647 return continueTo(rightClickIntersection);
55650 function continueTo(nextStep) {
55651 context.map().on("move.intro drawn.intro", null);
55652 context.ui().editMenu().on("toggled.intro", null);
55653 context.history().on("change.intro", null);
55657 function multiDelete() {
55658 if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
55659 return continueTo(rightClickIntersection);
55661 var node = selectMenuItem(context, "delete").node();
55663 return continueTo(multiRightClick);
55666 helpHtml("intro.lines.multi_delete"),
55669 context.map().on("move.intro drawn.intro", function() {
55672 helpHtml("intro.lines.multi_delete"),
55673 { duration: 0, padding: 50 }
55676 context.on("exit.intro", function() {
55677 if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
55678 return continueTo(multiSelect);
55681 context.history().on("change.intro", function() {
55682 if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
55683 continueTo(retryDelete);
55688 function continueTo(nextStep) {
55689 context.map().on("move.intro drawn.intro", null);
55690 context.on("exit.intro", null);
55691 context.history().on("change.intro", null);
55695 function retryDelete() {
55696 context.enter(modeBrowse(context));
55697 var padding = 200 * Math.pow(2, context.map().zoom() - 18);
55698 var box = pad(twelfthAvenue, padding, context);
55699 reveal(box, helpHtml("intro.lines.retry_delete"), {
55700 buttonText: _t.html("intro.ok"),
55701 buttonCallback: function() {
55702 continueTo(multiSelect);
55705 function continueTo(nextStep) {
55710 dispatch10.call("done");
55713 helpHtml("intro.lines.play", { next: _t("intro.buildings.title") }),
55715 tooltipBox: ".intro-nav-wrap .chapter-building",
55716 buttonText: _t.html("intro.ok"),
55717 buttonCallback: function() {
55718 reveal(".ideditor");
55723 chapter.enter = function() {
55726 chapter.exit = function() {
55727 timeouts.forEach(window.clearTimeout);
55728 select_default2(window).on("pointerdown.intro mousedown.intro", null, true);
55729 context.on("enter.intro exit.intro", null);
55730 context.map().on("move.intro drawn.intro", null);
55731 context.history().on("change.intro", null);
55732 context.container().select(".inspector-wrap").on("wheel.intro", null);
55733 context.container().select(".preset-list-button").on("click.intro", null);
55735 chapter.restart = function() {
55739 return utilRebind(chapter, dispatch10, "on");
55742 // modules/ui/intro/building.js
55743 function uiIntroBuilding(context, reveal) {
55744 var dispatch10 = dispatch_default("done");
55745 var house = [-85.62815, 41.95638];
55746 var tank = [-85.62732, 41.95347];
55747 var buildingCatetory = _mainPresetIndex.item("category-building");
55748 var housePreset = _mainPresetIndex.item("building/house");
55749 var tankPreset = _mainPresetIndex.item("man_made/storage_tank");
55751 var _houseID = null;
55752 var _tankID = null;
55754 title: "intro.buildings.title"
55756 function timeout2(f2, t) {
55757 timeouts.push(window.setTimeout(f2, t));
55759 function eventCancel(d3_event) {
55760 d3_event.stopPropagation();
55761 d3_event.preventDefault();
55763 function revealHouse(center, text2, options2) {
55764 var padding = 160 * Math.pow(2, context.map().zoom() - 20);
55765 var box = pad(center, padding, context);
55766 reveal(box, text2, options2);
55768 function revealTank(center, text2, options2) {
55769 var padding = 190 * Math.pow(2, context.map().zoom() - 19.5);
55770 var box = pad(center, padding, context);
55771 reveal(box, text2, options2);
55773 function addHouse() {
55774 context.enter(modeBrowse(context));
55775 context.history().reset("initial");
55777 var msec = transitionTime(house, context.map().center());
55779 reveal(null, null, { duration: 0 });
55781 context.map().centerZoomEase(house, 19, msec);
55782 timeout2(function() {
55783 var tooltip = reveal(
55785 helpHtml("intro.buildings.add_building")
55787 tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-buildings");
55788 context.on("enter.intro", function(mode) {
55789 if (mode.id !== "add-area")
55791 continueTo(startHouse);
55794 function continueTo(nextStep) {
55795 context.on("enter.intro", null);
55799 function startHouse() {
55800 if (context.mode().id !== "add-area") {
55801 return continueTo(addHouse);
55804 context.map().zoomEase(20, 500);
55805 timeout2(function() {
55806 var startString = helpHtml("intro.buildings.start_building") + helpHtml("intro.buildings.building_corner_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
55807 revealHouse(house, startString);
55808 context.map().on("move.intro drawn.intro", function() {
55809 revealHouse(house, startString, { duration: 0 });
55811 context.on("enter.intro", function(mode) {
55812 if (mode.id !== "draw-area")
55813 return chapter.restart();
55814 continueTo(continueHouse);
55817 function continueTo(nextStep) {
55818 context.map().on("move.intro drawn.intro", null);
55819 context.on("enter.intro", null);
55823 function continueHouse() {
55824 if (context.mode().id !== "draw-area") {
55825 return continueTo(addHouse);
55828 var continueString = helpHtml("intro.buildings.continue_building") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_building");
55829 revealHouse(house, continueString);
55830 context.map().on("move.intro drawn.intro", function() {
55831 revealHouse(house, continueString, { duration: 0 });
55833 context.on("enter.intro", function(mode) {
55834 if (mode.id === "draw-area") {
55836 } else if (mode.id === "select") {
55837 var graph = context.graph();
55838 var way = context.entity(context.selectedIDs()[0]);
55839 var nodes = graph.childNodes(way);
55840 var points = utilArrayUniq(nodes).map(function(n2) {
55841 return context.projection(n2.loc);
55843 if (isMostlySquare(points)) {
55845 return continueTo(chooseCategoryBuilding);
55847 return continueTo(retryHouse);
55850 return chapter.restart();
55853 function continueTo(nextStep) {
55854 context.map().on("move.intro drawn.intro", null);
55855 context.on("enter.intro", null);
55859 function retryHouse() {
55860 var onClick = function() {
55861 continueTo(addHouse);
55865 helpHtml("intro.buildings.retry_building"),
55866 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
55868 context.map().on("move.intro drawn.intro", function() {
55871 helpHtml("intro.buildings.retry_building"),
55872 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
55875 function continueTo(nextStep) {
55876 context.map().on("move.intro drawn.intro", null);
55880 function chooseCategoryBuilding() {
55881 if (!_houseID || !context.hasEntity(_houseID)) {
55884 var ids = context.selectedIDs();
55885 if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
55886 context.enter(modeSelect(context, [_houseID]));
55888 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
55889 timeout2(function() {
55890 context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
55891 var button = context.container().select(".preset-category-building .preset-list-button");
55894 helpHtml("intro.buildings.choose_category_building", { category: buildingCatetory.name() })
55896 button.on("click.intro", function() {
55897 button.on("click.intro", null);
55898 continueTo(choosePresetHouse);
55901 context.on("enter.intro", function(mode) {
55902 if (!_houseID || !context.hasEntity(_houseID)) {
55903 return continueTo(addHouse);
55905 var ids2 = context.selectedIDs();
55906 if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
55907 return continueTo(chooseCategoryBuilding);
55910 function continueTo(nextStep) {
55911 context.container().select(".inspector-wrap").on("wheel.intro", null);
55912 context.container().select(".preset-list-button").on("click.intro", null);
55913 context.on("enter.intro", null);
55917 function choosePresetHouse() {
55918 if (!_houseID || !context.hasEntity(_houseID)) {
55921 var ids = context.selectedIDs();
55922 if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
55923 context.enter(modeSelect(context, [_houseID]));
55925 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
55926 timeout2(function() {
55927 context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
55928 var button = context.container().select(".preset-building-house .preset-list-button");
55931 helpHtml("intro.buildings.choose_preset_house", { preset: housePreset.name() }),
55934 button.on("click.intro", function() {
55935 button.on("click.intro", null);
55936 continueTo(closeEditorHouse);
55939 context.on("enter.intro", function(mode) {
55940 if (!_houseID || !context.hasEntity(_houseID)) {
55941 return continueTo(addHouse);
55943 var ids2 = context.selectedIDs();
55944 if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
55945 return continueTo(chooseCategoryBuilding);
55948 function continueTo(nextStep) {
55949 context.container().select(".inspector-wrap").on("wheel.intro", null);
55950 context.container().select(".preset-list-button").on("click.intro", null);
55951 context.on("enter.intro", null);
55955 function closeEditorHouse() {
55956 if (!_houseID || !context.hasEntity(_houseID)) {
55959 var ids = context.selectedIDs();
55960 if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
55961 context.enter(modeSelect(context, [_houseID]));
55963 context.history().checkpoint("hasHouse");
55964 context.on("exit.intro", function() {
55965 continueTo(rightClickHouse);
55967 timeout2(function() {
55969 ".entity-editor-pane",
55970 helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
55973 function continueTo(nextStep) {
55974 context.on("exit.intro", null);
55978 function rightClickHouse() {
55980 return chapter.restart();
55981 context.enter(modeBrowse(context));
55982 context.history().reset("hasHouse");
55983 var zoom = context.map().zoom();
55987 context.map().centerZoomEase(house, zoom, 500);
55988 context.on("enter.intro", function(mode) {
55989 if (mode.id !== "select")
55991 var ids = context.selectedIDs();
55992 if (ids.length !== 1 || ids[0] !== _houseID)
55994 timeout2(function() {
55995 var node = selectMenuItem(context, "orthogonalize").node();
55998 continueTo(clickSquare);
56001 context.map().on("move.intro drawn.intro", function() {
56002 var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_building" : "edit_menu_building_touch"));
56003 revealHouse(house, rightclickString, { duration: 0 });
56005 context.history().on("change.intro", function() {
56006 continueTo(rightClickHouse);
56008 function continueTo(nextStep) {
56009 context.on("enter.intro", null);
56010 context.map().on("move.intro drawn.intro", null);
56011 context.history().on("change.intro", null);
56015 function clickSquare() {
56017 return chapter.restart();
56018 var entity = context.hasEntity(_houseID);
56020 return continueTo(rightClickHouse);
56021 var node = selectMenuItem(context, "orthogonalize").node();
56023 return continueTo(rightClickHouse);
56025 var wasChanged = false;
56028 helpHtml("intro.buildings.square_building"),
56031 context.on("enter.intro", function(mode) {
56032 if (mode.id === "browse") {
56033 continueTo(rightClickHouse);
56034 } else if (mode.id === "move" || mode.id === "rotate") {
56035 continueTo(retryClickSquare);
56038 context.map().on("move.intro", function() {
56039 var node2 = selectMenuItem(context, "orthogonalize").node();
56040 if (!wasChanged && !node2) {
56041 return continueTo(rightClickHouse);
56045 helpHtml("intro.buildings.square_building"),
56046 { duration: 0, padding: 50 }
56049 context.history().on("change.intro", function() {
56051 context.history().on("change.intro", null);
56052 timeout2(function() {
56053 if (context.history().undoAnnotation() === _t("operations.orthogonalize.annotation.feature", { n: 1 })) {
56054 continueTo(doneSquare);
56056 continueTo(retryClickSquare);
56060 function continueTo(nextStep) {
56061 context.on("enter.intro", null);
56062 context.map().on("move.intro", null);
56063 context.history().on("change.intro", null);
56067 function retryClickSquare() {
56068 context.enter(modeBrowse(context));
56069 revealHouse(house, helpHtml("intro.buildings.retry_square"), {
56070 buttonText: _t.html("intro.ok"),
56071 buttonCallback: function() {
56072 continueTo(rightClickHouse);
56075 function continueTo(nextStep) {
56079 function doneSquare() {
56080 context.history().checkpoint("doneSquare");
56081 revealHouse(house, helpHtml("intro.buildings.done_square"), {
56082 buttonText: _t.html("intro.ok"),
56083 buttonCallback: function() {
56084 continueTo(addTank);
56087 function continueTo(nextStep) {
56091 function addTank() {
56092 context.enter(modeBrowse(context));
56093 context.history().reset("doneSquare");
56095 var msec = transitionTime(tank, context.map().center());
56097 reveal(null, null, { duration: 0 });
56099 context.map().centerZoomEase(tank, 19.5, msec);
56100 timeout2(function() {
56103 helpHtml("intro.buildings.add_tank")
56105 context.on("enter.intro", function(mode) {
56106 if (mode.id !== "add-area")
56108 continueTo(startTank);
56111 function continueTo(nextStep) {
56112 context.on("enter.intro", null);
56116 function startTank() {
56117 if (context.mode().id !== "add-area") {
56118 return continueTo(addTank);
56121 timeout2(function() {
56122 var startString = helpHtml("intro.buildings.start_tank") + helpHtml("intro.buildings.tank_edge_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
56123 revealTank(tank, startString);
56124 context.map().on("move.intro drawn.intro", function() {
56125 revealTank(tank, startString, { duration: 0 });
56127 context.on("enter.intro", function(mode) {
56128 if (mode.id !== "draw-area")
56129 return chapter.restart();
56130 continueTo(continueTank);
56133 function continueTo(nextStep) {
56134 context.map().on("move.intro drawn.intro", null);
56135 context.on("enter.intro", null);
56139 function continueTank() {
56140 if (context.mode().id !== "draw-area") {
56141 return continueTo(addTank);
56144 var continueString = helpHtml("intro.buildings.continue_tank") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_tank");
56145 revealTank(tank, continueString);
56146 context.map().on("move.intro drawn.intro", function() {
56147 revealTank(tank, continueString, { duration: 0 });
56149 context.on("enter.intro", function(mode) {
56150 if (mode.id === "draw-area") {
56152 } else if (mode.id === "select") {
56153 _tankID = context.selectedIDs()[0];
56154 return continueTo(searchPresetTank);
56156 return continueTo(addTank);
56159 function continueTo(nextStep) {
56160 context.map().on("move.intro drawn.intro", null);
56161 context.on("enter.intro", null);
56165 function searchPresetTank() {
56166 if (!_tankID || !context.hasEntity(_tankID)) {
56169 var ids = context.selectedIDs();
56170 if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
56171 context.enter(modeSelect(context, [_tankID]));
56173 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
56174 timeout2(function() {
56175 context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
56176 context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
56178 ".preset-search-input",
56179 helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
56182 context.on("enter.intro", function(mode) {
56183 if (!_tankID || !context.hasEntity(_tankID)) {
56184 return continueTo(addTank);
56186 var ids2 = context.selectedIDs();
56187 if (mode.id !== "select" || !ids2.length || ids2[0] !== _tankID) {
56188 context.enter(modeSelect(context, [_tankID]));
56189 context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
56190 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
56191 context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
56193 ".preset-search-input",
56194 helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
56196 context.history().on("change.intro", null);
56199 function checkPresetSearch() {
56200 var first = context.container().select(".preset-list-item:first-child");
56201 if (first.classed("preset-man_made-storage_tank")) {
56203 first.select(".preset-list-button").node(),
56204 helpHtml("intro.buildings.choose_tank", { preset: tankPreset.name() }),
56207 context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
56208 context.history().on("change.intro", function() {
56209 continueTo(closeEditorTank);
56213 function continueTo(nextStep) {
56214 context.container().select(".inspector-wrap").on("wheel.intro", null);
56215 context.on("enter.intro", null);
56216 context.history().on("change.intro", null);
56217 context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
56221 function closeEditorTank() {
56222 if (!_tankID || !context.hasEntity(_tankID)) {
56225 var ids = context.selectedIDs();
56226 if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
56227 context.enter(modeSelect(context, [_tankID]));
56229 context.history().checkpoint("hasTank");
56230 context.on("exit.intro", function() {
56231 continueTo(rightClickTank);
56233 timeout2(function() {
56235 ".entity-editor-pane",
56236 helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
56239 function continueTo(nextStep) {
56240 context.on("exit.intro", null);
56244 function rightClickTank() {
56246 return continueTo(addTank);
56247 context.enter(modeBrowse(context));
56248 context.history().reset("hasTank");
56249 context.map().centerEase(tank, 500);
56250 timeout2(function() {
56251 context.on("enter.intro", function(mode) {
56252 if (mode.id !== "select")
56254 var ids = context.selectedIDs();
56255 if (ids.length !== 1 || ids[0] !== _tankID)
56257 timeout2(function() {
56258 var node = selectMenuItem(context, "circularize").node();
56261 continueTo(clickCircle);
56264 var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_tank" : "edit_menu_tank_touch"));
56265 revealTank(tank, rightclickString);
56266 context.map().on("move.intro drawn.intro", function() {
56267 revealTank(tank, rightclickString, { duration: 0 });
56269 context.history().on("change.intro", function() {
56270 continueTo(rightClickTank);
56273 function continueTo(nextStep) {
56274 context.on("enter.intro", null);
56275 context.map().on("move.intro drawn.intro", null);
56276 context.history().on("change.intro", null);
56280 function clickCircle() {
56282 return chapter.restart();
56283 var entity = context.hasEntity(_tankID);
56285 return continueTo(rightClickTank);
56286 var node = selectMenuItem(context, "circularize").node();
56288 return continueTo(rightClickTank);
56290 var wasChanged = false;
56293 helpHtml("intro.buildings.circle_tank"),
56296 context.on("enter.intro", function(mode) {
56297 if (mode.id === "browse") {
56298 continueTo(rightClickTank);
56299 } else if (mode.id === "move" || mode.id === "rotate") {
56300 continueTo(retryClickCircle);
56303 context.map().on("move.intro", function() {
56304 var node2 = selectMenuItem(context, "circularize").node();
56305 if (!wasChanged && !node2) {
56306 return continueTo(rightClickTank);
56310 helpHtml("intro.buildings.circle_tank"),
56311 { duration: 0, padding: 50 }
56314 context.history().on("change.intro", function() {
56316 context.history().on("change.intro", null);
56317 timeout2(function() {
56318 if (context.history().undoAnnotation() === _t("operations.circularize.annotation.feature", { n: 1 })) {
56321 continueTo(retryClickCircle);
56325 function continueTo(nextStep) {
56326 context.on("enter.intro", null);
56327 context.map().on("move.intro", null);
56328 context.history().on("change.intro", null);
56332 function retryClickCircle() {
56333 context.enter(modeBrowse(context));
56334 revealTank(tank, helpHtml("intro.buildings.retry_circle"), {
56335 buttonText: _t.html("intro.ok"),
56336 buttonCallback: function() {
56337 continueTo(rightClickTank);
56340 function continueTo(nextStep) {
56345 dispatch10.call("done");
56348 helpHtml("intro.buildings.play", { next: _t("intro.startediting.title") }),
56350 tooltipBox: ".intro-nav-wrap .chapter-startEditing",
56351 buttonText: _t.html("intro.ok"),
56352 buttonCallback: function() {
56353 reveal(".ideditor");
56358 chapter.enter = function() {
56361 chapter.exit = function() {
56362 timeouts.forEach(window.clearTimeout);
56363 context.on("enter.intro exit.intro", null);
56364 context.map().on("move.intro drawn.intro", null);
56365 context.history().on("change.intro", null);
56366 context.container().select(".inspector-wrap").on("wheel.intro", null);
56367 context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
56368 context.container().select(".more-fields .combobox-input").on("click.intro", null);
56370 chapter.restart = function() {
56374 return utilRebind(chapter, dispatch10, "on");
56377 // modules/ui/intro/start_editing.js
56378 function uiIntroStartEditing(context, reveal) {
56379 var dispatch10 = dispatch_default("done", "startEditing");
56380 var modalSelection = select_default2(null);
56382 title: "intro.startediting.title"
56384 function showHelp() {
56386 ".map-control.help-control",
56387 helpHtml("intro.startediting.help"),
56389 buttonText: _t.html("intro.ok"),
56390 buttonCallback: function() {
56396 function shortcuts() {
56398 ".map-control.help-control",
56399 helpHtml("intro.startediting.shortcuts"),
56401 buttonText: _t.html("intro.ok"),
56402 buttonCallback: function() {
56408 function showSave() {
56409 context.container().selectAll(".shaded").remove();
56411 ".top-toolbar button.save",
56412 helpHtml("intro.startediting.save"),
56414 buttonText: _t.html("intro.ok"),
56415 buttonCallback: function() {
56421 function showStart() {
56422 context.container().selectAll(".shaded").remove();
56423 modalSelection = uiModal(context.container());
56424 modalSelection.select(".modal").attr("class", "modal-splash modal");
56425 modalSelection.selectAll(".close").remove();
56426 var startbutton = modalSelection.select(".content").attr("class", "fillL").append("button").attr("class", "modal-section huge-modal-button").on("click", function() {
56427 modalSelection.remove();
56429 startbutton.append("svg").attr("class", "illustration").append("use").attr("xlink:href", "#iD-logo-walkthrough");
56430 startbutton.append("h2").call(_t.append("intro.startediting.start"));
56431 dispatch10.call("startEditing");
56433 chapter.enter = function() {
56436 chapter.exit = function() {
56437 modalSelection.remove();
56438 context.container().selectAll(".shaded").remove();
56440 return utilRebind(chapter, dispatch10, "on");
56443 // modules/ui/intro/intro.js
56445 welcome: uiIntroWelcome,
56446 navigation: uiIntroNavigation,
56447 point: uiIntroPoint,
56450 building: uiIntroBuilding,
56451 startEditing: uiIntroStartEditing
56453 var chapterFlow = [
56462 function uiIntro(context) {
56463 const INTRO_IMAGERY = "EsriWorldImageryClarity";
56464 let _introGraph = {};
56466 function intro(selection2) {
56467 _mainFileFetcher.get("intro_graph").then((dataIntroGraph) => {
56468 for (let id2 in dataIntroGraph) {
56469 if (!_introGraph[id2]) {
56470 _introGraph[id2] = osmEntity(localize(dataIntroGraph[id2]));
56473 selection2.call(startIntro);
56474 }).catch(function() {
56477 function startIntro(selection2) {
56478 context.enter(modeBrowse(context));
56479 let osm = context.connection();
56480 let history = context.history().toJSON();
56481 let hash = window.location.hash;
56482 let center = context.map().center();
56483 let zoom = context.map().zoom();
56484 let background = context.background().baseLayerSource();
56485 let overlays = context.background().overlayLayerSources();
56486 let opacity = context.container().selectAll(".main-map .layer-background").style("opacity");
56487 let caches = osm && osm.caches();
56488 let baseEntities = context.history().graph().base().entities;
56489 context.ui().sidebar.expand();
56490 context.container().selectAll("button.sidebar-toggle").classed("disabled", true);
56491 context.inIntro(true);
56493 osm.toggle(false).reset();
56495 context.history().reset();
56496 context.history().merge(Object.values(coreGraph().load(_introGraph).entities));
56497 context.history().checkpoint("initial");
56498 let imagery = context.background().findSource(INTRO_IMAGERY);
56500 context.background().baseLayerSource(imagery);
56502 context.background().bing();
56504 overlays.forEach((d) => context.background().toggleOverlayLayer(d));
56505 let layers = context.layers();
56506 layers.all().forEach((item) => {
56507 if (typeof item.layer.enabled === "function") {
56508 item.layer.enabled(item.id === "osm");
56511 context.container().selectAll(".main-map .layer-background").style("opacity", 1);
56512 let curtain = uiCurtain(context.container().node());
56513 selection2.call(curtain);
56514 corePreferences("walkthrough_started", "yes");
56515 let storedProgress = corePreferences("walkthrough_progress") || "";
56516 let progress = storedProgress.split(";").filter(Boolean);
56517 let chapters = chapterFlow.map((chapter, i2) => {
56518 let s = chapterUi[chapter](context, curtain.reveal).on("done", () => {
56519 buttons.filter((d) => d.title === s.title).classed("finished", true);
56520 if (i2 < chapterFlow.length - 1) {
56521 const next = chapterFlow[i2 + 1];
56522 context.container().select(`button.chapter-${next}`).classed("next", true);
56524 progress.push(chapter);
56525 corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
56529 chapters[chapters.length - 1].on("startEditing", () => {
56530 progress.push("startEditing");
56531 corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
56532 let incomplete = utilArrayDifference(chapterFlow, progress);
56533 if (!incomplete.length) {
56534 corePreferences("walkthrough_completed", "yes");
56538 context.container().selectAll(".main-map .layer-background").style("opacity", opacity);
56539 context.container().selectAll("button.sidebar-toggle").classed("disabled", false);
56541 osm.toggle(true).reset().caches(caches);
56543 context.history().reset().merge(Object.values(baseEntities));
56544 context.background().baseLayerSource(background);
56545 overlays.forEach((d) => context.background().toggleOverlayLayer(d));
56547 context.history().fromJSON(history, false);
56549 context.map().centerZoom(center, zoom);
56550 window.location.replace(hash);
56551 context.inIntro(false);
56553 let navwrap = selection2.append("div").attr("class", "intro-nav-wrap fillD");
56554 navwrap.append("svg").attr("class", "intro-nav-wrap-logo").append("use").attr("xlink:href", "#iD-logo-walkthrough");
56555 let buttonwrap = navwrap.append("div").attr("class", "joined").selectAll("button.chapter");
56556 let buttons = buttonwrap.data(chapters).enter().append("button").attr("class", (d, i2) => `chapter chapter-${chapterFlow[i2]}`).on("click", enterChapter);
56557 buttons.append("span").html((d) => _t.html(d.title));
56558 buttons.append("span").attr("class", "status").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
56559 enterChapter(null, chapters[0]);
56560 function enterChapter(d3_event, newChapter) {
56561 if (_currChapter) {
56562 _currChapter.exit();
56564 context.enter(modeBrowse(context));
56565 _currChapter = newChapter;
56566 _currChapter.enter();
56567 buttons.classed("next", false).classed("active", (d) => d.title === _currChapter.title);
56573 // modules/ui/issues_info.js
56574 function uiIssuesInfo(context) {
56575 var warningsItem = {
56578 iconID: "iD-icon-alert",
56579 descriptionID: "issues.warnings_and_errors"
56581 var resolvedItem = {
56584 iconID: "iD-icon-apply",
56585 descriptionID: "issues.user_resolved_issues"
56587 function update(selection2) {
56588 var shownItems = [];
56589 var liveIssues = context.validator().getIssues({
56590 what: corePreferences("validate-what") || "edited",
56591 where: corePreferences("validate-where") || "all"
56593 if (liveIssues.length) {
56594 warningsItem.count = liveIssues.length;
56595 shownItems.push(warningsItem);
56597 if (corePreferences("validate-what") === "all") {
56598 var resolvedIssues = context.validator().getResolvedIssues();
56599 if (resolvedIssues.length) {
56600 resolvedItem.count = resolvedIssues.length;
56601 shownItems.push(resolvedItem);
56604 var chips = selection2.selectAll(".chip").data(shownItems, function(d) {
56607 chips.exit().remove();
56608 var enter = chips.enter().append("a").attr("class", function(d) {
56609 return "chip " + d.id + "-count";
56610 }).attr("href", "#").each(function(d) {
56611 var chipSelection = select_default2(this);
56612 var tooltipBehavior = uiTooltip().placement("top").title(() => _t.append(d.descriptionID));
56613 chipSelection.call(tooltipBehavior).on("click", function(d3_event) {
56614 d3_event.preventDefault();
56615 tooltipBehavior.hide(select_default2(this));
56616 context.ui().togglePanes(context.container().select(".map-panes .issues-pane"));
56618 chipSelection.call(svgIcon("#" + d.iconID));
56620 enter.append("span").attr("class", "count");
56621 enter.merge(chips).selectAll("span.count").text(function(d) {
56622 return d.count.toString();
56625 return function(selection2) {
56626 update(selection2);
56627 context.validator().on("validated.infobox", function() {
56628 update(selection2);
56633 // modules/ui/map_in_map.js
56634 function uiMapInMap(context) {
56635 function mapInMap(selection2) {
56636 var backgroundLayer = rendererTileLayer(context);
56637 var overlayLayers = {};
56638 var projection2 = geoRawMercator();
56639 var dataLayer = svgData(projection2, context).showLabels(false);
56640 var debugLayer = svgDebug(projection2, context);
56641 var zoom = zoom_default2().scaleExtent([geoZoomToScale(0.5), geoZoomToScale(24)]).on("start", zoomStarted).on("zoom", zoomed).on("end", zoomEnded);
56642 var wrap2 = select_default2(null);
56643 var tiles = select_default2(null);
56644 var viewport = select_default2(null);
56645 var _isTransformed = false;
56646 var _isHidden = true;
56647 var _skipEvents = false;
56648 var _gesture = null;
56655 function zoomStarted() {
56658 _tStart = _tCurr = projection2.transform();
56661 function zoomed(d3_event) {
56664 var x = d3_event.transform.x;
56665 var y = d3_event.transform.y;
56666 var k = d3_event.transform.k;
56667 var isZooming = k !== _tStart.k;
56668 var isPanning = x !== _tStart.x || y !== _tStart.y;
56669 if (!isZooming && !isPanning) {
56673 _gesture = isZooming ? "zoom" : "pan";
56675 var tMini = projection2.transform();
56677 if (_gesture === "zoom") {
56678 scale = k / tMini.k;
56679 tX = (_cMini[0] / scale - _cMini[0]) * scale;
56680 tY = (_cMini[1] / scale - _cMini[1]) * scale;
56687 utilSetTransform(tiles, tX, tY, scale);
56688 utilSetTransform(viewport, 0, 0, scale);
56689 _isTransformed = true;
56690 _tCurr = identity2.translate(x, y).scale(k);
56691 var zMain = geoScaleToZoom(context.projection.scale());
56692 var zMini = geoScaleToZoom(k);
56693 _zDiff = zMain - zMini;
56696 function zoomEnded() {
56699 if (_gesture !== "pan")
56701 updateProjection();
56703 context.map().center(projection2.invert(_cMini));
56705 function updateProjection() {
56706 var loc = context.map().center();
56707 var tMain = context.projection.transform();
56708 var zMain = geoScaleToZoom(tMain.k);
56709 var zMini = Math.max(zMain - _zDiff, 0.5);
56710 var kMini = geoZoomToScale(zMini);
56711 projection2.translate([tMain.x, tMain.y]).scale(kMini);
56712 var point2 = projection2(loc);
56713 var mouse = _gesture === "pan" ? geoVecSubtract([_tCurr.x, _tCurr.y], [_tStart.x, _tStart.y]) : [0, 0];
56714 var xMini = _cMini[0] - point2[0] + tMain.x + mouse[0];
56715 var yMini = _cMini[1] - point2[1] + tMain.y + mouse[1];
56716 projection2.translate([xMini, yMini]).clipExtent([[0, 0], _dMini]);
56717 _tCurr = projection2.transform();
56718 if (_isTransformed) {
56719 utilSetTransform(tiles, 0, 0);
56720 utilSetTransform(viewport, 0, 0);
56721 _isTransformed = false;
56723 zoom.scaleExtent([geoZoomToScale(0.5), geoZoomToScale(zMain - 3)]);
56724 _skipEvents = true;
56725 wrap2.call(zoom.transform, _tCurr);
56726 _skipEvents = false;
56728 function redraw() {
56729 clearTimeout(_timeoutID);
56732 updateProjection();
56733 var zMini = geoScaleToZoom(projection2.scale());
56734 tiles = wrap2.selectAll(".map-in-map-tiles").data([0]);
56735 tiles = tiles.enter().append("div").attr("class", "map-in-map-tiles").merge(tiles);
56736 backgroundLayer.source(context.background().baseLayerSource()).projection(projection2).dimensions(_dMini);
56737 var background = tiles.selectAll(".map-in-map-background").data([0]);
56738 background.enter().append("div").attr("class", "map-in-map-background").merge(background).call(backgroundLayer);
56739 var overlaySources = context.background().overlayLayerSources();
56740 var activeOverlayLayers = [];
56741 for (var i2 = 0; i2 < overlaySources.length; i2++) {
56742 if (overlaySources[i2].validZoom(zMini)) {
56743 if (!overlayLayers[i2])
56744 overlayLayers[i2] = rendererTileLayer(context);
56745 activeOverlayLayers.push(overlayLayers[i2].source(overlaySources[i2]).projection(projection2).dimensions(_dMini));
56748 var overlay = tiles.selectAll(".map-in-map-overlay").data([0]);
56749 overlay = overlay.enter().append("div").attr("class", "map-in-map-overlay").merge(overlay);
56750 var overlays = overlay.selectAll("div").data(activeOverlayLayers, function(d) {
56751 return d.source().name();
56753 overlays.exit().remove();
56754 overlays = overlays.enter().append("div").merge(overlays).each(function(layer) {
56755 select_default2(this).call(layer);
56757 var dataLayers = tiles.selectAll(".map-in-map-data").data([0]);
56758 dataLayers.exit().remove();
56759 dataLayers = dataLayers.enter().append("svg").attr("class", "map-in-map-data").merge(dataLayers).call(dataLayer).call(debugLayer);
56760 if (_gesture !== "pan") {
56761 var getPath = path_default(projection2);
56762 var bbox2 = { type: "Polygon", coordinates: [context.map().extent().polygon()] };
56763 viewport = wrap2.selectAll(".map-in-map-viewport").data([0]);
56764 viewport = viewport.enter().append("svg").attr("class", "map-in-map-viewport").merge(viewport);
56765 var path = viewport.selectAll(".map-in-map-bbox").data([bbox2]);
56766 path.enter().append("path").attr("class", "map-in-map-bbox").merge(path).attr("d", getPath).classed("thick", function(d) {
56767 return getPath.area(d) < 30;
56771 function queueRedraw() {
56772 clearTimeout(_timeoutID);
56773 _timeoutID = setTimeout(function() {
56777 function toggle(d3_event) {
56779 d3_event.preventDefault();
56780 _isHidden = !_isHidden;
56781 context.container().select(".minimap-toggle-item").classed("active", !_isHidden).select("input").property("checked", !_isHidden);
56783 wrap2.style("display", "block").style("opacity", "1").transition().duration(200).style("opacity", "0").on("end", function() {
56784 selection2.selectAll(".map-in-map").style("display", "none");
56787 wrap2.style("display", "block").style("opacity", "0").transition().duration(200).style("opacity", "1").on("end", function() {
56792 uiMapInMap.toggle = toggle;
56793 wrap2 = selection2.selectAll(".map-in-map").data([0]);
56794 wrap2 = wrap2.enter().append("div").attr("class", "map-in-map").style("display", _isHidden ? "none" : "block").call(zoom).on("dblclick.zoom", null).merge(wrap2);
56795 _dMini = [200, 150];
56796 _cMini = geoVecScale(_dMini, 0.5);
56797 context.map().on("drawn.map-in-map", function(drawn) {
56798 if (drawn.full === true) {
56803 context.keybinding().on(_t("background.minimap.key"), toggle);
56808 // modules/ui/notice.js
56809 function uiNotice(context) {
56810 return function(selection2) {
56811 var div = selection2.append("div").attr("class", "notice");
56812 var button = div.append("button").attr("class", "zoom-to notice fillD").on("click", function() {
56813 context.map().zoomEase(context.minEditableZoom());
56814 }).on("wheel", function(d3_event) {
56815 var e22 = new WheelEvent(d3_event.type, d3_event);
56816 context.surface().node().dispatchEvent(e22);
56818 button.call(svgIcon("#iD-icon-plus", "pre-text")).append("span").attr("class", "label").call(_t.append("zoom_in_edit"));
56819 function disableTooHigh() {
56820 var canEdit = context.map().zoom() >= context.minEditableZoom();
56821 div.style("display", canEdit ? "none" : "block");
56823 context.map().on("move.notice", debounce_default(disableTooHigh, 500));
56828 // modules/ui/photoviewer.js
56829 function uiPhotoviewer(context) {
56830 var dispatch10 = dispatch_default("resize");
56831 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
56832 function photoviewer(selection2) {
56833 selection2.append("button").attr("class", "thumb-hide").attr("title", _t("icons.close")).on("click", function() {
56834 if (services.streetside) {
56835 services.streetside.hideViewer(context);
56837 if (services.mapillary) {
56838 services.mapillary.hideViewer(context);
56840 if (services.kartaview) {
56841 services.kartaview.hideViewer(context);
56843 }).append("div").call(svgIcon("#iD-icon-close"));
56844 function preventDefault(d3_event) {
56845 d3_event.preventDefault();
56847 selection2.append("button").attr("class", "resize-handle-xy").on("touchstart touchdown touchend", preventDefault).on(
56848 _pointerPrefix + "down",
56849 buildResizeListener(selection2, "resize", dispatch10, { resizeOnX: true, resizeOnY: true })
56851 selection2.append("button").attr("class", "resize-handle-x").on("touchstart touchdown touchend", preventDefault).on(
56852 _pointerPrefix + "down",
56853 buildResizeListener(selection2, "resize", dispatch10, { resizeOnX: true })
56855 selection2.append("button").attr("class", "resize-handle-y").on("touchstart touchdown touchend", preventDefault).on(
56856 _pointerPrefix + "down",
56857 buildResizeListener(selection2, "resize", dispatch10, { resizeOnY: true })
56859 function buildResizeListener(target, eventName, dispatch11, options2) {
56860 var resizeOnX = !!options2.resizeOnX;
56861 var resizeOnY = !!options2.resizeOnY;
56862 var minHeight = options2.minHeight || 240;
56863 var minWidth = options2.minWidth || 320;
56869 function startResize(d3_event) {
56870 if (pointerId !== (d3_event.pointerId || "mouse"))
56872 d3_event.preventDefault();
56873 d3_event.stopPropagation();
56874 var mapSize = context.map().dimensions();
56876 var maxWidth = mapSize[0];
56877 var newWidth = clamp3(startWidth + d3_event.clientX - startX, minWidth, maxWidth);
56878 target.style("width", newWidth + "px");
56881 var maxHeight = mapSize[1] - 90;
56882 var newHeight = clamp3(startHeight + startY - d3_event.clientY, minHeight, maxHeight);
56883 target.style("height", newHeight + "px");
56885 dispatch11.call(eventName, target, utilGetDimensions(target, true));
56887 function clamp3(num, min3, max3) {
56888 return Math.max(min3, Math.min(num, max3));
56890 function stopResize(d3_event) {
56891 if (pointerId !== (d3_event.pointerId || "mouse"))
56893 d3_event.preventDefault();
56894 d3_event.stopPropagation();
56895 select_default2(window).on("." + eventName, null);
56897 return function initResize(d3_event) {
56898 d3_event.preventDefault();
56899 d3_event.stopPropagation();
56900 pointerId = d3_event.pointerId || "mouse";
56901 startX = d3_event.clientX;
56902 startY = d3_event.clientY;
56903 var targetRect = target.node().getBoundingClientRect();
56904 startWidth = targetRect.width;
56905 startHeight = targetRect.height;
56906 select_default2(window).on(_pointerPrefix + "move." + eventName, startResize, false).on(_pointerPrefix + "up." + eventName, stopResize, false);
56907 if (_pointerPrefix === "pointer") {
56908 select_default2(window).on("pointercancel." + eventName, stopResize, false);
56913 photoviewer.onMapResize = function() {
56914 var photoviewer2 = context.container().select(".photoviewer");
56915 var content = context.container().select(".main-content");
56916 var mapDimensions = utilGetDimensions(content, true);
56917 var photoDimensions = utilGetDimensions(photoviewer2, true);
56918 if (photoDimensions[0] > mapDimensions[0] || photoDimensions[1] > mapDimensions[1] - 90) {
56919 var setPhotoDimensions = [
56920 Math.min(photoDimensions[0], mapDimensions[0]),
56921 Math.min(photoDimensions[1], mapDimensions[1] - 90)
56923 photoviewer2.style("width", setPhotoDimensions[0] + "px").style("height", setPhotoDimensions[1] + "px");
56924 dispatch10.call("resize", photoviewer2, setPhotoDimensions);
56927 return utilRebind(photoviewer, dispatch10, "on");
56930 // modules/ui/restore.js
56931 function uiRestore(context) {
56932 return function(selection2) {
56933 if (!context.history().hasRestorableChanges())
56935 let modalSelection = uiModal(selection2, true);
56936 modalSelection.select(".modal").attr("class", "modal fillL");
56937 let introModal = modalSelection.select(".content");
56938 introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("restore.heading"));
56939 introModal.append("div").attr("class", "modal-section").append("p").call(_t.append("restore.description"));
56940 let buttonWrap = introModal.append("div").attr("class", "modal-actions");
56941 let restore = buttonWrap.append("button").attr("class", "restore").on("click", () => {
56942 context.history().restore();
56943 modalSelection.remove();
56945 restore.append("svg").attr("class", "logo logo-restore").append("use").attr("xlink:href", "#iD-logo-restore");
56946 restore.append("div").call(_t.append("restore.restore"));
56947 let reset = buttonWrap.append("button").attr("class", "reset").on("click", () => {
56948 context.history().clearSaved();
56949 modalSelection.remove();
56951 reset.append("svg").attr("class", "logo logo-reset").append("use").attr("xlink:href", "#iD-logo-reset");
56952 reset.append("div").call(_t.append("restore.reset"));
56953 restore.node().focus();
56957 // modules/ui/scale.js
56958 function uiScale(context) {
56959 var projection2 = context.projection, isImperial = !_mainLocalizer.usesMetric(), maxLength = 180, tickHeight = 8;
56960 function scaleDefs(loc1, loc2) {
56961 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;
56963 buckets = [528e4, 528e3, 52800, 5280, 500, 50, 5, 1];
56965 buckets = [5e6, 5e5, 5e4, 5e3, 500, 50, 5, 1];
56967 for (i2 = 0; i2 < buckets.length; i2++) {
56970 scale.dist = Math.floor(dist / val) * val;
56973 scale.dist = +dist.toFixed(2);
56976 dLon = geoMetersToLon(scale.dist / conversion, lat);
56977 scale.px = Math.round(projection2([loc1[0] + dLon, loc1[1]])[0]);
56978 scale.text = displayLength(scale.dist / conversion, isImperial);
56981 function update(selection2) {
56982 var dims = context.map().dimensions(), loc1 = projection2.invert([0, dims[1]]), loc2 = projection2.invert([maxLength, dims[1]]), scale = scaleDefs(loc1, loc2);
56983 selection2.select(".scale-path").attr("d", "M0.5,0.5v" + tickHeight + "h" + scale.px + "v-" + tickHeight);
56984 selection2.select(".scale-text").style(_mainLocalizer.textDirection() === "ltr" ? "left" : "right", scale.px + 16 + "px").text(scale.text);
56986 return function(selection2) {
56987 function switchUnits() {
56988 isImperial = !isImperial;
56989 selection2.call(update);
56991 var scalegroup = selection2.append("svg").attr("class", "scale").on("click", switchUnits).append("g").attr("transform", "translate(10,11)");
56992 scalegroup.append("path").attr("class", "scale-path");
56993 selection2.append("div").attr("class", "scale-text");
56994 selection2.call(update);
56995 context.map().on("move.scale", function() {
56996 update(selection2);
57001 // modules/ui/shortcuts.js
57002 function uiShortcuts(context) {
57003 var detected = utilDetect();
57004 var _activeTab = 0;
57005 var _modalSelection;
57006 var _selection = select_default2(null);
57007 var _dataShortcuts;
57008 function shortcutsModal(_modalSelection2) {
57009 _modalSelection2.select(".modal").classed("modal-shortcuts", true);
57010 var content = _modalSelection2.select(".content");
57011 content.append("div").attr("class", "modal-section header").append("h2").call(_t.append("shortcuts.title"));
57012 _mainFileFetcher.get("shortcuts").then(function(data) {
57013 _dataShortcuts = data;
57014 content.call(render);
57015 }).catch(function() {
57018 function render(selection2) {
57019 if (!_dataShortcuts)
57021 var wrapper = selection2.selectAll(".wrapper").data([0]);
57022 var wrapperEnter = wrapper.enter().append("div").attr("class", "wrapper modal-section");
57023 var tabsBar = wrapperEnter.append("div").attr("class", "tabs-bar");
57024 var shortcutsList = wrapperEnter.append("div").attr("class", "shortcuts-list");
57025 wrapper = wrapper.merge(wrapperEnter);
57026 var tabs = tabsBar.selectAll(".tab").data(_dataShortcuts);
57027 var tabsEnter = tabs.enter().append("a").attr("class", "tab").attr("href", "#").on("click", function(d3_event, d) {
57028 d3_event.preventDefault();
57029 var i2 = _dataShortcuts.indexOf(d);
57031 render(selection2);
57033 tabsEnter.append("span").html(function(d) {
57034 return _t.html(d.text);
57036 wrapper.selectAll(".tab").classed("active", function(d, i2) {
57037 return i2 === _activeTab;
57039 var shortcuts = shortcutsList.selectAll(".shortcut-tab").data(_dataShortcuts);
57040 var shortcutsEnter = shortcuts.enter().append("div").attr("class", function(d) {
57041 return "shortcut-tab shortcut-tab-" + d.tab;
57043 var columnsEnter = shortcutsEnter.selectAll(".shortcut-column").data(function(d) {
57045 }).enter().append("table").attr("class", "shortcut-column");
57046 var rowsEnter = columnsEnter.selectAll(".shortcut-row").data(function(d) {
57048 }).enter().append("tr").attr("class", "shortcut-row");
57049 var sectionRows = rowsEnter.filter(function(d) {
57050 return !d.shortcuts;
57052 sectionRows.append("td");
57053 sectionRows.append("td").attr("class", "shortcut-section").append("h3").html(function(d) {
57054 return _t.html(d.text);
57056 var shortcutRows = rowsEnter.filter(function(d) {
57057 return d.shortcuts;
57059 var shortcutKeys = shortcutRows.append("td").attr("class", "shortcut-keys");
57060 var modifierKeys = shortcutKeys.filter(function(d) {
57061 return d.modifiers;
57063 modifierKeys.selectAll("kbd.modifier").data(function(d) {
57064 if (detected.os === "win" && d.text === "shortcuts.editing.commands.redo") {
57066 } else if (detected.os !== "mac" && d.text === "shortcuts.browsing.display_options.fullscreen") {
57069 return d.modifiers;
57071 }).enter().each(function() {
57072 var selection3 = select_default2(this);
57073 selection3.append("kbd").attr("class", "modifier").text(function(d) {
57074 return uiCmd.display(d);
57076 selection3.append("span").text("+");
57078 shortcutKeys.selectAll("kbd.shortcut").data(function(d) {
57079 var arr = d.shortcuts;
57080 if (detected.os === "win" && d.text === "shortcuts.editing.commands.redo") {
57082 } else if (detected.os !== "mac" && d.text === "shortcuts.browsing.display_options.fullscreen") {
57085 arr = arr.map(function(s) {
57086 return uiCmd.display(s.indexOf(".") !== -1 ? _t(s) : s);
57088 return utilArrayUniq(arr).map(function(s) {
57091 separator: d.separator,
57095 }).enter().each(function(d, i2, nodes) {
57096 var selection3 = select_default2(this);
57097 var click = d.shortcut.toLowerCase().match(/(.*).click/);
57098 if (click && click[1]) {
57099 selection3.call(svgIcon("#iD-walkthrough-mouse-" + click[1], "operation"));
57100 } else if (d.shortcut.toLowerCase() === "long-press") {
57101 selection3.call(svgIcon("#iD-walkthrough-longpress", "longpress operation"));
57102 } else if (d.shortcut.toLowerCase() === "tap") {
57103 selection3.call(svgIcon("#iD-walkthrough-tap", "tap operation"));
57105 selection3.append("kbd").attr("class", "shortcut").text(function(d2) {
57106 return d2.shortcut;
57109 if (i2 < nodes.length - 1) {
57110 selection3.append("span").html(d.separator || "\xA0" + _t.html("shortcuts.or") + "\xA0");
57111 } else if (i2 === nodes.length - 1 && d.suffix) {
57112 selection3.append("span").text(d.suffix);
57115 shortcutKeys.filter(function(d) {
57117 }).each(function() {
57118 var selection3 = select_default2(this);
57119 selection3.append("span").text("+");
57120 selection3.append("span").attr("class", "gesture").html(function(d) {
57121 return _t.html(d.gesture);
57124 shortcutRows.append("td").attr("class", "shortcut-desc").html(function(d) {
57125 return d.text ? _t.html(d.text) : "\xA0";
57127 wrapper.selectAll(".shortcut-tab").style("display", function(d, i2) {
57128 return i2 === _activeTab ? "flex" : "none";
57131 return function(selection2, show) {
57132 _selection = selection2;
57134 _modalSelection = uiModal(selection2);
57135 _modalSelection.call(shortcutsModal);
57137 context.keybinding().on([_t("shortcuts.toggle.key"), "?"], function() {
57138 if (context.container().selectAll(".modal-shortcuts").size()) {
57139 if (_modalSelection) {
57140 _modalSelection.close();
57141 _modalSelection = null;
57144 _modalSelection = uiModal(_selection);
57145 _modalSelection.call(shortcutsModal);
57152 // modules/ui/data_header.js
57153 function uiDataHeader() {
57155 function dataHeader(selection2) {
57156 var header = selection2.selectAll(".data-header").data(
57157 _datum ? [_datum] : [],
57159 return d.__featurehash__;
57162 header.exit().remove();
57163 var headerEnter = header.enter().append("div").attr("class", "data-header");
57164 var iconEnter = headerEnter.append("div").attr("class", "data-header-icon");
57165 iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-data", "note-fill"));
57166 headerEnter.append("div").attr("class", "data-header-label").call(_t.append("map_data.layers.custom.title"));
57168 dataHeader.datum = function(val) {
57169 if (!arguments.length)
57177 // modules/ui/combobox.js
57178 var _comboHideTimerID;
57179 function uiCombobox(context, klass) {
57180 var dispatch10 = dispatch_default("accept", "cancel", "update");
57181 var container = context.container();
57182 var _suggestions = [];
57185 var _selected = null;
57186 var _canAutocomplete = true;
57187 var _caseSensitive = false;
57188 var _cancelFetch = false;
57191 var _mouseEnterHandler, _mouseLeaveHandler;
57192 var _fetcher = function(val, cb) {
57193 cb(_data.filter(function(d) {
57194 var terms = d.terms || [];
57195 terms.push(d.value);
57199 return terms.some(function(term) {
57200 return term.toString().toLowerCase().indexOf(val.toLowerCase()) !== -1;
57204 var combobox = function(input, attachTo) {
57205 if (!input || input.empty())
57207 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() {
57208 var parent = this.parentNode;
57209 var sibling = this.nextSibling;
57210 select_default2(parent).selectAll(".combobox-caret").filter(function(d) {
57211 return d === input.node();
57212 }).data([input.node()]).enter().insert("div", function() {
57214 }).attr("class", "combobox-caret").on("mousedown.combo-caret", function(d3_event) {
57215 d3_event.preventDefault();
57216 input.node().focus();
57217 mousedown(d3_event);
57218 }).on("mouseup.combo-caret", function(d3_event) {
57219 d3_event.preventDefault();
57223 function mousedown(d3_event) {
57224 if (d3_event.button !== 0)
57226 if (input.classed("disabled"))
57228 _tDown = +new Date();
57229 var start2 = input.property("selectionStart");
57230 var end = input.property("selectionEnd");
57231 if (start2 !== end) {
57232 var val = utilGetSetValue(input);
57233 input.node().setSelectionRange(val.length, val.length);
57236 input.on("mouseup.combo-input", mouseup);
57238 function mouseup(d3_event) {
57239 input.on("mouseup.combo-input", null);
57240 if (d3_event.button !== 0)
57242 if (input.classed("disabled"))
57244 if (input.node() !== document.activeElement)
57246 var start2 = input.property("selectionStart");
57247 var end = input.property("selectionEnd");
57248 if (start2 !== end)
57250 var combo = container.selectAll(".combobox");
57251 if (combo.empty() || combo.datum() !== input.node()) {
57252 var tOrig = _tDown;
57253 window.setTimeout(function() {
57254 if (tOrig !== _tDown)
57256 fetchComboData("", function() {
57266 fetchComboData("");
57269 _comboHideTimerID = window.setTimeout(hide, 75);
57273 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) {
57274 d3_event.preventDefault();
57276 container.on("scroll.combo-scroll", render, true);
57279 if (_comboHideTimerID) {
57280 window.clearTimeout(_comboHideTimerID);
57281 _comboHideTimerID = void 0;
57283 container.selectAll(".combobox").remove();
57284 container.on("scroll.combo-scroll", null);
57286 function keydown(d3_event) {
57287 var shown = !container.selectAll(".combobox").empty();
57288 var tagName = input.node() ? input.node().tagName.toLowerCase() : "";
57289 switch (d3_event.keyCode) {
57292 d3_event.stopPropagation();
57295 input.on("input.combo-input", function() {
57296 var start2 = input.property("selectionStart");
57297 input.node().setSelectionRange(start2, start2);
57298 input.on("input.combo-input", change);
57306 d3_event.preventDefault();
57307 d3_event.stopPropagation();
57311 if (tagName === "textarea" && !shown)
57313 d3_event.preventDefault();
57314 if (tagName === "input" && !shown) {
57320 if (tagName === "textarea" && !shown)
57322 d3_event.preventDefault();
57323 if (tagName === "input" && !shown) {
57330 function keyup(d3_event) {
57331 switch (d3_event.keyCode) {
57337 function change(doAutoComplete) {
57338 if (doAutoComplete === void 0)
57339 doAutoComplete = true;
57340 fetchComboData(value(), function() {
57342 var val = input.property("value");
57343 if (_suggestions.length) {
57344 if (doAutoComplete && input.property("selectionEnd") === val.length) {
57345 _selected = tryAutocomplete();
57352 var combo = container.selectAll(".combobox");
57353 if (combo.empty()) {
57362 function nav(dir) {
57363 if (_suggestions.length) {
57365 for (var i2 = 0; i2 < _suggestions.length; i2++) {
57366 if (_selected && _suggestions[i2].value === _selected) {
57371 index = Math.max(Math.min(index + dir, _suggestions.length - 1), 0);
57372 _selected = _suggestions[index].value;
57373 utilGetSetValue(input, _selected);
57374 dispatch10.call("update");
57379 function ensureVisible() {
57380 var combo = container.selectAll(".combobox");
57383 var containerRect = container.node().getBoundingClientRect();
57384 var comboRect = combo.node().getBoundingClientRect();
57385 if (comboRect.bottom > containerRect.bottom) {
57386 var node = attachTo ? attachTo.node() : input.node();
57387 node.scrollIntoView({ behavior: "instant", block: "center" });
57390 var selected = combo.selectAll(".combobox-option.selected").node();
57392 selected.scrollIntoView({ behavior: "smooth", block: "nearest" });
57396 var value2 = input.property("value");
57397 var start2 = input.property("selectionStart");
57398 var end = input.property("selectionEnd");
57399 if (start2 && end) {
57400 value2 = value2.substring(0, start2);
57404 function fetchComboData(v, cb) {
57405 _cancelFetch = false;
57406 _fetcher.call(input, v, function(results) {
57409 _suggestions = results;
57410 results.forEach(function(d) {
57411 _fetched[d.value] = d;
57418 function tryAutocomplete() {
57419 if (!_canAutocomplete)
57421 var val = _caseSensitive ? value() : value().toLowerCase();
57424 if (!isNaN(parseFloat(val)) && isFinite(val))
57426 const suggestionValues = [];
57427 _suggestions.forEach((s) => {
57428 suggestionValues.push(s.value);
57429 if (s.key && s.key !== s.value) {
57430 suggestionValues.push(s.key);
57433 var bestIndex = -1;
57434 for (var i2 = 0; i2 < suggestionValues.length; i2++) {
57435 var suggestion = suggestionValues[i2];
57436 var compare = _caseSensitive ? suggestion : suggestion.toLowerCase();
57437 if (compare === val) {
57440 } else if (bestIndex === -1 && compare.indexOf(val) === 0) {
57444 if (bestIndex !== -1) {
57445 var bestVal = suggestionValues[bestIndex];
57446 input.property("value", bestVal);
57447 input.node().setSelectionRange(val.length, bestVal.length);
57448 dispatch10.call("update");
57452 function render() {
57453 if (_suggestions.length < _minItems || document.activeElement !== input.node()) {
57457 var shown = !container.selectAll(".combobox").empty();
57460 var combo = container.selectAll(".combobox");
57461 var options2 = combo.selectAll(".combobox-option").data(_suggestions, function(d) {
57464 options2.exit().remove();
57465 options2.enter().append("a").attr("class", function(d) {
57466 return "combobox-option " + (d.klass || "");
57467 }).attr("title", function(d) {
57469 }).each(function(d) {
57471 d.display(select_default2(this));
57473 select_default2(this).text(d.value);
57475 }).on("mouseenter", _mouseEnterHandler).on("mouseleave", _mouseLeaveHandler).merge(options2).classed("selected", function(d) {
57476 return d.value === _selected || d.key === _selected;
57477 }).on("click.combo-option", accept).order();
57478 var node = attachTo ? attachTo.node() : input.node();
57479 var containerRect = container.node().getBoundingClientRect();
57480 var rect = node.getBoundingClientRect();
57481 combo.style("left", rect.left + 5 - containerRect.left + "px").style("width", rect.width - 10 + "px").style("top", rect.height + rect.top - containerRect.top + "px");
57483 function accept(d3_event, d) {
57484 _cancelFetch = true;
57485 var thiz = input.node();
57487 utilGetSetValue(input, d.value);
57488 utilTriggerEvent(input, "change");
57490 var val = utilGetSetValue(input);
57491 thiz.setSelectionRange(val.length, val.length);
57493 dispatch10.call("accept", thiz, d, val);
57496 function cancel() {
57497 _cancelFetch = true;
57498 var thiz = input.node();
57499 var val = utilGetSetValue(input);
57500 var start2 = input.property("selectionStart");
57501 var end = input.property("selectionEnd");
57502 val = val.slice(0, start2) + val.slice(end);
57503 utilGetSetValue(input, val);
57504 thiz.setSelectionRange(val.length, val.length);
57505 dispatch10.call("cancel", thiz);
57509 combobox.canAutocomplete = function(val) {
57510 if (!arguments.length)
57511 return _canAutocomplete;
57512 _canAutocomplete = val;
57515 combobox.caseSensitive = function(val) {
57516 if (!arguments.length)
57517 return _caseSensitive;
57518 _caseSensitive = val;
57521 combobox.data = function(val) {
57522 if (!arguments.length)
57527 combobox.fetcher = function(val) {
57528 if (!arguments.length)
57533 combobox.minItems = function(val) {
57534 if (!arguments.length)
57539 combobox.itemsMouseEnter = function(val) {
57540 if (!arguments.length)
57541 return _mouseEnterHandler;
57542 _mouseEnterHandler = val;
57545 combobox.itemsMouseLeave = function(val) {
57546 if (!arguments.length)
57547 return _mouseLeaveHandler;
57548 _mouseLeaveHandler = val;
57551 return utilRebind(combobox, dispatch10, "on");
57553 uiCombobox.off = function(input, context) {
57554 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);
57555 context.container().on("scroll.combo-scroll", null);
57558 // modules/ui/disclosure.js
57559 function uiDisclosure(context, key, expandedDefault) {
57560 var dispatch10 = dispatch_default("toggled");
57562 var _label = utilFunctor("");
57563 var _updatePreference = true;
57564 var _content = function() {
57566 var disclosure = function(selection2) {
57567 if (_expanded === void 0 || _expanded === null) {
57568 var preference = corePreferences("disclosure." + key + ".expanded");
57569 _expanded = preference === null ? !!expandedDefault : preference === "true";
57571 var hideToggle = selection2.selectAll(".hide-toggle-" + key).data([0]);
57572 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"));
57573 hideToggleEnter.append("span").attr("class", "hide-toggle-text");
57574 hideToggle = hideToggleEnter.merge(hideToggle);
57575 hideToggle.on("click", toggle).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`)).attr("aria-expanded", _expanded).classed("expanded", _expanded);
57576 const label = _label();
57577 const labelSelection = hideToggle.selectAll(".hide-toggle-text");
57578 if (typeof label !== "function") {
57579 labelSelection.text(_label());
57581 labelSelection.text("").call(label);
57583 hideToggle.selectAll(".hide-toggle-icon").attr(
57585 _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
57587 var wrap2 = selection2.selectAll(".disclosure-wrap").data([0]);
57588 wrap2 = wrap2.enter().append("div").attr("class", "disclosure-wrap disclosure-wrap-" + key).merge(wrap2).classed("hide", !_expanded);
57590 wrap2.call(_content);
57592 function toggle(d3_event) {
57593 d3_event.preventDefault();
57594 _expanded = !_expanded;
57595 if (_updatePreference) {
57596 corePreferences("disclosure." + key + ".expanded", _expanded);
57598 hideToggle.classed("expanded", _expanded).attr("aria-expanded", _expanded).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`));
57599 hideToggle.selectAll(".hide-toggle-icon").attr(
57601 _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
57603 wrap2.call(uiToggle(_expanded));
57605 wrap2.call(_content);
57607 dispatch10.call("toggled", this, _expanded);
57610 disclosure.label = function(val) {
57611 if (!arguments.length)
57613 _label = utilFunctor(val);
57616 disclosure.expanded = function(val) {
57617 if (!arguments.length)
57622 disclosure.updatePreference = function(val) {
57623 if (!arguments.length)
57624 return _updatePreference;
57625 _updatePreference = val;
57628 disclosure.content = function(val) {
57629 if (!arguments.length)
57634 return utilRebind(disclosure, dispatch10, "on");
57637 // modules/ui/section.js
57638 function uiSection(id2, context) {
57639 var _classes = utilFunctor("");
57640 var _shouldDisplay;
57644 var _expandedByDefault = utilFunctor(true);
57645 var _disclosureContent;
57646 var _disclosureExpanded;
57647 var _containerSelection = select_default2(null);
57651 section.classes = function(val) {
57652 if (!arguments.length)
57654 _classes = utilFunctor(val);
57657 section.label = function(val) {
57658 if (!arguments.length)
57660 _label = utilFunctor(val);
57663 section.expandedByDefault = function(val) {
57664 if (!arguments.length)
57665 return _expandedByDefault;
57666 _expandedByDefault = utilFunctor(val);
57669 section.shouldDisplay = function(val) {
57670 if (!arguments.length)
57671 return _shouldDisplay;
57672 _shouldDisplay = utilFunctor(val);
57675 section.content = function(val) {
57676 if (!arguments.length)
57681 section.disclosureContent = function(val) {
57682 if (!arguments.length)
57683 return _disclosureContent;
57684 _disclosureContent = val;
57687 section.disclosureExpanded = function(val) {
57688 if (!arguments.length)
57689 return _disclosureExpanded;
57690 _disclosureExpanded = val;
57693 section.render = function(selection2) {
57694 _containerSelection = selection2.selectAll(".section-" + id2).data([0]);
57695 var sectionEnter = _containerSelection.enter().append("div").attr("class", "section section-" + id2 + " " + (_classes && _classes() || ""));
57696 _containerSelection = sectionEnter.merge(_containerSelection);
57697 _containerSelection.call(renderContent);
57699 section.reRender = function() {
57700 _containerSelection.call(renderContent);
57702 section.selection = function() {
57703 return _containerSelection;
57705 section.disclosure = function() {
57706 return _disclosure;
57708 function renderContent(selection2) {
57709 if (_shouldDisplay) {
57710 var shouldDisplay = _shouldDisplay();
57711 selection2.classed("hide", !shouldDisplay);
57712 if (!shouldDisplay) {
57713 selection2.html("");
57717 if (_disclosureContent) {
57718 if (!_disclosure) {
57719 _disclosure = uiDisclosure(context, id2.replace(/-/g, "_"), _expandedByDefault()).label(_label || "").content(_disclosureContent);
57721 if (_disclosureExpanded !== void 0) {
57722 _disclosure.expanded(_disclosureExpanded);
57723 _disclosureExpanded = void 0;
57725 selection2.call(_disclosure);
57729 selection2.call(_content);
57735 // modules/ui/tag_reference.js
57736 function uiTagReference(what) {
57737 var wikibase = what.qid ? services.wikidata : services.osmWikibase;
57738 var tagReference = {};
57739 var _button = select_default2(null);
57740 var _body = select_default2(null);
57746 _button.classed("tag-reference-loading", true);
57747 wikibase.getDocs(what, gotDocs);
57749 function gotDocs(err, docs) {
57751 if (!docs || !docs.title) {
57752 _body.append("p").attr("class", "tag-reference-description").call(_t.append("inspector.no_documentation_key"));
57756 if (docs.imageURL) {
57757 _body.append("img").attr("class", "tag-reference-wiki-image").attr("alt", docs.description).attr("src", docs.imageURL).on("load", function() {
57759 }).on("error", function() {
57760 select_default2(this).remove();
57766 var tagReferenceDescription = _body.append("p").attr("class", "tag-reference-description").append("span");
57767 if (docs.description) {
57768 tagReferenceDescription = tagReferenceDescription.attr("class", "localized-text").attr("lang", docs.descriptionLocaleCode || "und").text(docs.description);
57770 tagReferenceDescription = tagReferenceDescription.call(_t.append("inspector.no_documentation_key"));
57772 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"));
57774 _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));
57776 if (what.key === "comment") {
57777 _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"));
57782 _button.classed("tag-reference-loading", false);
57783 _body.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1");
57785 _button.selectAll("svg.icon use").each(function() {
57786 var iconUse = select_default2(this);
57787 if (iconUse.attr("href") === "#iD-icon-info") {
57788 iconUse.attr("href", "#iD-icon-info-filled");
57793 _body.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
57794 _body.classed("expanded", false);
57797 _button.selectAll("svg.icon use").each(function() {
57798 var iconUse = select_default2(this);
57799 if (iconUse.attr("href") === "#iD-icon-info-filled") {
57800 iconUse.attr("href", "#iD-icon-info");
57804 tagReference.button = function(selection2, klass, iconName) {
57805 _button = selection2.selectAll(".tag-reference-button").data([0]);
57806 _button = _button.enter().append("button").attr("class", "tag-reference-button " + (klass || "")).attr("title", _t("icons.information")).call(svgIcon("#iD-icon-" + (iconName || "inspect"))).merge(_button);
57807 _button.on("click", function(d3_event) {
57808 d3_event.stopPropagation();
57809 d3_event.preventDefault();
57813 } else if (_loaded) {
57820 tagReference.body = function(selection2) {
57821 var itemID = what.qid || what.key + "-" + (what.value || "");
57822 _body = selection2.selectAll(".tag-reference-body").data([itemID], function(d) {
57825 _body.exit().remove();
57826 _body = _body.enter().append("div").attr("class", "tag-reference-body").style("max-height", "0").style("opacity", "0").merge(_body);
57827 if (_showing === false) {
57831 tagReference.showing = function(val) {
57832 if (!arguments.length)
57835 return tagReference;
57837 return tagReference;
57840 // modules/ui/field_help.js
57841 function uiFieldHelp(context, fieldName) {
57842 var fieldHelp = {};
57843 var _inspector = select_default2(null);
57844 var _wrap = select_default2(null);
57845 var _body = select_default2(null);
57846 var fieldHelpKeys = {
57874 "indirect_example",
57879 var fieldHelpHeadings = {};
57880 var replacements = {
57881 distField: { html: _t.html("restriction.controls.distance") },
57882 viaField: { html: _t.html("restriction.controls.via") },
57883 fromShadow: { html: icon("#iD-turn-shadow", "inline shadow from") },
57884 allowShadow: { html: icon("#iD-turn-shadow", "inline shadow allow") },
57885 restrictShadow: { html: icon("#iD-turn-shadow", "inline shadow restrict") },
57886 onlyShadow: { html: icon("#iD-turn-shadow", "inline shadow only") },
57887 allowTurn: { html: icon("#iD-turn-yes", "inline turn") },
57888 restrictTurn: { html: icon("#iD-turn-no", "inline turn") },
57889 onlyTurn: { html: icon("#iD-turn-only", "inline turn") }
57891 var docs = fieldHelpKeys[fieldName].map(function(key) {
57892 var helpkey = "help.field." + fieldName + "." + key[0];
57893 var text2 = key[1].reduce(function(all, part) {
57894 var subkey = helpkey + "." + part;
57895 var depth = fieldHelpHeadings[subkey];
57896 var hhh = depth ? Array(depth + 1).join("#") + " " : "";
57897 return all + hhh + _t.html(subkey, replacements) + "\n\n";
57901 title: _t.html(helpkey + ".title"),
57902 html: marked(text2.trim())
57907 _body.classed("hide", false).style("opacity", "0").transition().duration(200).style("opacity", "1");
57910 _body.classed("hide", true).transition().duration(200).style("opacity", "0").on("end", function() {
57911 _body.classed("hide", true);
57914 function clickHelp(index) {
57915 var d = docs[index];
57916 var tkeys = fieldHelpKeys[fieldName][index][1];
57917 _body.selectAll(".field-help-nav-item").classed("active", function(d2, i2) {
57918 return i2 === index;
57920 var content = _body.selectAll(".field-help-content").html(d.html);
57921 content.selectAll("p").attr("class", function(d2, i2) {
57924 if (d.key === "help.field.restrictions.inspecting") {
57925 content.insert("img", "p.from_shadow").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_inspect.gif"));
57926 } else if (d.key === "help.field.restrictions.modifying") {
57927 content.insert("img", "p.allow_turn").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_modify.gif"));
57930 fieldHelp.button = function(selection2) {
57933 var button = selection2.selectAll(".field-help-button").data([0]);
57934 button.enter().append("button").attr("class", "field-help-button").call(svgIcon("#iD-icon-help")).merge(button).on("click", function(d3_event) {
57935 d3_event.stopPropagation();
57936 d3_event.preventDefault();
57937 if (_body.classed("hide")) {
57944 function updatePosition() {
57945 var wrap2 = _wrap.node();
57946 var inspector = _inspector.node();
57947 var wRect = wrap2.getBoundingClientRect();
57948 var iRect = inspector.getBoundingClientRect();
57949 _body.style("top", wRect.top + inspector.scrollTop - iRect.top + "px");
57951 fieldHelp.body = function(selection2) {
57952 _wrap = selection2.selectAll(".form-field-input-wrap");
57955 _inspector = context.container().select(".sidebar .entity-editor-pane .inspector-body");
57956 if (_inspector.empty())
57958 _body = _inspector.selectAll(".field-help-body").data([0]);
57959 var enter = _body.enter().append("div").attr("class", "field-help-body hide");
57960 var titleEnter = enter.append("div").attr("class", "field-help-title cf");
57961 titleEnter.append("h2").attr("class", _mainLocalizer.textDirection() === "rtl" ? "fr" : "fl").call(_t.append("help.field." + fieldName + ".title"));
57962 titleEnter.append("button").attr("class", "fr close").attr("title", _t("icons.close")).on("click", function(d3_event) {
57963 d3_event.stopPropagation();
57964 d3_event.preventDefault();
57966 }).call(svgIcon("#iD-icon-close"));
57967 var navEnter = enter.append("div").attr("class", "field-help-nav cf");
57968 var titles = docs.map(function(d) {
57971 navEnter.selectAll(".field-help-nav-item").data(titles).enter().append("div").attr("class", "field-help-nav-item").html(function(d) {
57973 }).on("click", function(d3_event, d) {
57974 d3_event.stopPropagation();
57975 d3_event.preventDefault();
57976 clickHelp(titles.indexOf(d));
57978 enter.append("div").attr("class", "field-help-content");
57979 _body = _body.merge(enter);
57985 // modules/ui/fields/check.js
57986 function uiFieldCheck(field, context) {
57987 var dispatch10 = dispatch_default("change");
57988 var options2 = field.options;
57992 var input = select_default2(null);
57993 var text2 = select_default2(null);
57994 var label = select_default2(null);
57995 var reverser = select_default2(null);
57997 var _entityIDs = [];
57999 var stringsField = field.resolveReference("stringsCrossReference");
58000 if (!options2 && stringsField.options) {
58001 options2 = stringsField.options;
58004 for (var i2 in options2) {
58005 var v = options2[i2];
58006 values.push(v === "undefined" ? void 0 : v);
58007 texts.push(stringsField.t.html("options." + v, { "default": v }));
58010 values = [void 0, "yes"];
58011 texts = [_t.html("inspector.unknown"), _t.html("inspector.check.yes")];
58012 if (field.type !== "defaultCheck") {
58014 texts.push(_t.html("inspector.check.no"));
58017 function checkImpliedYes() {
58018 _impliedYes = field.id === "oneway_yes";
58019 if (field.id === "oneway") {
58020 var entity = context.entity(_entityIDs[0]);
58021 for (var key in entity.tags) {
58022 if (key in osmOneWayTags && entity.tags[key] in osmOneWayTags[key]) {
58023 _impliedYes = true;
58024 texts[0] = _t.html("_tagging.presets.fields.oneway_yes.options.undefined");
58030 function reverserHidden() {
58031 if (!context.container().select("div.inspector-hover").empty())
58033 return !(_value === "yes" || _impliedYes && !_value);
58035 function reverserSetText(selection2) {
58036 var entity = _entityIDs.length && context.hasEntity(_entityIDs[0]);
58037 if (reverserHidden() || !entity)
58039 var first = entity.first();
58040 var last = entity.isClosed() ? entity.nodes[entity.nodes.length - 2] : entity.last();
58041 var pseudoDirection = first < last;
58042 var icon2 = pseudoDirection ? "#iD-icon-forward" : "#iD-icon-backward";
58043 selection2.selectAll(".reverser-span").html("").call(_t.append("inspector.check.reverser")).call(svgIcon(icon2, "inline"));
58046 var check = function(selection2) {
58048 label = selection2.selectAll(".form-field-input-wrap").data([0]);
58049 var enter = label.enter().append("label").attr("class", "form-field-input-wrap form-field-input-check");
58050 enter.append("input").property("indeterminate", field.type !== "defaultCheck").attr("type", "checkbox").attr("id", field.domId);
58051 enter.append("span").html(texts[0]).attr("class", "value");
58052 if (field.type === "onewayCheck") {
58053 enter.append("button").attr("class", "reverser" + (reverserHidden() ? " hide" : "")).append("span").attr("class", "reverser-span");
58055 label = label.merge(enter);
58056 input = label.selectAll("input");
58057 text2 = label.selectAll("span.value");
58058 input.on("click", function(d3_event) {
58059 d3_event.stopPropagation();
58061 if (Array.isArray(_tags[field.key])) {
58062 if (values.indexOf("yes") !== -1) {
58063 t[field.key] = "yes";
58065 t[field.key] = values[0];
58068 t[field.key] = values[(values.indexOf(_value) + 1) % values.length];
58070 if (t[field.key] === "reversible" || t[field.key] === "alternating") {
58071 t[field.key] = values[0];
58073 dispatch10.call("change", this, t);
58075 if (field.type === "onewayCheck") {
58076 reverser = label.selectAll(".reverser");
58077 reverser.call(reverserSetText).on("click", function(d3_event) {
58078 d3_event.preventDefault();
58079 d3_event.stopPropagation();
58082 for (var i3 in _entityIDs) {
58083 graph = actionReverse(_entityIDs[i3])(graph);
58087 _t("operations.reverse.annotation.line", { n: 1 })
58089 context.validator().validate();
58090 select_default2(this).call(reverserSetText);
58094 check.entityIDs = function(val) {
58095 if (!arguments.length)
58100 check.tags = function(tags) {
58102 function isChecked(val) {
58103 return val !== "no" && val !== "" && val !== void 0 && val !== null;
58105 function textFor(val) {
58108 var index = values.indexOf(val);
58109 return index !== -1 ? texts[index] : '"' + val + '"';
58112 var isMixed = Array.isArray(tags[field.key]);
58113 _value = !isMixed && tags[field.key] && tags[field.key].toLowerCase();
58114 if (field.type === "onewayCheck" && (_value === "1" || _value === "-1")) {
58117 input.property("indeterminate", isMixed || field.type !== "defaultCheck" && !_value).property("checked", isChecked(_value));
58118 text2.html(isMixed ? _t.html("inspector.multiple_values") : textFor(_value)).classed("mixed", isMixed);
58119 label.classed("set", !!_value);
58120 if (field.type === "onewayCheck") {
58121 reverser.classed("hide", reverserHidden()).call(reverserSetText);
58124 check.focus = function() {
58125 input.node().focus();
58127 return utilRebind(check, dispatch10, "on");
58130 // modules/ui/fields/combo.js
58132 "crossing:markings": [
58147 function uiFieldCombo(field, context) {
58148 var dispatch10 = dispatch_default("change");
58149 var _isMulti = field.type === "multiCombo" || field.type === "manyCombo";
58150 var _isNetwork = field.type === "networkCombo";
58151 var _isSemi = field.type === "semiCombo";
58152 var _showTagInfoSuggestions = field.type !== "manyCombo" && field.autoSuggestions !== false;
58153 var _allowCustomValues = field.type !== "manyCombo" && field.customValues !== false;
58154 var _snake_case = field.snake_case || field.snake_case === void 0;
58155 var _combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(field.caseSensitive).minItems(1);
58156 var _container = select_default2(null);
58157 var _inputWrap = select_default2(null);
58158 var _input = select_default2(null);
58159 var _comboData = [];
58160 var _multiData = [];
58161 var _entityIDs = [];
58164 var _staticPlaceholder;
58165 var _dataDeprecated = [];
58166 _mainFileFetcher.get("deprecated").then(function(d) {
58167 _dataDeprecated = d;
58168 }).catch(function() {
58170 if (_isMulti && field.key && /[^:]$/.test(field.key)) {
58173 function snake(s) {
58174 return s.replace(/\s+/g, "_");
58176 function clean2(s) {
58177 return s.split(";").map(function(s2) {
58181 function tagValue(dval) {
58182 dval = clean2(dval || "");
58183 var found = getOptions().find(function(o) {
58184 return o.key && clean2(o.value) === dval;
58188 if (field.type === "typeCombo" && !dval) {
58192 dval = snake(dval);
58194 if (!field.caseSensitive) {
58195 dval = dval.toLowerCase();
58197 return dval || void 0;
58199 function displayValue(tval) {
58201 var stringsField = field.resolveReference("stringsCrossReference");
58202 if (stringsField.hasTextForStringId("options." + tval)) {
58203 return stringsField.t("options." + tval, { default: tval });
58205 if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
58210 function renderValue(tval) {
58212 var stringsField = field.resolveReference("stringsCrossReference");
58213 if (stringsField.hasTextForStringId("options." + tval)) {
58214 return stringsField.t.append("options." + tval, { default: tval });
58216 if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
58219 return (selection2) => selection2.text(tval);
58221 function objectDifference(a, b) {
58222 return a.filter(function(d1) {
58223 return !b.some(function(d2) {
58224 return !d2.isMixed && d1.value === d2.value;
58228 function initCombo(selection2, attachTo) {
58229 if (!_allowCustomValues) {
58230 selection2.attr("readonly", "readonly");
58232 if (_showTagInfoSuggestions && services.taginfo) {
58233 selection2.call(_combobox.fetcher(setTaginfoValues), attachTo);
58234 setTaginfoValues("", setPlaceholder);
58236 selection2.call(_combobox, attachTo);
58237 setStaticValues(setPlaceholder);
58240 function getOptions() {
58241 var stringsField = field.resolveReference("stringsCrossReference");
58242 if (!(field.options || stringsField.options))
58244 return (field.options || stringsField.options).map(function(v) {
58247 value: stringsField.t("options." + v, { default: v }),
58249 display: addComboboxIcons(stringsField.t.append("options." + v, { default: v }), v),
58250 klass: stringsField.hasTextForStringId("options." + v) ? "" : "raw-option"
58254 function setStaticValues(callback, filter2) {
58255 _comboData = getOptions();
58256 if (filter2 !== void 0) {
58257 _comboData = _comboData.filter(filter2);
58259 _comboData = objectDifference(_comboData, _multiData);
58260 _combobox.data(_comboData);
58262 callback(_comboData);
58264 function setTaginfoValues(q, callback) {
58265 var queryFilter = (d) => d.value.toLowerCase().includes(q.toLowerCase()) || d.key.toLowerCase().includes(q.toLowerCase());
58266 setStaticValues(callback, queryFilter);
58267 var stringsField = field.resolveReference("stringsCrossReference");
58268 var fn = _isMulti ? "multikeys" : "values";
58269 var query = (_isMulti ? field.key : "") + q;
58270 var hasCountryPrefix = _isNetwork && _countryCode && _countryCode.indexOf(q.toLowerCase()) === 0;
58271 if (hasCountryPrefix) {
58272 query = _countryCode + ":";
58275 debounce: q !== "",
58279 if (_entityIDs.length) {
58280 params.geometry = context.graph().geometry(_entityIDs[0]);
58282 services.taginfo[fn](params, function(err, data) {
58285 data = data.filter(function(d) {
58286 return field.type !== "typeCombo" || d.value !== "yes";
58288 var deprecatedValues = osmEntity.deprecatedTagValuesByKey(_dataDeprecated)[field.key];
58289 if (deprecatedValues) {
58290 data = data.filter(function(d) {
58291 return deprecatedValues.indexOf(d.value) === -1;
58294 if (hasCountryPrefix) {
58295 data = data.filter(function(d) {
58296 return d.value.toLowerCase().indexOf(_countryCode + ":") === 0;
58299 const additionalOptions = (field.options || stringsField.options || []).filter((v) => !data.some((dv) => dv.value === (_isMulti ? field.key + v : v))).map((v) => ({ value: v }));
58300 _container.classed("empty-combobox", data.length === 0);
58301 _comboData = data.concat(additionalOptions).map(function(d) {
58304 k = k.replace(field.key, "");
58305 var isLocalizable = stringsField.hasTextForStringId("options." + k);
58306 var label = stringsField.t("options." + k, { default: k });
58310 display: addComboboxIcons(stringsField.t.append("options." + k, { default: k }), k),
58311 title: isLocalizable ? k : d.title !== label ? d.title : "",
58312 klass: isLocalizable ? "" : "raw-option"
58315 _comboData = _comboData.filter(queryFilter);
58316 _comboData = objectDifference(_comboData, _multiData);
58318 callback(_comboData);
58321 function addComboboxIcons(disp, value) {
58322 if (valueIcons[field.key]) {
58323 return function(selection2) {
58324 var span = selection2.insert("span", ":first-child").attr("class", "tag-value-icon");
58325 if (valueIcons[field.key].indexOf(value) !== -1) {
58326 span.call(svgIcon("#iD-" + field.key.replace(/:/g, "_") + "-" + value.replace(/:/g, "_")));
58328 disp.call(this, selection2);
58333 function setPlaceholder(values) {
58334 if (_isMulti || _isSemi) {
58335 _staticPlaceholder = field.placeholder() || _t("inspector.add");
58337 var vals = values.map(function(d) {
58339 }).filter(function(s) {
58340 return s.length < 20;
58342 var placeholders = vals.length > 1 ? vals : values.map(function(d) {
58345 _staticPlaceholder = field.placeholder() || placeholders.slice(0, 3).join(", ");
58347 if (!/(…|\.\.\.)$/.test(_staticPlaceholder)) {
58348 _staticPlaceholder += "\u2026";
58351 if (!_isMulti && !_isSemi && _tags && Array.isArray(_tags[field.key])) {
58352 ph = _t("inspector.multiple_values");
58354 ph = _staticPlaceholder;
58356 _container.selectAll("input").attr("placeholder", ph);
58358 function change() {
58361 if (_isMulti || _isSemi) {
58364 vals = [tagValue(utilGetSetValue(_input))];
58365 } else if (_isSemi) {
58366 val = tagValue(utilGetSetValue(_input).replace(/,/g, ";")) || "";
58367 vals = val.split(";");
58369 vals = vals.filter(Boolean);
58372 _container.classed("active", false);
58373 utilGetSetValue(_input, "");
58375 utilArrayUniq(vals).forEach(function(v) {
58376 var key = (field.key || "") + v;
58378 var old = _tags[key];
58379 if (typeof old === "string" && old.toLowerCase() !== "no")
58382 key = context.cleanTagKey(key);
58383 field.keys.push(key);
58386 } else if (_isSemi) {
58387 var arr = _multiData.map(function(d) {
58390 arr = arr.concat(vals);
58391 t[field.key] = context.cleanTagValue(utilArrayUniq(arr).filter(Boolean).join(";"));
58393 window.setTimeout(function() {
58394 _input.node().focus();
58397 var rawValue = utilGetSetValue(_input);
58398 if (!rawValue && Array.isArray(_tags[field.key]))
58400 val = context.cleanTagValue(tagValue(rawValue));
58401 t[field.key] = val || void 0;
58403 dispatch10.call("change", this, t);
58405 function removeMultikey(d3_event, d) {
58406 d3_event.preventDefault();
58407 d3_event.stopPropagation();
58411 } else if (_isSemi) {
58412 var arr = _multiData.map(function(md) {
58413 return md.key === d.key ? null : md.key;
58414 }).filter(Boolean);
58415 arr = utilArrayUniq(arr);
58416 t[field.key] = arr.length ? arr.join(";") : void 0;
58418 dispatch10.call("change", this, t);
58420 function combo(selection2) {
58421 _container = selection2.selectAll(".form-field-input-wrap").data([0]);
58422 var type3 = _isMulti || _isSemi ? "multicombo" : "combo";
58423 _container = _container.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + type3).merge(_container);
58424 if (_isMulti || _isSemi) {
58425 _container = _container.selectAll(".chiplist").data([0]);
58426 var listClass = "chiplist";
58427 if (field.key === "destination" || field.key === "via") {
58428 listClass += " full-line-chips";
58430 _container = _container.enter().append("ul").attr("class", listClass).on("click", function() {
58431 window.setTimeout(function() {
58432 _input.node().focus();
58434 }).merge(_container);
58435 _inputWrap = _container.selectAll(".input-wrap").data([0]);
58436 _inputWrap = _inputWrap.enter().append("li").attr("class", "input-wrap").merge(_inputWrap);
58437 _input = _inputWrap.selectAll("input").data([0]);
58439 _input = _container.selectAll("input").data([0]);
58441 _input = _input.enter().append("input").attr("type", "text").attr("id", field.domId).call(utilNoAuto).call(initCombo, selection2).merge(_input);
58443 var extent = combinedEntityExtent();
58444 var countryCode = extent && iso1A2Code(extent.center());
58445 _countryCode = countryCode && countryCode.toLowerCase();
58447 _input.on("change", change).on("blur", change).on("input", function() {
58448 updateIcon(utilGetSetValue(_input));
58450 _input.on("keydown.field", function(d3_event) {
58451 switch (d3_event.keyCode) {
58453 _input.node().blur();
58454 d3_event.stopPropagation();
58458 if (_isMulti || _isSemi) {
58459 _combobox.on("accept", function() {
58460 _input.node().blur();
58461 _input.node().focus();
58463 _input.on("focus", function() {
58464 _container.classed("active", true);
58467 _combobox.on("cancel", function() {
58468 _input.node().blur();
58469 }).on("update", function() {
58470 updateIcon(utilGetSetValue(_input));
58473 function updateIcon(value) {
58474 value = tagValue(value);
58475 if (valueIcons[field.key]) {
58476 _container.selectAll(".tag-value-icon").remove();
58477 if (valueIcons[field.key].indexOf(value) !== -1) {
58478 _container.selectAll(".tag-value-icon").data([value]).enter().insert("div", "input").attr("class", "tag-value-icon").call(svgIcon("#iD-" + field.key.replace(/:/g, "_") + "-" + value.replace(/:/g, "_")));
58482 combo.tags = function(tags) {
58484 var stringsField = field.resolveReference("stringsCrossReference");
58485 if (_isMulti || _isSemi) {
58489 for (var k in tags) {
58490 if (field.key && k.indexOf(field.key) !== 0)
58492 if (!field.key && field.keys.indexOf(k) === -1)
58495 if (!v || typeof v === "string" && v.toLowerCase() === "no")
58497 var suffix = field.key ? k.slice(field.key.length) : k;
58500 value: displayValue(suffix),
58501 display: renderValue(suffix),
58502 isMixed: Array.isArray(v)
58506 field.keys = _multiData.map(function(d) {
58509 maxLength = context.maxCharsForTagKey() - utilUnicodeCharsCount(field.key);
58511 maxLength = context.maxCharsForTagKey();
58513 } else if (_isSemi) {
58514 var allValues = [];
58516 if (Array.isArray(tags[field.key])) {
58517 tags[field.key].forEach(function(tagVal) {
58518 var thisVals = utilArrayUniq((tagVal || "").split(";")).filter(Boolean);
58519 allValues = allValues.concat(thisVals);
58520 if (!commonValues) {
58521 commonValues = thisVals;
58523 commonValues = commonValues.filter((value) => thisVals.includes(value));
58526 allValues = utilArrayUniq(allValues).filter(Boolean);
58528 allValues = utilArrayUniq((tags[field.key] || "").split(";")).filter(Boolean);
58529 commonValues = allValues;
58531 _multiData = allValues.map(function(v2) {
58534 value: displayValue(v2),
58535 display: renderValue(v2),
58536 isMixed: !commonValues.includes(v2)
58539 var currLength = utilUnicodeCharsCount(commonValues.join(";"));
58540 maxLength = context.maxCharsForTagValue() - currLength;
58541 if (currLength > 0) {
58545 maxLength = Math.max(0, maxLength);
58546 var allowDragAndDrop = _isSemi && !Array.isArray(tags[field.key]);
58547 var available = objectDifference(_comboData, _multiData);
58548 _combobox.data(available);
58549 var hideAdd = !_allowCustomValues && !available.length || maxLength <= 0;
58550 _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
58551 var chips = _container.selectAll(".chip").data(_multiData);
58552 chips.exit().remove();
58553 var enter = chips.enter().insert("li", ".input-wrap").attr("class", "chip");
58554 enter.append("span");
58556 chips = chips.merge(enter).order().classed("raw-value", function(d) {
58559 k2 = k2.replace(field.key, "");
58560 return !stringsField.hasTextForStringId("options." + k2);
58561 }).classed("draggable", allowDragAndDrop).classed("mixed", function(d) {
58563 }).attr("title", function(d) {
58564 return d.isMixed ? _t("inspector.unshared_value_tooltip") : null;
58566 if (allowDragAndDrop) {
58567 registerDragAndDrop(chips);
58569 chips.select("span").each(function(d) {
58570 const selection2 = select_default2(this);
58572 selection2.text("");
58573 d.display(selection2);
58575 selection2.text(d.value);
58578 chips.select("a").attr("href", "#").on("click", removeMultikey).attr("class", "remove").text("\xD7");
58580 var isMixed = Array.isArray(tags[field.key]);
58581 var mixedValues = isMixed && tags[field.key].map(function(val) {
58582 return displayValue(val);
58583 }).filter(Boolean);
58584 var showsValue = !isMixed && tags[field.key] && !(field.type === "typeCombo" && tags[field.key] === "yes");
58585 var isRawValue = showsValue && !stringsField.hasTextForStringId("options." + tags[field.key]);
58586 var isKnownValue = showsValue && !isRawValue;
58587 var isReadOnly = !_allowCustomValues || isKnownValue;
58588 utilGetSetValue(_input, !isMixed ? displayValue(tags[field.key]) : "").classed("raw-value", isRawValue).classed("known-value", isKnownValue).attr("readonly", isReadOnly ? "readonly" : void 0).attr("title", isMixed ? mixedValues.join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : _staticPlaceholder || "").classed("mixed", isMixed).on("keydown.deleteCapture", function(d3_event) {
58589 if (isReadOnly && isKnownValue && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
58590 d3_event.preventDefault();
58591 d3_event.stopPropagation();
58593 t[field.key] = void 0;
58594 dispatch10.call("change", this, t);
58597 if (!Array.isArray(tags[field.key])) {
58598 updateIcon(tags[field.key]);
58602 function registerDragAndDrop(selection2) {
58603 var dragOrigin, targetIndex;
58605 drag_default().on("start", function(d3_event) {
58610 targetIndex = null;
58611 }).on("drag", function(d3_event) {
58612 var x = d3_event.x - dragOrigin.x, y = d3_event.y - dragOrigin.y;
58613 if (!select_default2(this).classed("dragging") && Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) <= 5)
58615 var index = selection2.nodes().indexOf(this);
58616 select_default2(this).classed("dragging", true);
58617 targetIndex = null;
58618 var targetIndexOffsetTop = null;
58619 var draggedTagWidth = select_default2(this).node().offsetWidth;
58620 if (field.key === "destination" || field.key === "via") {
58621 _container.selectAll(".chip").style("transform", function(d2, index2) {
58622 var node = select_default2(this).node();
58623 if (index === index2) {
58624 return "translate(" + x + "px, " + y + "px)";
58625 } else if (index2 > index && d3_event.y > node.offsetTop) {
58626 if (targetIndex === null || index2 > targetIndex) {
58627 targetIndex = index2;
58629 return "translateY(-100%)";
58630 } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
58631 if (targetIndex === null || index2 < targetIndex) {
58632 targetIndex = index2;
58634 return "translateY(100%)";
58639 _container.selectAll(".chip").each(function(d2, index2) {
58640 var node = select_default2(this).node();
58641 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) {
58642 targetIndex = index2;
58643 targetIndexOffsetTop = node.offsetTop;
58645 }).style("transform", function(d2, index2) {
58646 var node = select_default2(this).node();
58647 if (index === index2) {
58648 return "translate(" + x + "px, " + y + "px)";
58650 if (node.offsetTop === targetIndexOffsetTop) {
58651 if (index2 < index && index2 >= targetIndex) {
58652 return "translateX(" + draggedTagWidth + "px)";
58653 } else if (index2 > index && index2 <= targetIndex) {
58654 return "translateX(-" + draggedTagWidth + "px)";
58660 }).on("end", function() {
58661 if (!select_default2(this).classed("dragging")) {
58664 var index = selection2.nodes().indexOf(this);
58665 select_default2(this).classed("dragging", false);
58666 _container.selectAll(".chip").style("transform", null);
58667 if (typeof targetIndex === "number") {
58668 var element = _multiData[index];
58669 _multiData.splice(index, 1);
58670 _multiData.splice(targetIndex, 0, element);
58672 if (_multiData.length) {
58673 t[field.key] = _multiData.map(function(element2) {
58674 return element2.key;
58677 t[field.key] = void 0;
58679 dispatch10.call("change", this, t);
58681 dragOrigin = void 0;
58682 targetIndex = void 0;
58686 combo.focus = function() {
58687 _input.node().focus();
58689 combo.entityIDs = function(val) {
58690 if (!arguments.length)
58695 function combinedEntityExtent() {
58696 return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
58698 return utilRebind(combo, dispatch10, "on");
58701 // modules/ui/fields/input.js
58702 function uiFieldText(field, context) {
58703 var dispatch10 = dispatch_default("change");
58704 var input = select_default2(null);
58705 var outlinkButton = select_default2(null);
58706 var wrap2 = select_default2(null);
58707 var _entityIDs = [];
58709 var _phoneFormats = {};
58710 if (field.type === "tel") {
58711 _mainFileFetcher.get("phone_formats").then(function(d) {
58713 updatePhonePlaceholder();
58714 }).catch(function() {
58717 function calcLocked() {
58718 var isLocked = (field.id === "brand" || field.id === "network" || field.id === "operator" || field.id === "flag") && _entityIDs.length && _entityIDs.some(function(entityID) {
58719 var entity = context.graph().hasEntity(entityID);
58722 if (entity.tags.wikidata)
58724 var preset = _mainPresetIndex.match(entity, context.graph());
58725 var isSuggestion = preset && preset.suggestion;
58726 var which = field.id;
58727 return isSuggestion && !!entity.tags[which] && !!entity.tags[which + ":wikidata"];
58729 field.locked(isLocked);
58731 function i2(selection2) {
58733 var isLocked = field.locked();
58734 wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
58735 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
58736 input = wrap2.selectAll("input").data([0]);
58737 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);
58738 input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
58739 if (field.type === "tel") {
58740 updatePhonePlaceholder();
58741 } else if (field.type === "number") {
58742 var rtl = _mainLocalizer.textDirection() === "rtl";
58743 input.attr("type", "text");
58744 var inc = field.increment;
58745 var buttons = wrap2.selectAll(".increment, .decrement").data(rtl ? [inc, -inc] : [-inc, inc]);
58746 buttons.enter().append("button").attr("class", function(d) {
58747 var which = d > 0 ? "increment" : "decrement";
58748 return "form-field-button " + which;
58749 }).attr("title", function(d) {
58750 var which = d > 0 ? "increment" : "decrement";
58751 return _t(`inspector.${which}`);
58752 }).merge(buttons).on("click", function(d3_event, d) {
58753 d3_event.preventDefault();
58754 var raw_vals = input.node().value || "0";
58755 var vals = raw_vals.split(";");
58756 vals = vals.map(function(v) {
58757 var num = parseFloat(v.trim(), 10);
58759 return clamped(num + d);
58760 const compassDir = cardinal[v.trim().toLowerCase()];
58761 if (compassDir !== void 0)
58762 return clamped(compassDir + d);
58765 input.node().value = vals.join(";");
58768 } else if (field.type === "identifier" && field.urlFormat && field.pattern) {
58769 input.attr("type", "text");
58770 outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
58771 outlinkButton.enter().append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", function() {
58772 var domainResults = /^https?:\/\/(.{1,}?)\//.exec(field.urlFormat);
58773 if (domainResults.length >= 2 && domainResults[1]) {
58774 var domain2 = domainResults[1];
58775 return _t("icons.view_on", { domain: domain2 });
58778 }).on("click", function(d3_event) {
58779 d3_event.preventDefault();
58780 var value = validIdentifierValueForLink();
58782 var url = field.urlFormat.replace(/{value}/, encodeURIComponent(value));
58783 window.open(url, "_blank");
58785 }).merge(outlinkButton);
58786 } else if (field.type === "url") {
58787 input.attr("type", "text");
58788 outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
58789 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) {
58790 d3_event.preventDefault();
58791 const value = validIdentifierValueForLink();
58793 window.open(value, "_blank");
58794 }).merge(outlinkButton);
58795 } else if (field.type === "colour") {
58796 input.attr("type", "text");
58797 updateColourPreview();
58800 function isColourValid(colour) {
58801 if (!colour.match(/^(#([0-9a-fA-F]{3}){1,2}|\w+)$/)) {
58803 } else if (!CSS.supports("color", colour) || ["unset", "inherit", "initial", "revert"].includes(colour)) {
58808 function updateColourPreview() {
58809 wrap2.selectAll(".colour-preview").remove();
58810 const colour = utilGetSetValue(input);
58811 if (!isColourValid(colour) && colour !== "")
58813 var colourSelector = wrap2.selectAll(".colour-selector").data([0]);
58814 outlinkButton = wrap2.selectAll(".colour-preview").data([colour]);
58815 colourSelector.enter().append("input").attr("type", "color").attr("class", "form-field-button colour-selector").attr("value", colour).on("input", debounce_default(function(d3_event) {
58816 d3_event.preventDefault();
58817 var colour2 = this.value;
58818 if (!isColourValid(colour2))
58820 utilGetSetValue(input, this.value);
58822 updateColourPreview();
58824 outlinkButton = outlinkButton.enter().append("div").attr("class", "form-field-button colour-preview").append("div").style("background-color", (d) => d).attr("class", "colour-box");
58825 if (colour === "") {
58826 outlinkButton = outlinkButton.call(svgIcon("#iD-icon-edit"));
58828 outlinkButton.on("click", () => wrap2.select(".colour-selector").node().click()).merge(outlinkButton);
58830 function updatePhonePlaceholder() {
58831 if (input.empty() || !Object.keys(_phoneFormats).length)
58833 var extent = combinedEntityExtent();
58834 var countryCode = extent && iso1A2Code(extent.center());
58835 var format2 = countryCode && _phoneFormats[countryCode.toLowerCase()];
58837 input.attr("placeholder", format2);
58839 function validIdentifierValueForLink() {
58840 const value = utilGetSetValue(input).trim();
58841 if (field.type === "url" && value) {
58843 return new URL(value).href;
58848 if (field.type === "identifier" && field.pattern) {
58849 return value && value.match(new RegExp(field.pattern))[0];
58853 function clamped(num) {
58854 if (field.minValue !== void 0) {
58855 num = Math.max(num, field.minValue);
58857 if (field.maxValue !== void 0) {
58858 num = Math.min(num, field.maxValue);
58862 function change(onInput) {
58863 return function() {
58865 var val = utilGetSetValue(input);
58867 val = context.cleanTagValue(val);
58868 if (!val && Array.isArray(_tags[field.key]))
58871 if (field.type === "number" && val) {
58872 var vals = val.split(";");
58873 vals = vals.map(function(v) {
58874 var num = parseFloat(v.trim(), 10);
58875 return isFinite(num) ? clamped(num) : v.trim();
58877 val = vals.join(";");
58879 utilGetSetValue(input, val);
58881 t[field.key] = val || void 0;
58882 dispatch10.call("change", this, t, onInput);
58885 i2.entityIDs = function(val) {
58886 if (!arguments.length)
58891 i2.tags = function(tags) {
58893 var isMixed = Array.isArray(tags[field.key]);
58894 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);
58895 if (field.type === "tel")
58896 updatePhonePlaceholder();
58897 if (field.key.split(":").includes("colour"))
58898 updateColourPreview();
58899 if (outlinkButton && !outlinkButton.empty()) {
58900 var disabled = !validIdentifierValueForLink();
58901 outlinkButton.classed("disabled", disabled);
58904 i2.focus = function() {
58905 var node = input.node();
58909 function combinedEntityExtent() {
58910 return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
58912 return utilRebind(i2, dispatch10, "on");
58915 // modules/ui/fields/access.js
58916 function uiFieldAccess(field, context) {
58917 var dispatch10 = dispatch_default("change");
58918 var items = select_default2(null);
58920 function access(selection2) {
58921 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
58922 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
58923 var list = wrap2.selectAll("ul").data([0]);
58924 list = list.enter().append("ul").attr("class", "rows").merge(list);
58925 items = list.selectAll("li").data(field.keys);
58926 var enter = items.enter().append("li").attr("class", function(d) {
58927 return "labeled-input preset-access-" + d;
58929 enter.append("span").attr("class", "label preset-label-access").attr("for", function(d) {
58930 return "preset-input-access-" + d;
58931 }).html(function(d) {
58932 return field.t.html("types." + d);
58934 enter.append("div").attr("class", "preset-input-access-wrap").append("input").attr("type", "text").attr("class", function(d) {
58935 return "preset-input-access preset-input-access-" + d;
58936 }).call(utilNoAuto).each(function(d) {
58937 select_default2(this).call(
58938 uiCombobox(context, "access-" + d).data(access.options(d))
58941 items = items.merge(enter);
58942 wrap2.selectAll(".preset-input-access").on("change", change).on("blur", change);
58944 function change(d3_event, d) {
58946 var value = context.cleanTagValue(utilGetSetValue(select_default2(this)));
58947 if (!value && typeof _tags[d] !== "string")
58949 tag[d] = value || void 0;
58950 dispatch10.call("change", this, tag);
58952 access.options = function(type3) {
58964 if (type3 === "access") {
58965 options2 = options2.filter((v) => v !== "yes" && v !== "designated");
58967 if (type3 === "bicycle") {
58968 options2.splice(options2.length - 4, 0, "dismount");
58970 var stringsField = field.resolveReference("stringsCrossReference");
58971 return options2.map(function(option) {
58973 title: stringsField.t("options." + option + ".description"),
58978 const placeholdersByTag = {
58981 foot: "designated",
58982 motor_vehicle: "no"
58986 motor_vehicle: "no",
58992 motor_vehicle: "no"
58995 motor_vehicle: "no",
58996 bicycle: "designated"
58999 motor_vehicle: "no",
59000 horse: "designated"
59004 motor_vehicle: "no",
59010 motor_vehicle: "yes",
59015 motor_vehicle: "yes"
59019 motor_vehicle: "yes",
59025 motor_vehicle: "yes",
59031 motor_vehicle: "yes",
59037 motor_vehicle: "yes",
59043 motor_vehicle: "yes",
59049 motor_vehicle: "yes",
59055 motor_vehicle: "yes",
59060 motor_vehicle: "yes"
59064 motor_vehicle: "yes",
59070 motor_vehicle: "yes",
59076 motor_vehicle: "yes",
59091 motor_vehicle: "no",
59103 motor_vehicle: "no"
59120 motorcycle_barrier: {
59121 motor_vehicle: "no"
59128 access.tags = function(tags) {
59130 utilGetSetValue(items.selectAll(".preset-input-access"), function(d) {
59131 return typeof tags[d] === "string" ? tags[d] : "";
59132 }).classed("mixed", function(d) {
59133 return tags[d] && Array.isArray(tags[d]);
59134 }).attr("title", function(d) {
59135 return tags[d] && Array.isArray(tags[d]) && tags[d].filter(Boolean).join("\n");
59136 }).attr("placeholder", function(d) {
59137 if (tags[d] && Array.isArray(tags[d])) {
59138 return _t("inspector.multiple_values");
59140 if (d === "bicycle" || d === "motor_vehicle") {
59141 if (tags.vehicle && typeof tags.vehicle === "string") {
59142 return tags.vehicle;
59145 if (tags.access && typeof tags.access === "string") {
59146 return tags.access;
59148 function getPlaceholdersByTag(key, placeholdersByKey) {
59149 if (typeof tags[key] === "string") {
59150 if (placeholdersByKey[tags[key]] && placeholdersByKey[tags[key]][d]) {
59151 return placeholdersByKey[tags[key]][d];
59154 var impliedAccesses = tags[key].filter(Boolean).map(function(val) {
59155 return placeholdersByKey[val] && placeholdersByKey[val][d];
59156 }).filter(Boolean);
59157 if (impliedAccesses.length === tags[key].length && new Set(impliedAccesses).size === 1) {
59158 return impliedAccesses[0];
59162 for (const key in placeholdersByTag) {
59164 const impliedAccess = getPlaceholdersByTag(key, placeholdersByTag[key]);
59165 if (impliedAccess) {
59166 return impliedAccess;
59170 if (d === "access" && !tags.barrier) {
59173 return field.placeholder();
59176 access.focus = function() {
59177 items.selectAll(".preset-input-access").node().focus();
59179 return utilRebind(access, dispatch10, "on");
59182 // modules/ui/fields/address.js
59183 function uiFieldAddress(field, context) {
59184 var dispatch10 = dispatch_default("change");
59185 var _selection = select_default2(null);
59186 var _wrap = select_default2(null);
59187 var addrField = _mainPresetIndex.field("address");
59188 var _entityIDs = [];
59191 var _addressFormats = [{
59193 ["housenumber", "street"],
59194 ["city", "postcode"]
59197 _mainFileFetcher.get("address_formats").then(function(d) {
59198 _addressFormats = d;
59199 if (!_selection.empty()) {
59200 _selection.call(address);
59202 }).catch(function() {
59204 function getNearStreets() {
59205 var extent = combinedEntityExtent();
59206 var l = extent.center();
59207 var box = geoExtent(l).padByMeters(200);
59208 var streets = context.history().intersects(box).filter(isAddressable).map(function(d) {
59209 var loc = context.projection([
59210 (extent[0][0] + extent[1][0]) / 2,
59211 (extent[0][1] + extent[1][1]) / 2
59213 var choice = geoChooseEdge(context.graph().childNodes(d), loc, context.projection);
59215 title: d.tags.name,
59216 value: d.tags.name,
59217 dist: choice.distance
59219 }).sort(function(a, b) {
59220 return a.dist - b.dist;
59222 return utilArrayUniqBy(streets, "value");
59223 function isAddressable(d) {
59224 return d.tags.highway && d.tags.name && d.type === "way";
59227 function getNearCities() {
59228 var extent = combinedEntityExtent();
59229 var l = extent.center();
59230 var box = geoExtent(l).padByMeters(200);
59231 var cities = context.history().intersects(box).filter(isAddressable).map(function(d) {
59233 title: d.tags["addr:city"] || d.tags.name,
59234 value: d.tags["addr:city"] || d.tags.name,
59235 dist: geoSphericalDistance(d.extent(context.graph()).center(), l)
59237 }).sort(function(a, b) {
59238 return a.dist - b.dist;
59240 return utilArrayUniqBy(cities, "value");
59241 function isAddressable(d) {
59243 if (d.tags.admin_level === "8" && d.tags.boundary === "administrative")
59245 if (d.tags.border_type === "city")
59247 if (d.tags.place === "city" || d.tags.place === "town" || d.tags.place === "village")
59250 if (d.tags["addr:city"])
59255 function getNearValues(key) {
59256 var extent = combinedEntityExtent();
59257 var l = extent.center();
59258 var box = geoExtent(l).padByMeters(200);
59259 var results = context.history().intersects(box).filter(function hasTag(d) {
59260 return _entityIDs.indexOf(d.id) === -1 && d.tags[key];
59261 }).map(function(d) {
59263 title: d.tags[key],
59264 value: d.tags[key],
59265 dist: geoSphericalDistance(d.extent(context.graph()).center(), l)
59267 }).sort(function(a, b) {
59268 return a.dist - b.dist;
59270 return utilArrayUniqBy(results, "value");
59272 function updateForCountryCode() {
59276 for (var i2 = 0; i2 < _addressFormats.length; i2++) {
59277 var format2 = _addressFormats[i2];
59278 if (!format2.countryCodes) {
59279 addressFormat = format2;
59280 } else if (format2.countryCodes.indexOf(_countryCode) !== -1) {
59281 addressFormat = format2;
59285 var dropdowns = addressFormat.dropdowns || [
59301 var widths = addressFormat.widths || {
59302 housenumber: 1 / 3,
59309 var total = r.reduce(function(sum, key) {
59310 return sum + (widths[key] || 0.5);
59312 return r.map(function(key) {
59315 width: (widths[key] || 0.5) / total
59319 var rows = _wrap.selectAll(".addr-row").data(addressFormat.format, function(d) {
59320 return d.toString();
59322 rows.exit().remove();
59323 rows.enter().append("div").attr("class", "addr-row").selectAll("input").data(row).enter().append("input").property("type", "text").call(updatePlaceholder).attr("class", function(d) {
59324 return "addr-" + d.id;
59325 }).call(utilNoAuto).each(addDropdown).style("width", function(d) {
59326 return d.width * 100 + "%";
59328 function addDropdown(d) {
59329 if (dropdowns.indexOf(d.id) === -1)
59331 var nearValues = d.id === "street" ? getNearStreets : d.id === "city" ? getNearCities : getNearValues;
59332 select_default2(this).call(
59333 uiCombobox(context, "address-" + d.id).minItems(1).caseSensitive(true).fetcher(function(value, callback) {
59334 callback(nearValues("addr:" + d.id));
59338 _wrap.selectAll("input").on("blur", change()).on("change", change());
59339 _wrap.selectAll("input:not(.combobox-input)").on("input", change(true));
59343 function address(selection2) {
59344 _selection = selection2;
59345 _wrap = selection2.selectAll(".form-field-input-wrap").data([0]);
59346 _wrap = _wrap.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(_wrap);
59347 var extent = combinedEntityExtent();
59350 if (context.inIntro()) {
59351 countryCode = _t("intro.graph.countrycode");
59353 var center = extent.center();
59354 countryCode = iso1A2Code(center);
59357 _countryCode = countryCode.toLowerCase();
59358 updateForCountryCode();
59362 function change(onInput) {
59363 return function() {
59365 _wrap.selectAll("input").each(function(subfield) {
59366 var key = field.key + ":" + subfield.id;
59367 var value = this.value;
59369 value = context.cleanTagValue(value);
59370 if (Array.isArray(_tags[key]) && !value)
59372 tags[key] = value || void 0;
59374 dispatch10.call("change", this, tags, onInput);
59377 function updatePlaceholder(inputSelection) {
59378 return inputSelection.attr("placeholder", function(subfield) {
59379 if (_tags && Array.isArray(_tags[field.key + ":" + subfield.id])) {
59380 return _t("inspector.multiple_values");
59382 if (_countryCode) {
59383 var localkey = subfield.id + "!" + _countryCode;
59384 var tkey = addrField.hasTextForStringId("placeholders." + localkey) ? localkey : subfield.id;
59385 return addrField.t("placeholders." + tkey);
59389 function updateTags(tags) {
59390 utilGetSetValue(_wrap.selectAll("input"), function(subfield) {
59391 var val = tags[field.key + ":" + subfield.id];
59392 return typeof val === "string" ? val : "";
59393 }).attr("title", function(subfield) {
59394 var val = tags[field.key + ":" + subfield.id];
59395 return val && Array.isArray(val) ? val.filter(Boolean).join("\n") : void 0;
59396 }).classed("mixed", function(subfield) {
59397 return Array.isArray(tags[field.key + ":" + subfield.id]);
59398 }).call(updatePlaceholder);
59400 function combinedEntityExtent() {
59401 return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
59403 address.entityIDs = function(val) {
59404 if (!arguments.length)
59409 address.tags = function(tags) {
59413 address.focus = function() {
59414 var node = _wrap.selectAll("input").node();
59418 return utilRebind(address, dispatch10, "on");
59421 // modules/ui/fields/cycleway.js
59422 function uiFieldCycleway(field, context) {
59423 var dispatch10 = dispatch_default("change");
59424 var items = select_default2(null);
59425 var wrap2 = select_default2(null);
59427 function cycleway(selection2) {
59428 function stripcolon(s) {
59429 return s.replace(":", "");
59431 wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
59432 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
59433 var div = wrap2.selectAll("ul").data([0]);
59434 div = div.enter().append("ul").attr("class", "rows").merge(div);
59435 var keys = ["cycleway:left", "cycleway:right"];
59436 items = div.selectAll("li").data(keys);
59437 var enter = items.enter().append("li").attr("class", function(d) {
59438 return "labeled-input preset-cycleway-" + stripcolon(d);
59440 enter.append("span").attr("class", "label preset-label-cycleway").attr("for", function(d) {
59441 return "preset-input-cycleway-" + stripcolon(d);
59442 }).html(function(d) {
59443 return field.t.html("types." + d);
59445 enter.append("div").attr("class", "preset-input-cycleway-wrap").append("input").attr("type", "text").attr("class", function(d) {
59446 return "preset-input-cycleway preset-input-" + stripcolon(d);
59447 }).call(utilNoAuto).each(function(d) {
59448 select_default2(this).call(
59449 uiCombobox(context, "cycleway-" + stripcolon(d)).data(cycleway.options(d))
59452 items = items.merge(enter);
59453 wrap2.selectAll(".preset-input-cycleway").on("change", change).on("blur", change);
59455 function change(d3_event, key) {
59456 var newValue = context.cleanTagValue(utilGetSetValue(select_default2(this)));
59457 if (!newValue && (Array.isArray(_tags.cycleway) || Array.isArray(_tags[key])))
59459 if (newValue === "none" || newValue === "") {
59462 var otherKey = key === "cycleway:left" ? "cycleway:right" : "cycleway:left";
59463 var otherValue = typeof _tags.cycleway === "string" ? _tags.cycleway : _tags[otherKey];
59464 if (otherValue && Array.isArray(otherValue)) {
59465 otherValue = otherValue[0];
59467 if (otherValue === "none" || otherValue === "") {
59468 otherValue = void 0;
59471 if (newValue === otherValue) {
59473 cycleway: newValue,
59474 "cycleway:left": void 0,
59475 "cycleway:right": void 0
59481 tag[key] = newValue;
59482 tag[otherKey] = otherValue;
59484 dispatch10.call("change", this, tag);
59486 cycleway.options = function() {
59487 var stringsField = field.resolveReference("stringsCrossReference");
59488 return field.options.map(function(option) {
59490 title: stringsField.t("options." + option + ".description"),
59495 cycleway.tags = function(tags) {
59497 var commonValue = typeof tags.cycleway === "string" && tags.cycleway;
59498 utilGetSetValue(items.selectAll(".preset-input-cycleway"), function(d) {
59500 return commonValue;
59501 return !tags.cycleway && typeof tags[d] === "string" ? tags[d] : "";
59502 }).attr("title", function(d) {
59503 if (Array.isArray(tags.cycleway) || Array.isArray(tags[d])) {
59505 if (Array.isArray(tags.cycleway)) {
59506 vals = vals.concat(tags.cycleway);
59508 if (Array.isArray(tags[d])) {
59509 vals = vals.concat(tags[d]);
59511 return vals.filter(Boolean).join("\n");
59514 }).attr("placeholder", function(d) {
59515 if (Array.isArray(tags.cycleway) || Array.isArray(tags[d])) {
59516 return _t("inspector.multiple_values");
59518 return field.placeholder();
59519 }).classed("mixed", function(d) {
59520 return Array.isArray(tags.cycleway) || Array.isArray(tags[d]);
59523 cycleway.focus = function() {
59524 var node = wrap2.selectAll("input").node();
59528 return utilRebind(cycleway, dispatch10, "on");
59531 // modules/ui/fields/lanes.js
59532 function uiFieldLanes(field, context) {
59533 var dispatch10 = dispatch_default("change");
59534 var LANE_WIDTH = 40;
59535 var LANE_HEIGHT = 200;
59536 var _entityIDs = [];
59537 function lanes(selection2) {
59538 var lanesData = context.entity(_entityIDs[0]).lanes();
59539 if (!context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode) {
59540 selection2.call(lanes.off);
59543 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
59544 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
59545 var surface = wrap2.selectAll(".surface").data([0]);
59546 var d = utilGetDimensions(wrap2);
59547 var freeSpace = d[0] - lanesData.lanes.length * LANE_WIDTH * 1.5 + LANE_WIDTH * 0.5;
59548 surface = surface.enter().append("svg").attr("width", d[0]).attr("height", 300).attr("class", "surface").merge(surface);
59549 var lanesSelection = surface.selectAll(".lanes").data([0]);
59550 lanesSelection = lanesSelection.enter().append("g").attr("class", "lanes").merge(lanesSelection);
59551 lanesSelection.attr("transform", function() {
59552 return "translate(" + freeSpace / 2 + ", 0)";
59554 var lane = lanesSelection.selectAll(".lane").data(lanesData.lanes);
59555 lane.exit().remove();
59556 var enter = lane.enter().append("g").attr("class", "lane");
59557 enter.append("g").append("rect").attr("y", 50).attr("width", LANE_WIDTH).attr("height", LANE_HEIGHT);
59558 enter.append("g").attr("class", "forward").append("text").attr("y", 40).attr("x", 14).text("\u25B2");
59559 enter.append("g").attr("class", "bothways").append("text").attr("y", 40).attr("x", 14).text("\u25B2\u25BC");
59560 enter.append("g").attr("class", "backward").append("text").attr("y", 40).attr("x", 14).text("\u25BC");
59561 lane = lane.merge(enter);
59562 lane.attr("transform", function(d2) {
59563 return "translate(" + LANE_WIDTH * d2.index * 1.5 + ", 0)";
59565 lane.select(".forward").style("visibility", function(d2) {
59566 return d2.direction === "forward" ? "visible" : "hidden";
59568 lane.select(".bothways").style("visibility", function(d2) {
59569 return d2.direction === "bothways" ? "visible" : "hidden";
59571 lane.select(".backward").style("visibility", function(d2) {
59572 return d2.direction === "backward" ? "visible" : "hidden";
59575 lanes.entityIDs = function(val) {
59578 lanes.tags = function() {
59580 lanes.focus = function() {
59582 lanes.off = function() {
59584 return utilRebind(lanes, dispatch10, "on");
59586 uiFieldLanes.supportsMultiselection = false;
59588 // modules/ui/fields/localized.js
59589 var _languagesArray = [];
59590 function uiFieldLocalized(field, context) {
59591 var dispatch10 = dispatch_default("change", "input");
59592 var wikipedia = services.wikipedia;
59593 var input = select_default2(null);
59594 var localizedInputs = select_default2(null);
59597 _mainFileFetcher.get("languages").then(loadLanguagesArray).catch(function() {
59599 var _territoryLanguages = {};
59600 _mainFileFetcher.get("territory_languages").then(function(d) {
59601 _territoryLanguages = d;
59602 }).catch(function() {
59604 var langCombo = uiCombobox(context, "localized-lang").fetcher(fetchLanguages).minItems(0);
59605 var _selection = select_default2(null);
59606 var _multilingual = [];
59607 var _buttonTip = uiTooltip().title(() => _t.append("translate.translate")).placement("left");
59609 var _entityIDs = [];
59610 function loadLanguagesArray(dataLanguages) {
59611 if (_languagesArray.length !== 0)
59613 var replacements = {
59617 for (var code in dataLanguages) {
59618 if (replacements[code] === false)
59620 var metaCode = code;
59621 if (replacements[code])
59622 metaCode = replacements[code];
59623 _languagesArray.push({
59624 localName: _mainLocalizer.languageName(metaCode, { localOnly: true }),
59625 nativeName: dataLanguages[metaCode].nativeName,
59627 label: _mainLocalizer.languageName(metaCode)
59631 function calcLocked() {
59632 var isLocked = field.id === "name" && _entityIDs.length && _entityIDs.some(function(entityID) {
59633 var entity = context.graph().hasEntity(entityID);
59636 if (entity.tags.wikidata)
59638 if (entity.tags["name:etymology:wikidata"])
59640 var preset = _mainPresetIndex.match(entity, context.graph());
59642 var isSuggestion = preset.suggestion;
59643 var fields = preset.fields();
59644 var showsBrandField = fields.some(function(d) {
59645 return d.id === "brand";
59647 var showsOperatorField = fields.some(function(d) {
59648 return d.id === "operator";
59650 var setsName = preset.addTags.name;
59651 var setsBrandWikidata = preset.addTags["brand:wikidata"];
59652 var setsOperatorWikidata = preset.addTags["operator:wikidata"];
59653 return isSuggestion && setsName && (setsBrandWikidata && !showsBrandField || setsOperatorWikidata && !showsOperatorField);
59657 field.locked(isLocked);
59659 function calcMultilingual(tags) {
59660 var existingLangsOrdered = _multilingual.map(function(item2) {
59663 var existingLangs = new Set(existingLangsOrdered.filter(Boolean));
59664 for (var k in tags) {
59665 var m = k.match(/^(.*):([a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?)$/);
59666 if (m && m[1] === field.key && m[2]) {
59667 var item = { lang: m[2], value: tags[k] };
59668 if (existingLangs.has(item.lang)) {
59669 _multilingual[existingLangsOrdered.indexOf(item.lang)].value = item.value;
59670 existingLangs.delete(item.lang);
59672 _multilingual.push(item);
59676 _multilingual.forEach(function(item2) {
59677 if (item2.lang && existingLangs.has(item2.lang)) {
59682 function localized(selection2) {
59683 _selection = selection2;
59685 var isLocked = field.locked();
59686 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
59687 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
59688 input = wrap2.selectAll(".localized-main").data([0]);
59689 input = input.enter().append("input").attr("type", "text").attr("id", field.domId).attr("class", "localized-main").call(utilNoAuto).merge(input);
59690 input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
59691 var translateButton = wrap2.selectAll(".localized-add").data([0]);
59692 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);
59693 translateButton.classed("disabled", !!isLocked).call(isLocked ? _buttonTip.destroy : _buttonTip).on("click", addNew);
59694 if (_tags && !_multilingual.length) {
59695 calcMultilingual(_tags);
59697 localizedInputs = selection2.selectAll(".localized-multilingual").data([0]);
59698 localizedInputs = localizedInputs.enter().append("div").attr("class", "localized-multilingual").merge(localizedInputs);
59699 localizedInputs.call(renderMultilingual);
59700 localizedInputs.selectAll("button, input").classed("disabled", !!isLocked).attr("readonly", isLocked || null);
59701 selection2.selectAll(".combobox-caret").classed("nope", true);
59702 function addNew(d3_event) {
59703 d3_event.preventDefault();
59704 if (field.locked())
59706 var defaultLang = _mainLocalizer.languageCode().toLowerCase();
59707 var langExists = _multilingual.find(function(datum2) {
59708 return datum2.lang === defaultLang;
59710 var isLangEn = defaultLang.indexOf("en") > -1;
59711 if (isLangEn || langExists) {
59713 langExists = _multilingual.find(function(datum2) {
59714 return datum2.lang === defaultLang;
59718 _multilingual.unshift({ lang: defaultLang, value: "" });
59719 localizedInputs.call(renderMultilingual);
59722 function change(onInput) {
59723 return function(d3_event) {
59724 if (field.locked()) {
59725 d3_event.preventDefault();
59728 var val = utilGetSetValue(select_default2(this));
59730 val = context.cleanTagValue(val);
59731 if (!val && Array.isArray(_tags[field.key]))
59734 t[field.key] = val || void 0;
59735 dispatch10.call("change", this, t, onInput);
59739 function key(lang) {
59740 return field.key + ":" + lang;
59742 function changeLang(d3_event, d) {
59744 var lang = utilGetSetValue(select_default2(this)).toLowerCase();
59745 var language = _languagesArray.find(function(d2) {
59746 return d2.label.toLowerCase() === lang || d2.localName && d2.localName.toLowerCase() === lang || d2.nativeName && d2.nativeName.toLowerCase() === lang;
59749 lang = language.code;
59750 if (d.lang && d.lang !== lang) {
59751 tags[key(d.lang)] = void 0;
59753 var newKey = lang && context.cleanTagKey(key(lang));
59754 var value = utilGetSetValue(select_default2(this.parentNode).selectAll(".localized-value"));
59755 if (newKey && value) {
59756 tags[newKey] = value;
59757 } else if (newKey && _wikiTitles && _wikiTitles[d.lang]) {
59758 tags[newKey] = _wikiTitles[d.lang];
59761 dispatch10.call("change", this, tags);
59763 function changeValue(d3_event, d) {
59766 var value = context.cleanTagValue(utilGetSetValue(select_default2(this))) || void 0;
59767 if (!value && Array.isArray(d.value))
59770 t[key(d.lang)] = value;
59772 dispatch10.call("change", this, t);
59774 function fetchLanguages(value, cb) {
59775 var v = value.toLowerCase();
59776 var langCodes = [_mainLocalizer.localeCode(), _mainLocalizer.languageCode()];
59777 if (_countryCode && _territoryLanguages[_countryCode]) {
59778 langCodes = langCodes.concat(_territoryLanguages[_countryCode]);
59780 var langItems = [];
59781 langCodes.forEach(function(code) {
59782 var langItem = _languagesArray.find(function(item) {
59783 return item.code === code;
59786 langItems.push(langItem);
59788 langItems = utilArrayUniq(langItems.concat(_languagesArray));
59789 cb(langItems.filter(function(d) {
59790 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;
59791 }).map(function(d) {
59792 return { value: d.label };
59795 function renderMultilingual(selection2) {
59796 var entries = selection2.selectAll("div.entry").data(_multilingual, function(d) {
59799 entries.exit().style("top", "0").style("max-height", "240px").transition().duration(200).style("opacity", "0").style("max-height", "0px").remove();
59800 var entriesEnter = entries.enter().append("div").attr("class", "entry").each(function(_, index) {
59801 var wrap2 = select_default2(this);
59802 var domId = utilUniqueDomId(index);
59803 var label = wrap2.append("label").attr("class", "field-label").attr("for", domId);
59804 var text2 = label.append("span").attr("class", "label-text");
59805 text2.append("span").attr("class", "label-textvalue").call(_t.append("translate.localized_translation_label"));
59806 text2.append("span").attr("class", "label-textannotation");
59807 label.append("button").attr("class", "remove-icon-multilingual").attr("title", _t("icons.remove")).on("click", function(d3_event, d) {
59808 if (field.locked())
59810 d3_event.preventDefault();
59811 _multilingual.splice(_multilingual.indexOf(d), 1);
59812 var langKey = d.lang && key(d.lang);
59813 if (langKey && langKey in _tags) {
59814 delete _tags[langKey];
59816 t[langKey] = void 0;
59817 dispatch10.call("change", this, t);
59820 renderMultilingual(selection2);
59821 }).call(svgIcon("#iD-operation-delete"));
59822 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);
59823 wrap2.append("input").attr("type", "text").attr("class", "localized-value").on("blur", changeValue).on("change", changeValue);
59825 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() {
59826 select_default2(this).style("max-height", "").style("overflow", "visible");
59828 entries = entries.merge(entriesEnter);
59830 entries.classed("present", true);
59831 utilGetSetValue(entries.select(".localized-lang"), function(d) {
59832 var langItem = _languagesArray.find(function(item) {
59833 return item.code === d.lang;
59836 return langItem.label;
59839 utilGetSetValue(entries.select(".localized-value"), function(d) {
59840 return typeof d.value === "string" ? d.value : "";
59841 }).attr("title", function(d) {
59842 return Array.isArray(d.value) ? d.value.filter(Boolean).join("\n") : null;
59843 }).attr("placeholder", function(d) {
59844 return Array.isArray(d.value) ? _t("inspector.multiple_values") : _t("translate.localized_translation_name");
59845 }).classed("mixed", function(d) {
59846 return Array.isArray(d.value);
59849 localized.tags = function(tags) {
59851 if (typeof tags.wikipedia === "string" && !_wikiTitles) {
59853 var wm = tags.wikipedia.match(/([^:]+):(.+)/);
59854 if (wm && wm[0] && wm[1]) {
59855 wikipedia.translations(wm[1], wm[2], function(err, d) {
59862 var isMixed = Array.isArray(tags[field.key]);
59863 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);
59864 calcMultilingual(tags);
59865 _selection.call(localized);
59867 localized.focus = function() {
59868 input.node().focus();
59870 localized.entityIDs = function(val) {
59871 if (!arguments.length)
59874 _multilingual = [];
59878 function loadCountryCode() {
59879 var extent = combinedEntityExtent();
59880 var countryCode = extent && iso1A2Code(extent.center());
59881 _countryCode = countryCode && countryCode.toLowerCase();
59883 function combinedEntityExtent() {
59884 return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
59886 return utilRebind(localized, dispatch10, "on");
59889 // modules/ui/fields/roadheight.js
59890 function uiFieldRoadheight(field, context) {
59891 var dispatch10 = dispatch_default("change");
59892 var primaryUnitInput = select_default2(null);
59893 var primaryInput = select_default2(null);
59894 var secondaryInput = select_default2(null);
59895 var secondaryUnitInput = select_default2(null);
59896 var _entityIDs = [];
59899 var primaryUnits = [
59902 title: _t("inspector.roadheight.meter")
59906 title: _t("inspector.roadheight.foot")
59909 var unitCombo = uiCombobox(context, "roadheight-unit").data(primaryUnits);
59910 function roadheight(selection2) {
59911 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
59912 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
59913 primaryInput = wrap2.selectAll("input.roadheight-number").data([0]);
59914 primaryInput = primaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-number").attr("id", field.domId).call(utilNoAuto).merge(primaryInput);
59915 primaryInput.on("change", change).on("blur", change);
59916 var loc = combinedEntityExtent().center();
59917 _isImperial = roadHeightUnit(loc) === "ft";
59918 primaryUnitInput = wrap2.selectAll("input.roadheight-unit").data([0]);
59919 primaryUnitInput = primaryUnitInput.enter().append("input").attr("type", "text").attr("class", "roadheight-unit").call(unitCombo).merge(primaryUnitInput);
59920 primaryUnitInput.on("blur", changeUnits).on("change", changeUnits);
59921 secondaryInput = wrap2.selectAll("input.roadheight-secondary-number").data([0]);
59922 secondaryInput = secondaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-secondary-number").call(utilNoAuto).merge(secondaryInput);
59923 secondaryInput.on("change", change).on("blur", change);
59924 secondaryUnitInput = wrap2.selectAll("input.roadheight-secondary-unit").data([0]);
59925 secondaryUnitInput = secondaryUnitInput.enter().append("input").attr("type", "text").call(utilNoAuto).classed("disabled", true).classed("roadheight-secondary-unit", true).attr("readonly", "readonly").merge(secondaryUnitInput);
59926 function changeUnits() {
59927 var primaryUnit = utilGetSetValue(primaryUnitInput);
59928 if (primaryUnit === "m") {
59929 _isImperial = false;
59930 } else if (primaryUnit === "ft") {
59931 _isImperial = true;
59933 utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
59934 setUnitSuggestions();
59938 function setUnitSuggestions() {
59939 utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
59941 function change() {
59943 var primaryValue = utilGetSetValue(primaryInput).trim();
59944 var secondaryValue = utilGetSetValue(secondaryInput).trim();
59945 if (!primaryValue && !secondaryValue && Array.isArray(_tags[field.key]))
59947 if (!primaryValue && !secondaryValue) {
59948 tag[field.key] = void 0;
59949 } else if (isNaN(primaryValue) || isNaN(secondaryValue) || !_isImperial) {
59950 tag[field.key] = context.cleanTagValue(primaryValue);
59952 if (primaryValue !== "") {
59953 primaryValue = context.cleanTagValue(primaryValue + "'");
59955 if (secondaryValue !== "") {
59956 secondaryValue = context.cleanTagValue(secondaryValue + '"');
59958 tag[field.key] = primaryValue + secondaryValue;
59960 dispatch10.call("change", this, tag);
59962 roadheight.tags = function(tags) {
59964 var primaryValue = tags[field.key];
59965 var secondaryValue;
59966 var isMixed = Array.isArray(primaryValue);
59968 if (primaryValue && (primaryValue.indexOf("'") >= 0 || primaryValue.indexOf('"') >= 0)) {
59969 secondaryValue = primaryValue.match(/(-?[\d.]+)"/);
59970 if (secondaryValue !== null) {
59971 secondaryValue = secondaryValue[1];
59973 primaryValue = primaryValue.match(/(-?[\d.]+)'/);
59974 if (primaryValue !== null) {
59975 primaryValue = primaryValue[1];
59977 _isImperial = true;
59978 } else if (primaryValue) {
59979 _isImperial = false;
59982 setUnitSuggestions();
59983 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);
59984 utilGetSetValue(secondaryInput, typeof secondaryValue === "string" ? secondaryValue : "").attr("placeholder", isMixed ? _t("inspector.multiple_values") : _isImperial ? "0" : null).classed("mixed", isMixed).classed("disabled", !_isImperial).attr("readonly", _isImperial ? null : "readonly");
59985 secondaryUnitInput.attr("value", _isImperial ? _t("inspector.roadheight.inch") : null);
59987 roadheight.focus = function() {
59988 primaryInput.node().focus();
59990 roadheight.entityIDs = function(val) {
59993 function combinedEntityExtent() {
59994 return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
59996 return utilRebind(roadheight, dispatch10, "on");
59999 // modules/ui/fields/roadspeed.js
60000 function uiFieldRoadspeed(field, context) {
60001 var dispatch10 = dispatch_default("change");
60002 var unitInput = select_default2(null);
60003 var input = select_default2(null);
60004 var _entityIDs = [];
60007 var speedCombo = uiCombobox(context, "roadspeed");
60008 var unitCombo = uiCombobox(context, "roadspeed-unit").data(["km/h", "mph"].map(comboValues));
60009 var metricValues = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120];
60010 var imperialValues = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80];
60011 function roadspeed(selection2) {
60012 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
60013 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
60014 input = wrap2.selectAll("input.roadspeed-number").data([0]);
60015 input = input.enter().append("input").attr("type", "text").attr("class", "roadspeed-number").attr("id", field.domId).call(utilNoAuto).call(speedCombo).merge(input);
60016 input.on("change", change).on("blur", change);
60017 var loc = combinedEntityExtent().center();
60018 _isImperial = roadSpeedUnit(loc) === "mph";
60019 unitInput = wrap2.selectAll("input.roadspeed-unit").data([0]);
60020 unitInput = unitInput.enter().append("input").attr("type", "text").attr("class", "roadspeed-unit").attr("aria-label", _t("inspector.speed_unit")).call(unitCombo).merge(unitInput);
60021 unitInput.on("blur", changeUnits).on("change", changeUnits);
60022 function changeUnits() {
60023 var unit2 = utilGetSetValue(unitInput);
60024 if (unit2 === "km/h") {
60025 _isImperial = false;
60026 } else if (unit2 === "mph") {
60027 _isImperial = true;
60029 utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
60030 setUnitSuggestions();
60034 function setUnitSuggestions() {
60035 speedCombo.data((_isImperial ? imperialValues : metricValues).map(comboValues));
60036 utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
60038 function comboValues(d) {
60040 value: d.toString(),
60041 title: d.toString()
60044 function change() {
60046 var value = utilGetSetValue(input).trim();
60047 if (!value && Array.isArray(_tags[field.key]))
60050 tag[field.key] = void 0;
60051 } else if (isNaN(value) || !_isImperial) {
60052 tag[field.key] = context.cleanTagValue(value);
60054 tag[field.key] = context.cleanTagValue(value + " mph");
60056 dispatch10.call("change", this, tag);
60058 roadspeed.tags = function(tags) {
60060 var value = tags[field.key];
60061 var isMixed = Array.isArray(value);
60063 if (value && value.indexOf("mph") >= 0) {
60064 value = parseInt(value, 10).toString();
60065 _isImperial = true;
60066 } else if (value) {
60067 _isImperial = false;
60070 setUnitSuggestions();
60071 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);
60073 roadspeed.focus = function() {
60074 input.node().focus();
60076 roadspeed.entityIDs = function(val) {
60079 function combinedEntityExtent() {
60080 return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
60082 return utilRebind(roadspeed, dispatch10, "on");
60085 // modules/ui/fields/radio.js
60086 function uiFieldRadio(field, context) {
60087 var dispatch10 = dispatch_default("change");
60088 var placeholder = select_default2(null);
60089 var wrap2 = select_default2(null);
60090 var labels = select_default2(null);
60091 var radios = select_default2(null);
60092 var radioData = (field.options || field.keys).slice();
60096 var _entityIDs = [];
60097 function selectedKey() {
60098 var node = wrap2.selectAll(".form-field-input-radio label.active input");
60099 return !node.empty() && node.datum();
60101 function radio(selection2) {
60102 selection2.classed("preset-radio", true);
60103 wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
60104 var enter = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-radio");
60105 enter.append("span").attr("class", "placeholder");
60106 wrap2 = wrap2.merge(enter);
60107 placeholder = wrap2.selectAll(".placeholder");
60108 labels = wrap2.selectAll("label").data(radioData);
60109 enter = labels.enter().append("label");
60110 var stringsField = field.resolveReference("stringsCrossReference");
60111 enter.append("input").attr("type", "radio").attr("name", field.id).attr("value", function(d) {
60112 return stringsField.t("options." + d, { "default": d });
60113 }).attr("checked", false);
60114 enter.append("span").each(function(d) {
60115 stringsField.t.append("options." + d, { "default": d })(select_default2(this));
60117 labels = labels.merge(enter);
60118 radios = labels.selectAll("input").on("change", changeRadio);
60120 function structureExtras(selection2, tags) {
60121 var selected = selectedKey() || tags.layer !== void 0;
60122 var type3 = _mainPresetIndex.field(selected);
60123 var layer = _mainPresetIndex.field("layer");
60124 var showLayer = selected === "bridge" || selected === "tunnel" || tags.layer !== void 0;
60125 var extrasWrap = selection2.selectAll(".structure-extras-wrap").data(selected ? [0] : []);
60126 extrasWrap.exit().remove();
60127 extrasWrap = extrasWrap.enter().append("div").attr("class", "structure-extras-wrap").merge(extrasWrap);
60128 var list = extrasWrap.selectAll("ul").data([0]);
60129 list = list.enter().append("ul").attr("class", "rows").merge(list);
60131 if (!typeField || typeField.id !== selected) {
60132 typeField = uiField(context, type3, _entityIDs, { wrap: false }).on("change", changeType);
60134 typeField.tags(tags);
60138 var typeItem = list.selectAll(".structure-type-item").data(typeField ? [typeField] : [], function(d) {
60141 typeItem.exit().remove();
60142 var typeEnter = typeItem.enter().insert("li", ":first-child").attr("class", "labeled-input structure-type-item");
60143 typeEnter.append("span").attr("class", "label structure-label-type").attr("for", "preset-input-" + selected).call(_t.append("inspector.radio.structure.type"));
60144 typeEnter.append("div").attr("class", "structure-input-type-wrap");
60145 typeItem = typeItem.merge(typeEnter);
60147 typeItem.selectAll(".structure-input-type-wrap").call(typeField.render);
60149 if (layer && showLayer) {
60151 layerField = uiField(context, layer, _entityIDs, { wrap: false }).on("change", changeLayer);
60153 layerField.tags(tags);
60154 field.keys = utilArrayUnion(field.keys, ["layer"]);
60157 field.keys = field.keys.filter(function(k) {
60158 return k !== "layer";
60161 var layerItem = list.selectAll(".structure-layer-item").data(layerField ? [layerField] : []);
60162 layerItem.exit().remove();
60163 var layerEnter = layerItem.enter().append("li").attr("class", "labeled-input structure-layer-item");
60164 layerEnter.append("span").attr("class", "label structure-label-layer").attr("for", "preset-input-layer").call(_t.append("inspector.radio.structure.layer"));
60165 layerEnter.append("div").attr("class", "structure-input-layer-wrap");
60166 layerItem = layerItem.merge(layerEnter);
60168 layerItem.selectAll(".structure-input-layer-wrap").call(layerField.render);
60171 function changeType(t, onInput) {
60172 var key = selectedKey();
60176 if (val !== "no") {
60177 _oldType[key] = val;
60179 if (field.type === "structureRadio") {
60180 if (val === "no" || key !== "bridge" && key !== "tunnel" || key === "tunnel" && val === "building_passage") {
60183 if (t.layer === void 0) {
60184 if (key === "bridge" && val !== "no") {
60187 if (key === "tunnel" && val !== "no" && val !== "building_passage") {
60192 dispatch10.call("change", this, t, onInput);
60194 function changeLayer(t, onInput) {
60195 if (t.layer === "0") {
60198 dispatch10.call("change", this, t, onInput);
60200 function changeRadio() {
60204 t[field.key] = void 0;
60206 radios.each(function(d) {
60207 var active = select_default2(this).property("checked");
60214 var val = _oldType[activeKey] || "yes";
60215 t[d] = active ? val : void 0;
60218 if (field.type === "structureRadio") {
60219 if (activeKey === "bridge") {
60221 } else if (activeKey === "tunnel" && t.tunnel !== "building_passage") {
60227 dispatch10.call("change", this, t);
60229 radio.tags = function(tags) {
60230 function isOptionChecked(d) {
60232 return tags[field.key] === d;
60234 return !!(typeof tags[d] === "string" && tags[d].toLowerCase() !== "no");
60236 function isMixed(d) {
60238 return Array.isArray(tags[field.key]) && tags[field.key].includes(d);
60240 return Array.isArray(tags[d]);
60242 radios.property("checked", function(d) {
60243 return isOptionChecked(d) && (field.key || field.options.filter(isOptionChecked).length === 1);
60245 labels.classed("active", function(d) {
60247 return Array.isArray(tags[field.key]) && tags[field.key].includes(d) || tags[field.key] === d;
60249 return Array.isArray(tags[d]) && tags[d].some((v) => typeof v === "string" && v.toLowerCase() !== "no") || !!(typeof tags[d] === "string" && tags[d].toLowerCase() !== "no");
60250 }).classed("mixed", isMixed).attr("title", function(d) {
60251 return isMixed(d) ? _t("inspector.unshared_value_tooltip") : null;
60253 var selection2 = radios.filter(function() {
60254 return this.checked;
60256 if (selection2.empty()) {
60257 placeholder.text("");
60258 placeholder.call(_t.append("inspector.none"));
60260 placeholder.text(selection2.attr("value"));
60261 _oldType[selection2.datum()] = tags[selection2.datum()];
60263 if (field.type === "structureRadio") {
60264 if (!!tags.waterway && !_oldType.tunnel) {
60265 _oldType.tunnel = "culvert";
60267 wrap2.call(structureExtras, tags);
60270 radio.focus = function() {
60271 radios.node().focus();
60273 radio.entityIDs = function(val) {
60274 if (!arguments.length)
60280 radio.isAllowed = function() {
60281 return _entityIDs.length === 1;
60283 return utilRebind(radio, dispatch10, "on");
60286 // modules/ui/fields/restrictions.js
60287 function uiFieldRestrictions(field, context) {
60288 var dispatch10 = dispatch_default("change");
60289 var breathe = behaviorBreathe(context);
60290 corePreferences("turn-restriction-via-way", null);
60291 var storedViaWay = corePreferences("turn-restriction-via-way0");
60292 var storedDistance = corePreferences("turn-restriction-distance");
60293 var _maxViaWay = storedViaWay !== null ? +storedViaWay : 0;
60294 var _maxDistance = storedDistance ? +storedDistance : 30;
60295 var _initialized2 = false;
60296 var _parent = select_default2(null);
60297 var _container = select_default2(null);
60304 function restrictions(selection2) {
60305 _parent = selection2;
60306 if (_vertexID && (context.graph() !== _graph || !_intersection)) {
60307 _graph = context.graph();
60308 _intersection = osmIntersection(_graph, _vertexID, _maxDistance);
60310 var isOK = _intersection && _intersection.vertices.length && _intersection.vertices.filter(function(vertex) {
60311 return vertex.id === _vertexID;
60312 }).length && _intersection.ways.length > 2 && _intersection.ways.filter(function(way) {
60315 select_default2(selection2.node().parentNode).classed("hide", !isOK);
60316 if (!isOK || !context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode || !selection2.node().parentNode.parentNode) {
60317 selection2.call(restrictions.off);
60320 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
60321 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
60322 var container = wrap2.selectAll(".restriction-container").data([0]);
60323 var containerEnter = container.enter().append("div").attr("class", "restriction-container");
60324 containerEnter.append("div").attr("class", "restriction-help");
60325 _container = containerEnter.merge(container).call(renderViewer);
60326 var controls = wrap2.selectAll(".restriction-controls").data([0]);
60327 controls.enter().append("div").attr("class", "restriction-controls-container").append("div").attr("class", "restriction-controls").merge(controls).call(renderControls);
60329 function renderControls(selection2) {
60330 var distControl = selection2.selectAll(".restriction-distance").data([0]);
60331 distControl.exit().remove();
60332 var distControlEnter = distControl.enter().append("div").attr("class", "restriction-control restriction-distance");
60333 distControlEnter.append("span").attr("class", "restriction-control-label restriction-distance-label").call(_t.append("restriction.controls.distance", { suffix: ":" }));
60334 distControlEnter.append("input").attr("class", "restriction-distance-input").attr("type", "range").attr("min", "20").attr("max", "50").attr("step", "5");
60335 distControlEnter.append("span").attr("class", "restriction-distance-text");
60336 selection2.selectAll(".restriction-distance-input").property("value", _maxDistance).on("input", function() {
60337 var val = select_default2(this).property("value");
60338 _maxDistance = +val;
60339 _intersection = null;
60340 _container.selectAll(".layer-osm .layer-turns *").remove();
60341 corePreferences("turn-restriction-distance", _maxDistance);
60342 _parent.call(restrictions);
60344 selection2.selectAll(".restriction-distance-text").call(displayMaxDistance(_maxDistance));
60345 var viaControl = selection2.selectAll(".restriction-via-way").data([0]);
60346 viaControl.exit().remove();
60347 var viaControlEnter = viaControl.enter().append("div").attr("class", "restriction-control restriction-via-way");
60348 viaControlEnter.append("span").attr("class", "restriction-control-label restriction-via-way-label").call(_t.append("restriction.controls.via", { suffix: ":" }));
60349 viaControlEnter.append("input").attr("class", "restriction-via-way-input").attr("type", "range").attr("min", "0").attr("max", "2").attr("step", "1");
60350 viaControlEnter.append("span").attr("class", "restriction-via-way-text");
60351 selection2.selectAll(".restriction-via-way-input").property("value", _maxViaWay).on("input", function() {
60352 var val = select_default2(this).property("value");
60354 _container.selectAll(".layer-osm .layer-turns *").remove();
60355 corePreferences("turn-restriction-via-way0", _maxViaWay);
60356 _parent.call(restrictions);
60358 selection2.selectAll(".restriction-via-way-text").call(displayMaxVia(_maxViaWay));
60360 function renderViewer(selection2) {
60361 if (!_intersection)
60363 var vgraph = _intersection.graph;
60364 var filter2 = utilFunctor(true);
60365 var projection2 = geoRawMercator();
60366 var sdims = utilGetDimensions(context.container().select(".sidebar"));
60367 var d = [sdims[0] - 50, 370];
60368 var c = geoVecScale(d, 0.5);
60370 projection2.scale(geoZoomToScale(z));
60371 var extent = geoExtent();
60372 for (var i2 = 0; i2 < _intersection.vertices.length; i2++) {
60373 extent._extend(_intersection.vertices[i2].extent());
60376 if (_intersection.vertices.length > 1) {
60377 var hPadding = Math.min(160, Math.max(110, d[0] * 0.4));
60378 var vPadding = 160;
60379 var tl = projection2([extent[0][0], extent[1][1]]);
60380 var br = projection2([extent[1][0], extent[0][1]]);
60381 var hFactor = (br[0] - tl[0]) / (d[0] - hPadding);
60382 var vFactor = (br[1] - tl[1]) / (d[1] - vPadding - padTop);
60383 var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
60384 var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
60385 z = z - Math.max(hZoomDiff, vZoomDiff);
60386 projection2.scale(geoZoomToScale(z));
60388 var extentCenter = projection2(extent.center());
60389 extentCenter[1] = extentCenter[1] - padTop / 2;
60390 projection2.translate(geoVecSubtract(c, extentCenter)).clipExtent([[0, 0], d]);
60391 var drawLayers = svgLayers(projection2, context).only(["osm", "touch"]).dimensions(d);
60392 var drawVertices = svgVertices(projection2, context);
60393 var drawLines = svgLines(projection2, context);
60394 var drawTurns = svgTurns(projection2, context);
60395 var firstTime = selection2.selectAll(".surface").empty();
60396 selection2.call(drawLayers);
60397 var surface = selection2.selectAll(".surface").classed("tr", true);
60399 _initialized2 = true;
60400 surface.call(breathe);
60402 if (_fromWayID && !vgraph.hasEntity(_fromWayID)) {
60406 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));
60407 surface.on("click.restrictions", click).on("mouseover.restrictions", mouseover);
60408 surface.selectAll(".selected").classed("selected", false);
60409 surface.selectAll(".related").classed("related", false);
60412 way = vgraph.entity(_fromWayID);
60413 surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
60415 document.addEventListener("resizeWindow", function() {
60416 utilSetDimensions(_container, null);
60420 function click(d3_event) {
60421 surface.call(breathe.off).call(breathe);
60422 var datum2 = d3_event.target.__data__;
60423 var entity = datum2 && datum2.properties && datum2.properties.entity;
60427 if (datum2 instanceof osmWay && (datum2.__from || datum2.__via)) {
60428 _fromWayID = datum2.id;
60431 } else if (datum2 instanceof osmTurn) {
60432 var actions, extraActions, turns, i3;
60433 var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
60434 if (datum2.restrictionID && !datum2.direct) {
60436 } else if (datum2.restrictionID && !datum2.only) {
60438 var datumOnly = JSON.parse(JSON.stringify(datum2));
60439 datumOnly.only = true;
60440 restrictionType = restrictionType.replace(/^no/, "only");
60441 turns = _intersection.turns(_fromWayID, 2);
60444 for (i3 = 0; i3 < turns.length; i3++) {
60445 var turn = turns[i3];
60446 if (seen[turn.restrictionID])
60448 if (turn.direct && turn.path[1] === datum2.path[1]) {
60449 seen[turns[i3].restrictionID] = true;
60450 turn.restrictionType = osmInferRestriction(vgraph, turn, projection2);
60451 _oldTurns.push(turn);
60452 extraActions.push(actionUnrestrictTurn(turn));
60455 actions = _intersection.actions.concat(extraActions, [
60456 actionRestrictTurn(datumOnly, restrictionType),
60457 _t("operations.restriction.annotation.create")
60459 } else if (datum2.restrictionID) {
60460 turns = _oldTurns || [];
60462 for (i3 = 0; i3 < turns.length; i3++) {
60463 if (turns[i3].key !== datum2.key) {
60464 extraActions.push(actionRestrictTurn(turns[i3], turns[i3].restrictionType));
60468 actions = _intersection.actions.concat(extraActions, [
60469 actionUnrestrictTurn(datum2),
60470 _t("operations.restriction.annotation.delete")
60473 actions = _intersection.actions.concat([
60474 actionRestrictTurn(datum2, restrictionType),
60475 _t("operations.restriction.annotation.create")
60478 context.perform.apply(context, actions);
60479 var s = surface.selectAll("." + datum2.key);
60480 datum2 = s.empty() ? null : s.datum();
60481 updateHints(datum2);
60488 function mouseover(d3_event) {
60489 var datum2 = d3_event.target.__data__;
60490 updateHints(datum2);
60492 _lastXPos = _lastXPos || sdims[0];
60493 function redraw(minChange) {
60496 xPos = utilGetDimensions(context.container().select(".sidebar"))[0];
60498 if (!minChange || minChange && Math.abs(xPos - _lastXPos) >= minChange) {
60499 if (context.hasEntity(_vertexID)) {
60501 _container.call(renderViewer);
60505 function highlightPathsFrom(wayID) {
60506 surface.selectAll(".related").classed("related", false).classed("allow", false).classed("restrict", false).classed("only", false);
60507 surface.selectAll("." + wayID).classed("related", true);
60509 var turns = _intersection.turns(wayID, _maxViaWay);
60510 for (var i3 = 0; i3 < turns.length; i3++) {
60511 var turn = turns[i3];
60512 var ids = [turn.to.way];
60513 var klass = turn.no ? "restrict" : turn.only ? "only" : "allow";
60514 if (turn.only || turns.length === 1) {
60515 if (turn.via.ways) {
60516 ids = ids.concat(turn.via.ways);
60518 } else if (turn.to.way === wayID) {
60521 surface.selectAll(utilEntitySelector(ids)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
60525 function updateHints(datum2) {
60526 var help = _container.selectAll(".restriction-help").html("");
60527 var placeholders = {};
60528 ["from", "via", "to"].forEach(function(k) {
60529 placeholders[k] = { html: '<span class="qualifier">' + _t("restriction.help." + k) + "</span>" };
60531 var entity = datum2 && datum2.properties && datum2.properties.entity;
60536 way = vgraph.entity(_fromWayID);
60537 surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
60539 if (datum2 instanceof osmWay && datum2.__from) {
60541 highlightPathsFrom(_fromWayID ? null : way.id);
60542 surface.selectAll("." + way.id).classed("related", true);
60543 var clickSelect = !_fromWayID || _fromWayID !== way.id;
60544 help.append("div").html(_t.html("restriction.help." + (clickSelect ? "select_from_name" : "from_name"), {
60545 from: placeholders.from,
60546 fromName: displayName(way.id, vgraph)
60548 } else if (datum2 instanceof osmTurn) {
60549 var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
60550 var turnType = restrictionType.replace(/^(only|no)\_/, "");
60551 var indirect = datum2.direct === false ? _t.html("restriction.help.indirect") : "";
60552 var klass, turnText, nextText;
60554 klass = "restrict";
60555 turnText = _t.html("restriction.help.turn.no_" + turnType, { indirect: { html: indirect } });
60556 nextText = _t.html("restriction.help.turn.only_" + turnType, { indirect: "" });
60557 } else if (datum2.only) {
60559 turnText = _t.html("restriction.help.turn.only_" + turnType, { indirect: { html: indirect } });
60560 nextText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: "" });
60563 turnText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: { html: indirect } });
60564 nextText = _t.html("restriction.help.turn.no_" + turnType, { indirect: "" });
60566 help.append("div").attr("class", "qualifier " + klass).html(turnText);
60567 help.append("div").html(_t.html("restriction.help.from_name_to_name", {
60568 from: placeholders.from,
60569 fromName: displayName(datum2.from.way, vgraph),
60570 to: placeholders.to,
60571 toName: displayName(datum2.to.way, vgraph)
60573 if (datum2.via.ways && datum2.via.ways.length) {
60575 for (var i3 = 0; i3 < datum2.via.ways.length; i3++) {
60576 var prev = names[names.length - 1];
60577 var curr = displayName(datum2.via.ways[i3], vgraph);
60578 if (!prev || curr !== prev) {
60582 help.append("div").html(_t.html("restriction.help.via_names", {
60583 via: placeholders.via,
60584 viaNames: names.join(", ")
60588 help.append("div").html(_t.html("restriction.help.toggle", { turn: { html: nextText.trim() } }));
60590 highlightPathsFrom(null);
60591 var alongIDs = datum2.path.slice();
60592 surface.selectAll(utilEntitySelector(alongIDs)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
60594 highlightPathsFrom(null);
60596 help.append("div").html(_t.html("restriction.help.from_name", {
60597 from: placeholders.from,
60598 fromName: displayName(_fromWayID, vgraph)
60601 help.append("div").html(_t.html("restriction.help.select_from", {
60602 from: placeholders.from
60608 function displayMaxDistance(maxDist) {
60609 return (selection2) => {
60610 var isImperial = !_mainLocalizer.usesMetric();
60622 opts = { distance: _t("units.feet", { quantity: distToFeet }) };
60624 opts = { distance: _t("units.meters", { quantity: maxDist }) };
60626 return selection2.html("").call(_t.append("restriction.controls.distance_up_to", opts));
60629 function displayMaxVia(maxVia) {
60630 return (selection2) => {
60631 selection2 = selection2.html("");
60632 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"));
60635 function displayName(entityID, graph) {
60636 var entity = graph.entity(entityID);
60637 var name = utilDisplayName(entity) || "";
60638 var matched = _mainPresetIndex.match(entity, graph);
60639 var type3 = matched && matched.name() || utilDisplayType(entity.id);
60640 return name || type3;
60642 restrictions.entityIDs = function(val) {
60643 _intersection = null;
60646 _vertexID = val[0];
60648 restrictions.tags = function() {
60650 restrictions.focus = function() {
60652 restrictions.off = function(selection2) {
60653 if (!_initialized2)
60655 selection2.selectAll(".surface").call(breathe.off).on("click.restrictions", null).on("mouseover.restrictions", null);
60656 select_default2(window).on("resize.restrictions", null);
60658 return utilRebind(restrictions, dispatch10, "on");
60660 uiFieldRestrictions.supportsMultiselection = false;
60662 // modules/ui/fields/textarea.js
60663 function uiFieldTextarea(field, context) {
60664 var dispatch10 = dispatch_default("change");
60665 var input = select_default2(null);
60667 function textarea(selection2) {
60668 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
60669 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
60670 input = wrap2.selectAll("textarea").data([0]);
60671 input = input.enter().append("textarea").attr("id", field.domId).call(utilNoAuto).on("input", change(true)).on("blur", change()).on("change", change()).merge(input);
60673 function change(onInput) {
60674 return function() {
60675 var val = utilGetSetValue(input);
60677 val = context.cleanTagValue(val);
60678 if (!val && Array.isArray(_tags[field.key]))
60681 t[field.key] = val || void 0;
60682 dispatch10.call("change", this, t, onInput);
60685 textarea.tags = function(tags) {
60687 var isMixed = Array.isArray(tags[field.key]);
60688 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);
60690 textarea.focus = function() {
60691 input.node().focus();
60693 return utilRebind(textarea, dispatch10, "on");
60696 // modules/ui/fields/wikidata.js
60697 function uiFieldWikidata(field, context) {
60698 var wikidata = services.wikidata;
60699 var dispatch10 = dispatch_default("change");
60700 var _selection = select_default2(null);
60701 var _searchInput = select_default2(null);
60703 var _wikidataEntity = null;
60705 var _entityIDs = [];
60706 var _wikipediaKey = field.keys && field.keys.find(function(key) {
60707 return key.includes("wikipedia");
60709 var _hintKey = field.key === "wikidata" ? "name" : field.key.split(":")[0];
60710 var combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(true).minItems(1);
60711 function wiki(selection2) {
60712 _selection = selection2;
60713 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
60714 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
60715 var list = wrap2.selectAll("ul").data([0]);
60716 list = list.enter().append("ul").attr("class", "rows").merge(list);
60717 var searchRow = list.selectAll("li.wikidata-search").data([0]);
60718 var searchRowEnter = searchRow.enter().append("li").attr("class", "wikidata-search");
60719 searchRowEnter.append("input").attr("type", "text").attr("id", field.domId).style("flex", "1").call(utilNoAuto).on("focus", function() {
60720 var node = select_default2(this).node();
60721 node.setSelectionRange(0, node.value.length);
60722 }).on("blur", function() {
60723 setLabelForEntity();
60724 }).call(combobox.fetcher(fetchWikidataItems));
60725 combobox.on("accept", function(d) {
60730 }).on("cancel", function() {
60731 setLabelForEntity();
60733 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) {
60734 d3_event.preventDefault();
60736 window.open(_wikiURL, "_blank");
60738 searchRow = searchRow.merge(searchRowEnter);
60739 _searchInput = searchRow.select("input");
60740 var wikidataProperties = ["description", "identifier"];
60741 var items = list.selectAll("li.labeled-input").data(wikidataProperties);
60742 var enter = items.enter().append("li").attr("class", function(d) {
60743 return "labeled-input preset-wikidata-" + d;
60745 enter.append("span").attr("class", "label").html(function(d) {
60746 return _t.html("wikidata." + d);
60748 enter.append("input").attr("type", "text").call(utilNoAuto).classed("disabled", "true").attr("readonly", "true");
60749 enter.append("button").attr("class", "form-field-button").attr("title", _t("icons.copy")).call(svgIcon("#iD-operation-copy")).on("click", function(d3_event) {
60750 d3_event.preventDefault();
60751 select_default2(this.parentNode).select("input").node().select();
60752 document.execCommand("copy");
60755 function fetchWikidataItems(q, callback) {
60756 if (!q && _hintKey) {
60757 for (var i2 in _entityIDs) {
60758 var entity = context.hasEntity(_entityIDs[i2]);
60759 if (entity.tags[_hintKey]) {
60760 q = entity.tags[_hintKey];
60765 wikidata.itemsForSearchQuery(q, function(err, data) {
60768 var result = data.map(function(item) {
60771 value: item.display.label.value + " (" + item.id + ")",
60772 display: (selection2) => selection2.append("span").attr("class", "localized-text").attr("lang", item.display.label.language).text(item.display.label.value),
60773 title: item.display.description && item.display.description.value,
60774 terms: item.aliases
60781 function change() {
60783 syncTags[field.key] = _qid;
60784 dispatch10.call("change", this, syncTags);
60785 var initGraph = context.graph();
60786 var initEntityIDs = _entityIDs;
60787 wikidata.entityByQID(_qid, function(err, entity) {
60790 if (context.graph() !== initGraph)
60792 if (!entity.sitelinks)
60794 var langs = wikidata.languagesToQuery();
60795 ["labels", "descriptions"].forEach(function(key) {
60798 var valueLangs = Object.keys(entity[key]);
60799 if (valueLangs.length === 0)
60801 var valueLang = valueLangs[0];
60802 if (langs.indexOf(valueLang) === -1) {
60803 langs.push(valueLang);
60806 var newWikipediaValue;
60807 if (_wikipediaKey) {
60808 var foundPreferred;
60809 for (var i2 in langs) {
60810 var lang = langs[i2];
60811 var siteID = lang.replace("-", "_") + "wiki";
60812 if (entity.sitelinks[siteID]) {
60813 foundPreferred = true;
60814 newWikipediaValue = lang + ":" + entity.sitelinks[siteID].title;
60818 if (!foundPreferred) {
60819 var wikiSiteKeys = Object.keys(entity.sitelinks).filter(function(site) {
60820 return site.endsWith("wiki");
60822 if (wikiSiteKeys.length === 0) {
60823 newWikipediaValue = null;
60825 var wikiLang = wikiSiteKeys[0].slice(0, -4).replace("_", "-");
60826 var wikiTitle = entity.sitelinks[wikiSiteKeys[0]].title;
60827 newWikipediaValue = wikiLang + ":" + wikiTitle;
60831 if (newWikipediaValue) {
60832 newWikipediaValue = context.cleanTagValue(newWikipediaValue);
60834 if (typeof newWikipediaValue === "undefined")
60836 var actions = initEntityIDs.map(function(entityID) {
60837 var entity2 = context.hasEntity(entityID);
60840 var currTags = Object.assign({}, entity2.tags);
60841 if (newWikipediaValue === null) {
60842 if (!currTags[_wikipediaKey])
60844 delete currTags[_wikipediaKey];
60846 currTags[_wikipediaKey] = newWikipediaValue;
60848 return actionChangeTags(entityID, currTags);
60849 }).filter(Boolean);
60850 if (!actions.length)
60853 function actionUpdateWikipediaTags(graph) {
60854 actions.forEach(function(action) {
60855 graph = action(graph);
60859 context.history().undoAnnotation()
60863 function setLabelForEntity() {
60865 if (_wikidataEntity) {
60866 label = entityPropertyForDisplay(_wikidataEntity, "labels");
60867 if (label.length === 0) {
60868 label = _wikidataEntity.id.toString();
60871 utilGetSetValue(_searchInput, label);
60873 wiki.tags = function(tags) {
60874 var isMixed = Array.isArray(tags[field.key]);
60875 _searchInput.attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : "").classed("mixed", isMixed);
60876 _qid = typeof tags[field.key] === "string" && tags[field.key] || "";
60877 if (!/^Q[0-9]*$/.test(_qid)) {
60881 _wikiURL = "https://wikidata.org/wiki/" + _qid;
60882 wikidata.entityByQID(_qid, function(err, entity) {
60887 _wikidataEntity = entity;
60888 setLabelForEntity();
60889 var description = entityPropertyForDisplay(entity, "descriptions");
60890 _selection.select("button.wiki-link").classed("disabled", false);
60891 _selection.select(".preset-wikidata-description").style("display", function() {
60892 return description.length > 0 ? "flex" : "none";
60893 }).select("input").attr("value", description);
60894 _selection.select(".preset-wikidata-identifier").style("display", function() {
60895 return entity.id ? "flex" : "none";
60896 }).select("input").attr("value", entity.id);
60898 function unrecognized() {
60899 _wikidataEntity = null;
60900 setLabelForEntity();
60901 _selection.select(".preset-wikidata-description").style("display", "none");
60902 _selection.select(".preset-wikidata-identifier").style("display", "none");
60903 _selection.select("button.wiki-link").classed("disabled", true);
60904 if (_qid && _qid !== "") {
60905 _wikiURL = "https://wikidata.org/wiki/Special:Search?search=" + _qid;
60911 function entityPropertyForDisplay(wikidataEntity, propKey) {
60912 if (!wikidataEntity[propKey])
60914 var propObj = wikidataEntity[propKey];
60915 var langKeys = Object.keys(propObj);
60916 if (langKeys.length === 0)
60918 var langs = wikidata.languagesToQuery();
60919 for (var i2 in langs) {
60920 var lang = langs[i2];
60921 var valueObj = propObj[lang];
60922 if (valueObj && valueObj.value && valueObj.value.length > 0)
60923 return valueObj.value;
60925 return propObj[langKeys[0]].value;
60927 wiki.entityIDs = function(val) {
60928 if (!arguments.length)
60933 wiki.focus = function() {
60934 _searchInput.node().focus();
60936 return utilRebind(wiki, dispatch10, "on");
60939 // modules/ui/fields/wikipedia.js
60940 function uiFieldWikipedia(field, context) {
60941 const dispatch10 = dispatch_default("change");
60942 const wikipedia = services.wikipedia;
60943 const wikidata = services.wikidata;
60944 let _langInput = select_default2(null);
60945 let _titleInput = select_default2(null);
60949 let _dataWikipedia = [];
60950 _mainFileFetcher.get("wmf_sitematrix").then((d) => {
60951 _dataWikipedia = d;
60953 updateForTags(_tags);
60956 const langCombo = uiCombobox(context, "wikipedia-lang").fetcher((value, callback) => {
60957 const v = value.toLowerCase();
60959 _dataWikipedia.filter((d) => {
60960 return d[0].toLowerCase().indexOf(v) >= 0 || d[1].toLowerCase().indexOf(v) >= 0 || d[2].toLowerCase().indexOf(v) >= 0;
60961 }).map((d) => ({ value: d[1] }))
60964 const titleCombo = uiCombobox(context, "wikipedia-title").fetcher((value, callback) => {
60967 for (let i2 in _entityIDs) {
60968 let entity = context.hasEntity(_entityIDs[i2]);
60969 if (entity.tags.name) {
60970 value = entity.tags.name;
60975 const searchfn = value.length > 7 ? wikipedia.search : wikipedia.suggestions;
60976 searchfn(language()[2], value, (query, data) => {
60977 callback(data.map((d) => ({ value: d })));
60980 function wiki(selection2) {
60981 let wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
60982 wrap2 = wrap2.enter().append("div").attr("class", `form-field-input-wrap form-field-input-${field.type}`).merge(wrap2);
60983 let langContainer = wrap2.selectAll(".wiki-lang-container").data([0]);
60984 langContainer = langContainer.enter().append("div").attr("class", "wiki-lang-container").merge(langContainer);
60985 _langInput = langContainer.selectAll("input.wiki-lang").data([0]);
60986 _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);
60987 _langInput.on("blur", changeLang).on("change", changeLang);
60988 let titleContainer = wrap2.selectAll(".wiki-title-container").data([0]);
60989 titleContainer = titleContainer.enter().append("div").attr("class", "wiki-title-container").merge(titleContainer);
60990 _titleInput = titleContainer.selectAll("input.wiki-title").data([0]);
60991 _titleInput = _titleInput.enter().append("input").attr("type", "text").attr("class", "wiki-title").attr("id", field.domId).call(utilNoAuto).call(titleCombo).merge(_titleInput);
60992 _titleInput.on("blur", function() {
60994 }).on("change", function() {
60997 let link2 = titleContainer.selectAll(".wiki-link").data([0]);
60998 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);
60999 link2.on("click", (d3_event) => {
61000 d3_event.preventDefault();
61002 window.open(_wikiURL, "_blank");
61005 function defaultLanguageInfo(skipEnglishFallback) {
61006 const langCode = _mainLocalizer.languageCode().toLowerCase();
61007 for (let i2 in _dataWikipedia) {
61008 let d = _dataWikipedia[i2];
61009 if (d[2] === langCode)
61012 return skipEnglishFallback ? ["", "", ""] : ["English", "English", "en"];
61014 function language(skipEnglishFallback) {
61015 const value = utilGetSetValue(_langInput).toLowerCase();
61016 for (let i2 in _dataWikipedia) {
61017 let d = _dataWikipedia[i2];
61018 if (d[0].toLowerCase() === value || d[1].toLowerCase() === value || d[2] === value)
61021 return defaultLanguageInfo(skipEnglishFallback);
61023 function changeLang() {
61024 utilGetSetValue(_langInput, language()[1]);
61027 function change(skipWikidata) {
61028 let value = utilGetSetValue(_titleInput);
61029 const m = value.match(/https?:\/\/([-a-z]+)\.wikipedia\.org\/(?:wiki|\1-[-a-z]+)\/([^#]+)(?:#(.+))?/);
61030 const langInfo = m && _dataWikipedia.find((d) => m[1] === d[2]);
61033 const nativeLangName = langInfo[1];
61034 value = decodeURIComponent(m[2]).replace(/_/g, " ");
61037 anchor = decodeURIComponent(m[3]);
61038 value += "#" + anchor.replace(/_/g, " ");
61040 value = value.slice(0, 1).toUpperCase() + value.slice(1);
61041 utilGetSetValue(_langInput, nativeLangName);
61042 utilGetSetValue(_titleInput, value);
61045 syncTags.wikipedia = context.cleanTagValue(language()[2] + ":" + value);
61047 syncTags.wikipedia = void 0;
61049 dispatch10.call("change", this, syncTags);
61050 if (skipWikidata || !value || !language()[2])
61052 const initGraph = context.graph();
61053 const initEntityIDs = _entityIDs;
61054 wikidata.itemsByTitle(language()[2], value, (err, data) => {
61055 if (err || !data || !Object.keys(data).length)
61057 if (context.graph() !== initGraph)
61059 const qids = Object.keys(data);
61060 const value2 = qids && qids.find((id2) => id2.match(/^Q\d+$/));
61061 let actions = initEntityIDs.map((entityID) => {
61062 let entity = context.entity(entityID).tags;
61063 let currTags = Object.assign({}, entity);
61064 if (currTags.wikidata !== value2) {
61065 currTags.wikidata = value2;
61066 return actionChangeTags(entityID, currTags);
61069 }).filter(Boolean);
61070 if (!actions.length)
61073 function actionUpdateWikidataTags(graph) {
61074 actions.forEach(function(action) {
61075 graph = action(graph);
61079 context.history().undoAnnotation()
61083 wiki.tags = (tags) => {
61085 updateForTags(tags);
61087 function updateForTags(tags) {
61088 const value = typeof tags[field.key] === "string" ? tags[field.key] : "";
61089 const m = value.match(/([^:]+):([^#]+)(?:#(.+))?/);
61090 const tagLang = m && m[1];
61091 const tagArticleTitle = m && m[2];
61092 let anchor = m && m[3];
61093 const tagLangInfo = tagLang && _dataWikipedia.find((d) => tagLang === d[2]);
61095 const nativeLangName = tagLangInfo[1];
61096 utilGetSetValue(_langInput, nativeLangName);
61097 utilGetSetValue(_titleInput, tagArticleTitle + (anchor ? "#" + anchor : ""));
61100 anchor = encodeURIComponent(anchor.replace(/ /g, "_")).replace(/%/g, ".");
61102 anchor = anchor.replace(/ /g, "_");
61105 _wikiURL = "https://" + tagLang + ".wikipedia.org/wiki/" + tagArticleTitle.replace(/ /g, "_") + (anchor ? "#" + anchor : "");
61107 utilGetSetValue(_titleInput, value);
61108 if (value && value !== "") {
61109 utilGetSetValue(_langInput, "");
61110 const defaultLangInfo = defaultLanguageInfo();
61111 _wikiURL = `https://${defaultLangInfo[2]}.wikipedia.org/w/index.php?fulltext=1&search=${value}`;
61113 const shownOrDefaultLangInfo = language(true);
61114 utilGetSetValue(_langInput, shownOrDefaultLangInfo[1]);
61119 wiki.entityIDs = (val) => {
61120 if (!arguments.length)
61125 wiki.focus = () => {
61126 _titleInput.node().focus();
61128 return utilRebind(wiki, dispatch10, "on");
61130 uiFieldWikipedia.supportsMultiselection = false;
61132 // modules/ui/fields/index.js
61134 access: uiFieldAccess,
61135 address: uiFieldAddress,
61136 check: uiFieldCheck,
61137 colour: uiFieldText,
61138 combo: uiFieldCombo,
61139 cycleway: uiFieldCycleway,
61140 defaultCheck: uiFieldCheck,
61141 email: uiFieldText,
61142 identifier: uiFieldText,
61143 lanes: uiFieldLanes,
61144 localized: uiFieldLocalized,
61145 roadheight: uiFieldRoadheight,
61146 roadspeed: uiFieldRoadspeed,
61147 manyCombo: uiFieldCombo,
61148 multiCombo: uiFieldCombo,
61149 networkCombo: uiFieldCombo,
61150 number: uiFieldText,
61151 onewayCheck: uiFieldCheck,
61152 radio: uiFieldRadio,
61153 restrictions: uiFieldRestrictions,
61154 semiCombo: uiFieldCombo,
61155 structureRadio: uiFieldRadio,
61158 textarea: uiFieldTextarea,
61159 typeCombo: uiFieldCombo,
61161 wikidata: uiFieldWikidata,
61162 wikipedia: uiFieldWikipedia
61165 // modules/ui/field.js
61166 function uiField(context, presetField2, entityIDs, options2) {
61167 options2 = Object.assign({
61174 var dispatch10 = dispatch_default("change", "revert");
61175 var field = Object.assign({}, presetField2);
61176 field.domId = utilUniqueDomId("form-field-" + field.safeid);
61177 var _show = options2.show;
61181 if (entityIDs && entityIDs.length) {
61182 _entityExtent = entityIDs.reduce(function(extent, entityID) {
61183 var entity = context.graph().entity(entityID);
61184 return extent.extend(entity.extent(context.graph()));
61187 var _locked = false;
61188 var _lockedTip = uiTooltip().title(() => _t.append("inspector.lock.suggestion", { label: field.title })).placement("bottom");
61189 field.keys = field.keys || [field.key];
61190 if (_show && !field.impl) {
61193 function createField() {
61194 field.impl = uiFields[field.type](field, context).on("change", function(t, onInput) {
61195 dispatch10.call("change", field, t, onInput);
61198 field.entityIDs = entityIDs;
61199 if (field.impl.entityIDs) {
61200 field.impl.entityIDs(entityIDs);
61204 function isModified() {
61205 if (!entityIDs || !entityIDs.length)
61207 return entityIDs.some(function(entityID) {
61208 var original = context.graph().base().entities[entityID];
61209 var latest = context.graph().entity(entityID);
61210 return field.keys.some(function(key) {
61211 return original ? latest.tags[key] !== original.tags[key] : latest.tags[key];
61215 function tagsContainFieldKey() {
61216 return field.keys.some(function(key) {
61217 if (field.type === "multiCombo") {
61218 for (var tagKey in _tags) {
61219 if (tagKey.indexOf(key) === 0) {
61225 return _tags[key] !== void 0;
61228 function revert(d3_event, d) {
61229 d3_event.stopPropagation();
61230 d3_event.preventDefault();
61231 if (!entityIDs || _locked)
61233 dispatch10.call("revert", d, d.keys);
61235 function remove2(d3_event, d) {
61236 d3_event.stopPropagation();
61237 d3_event.preventDefault();
61241 d.keys.forEach(function(key) {
61244 dispatch10.call("change", d, t);
61246 field.render = function(selection2) {
61247 var container = selection2.selectAll(".form-field").data([field]);
61248 var enter = container.enter().append("div").attr("class", function(d) {
61249 return "form-field form-field-" + d.safeid;
61250 }).classed("nowrap", !options2.wrap);
61251 if (options2.wrap) {
61252 var labelEnter = enter.append("label").attr("class", "field-label").attr("for", function(d) {
61255 var textEnter = labelEnter.append("span").attr("class", "label-text");
61256 textEnter.append("span").attr("class", "label-textvalue").each(function(d) {
61257 d.label()(select_default2(this));
61259 textEnter.append("span").attr("class", "label-textannotation");
61260 if (options2.remove) {
61261 labelEnter.append("button").attr("class", "remove-icon").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
61263 if (options2.revert) {
61264 labelEnter.append("button").attr("class", "modified-icon").attr("title", _t("icons.undo")).call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo"));
61267 container = container.merge(enter);
61268 container.select(".field-label > .remove-icon").on("click", remove2);
61269 container.select(".field-label > .modified-icon").on("click", revert);
61270 container.each(function(d) {
61271 var selection3 = select_default2(this);
61275 var reference, help;
61276 if (options2.wrap && field.type === "restrictions") {
61277 help = uiFieldHelp(context, "restrictions");
61279 if (options2.wrap && options2.info) {
61280 var referenceKey = d.key || "";
61281 if (d.type === "multiCombo") {
61282 referenceKey = referenceKey.replace(/:$/, "");
61284 reference = uiTagReference(d.reference || { key: referenceKey }, context);
61285 if (_state === "hover") {
61286 reference.showing(false);
61289 selection3.call(d.impl);
61291 selection3.call(help.body).select(".field-label").call(help.button);
61294 selection3.call(reference.body).select(".field-label").call(reference.button);
61296 d.impl.tags(_tags);
61298 container.classed("locked", _locked).classed("modified", isModified()).classed("present", tagsContainFieldKey());
61299 var annotation = container.selectAll(".field-label .label-textannotation");
61300 var icon2 = annotation.selectAll(".icon").data(_locked ? [0] : []);
61301 icon2.exit().remove();
61302 icon2.enter().append("svg").attr("class", "icon").append("use").attr("xlink:href", "#fas-lock");
61303 container.call(_locked ? _lockedTip : _lockedTip.destroy);
61305 field.state = function(val) {
61306 if (!arguments.length)
61311 field.tags = function(val) {
61312 if (!arguments.length)
61315 if (tagsContainFieldKey() && !_show) {
61323 field.locked = function(val) {
61324 if (!arguments.length)
61329 field.show = function() {
61334 if (field.default && field.key && _tags[field.key] !== field.default) {
61336 t[field.key] = field.default;
61337 dispatch10.call("change", this, t);
61340 field.isShown = function() {
61343 field.isAllowed = function() {
61344 if (entityIDs && entityIDs.length > 1 && uiFields[field.type].supportsMultiselection === false)
61346 if (field.geometry && !entityIDs.every(function(entityID) {
61347 return field.matchGeometry(context.graph().geometry(entityID));
61350 if (entityIDs && _entityExtent && field.locationSetID) {
61351 var validHere = _sharedLocationManager.locationSetsAt(_entityExtent.center());
61352 if (!validHere[field.locationSetID])
61355 var prerequisiteTag = field.prerequisiteTag;
61356 if (entityIDs && !tagsContainFieldKey() && prerequisiteTag) {
61357 if (!entityIDs.every(function(entityID) {
61358 var entity = context.graph().entity(entityID);
61359 if (prerequisiteTag.key) {
61360 var value = entity.tags[prerequisiteTag.key];
61363 if (prerequisiteTag.valueNot) {
61364 return prerequisiteTag.valueNot !== value;
61366 if (prerequisiteTag.value) {
61367 return prerequisiteTag.value === value;
61369 } else if (prerequisiteTag.keyNot) {
61370 if (entity.tags[prerequisiteTag.keyNot])
61379 field.focus = function() {
61381 field.impl.focus();
61384 return utilRebind(field, dispatch10, "on");
61387 // modules/ui/form_fields.js
61388 function uiFormFields(context) {
61389 var moreCombo = uiCombobox(context, "more-fields").minItems(1);
61390 var _fieldsArr = [];
61391 var _lastPlaceholder = "";
61394 function formFields(selection2) {
61395 var allowedFields = _fieldsArr.filter(function(field) {
61396 return field.isAllowed();
61398 var shown = allowedFields.filter(function(field) {
61399 return field.isShown();
61401 var notShown = allowedFields.filter(function(field) {
61402 return !field.isShown();
61404 var container = selection2.selectAll(".form-fields-container").data([0]);
61405 container = container.enter().append("div").attr("class", "form-fields-container " + (_klass || "")).merge(container);
61406 var fields = container.selectAll(".wrap-form-field").data(shown, function(d) {
61407 return d.id + (d.entityIDs ? d.entityIDs.join() : "");
61409 fields.exit().remove();
61410 var enter = fields.enter().append("div").attr("class", function(d) {
61411 return "wrap-form-field wrap-form-field-" + d.safeid;
61413 fields = fields.merge(enter);
61414 fields.order().each(function(d) {
61415 select_default2(this).call(d.render);
61418 var moreFields = notShown.map(function(field) {
61419 var title = field.title();
61420 titles.push(title);
61421 var terms = field.terms();
61423 terms.push(field.key);
61425 terms = terms.concat(field.keys);
61427 display: field.label(),
61434 var placeholder = titles.slice(0, 3).join(", ") + (titles.length > 3 ? "\u2026" : "");
61435 var more = selection2.selectAll(".more-fields").data(_state === "hover" || moreFields.length === 0 ? [] : [0]);
61436 more.exit().remove();
61437 var moreEnter = more.enter().append("div").attr("class", "more-fields").append("label");
61438 moreEnter.append("span").call(_t.append("inspector.add_fields"));
61439 more = moreEnter.merge(more);
61440 var input = more.selectAll(".value").data([0]);
61441 input.exit().remove();
61442 input = input.enter().append("input").attr("class", "value").attr("type", "text").attr("placeholder", placeholder).call(utilNoAuto).merge(input);
61443 input.call(utilGetSetValue, "").call(
61444 moreCombo.data(moreFields).on("accept", function(d) {
61447 var field = d.field;
61449 selection2.call(formFields);
61453 if (_lastPlaceholder !== placeholder) {
61454 input.attr("placeholder", placeholder);
61455 _lastPlaceholder = placeholder;
61458 formFields.fieldsArr = function(val) {
61459 if (!arguments.length)
61461 _fieldsArr = val || [];
61464 formFields.state = function(val) {
61465 if (!arguments.length)
61470 formFields.klass = function(val) {
61471 if (!arguments.length)
61479 // modules/ui/changeset_editor.js
61480 function uiChangesetEditor(context) {
61481 var dispatch10 = dispatch_default("change");
61482 var formFields = uiFormFields(context);
61483 var commentCombo = uiCombobox(context, "comment").caseSensitive(true);
61487 function changesetEditor(selection2) {
61488 render(selection2);
61490 function render(selection2) {
61491 var initial = false;
61494 var presets = _mainPresetIndex;
61496 uiField(context, presets.field("comment"), null, { show: true, revert: false }),
61497 uiField(context, presets.field("source"), null, { show: false, revert: false }),
61498 uiField(context, presets.field("hashtags"), null, { show: false, revert: false })
61500 _fieldsArr.forEach(function(field) {
61501 field.on("change", function(t, onInput) {
61502 dispatch10.call("change", field, void 0, t, onInput);
61506 _fieldsArr.forEach(function(field) {
61509 selection2.call(formFields.fieldsArr(_fieldsArr));
61511 var commentField = selection2.select(".form-field-comment textarea");
61512 var commentNode = commentField.node();
61514 commentNode.focus();
61515 commentNode.select();
61517 utilTriggerEvent(commentField, "blur");
61518 var osm = context.connection();
61520 osm.userChangesets(function(err, changesets) {
61523 var comments = changesets.map(function(changeset) {
61524 var comment = changeset.tags.comment;
61525 return comment ? { title: comment, value: comment } : null;
61526 }).filter(Boolean);
61528 commentCombo.data(utilArrayUniqBy(comments, "title"))
61533 var hasGoogle = _tags.comment.match(/google/i);
61534 var commentWarning = selection2.select(".form-field-comment").selectAll(".comment-warning").data(hasGoogle ? [0] : []);
61535 commentWarning.exit().transition().duration(200).style("opacity", 0).remove();
61536 var commentEnter = commentWarning.enter().insert("div", ".tag-reference-body").attr("class", "field-warning comment-warning").style("opacity", 0);
61537 commentEnter.append("a").attr("target", "_blank").call(svgIcon("#iD-icon-alert", "inline")).attr("href", _t("commit.google_warning_link")).append("span").call(_t.append("commit.google_warning"));
61538 commentEnter.transition().duration(200).style("opacity", 1);
61540 changesetEditor.tags = function(_) {
61541 if (!arguments.length)
61544 return changesetEditor;
61546 changesetEditor.changesetID = function(_) {
61547 if (!arguments.length)
61548 return _changesetID;
61549 if (_changesetID === _)
61550 return changesetEditor;
61553 return changesetEditor;
61555 return utilRebind(changesetEditor, dispatch10, "on");
61558 // modules/ui/commit.js
61559 var import_fast_deep_equal9 = __toESM(require_fast_deep_equal());
61561 // modules/util/jxon.js
61562 var JXON = new function() {
61563 var sValueProp = "keyValue", sAttributesProp = "keyAttributes", sAttrPref = "@", aCache = [], rIsNull = /^\s*$/, rIsBool = /^(?:true|false)$/i;
61564 function parseText(sValue) {
61565 if (rIsNull.test(sValue)) {
61568 if (rIsBool.test(sValue)) {
61569 return sValue.toLowerCase() === "true";
61571 if (isFinite(sValue)) {
61572 return parseFloat(sValue);
61574 if (isFinite(Date.parse(sValue))) {
61575 return new Date(sValue);
61579 function EmptyTree() {
61581 EmptyTree.prototype.toString = function() {
61584 EmptyTree.prototype.valueOf = function() {
61587 function objectify(vValue) {
61588 return vValue === null ? new EmptyTree() : vValue instanceof Object ? vValue : new vValue.constructor(vValue);
61590 function createObjTree(oParentNode, nVerb, bFreeze, bNesteAttr) {
61591 var nLevelStart = aCache.length, bChildren = oParentNode.hasChildNodes(), bAttributes = oParentNode.hasAttributes(), bHighVerb = Boolean(nVerb & 2);
61592 var sProp, vContent, nLength = 0, sCollectedTxt = "", vResult = bHighVerb ? {} : true;
61594 for (var oNode, nItem = 0; nItem < oParentNode.childNodes.length; nItem++) {
61595 oNode = oParentNode.childNodes.item(nItem);
61596 if (oNode.nodeType === 4) {
61597 sCollectedTxt += oNode.nodeValue;
61598 } else if (oNode.nodeType === 3) {
61599 sCollectedTxt += oNode.nodeValue.trim();
61600 } else if (oNode.nodeType === 1 && !oNode.prefix) {
61601 aCache.push(oNode);
61605 var nLevelEnd = aCache.length, vBuiltVal = parseText(sCollectedTxt);
61606 if (!bHighVerb && (bChildren || bAttributes)) {
61607 vResult = nVerb === 0 ? objectify(vBuiltVal) : {};
61609 for (var nElId = nLevelStart; nElId < nLevelEnd; nElId++) {
61610 sProp = aCache[nElId].nodeName.toLowerCase();
61611 vContent = createObjTree(aCache[nElId], nVerb, bFreeze, bNesteAttr);
61612 if (vResult.hasOwnProperty(sProp)) {
61613 if (vResult[sProp].constructor !== Array) {
61614 vResult[sProp] = [vResult[sProp]];
61616 vResult[sProp].push(vContent);
61618 vResult[sProp] = vContent;
61623 var nAttrLen = oParentNode.attributes.length, sAPrefix = bNesteAttr ? "" : sAttrPref, oAttrParent = bNesteAttr ? {} : vResult;
61624 for (var oAttrib, nAttrib = 0; nAttrib < nAttrLen; nLength++, nAttrib++) {
61625 oAttrib = oParentNode.attributes.item(nAttrib);
61626 oAttrParent[sAPrefix + oAttrib.name.toLowerCase()] = parseText(oAttrib.value.trim());
61630 Object.freeze(oAttrParent);
61632 vResult[sAttributesProp] = oAttrParent;
61633 nLength -= nAttrLen - 1;
61636 if (nVerb === 3 || (nVerb === 2 || nVerb === 1 && nLength > 0) && sCollectedTxt) {
61637 vResult[sValueProp] = vBuiltVal;
61638 } else if (!bHighVerb && nLength === 0 && sCollectedTxt) {
61639 vResult = vBuiltVal;
61641 if (bFreeze && (bHighVerb || nLength > 0)) {
61642 Object.freeze(vResult);
61644 aCache.length = nLevelStart;
61647 function loadObjTree(oXMLDoc, oParentEl, oParentObj) {
61648 var vValue, oChild;
61649 if (oParentObj instanceof String || oParentObj instanceof Number || oParentObj instanceof Boolean) {
61650 oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toString()));
61651 } else if (oParentObj.constructor === Date) {
61652 oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toGMTString()));
61654 for (var sName in oParentObj) {
61655 vValue = oParentObj[sName];
61656 if (isFinite(sName) || vValue instanceof Function) {
61659 if (sName === sValueProp) {
61660 if (vValue !== null && vValue !== true) {
61661 oParentEl.appendChild(oXMLDoc.createTextNode(vValue.constructor === Date ? vValue.toGMTString() : String(vValue)));
61663 } else if (sName === sAttributesProp) {
61664 for (var sAttrib in vValue) {
61665 oParentEl.setAttribute(sAttrib, vValue[sAttrib]);
61667 } else if (sName.charAt(0) === sAttrPref) {
61668 oParentEl.setAttribute(sName.slice(1), vValue);
61669 } else if (vValue.constructor === Array) {
61670 for (var nItem = 0; nItem < vValue.length; nItem++) {
61671 oChild = oXMLDoc.createElement(sName);
61672 loadObjTree(oXMLDoc, oChild, vValue[nItem]);
61673 oParentEl.appendChild(oChild);
61676 oChild = oXMLDoc.createElement(sName);
61677 if (vValue instanceof Object) {
61678 loadObjTree(oXMLDoc, oChild, vValue);
61679 } else if (vValue !== null && vValue !== true) {
61680 oChild.appendChild(oXMLDoc.createTextNode(vValue.toString()));
61682 oParentEl.appendChild(oChild);
61686 this.build = function(oXMLParent, nVerbosity, bFreeze, bNesteAttributes) {
61687 var _nVerb = arguments.length > 1 && typeof nVerbosity === "number" ? nVerbosity & 3 : 1;
61688 return createObjTree(oXMLParent, _nVerb, bFreeze || false, arguments.length > 3 ? bNesteAttributes : _nVerb === 3);
61690 this.unbuild = function(oObjTree) {
61691 var oNewDoc = document.implementation.createDocument("", "", null);
61692 loadObjTree(oNewDoc, oNewDoc, oObjTree);
61695 this.stringify = function(oObjTree) {
61696 return new XMLSerializer().serializeToString(JXON.unbuild(oObjTree));
61700 // modules/ui/sections/changes.js
61701 function uiSectionChanges(context) {
61702 var _discardTags = {};
61703 _mainFileFetcher.get("discarded").then(function(d) {
61705 }).catch(function() {
61707 var section = uiSection("changes-list", context).label(function() {
61708 var history = context.history();
61709 var summary = history.difference().summary();
61710 return _t.append("inspector.title_count", { title: _t("commit.changes"), count: summary.length });
61711 }).disclosureContent(renderDisclosureContent);
61712 function renderDisclosureContent(selection2) {
61713 var history = context.history();
61714 var summary = history.difference().summary();
61715 var container = selection2.selectAll(".commit-section").data([0]);
61716 var containerEnter = container.enter().append("div").attr("class", "commit-section");
61717 containerEnter.append("ul").attr("class", "changeset-list");
61718 container = containerEnter.merge(container);
61719 var items = container.select("ul").selectAll("li").data(summary);
61720 var itemsEnter = items.enter().append("li").attr("class", "change-item");
61721 var buttons = itemsEnter.append("button").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
61722 buttons.each(function(d) {
61723 select_default2(this).call(svgIcon("#iD-icon-" + d.entity.geometry(d.graph), "pre-text " + d.changeType));
61725 buttons.append("span").attr("class", "change-type").html(function(d) {
61726 return _t.html("commit." + d.changeType) + " ";
61728 buttons.append("strong").attr("class", "entity-type").text(function(d) {
61729 var matched = _mainPresetIndex.match(d.entity, d.graph);
61730 return matched && matched.name() || utilDisplayType(d.entity.id);
61732 buttons.append("span").attr("class", "entity-name").text(function(d) {
61733 var name = utilDisplayName(d.entity) || "", string = "";
61737 return string += " " + name;
61739 items = itemsEnter.merge(items);
61740 var changeset = new osmChangeset().update({ id: void 0 });
61741 var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
61742 delete changeset.id;
61743 var data = JXON.stringify(changeset.osmChangeJXON(changes));
61744 var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
61745 var fileName = "changes.osc";
61746 var linkEnter = container.selectAll(".download-changes").data([0]).enter().append("a").attr("class", "download-changes");
61747 linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
61748 linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("commit.download_changes"));
61749 function mouseover(d) {
61751 context.surface().selectAll(
61752 utilEntityOrMemberSelector([d.entity.id], context.graph())
61753 ).classed("hover", true);
61756 function mouseout() {
61757 context.surface().selectAll(".hover").classed("hover", false);
61759 function click(d3_event, change) {
61760 if (change.changeType !== "deleted") {
61761 var entity = change.entity;
61762 context.map().zoomToEase(entity);
61763 context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
61770 // modules/ui/commit_warnings.js
61771 function uiCommitWarnings(context) {
61772 function commitWarnings(selection2) {
61773 var issuesBySeverity = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeDisabledRules: true });
61774 for (var severity in issuesBySeverity) {
61775 var issues = issuesBySeverity[severity];
61776 if (severity !== "error") {
61777 issues = issues.filter(function(issue) {
61778 return issue.type !== "help_request";
61781 var section = severity + "-section";
61782 var issueItem = severity + "-item";
61783 var container = selection2.selectAll("." + section).data(issues.length ? [0] : []);
61784 container.exit().remove();
61785 var containerEnter = container.enter().append("div").attr("class", "modal-section " + section + " fillL2");
61786 containerEnter.append("h3").call(severity === "warning" ? _t.append("commit.warnings") : _t.append("commit.errors"));
61787 containerEnter.append("ul").attr("class", "changeset-list");
61788 container = containerEnter.merge(container);
61789 var items = container.select("ul").selectAll("li").data(issues, function(d) {
61792 items.exit().remove();
61793 var itemsEnter = items.enter().append("li").attr("class", issueItem);
61794 var buttons = itemsEnter.append("button").on("mouseover", function(d3_event, d) {
61796 context.surface().selectAll(
61797 utilEntityOrMemberSelector(
61801 ).classed("hover", true);
61803 }).on("mouseout", function() {
61804 context.surface().selectAll(".hover").classed("hover", false);
61805 }).on("click", function(d3_event, d) {
61806 context.validator().focusIssue(d);
61808 buttons.call(svgIcon("#iD-icon-alert", "pre-text"));
61809 buttons.append("strong").attr("class", "issue-message");
61810 buttons.filter(function(d) {
61813 uiTooltip().title(function(d) {
61815 }).placement("top")
61817 items = itemsEnter.merge(items);
61818 items.selectAll(".issue-message").text("").each(function(d) {
61819 return d.message(context)(select_default2(this));
61823 return commitWarnings;
61826 // modules/ui/commit.js
61827 var readOnlyTags = [
61828 /^changesets_count$/,
61837 /^closed:keepright$/,
61838 /^closed:improveosm:/,
61841 var hashtagRegex = /(#[^\u2000-\u206F\u2E00-\u2E7F\s\\'!"#$%()*,.\/:;<=>?@\[\]^`{|}~]+)/g;
61842 function uiCommit(context) {
61843 var dispatch10 = dispatch_default("cancel");
61846 var changesetEditor = uiChangesetEditor(context).on("change", changeTags);
61847 var rawTagEditor = uiSectionRawTagEditor("changeset-tag-editor", context).on("change", changeTags).readOnlyTags(readOnlyTags);
61848 var commitChanges = uiSectionChanges(context);
61849 var commitWarnings = uiCommitWarnings(context);
61850 function commit(selection2) {
61851 _selection = selection2;
61852 if (!context.changeset)
61854 loadDerivedChangesetTags();
61855 selection2.call(render);
61857 function initChangeset() {
61858 var commentDate = +corePreferences("commentDate") || 0;
61859 var currDate = Date.now();
61860 var cutoff = 2 * 86400 * 1e3;
61861 if (commentDate > currDate || currDate - commentDate > cutoff) {
61862 corePreferences("comment", null);
61863 corePreferences("hashtags", null);
61864 corePreferences("source", null);
61866 if (context.defaultChangesetComment()) {
61867 corePreferences("comment", context.defaultChangesetComment());
61868 corePreferences("commentDate", Date.now());
61870 if (context.defaultChangesetSource()) {
61871 corePreferences("source", context.defaultChangesetSource());
61872 corePreferences("commentDate", Date.now());
61874 if (context.defaultChangesetHashtags()) {
61875 corePreferences("hashtags", context.defaultChangesetHashtags());
61876 corePreferences("commentDate", Date.now());
61878 var detected = utilDetect();
61880 comment: corePreferences("comment") || "",
61881 created_by: context.cleanTagValue("iD " + context.version),
61882 host: context.cleanTagValue(detected.host),
61883 locale: context.cleanTagValue(_mainLocalizer.localeCode())
61885 findHashtags(tags, true);
61886 var hashtags = corePreferences("hashtags");
61888 tags.hashtags = hashtags;
61890 var source = corePreferences("source");
61892 tags.source = source;
61894 var photoOverlaysUsed = context.history().photoOverlaysUsed();
61895 if (photoOverlaysUsed.length) {
61896 var sources = (tags.source || "").split(";");
61897 if (sources.indexOf("streetlevel imagery") === -1) {
61898 sources.push("streetlevel imagery");
61900 photoOverlaysUsed.forEach(function(photoOverlay) {
61901 if (sources.indexOf(photoOverlay) === -1) {
61902 sources.push(photoOverlay);
61905 tags.source = context.cleanTagValue(sources.join(";"));
61907 context.changeset = new osmChangeset({ tags });
61909 function loadDerivedChangesetTags() {
61910 var osm = context.connection();
61913 var tags = Object.assign({}, context.changeset.tags);
61914 var imageryUsed = context.cleanTagValue(context.history().imageryUsed().join(";"));
61915 tags.imagery_used = imageryUsed || "None";
61916 var osmClosed = osm.getClosedIDs();
61918 if (osmClosed.length) {
61919 tags["closed:note"] = context.cleanTagValue(osmClosed.join(";"));
61921 if (services.keepRight) {
61922 var krClosed = services.keepRight.getClosedIDs();
61923 if (krClosed.length) {
61924 tags["closed:keepright"] = context.cleanTagValue(krClosed.join(";"));
61927 if (services.improveOSM) {
61928 var iOsmClosed = services.improveOSM.getClosedCounts();
61929 for (itemType in iOsmClosed) {
61930 tags["closed:improveosm:" + itemType] = context.cleanTagValue(iOsmClosed[itemType].toString());
61933 if (services.osmose) {
61934 var osmoseClosed = services.osmose.getClosedCounts();
61935 for (itemType in osmoseClosed) {
61936 tags["closed:osmose:" + itemType] = context.cleanTagValue(osmoseClosed[itemType].toString());
61939 for (var key in tags) {
61940 if (key.match(/(^warnings:)|(^resolved:)/)) {
61944 function addIssueCounts(issues, prefix) {
61945 var issuesByType = utilArrayGroupBy(issues, "type");
61946 for (var issueType in issuesByType) {
61947 var issuesOfType = issuesByType[issueType];
61948 if (issuesOfType[0].subtype) {
61949 var issuesBySubtype = utilArrayGroupBy(issuesOfType, "subtype");
61950 for (var issueSubtype in issuesBySubtype) {
61951 var issuesOfSubtype = issuesBySubtype[issueSubtype];
61952 tags[prefix + ":" + issueType + ":" + issueSubtype] = context.cleanTagValue(issuesOfSubtype.length.toString());
61955 tags[prefix + ":" + issueType] = context.cleanTagValue(issuesOfType.length.toString());
61959 var warnings = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeIgnored: true, includeDisabledRules: true }).warning.filter(function(issue) {
61960 return issue.type !== "help_request";
61962 addIssueCounts(warnings, "warnings");
61963 var resolvedIssues = context.validator().getResolvedIssues();
61964 addIssueCounts(resolvedIssues, "resolved");
61965 context.changeset = context.changeset.update({ tags });
61967 function render(selection2) {
61968 var osm = context.connection();
61971 var header = selection2.selectAll(".header").data([0]);
61972 var headerTitle = header.enter().append("div").attr("class", "header fillL");
61973 headerTitle.append("div").append("h2").call(_t.append("commit.title"));
61974 headerTitle.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
61975 dispatch10.call("cancel", this);
61976 }).call(svgIcon("#iD-icon-close"));
61977 var body = selection2.selectAll(".body").data([0]);
61978 body = body.enter().append("div").attr("class", "body").merge(body);
61979 var changesetSection = body.selectAll(".changeset-editor").data([0]);
61980 changesetSection = changesetSection.enter().append("div").attr("class", "modal-section changeset-editor").merge(changesetSection);
61981 changesetSection.call(
61982 changesetEditor.changesetID(context.changeset.id).tags(context.changeset.tags)
61984 body.call(commitWarnings);
61985 var saveSection = body.selectAll(".save-section").data([0]);
61986 saveSection = saveSection.enter().append("div").attr("class", "modal-section save-section fillL").merge(saveSection);
61987 var prose = saveSection.selectAll(".commit-info").data([0]);
61988 if (prose.enter().size()) {
61989 _userDetails2 = null;
61991 prose = prose.enter().append("p").attr("class", "commit-info").call(_t.append("commit.upload_explanation")).merge(prose);
61992 osm.userDetails(function(err, user) {
61995 if (_userDetails2 === user)
61997 _userDetails2 = user;
61998 var userLink = select_default2(document.createElement("div"));
61999 if (user.image_url) {
62000 userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
62002 userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
62003 prose.html(_t.html("commit.upload_explanation_with_user", { user: { html: userLink.html() } }));
62005 var requestReview = saveSection.selectAll(".request-review").data([0]);
62006 var requestReviewEnter = requestReview.enter().append("div").attr("class", "request-review");
62007 var requestReviewDomId = utilUniqueDomId("commit-input-request-review");
62008 var labelEnter = requestReviewEnter.append("label").attr("for", requestReviewDomId);
62009 if (!labelEnter.empty()) {
62010 labelEnter.call(uiTooltip().title(() => _t.append("commit.request_review_info")).placement("top"));
62012 labelEnter.append("input").attr("type", "checkbox").attr("id", requestReviewDomId);
62013 labelEnter.append("span").call(_t.append("commit.request_review"));
62014 requestReview = requestReview.merge(requestReviewEnter);
62015 var requestReviewInput = requestReview.selectAll("input").property("checked", isReviewRequested(context.changeset.tags)).on("change", toggleRequestReview);
62016 var buttonSection = saveSection.selectAll(".buttons").data([0]);
62017 var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons fillL");
62018 buttonEnter.append("button").attr("class", "secondary-action button cancel-button").append("span").attr("class", "label").call(_t.append("commit.cancel"));
62019 var uploadButton = buttonEnter.append("button").attr("class", "action button save-button");
62020 uploadButton.append("span").attr("class", "label").call(_t.append("commit.save"));
62021 var uploadBlockerTooltipText = getUploadBlockerMessage();
62022 buttonSection = buttonSection.merge(buttonEnter);
62023 buttonSection.selectAll(".cancel-button").on("click.cancel", function() {
62024 dispatch10.call("cancel", this);
62026 buttonSection.selectAll(".save-button").classed("disabled", uploadBlockerTooltipText !== null).on("click.save", function() {
62027 if (!select_default2(this).classed("disabled")) {
62029 for (var key in context.changeset.tags) {
62031 delete context.changeset.tags[key];
62033 context.uploader().save(context.changeset);
62036 uiTooltip().destroyAny(buttonSection.selectAll(".save-button"));
62037 if (uploadBlockerTooltipText) {
62038 buttonSection.selectAll(".save-button").call(uiTooltip().title(() => uploadBlockerTooltipText).placement("top"));
62040 var tagSection = body.selectAll(".tag-section.raw-tag-editor").data([0]);
62041 tagSection = tagSection.enter().append("div").attr("class", "modal-section tag-section raw-tag-editor").merge(tagSection);
62043 rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
62045 var changesSection = body.selectAll(".commit-changes-section").data([0]);
62046 changesSection = changesSection.enter().append("div").attr("class", "modal-section commit-changes-section").merge(changesSection);
62047 changesSection.call(commitChanges.render);
62048 function toggleRequestReview() {
62049 var rr = requestReviewInput.property("checked");
62050 updateChangeset({ review_requested: rr ? "yes" : void 0 });
62052 rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
62056 function getUploadBlockerMessage() {
62057 var errors = context.validator().getIssuesBySeverity({ what: "edited", where: "all" }).error;
62058 if (errors.length) {
62059 return _t.append("commit.outstanding_errors_message", { count: errors.length });
62061 var hasChangesetComment = context.changeset && context.changeset.tags.comment && context.changeset.tags.comment.trim().length;
62062 if (!hasChangesetComment) {
62063 return _t.append("commit.comment_needed_message");
62068 function changeTags(_, changed, onInput) {
62069 if (changed.hasOwnProperty("comment")) {
62070 if (changed.comment === void 0) {
62071 changed.comment = "";
62074 corePreferences("comment", changed.comment);
62075 corePreferences("commentDate", Date.now());
62078 if (changed.hasOwnProperty("source")) {
62079 if (changed.source === void 0) {
62080 corePreferences("source", null);
62081 } else if (!onInput) {
62082 corePreferences("source", changed.source);
62083 corePreferences("commentDate", Date.now());
62086 updateChangeset(changed, onInput);
62088 _selection.call(render);
62091 function findHashtags(tags, commentOnly) {
62092 var detectedHashtags = commentHashtags();
62093 if (detectedHashtags.length) {
62094 corePreferences("hashtags", null);
62096 if (!detectedHashtags.length || !commentOnly) {
62097 detectedHashtags = detectedHashtags.concat(hashtagHashtags());
62099 var allLowerCase = /* @__PURE__ */ new Set();
62100 return detectedHashtags.filter(function(hashtag) {
62101 var lowerCase = hashtag.toLowerCase();
62102 if (!allLowerCase.has(lowerCase)) {
62103 allLowerCase.add(lowerCase);
62108 function commentHashtags() {
62109 var matches = (tags.comment || "").replace(/http\S*/g, "").match(hashtagRegex);
62110 return matches || [];
62112 function hashtagHashtags() {
62113 var matches = (tags.hashtags || "").split(/[,;\s]+/).map(function(s) {
62114 if (s[0] !== "#") {
62117 var matched = s.match(hashtagRegex);
62118 return matched && matched[0];
62119 }).filter(Boolean);
62120 return matches || [];
62123 function isReviewRequested(tags) {
62124 var rr = tags.review_requested;
62127 rr = rr.trim().toLowerCase();
62128 return !(rr === "" || rr === "no");
62130 function updateChangeset(changed, onInput) {
62131 var tags = Object.assign({}, context.changeset.tags);
62132 Object.keys(changed).forEach(function(k) {
62133 var v = changed[k];
62134 k = context.cleanTagKey(k);
62135 if (readOnlyTags.indexOf(k) !== -1)
62137 if (v === void 0) {
62139 } else if (onInput) {
62142 tags[k] = context.cleanTagValue(v);
62146 var commentOnly = changed.hasOwnProperty("comment") && changed.comment !== "";
62147 var arr = findHashtags(tags, commentOnly);
62149 tags.hashtags = context.cleanTagValue(arr.join(";"));
62150 corePreferences("hashtags", tags.hashtags);
62152 delete tags.hashtags;
62153 corePreferences("hashtags", null);
62156 if (_userDetails2 && _userDetails2.changesets_count !== void 0) {
62157 var changesetsCount = parseInt(_userDetails2.changesets_count, 10) + 1;
62158 tags.changesets_count = String(changesetsCount);
62159 if (changesetsCount <= 100) {
62161 s = corePreferences("walkthrough_completed");
62163 tags["ideditor:walkthrough_completed"] = s;
62165 s = corePreferences("walkthrough_progress");
62167 tags["ideditor:walkthrough_progress"] = s;
62169 s = corePreferences("walkthrough_started");
62171 tags["ideditor:walkthrough_started"] = s;
62175 delete tags.changesets_count;
62177 if (!(0, import_fast_deep_equal9.default)(context.changeset.tags, tags)) {
62178 context.changeset = context.changeset.update({ tags });
62181 commit.reset = function() {
62182 context.changeset = null;
62184 return utilRebind(commit, dispatch10, "on");
62187 // modules/ui/confirm.js
62188 function uiConfirm(selection2) {
62189 var modalSelection = uiModal(selection2);
62190 modalSelection.select(".modal").classed("modal-alert", true);
62191 var section = modalSelection.select(".content");
62192 section.append("div").attr("class", "modal-section header");
62193 section.append("div").attr("class", "modal-section message-text");
62194 var buttons = section.append("div").attr("class", "modal-section buttons cf");
62195 modalSelection.okButton = function() {
62196 buttons.append("button").attr("class", "button ok-button action").on("click.confirm", function() {
62197 modalSelection.remove();
62198 }).call(_t.append("confirm.okay")).node().focus();
62199 return modalSelection;
62201 return modalSelection;
62204 // modules/ui/conflicts.js
62205 function uiConflicts(context) {
62206 var dispatch10 = dispatch_default("cancel", "save");
62207 var keybinding = utilKeybinding("conflicts");
62210 var _shownConflictIndex;
62211 function keybindingOn() {
62212 select_default2(document).call(keybinding.on("\u238B", cancel, true));
62214 function keybindingOff() {
62215 select_default2(document).call(keybinding.unbind);
62217 function tryAgain() {
62219 dispatch10.call("save");
62221 function cancel() {
62223 dispatch10.call("cancel");
62225 function conflicts(selection2) {
62227 var headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
62228 headerEnter.append("button").attr("class", "fr").attr("title", _t("icons.close")).on("click", cancel).call(svgIcon("#iD-icon-close"));
62229 headerEnter.append("h2").call(_t.append("save.conflict.header"));
62230 var bodyEnter = selection2.selectAll(".body").data([0]).enter().append("div").attr("class", "body fillL");
62231 var conflictsHelpEnter = bodyEnter.append("div").attr("class", "conflicts-help").call(_t.append("save.conflict.help"));
62232 var changeset = new osmChangeset();
62233 delete changeset.id;
62234 var data = JXON.stringify(changeset.osmChangeJXON(_origChanges));
62235 var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
62236 var fileName = "changes.osc";
62237 var linkEnter = conflictsHelpEnter.selectAll(".download-changes").append("a").attr("class", "download-changes");
62238 linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
62239 linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("save.conflict.download_changes"));
62240 bodyEnter.append("div").attr("class", "conflict-container fillL3").call(showConflict, 0);
62241 bodyEnter.append("div").attr("class", "conflicts-done").attr("opacity", 0).style("display", "none").call(_t.append("save.conflict.done"));
62242 var buttonsEnter = bodyEnter.append("div").attr("class", "buttons col12 joined conflicts-buttons");
62243 buttonsEnter.append("button").attr("disabled", _conflictList.length > 1).attr("class", "action conflicts-button col6").call(_t.append("save.title")).on("click.try_again", tryAgain);
62244 buttonsEnter.append("button").attr("class", "secondary-action conflicts-button col6").call(_t.append("confirm.cancel")).on("click.cancel", cancel);
62246 function showConflict(selection2, index) {
62247 index = utilWrap(index, _conflictList.length);
62248 _shownConflictIndex = index;
62249 var parent = select_default2(selection2.node().parentNode);
62250 if (index === _conflictList.length - 1) {
62251 window.setTimeout(function() {
62252 parent.select(".conflicts-button").attr("disabled", null);
62253 parent.select(".conflicts-done").transition().attr("opacity", 1).style("display", "block");
62256 var conflict = selection2.selectAll(".conflict").data([_conflictList[index]]);
62257 conflict.exit().remove();
62258 var conflictEnter = conflict.enter().append("div").attr("class", "conflict");
62259 conflictEnter.append("h4").attr("class", "conflict-count").call(_t.append("save.conflict.count", { num: index + 1, total: _conflictList.length }));
62260 conflictEnter.append("a").attr("class", "conflict-description").attr("href", "#").text(function(d) {
62262 }).on("click", function(d3_event, d) {
62263 d3_event.preventDefault();
62264 zoomToEntity(d.id);
62266 var details = conflictEnter.append("div").attr("class", "conflict-detail-container");
62267 details.append("ul").attr("class", "conflict-detail-list").selectAll("li").data(function(d) {
62268 return d.details || [];
62269 }).enter().append("li").attr("class", "conflict-detail-item").html(function(d) {
62272 details.append("div").attr("class", "conflict-choices").call(addChoices);
62273 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) {
62274 return i2 === 0 && index === 0 || i2 === 1 && index === _conflictList.length - 1 || null;
62275 }).on("click", function(d3_event, d) {
62276 d3_event.preventDefault();
62277 var container = parent.selectAll(".conflict-container");
62278 var sign2 = d === "previous" ? -1 : 1;
62279 container.selectAll(".conflict").remove();
62280 container.call(showConflict, index + sign2);
62281 }).each(function(d) {
62282 _t.append("save.conflict." + d)(select_default2(this));
62285 function addChoices(selection2) {
62286 var choices = selection2.append("ul").attr("class", "layer-list").selectAll("li").data(function(d) {
62287 return d.choices || [];
62289 var choicesEnter = choices.enter().append("li").attr("class", "layer");
62290 var labelEnter = choicesEnter.append("label");
62291 labelEnter.append("input").attr("type", "radio").attr("name", function(d) {
62293 }).on("change", function(d3_event, d) {
62294 var ul = this.parentNode.parentNode.parentNode;
62295 ul.__data__.chosen = d.id;
62296 choose(d3_event, ul, d);
62298 labelEnter.append("span").text(function(d) {
62301 choicesEnter.merge(choices).each(function(d) {
62302 var ul = this.parentNode;
62303 if (ul.__data__.chosen === d.id) {
62304 choose(null, ul, d);
62308 function choose(d3_event, ul, datum2) {
62310 d3_event.preventDefault();
62311 select_default2(ul).selectAll("li").classed("active", function(d) {
62312 return d === datum2;
62313 }).selectAll("input").property("checked", function(d) {
62314 return d === datum2;
62316 var extent = geoExtent();
62318 entity = context.graph().hasEntity(datum2.id);
62320 extent._extend(entity.extent(context.graph()));
62322 entity = context.graph().hasEntity(datum2.id);
62324 extent._extend(entity.extent(context.graph()));
62325 zoomToEntity(datum2.id, extent);
62327 function zoomToEntity(id2, extent) {
62328 context.surface().selectAll(".hover").classed("hover", false);
62329 var entity = context.graph().hasEntity(id2);
62332 context.map().trimmedExtent(extent);
62334 context.map().zoomToEase(entity);
62336 context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
62339 conflicts.conflictList = function(_) {
62340 if (!arguments.length)
62341 return _conflictList;
62345 conflicts.origChanges = function(_) {
62346 if (!arguments.length)
62347 return _origChanges;
62351 conflicts.shownEntityIds = function() {
62352 if (_conflictList && typeof _shownConflictIndex === "number") {
62353 return [_conflictList[_shownConflictIndex].id];
62357 return utilRebind(conflicts, dispatch10, "on");
62360 // modules/ui/entity_editor.js
62361 var import_fast_deep_equal10 = __toESM(require_fast_deep_equal());
62363 // modules/ui/sections/entity_issues.js
62364 function uiSectionEntityIssues(context) {
62365 var preference = corePreferences("entity-issues.reference.expanded");
62366 var _expanded = preference === null ? true : preference === "true";
62367 var _entityIDs = [];
62369 var _activeIssueID;
62370 var section = uiSection("entity-issues", context).shouldDisplay(function() {
62371 return _issues.length > 0;
62372 }).label(function() {
62373 return _t.append("inspector.title_count", { title: _t("issues.list_title"), count: _issues.length });
62374 }).disclosureContent(renderDisclosureContent);
62375 context.validator().on("validated.entity_issues", function() {
62377 section.reRender();
62378 }).on("focusedIssue.entity_issues", function(issue) {
62379 makeActiveIssue(issue.id);
62381 function reloadIssues() {
62382 _issues = context.validator().getSharedEntityIssues(_entityIDs, { includeDisabledRules: true });
62384 function makeActiveIssue(issueID) {
62385 _activeIssueID = issueID;
62386 section.selection().selectAll(".issue-container").classed("active", function(d) {
62387 return d.id === _activeIssueID;
62390 function renderDisclosureContent(selection2) {
62391 selection2.classed("grouped-items-area", true);
62392 _activeIssueID = _issues.length > 0 ? _issues[0].id : null;
62393 var containers = selection2.selectAll(".issue-container").data(_issues, function(d) {
62396 containers.exit().remove();
62397 var containersEnter = containers.enter().append("div").attr("class", "issue-container");
62398 var itemsEnter = containersEnter.append("div").attr("class", function(d) {
62399 return "issue severity-" + d.severity;
62400 }).on("mouseover.highlight", function(d3_event, d) {
62401 var ids = d.entityIds.filter(function(e) {
62402 return _entityIDs.indexOf(e) === -1;
62404 utilHighlightEntities(ids, true, context);
62405 }).on("mouseout.highlight", function(d3_event, d) {
62406 var ids = d.entityIds.filter(function(e) {
62407 return _entityIDs.indexOf(e) === -1;
62409 utilHighlightEntities(ids, false, context);
62411 var labelsEnter = itemsEnter.append("div").attr("class", "issue-label");
62412 var textEnter = labelsEnter.append("button").attr("class", "issue-text").on("click", function(d3_event, d) {
62413 makeActiveIssue(d.id);
62414 var extent = d.extent(context.graph());
62416 var setZoom = Math.max(context.map().zoom(), 19);
62417 context.map().unobscuredCenterZoomEase(extent.center(), setZoom);
62420 textEnter.each(function(d) {
62421 var iconName = "#iD-icon-" + (d.severity === "warning" ? "alert" : "error");
62422 select_default2(this).call(svgIcon(iconName, "issue-icon"));
62424 textEnter.append("span").attr("class", "issue-message");
62425 var infoButton = labelsEnter.append("button").attr("class", "issue-info-button").attr("title", _t("icons.information")).call(svgIcon("#iD-icon-inspect"));
62426 infoButton.on("click", function(d3_event) {
62427 d3_event.stopPropagation();
62428 d3_event.preventDefault();
62430 var container = select_default2(this.parentNode.parentNode.parentNode);
62431 var info = container.selectAll(".issue-info");
62432 var isExpanded = info.classed("expanded");
62433 _expanded = !isExpanded;
62434 corePreferences("entity-issues.reference.expanded", _expanded);
62436 info.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
62437 info.classed("expanded", false);
62440 info.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1").on("end", function() {
62441 info.style("max-height", null);
62445 itemsEnter.append("ul").attr("class", "issue-fix-list");
62446 containersEnter.append("div").attr("class", "issue-info" + (_expanded ? " expanded" : "")).style("max-height", _expanded ? null : "0").style("opacity", _expanded ? "1" : "0").each(function(d) {
62447 if (typeof d.reference === "function") {
62448 select_default2(this).call(d.reference);
62450 select_default2(this).call(_t.append("inspector.no_documentation_key"));
62453 containers = containers.merge(containersEnter).classed("active", function(d) {
62454 return d.id === _activeIssueID;
62456 containers.selectAll(".issue-message").text("").each(function(d) {
62457 return d.message(context)(select_default2(this));
62459 var fixLists = containers.selectAll(".issue-fix-list");
62460 var fixes = fixLists.selectAll(".issue-fix-item").data(function(d) {
62461 return d.fixes ? d.fixes(context) : [];
62465 fixes.exit().remove();
62466 var fixesEnter = fixes.enter().append("li").attr("class", "issue-fix-item");
62467 var buttons = fixesEnter.append("button").on("click", function(d3_event, d) {
62468 if (select_default2(this).attr("disabled") || !d.onClick)
62470 if (d.issue.dateLastRanFix && new Date() - d.issue.dateLastRanFix < 1e3)
62472 d.issue.dateLastRanFix = new Date();
62473 utilHighlightEntities(d.issue.entityIds.concat(d.entityIds), false, context);
62474 new Promise(function(resolve, reject) {
62475 d.onClick(context, resolve, reject);
62476 if (d.onClick.length <= 1) {
62479 }).then(function() {
62480 context.validator().validate();
62482 }).on("mouseover.highlight", function(d3_event, d) {
62483 utilHighlightEntities(d.entityIds, true, context);
62484 }).on("mouseout.highlight", function(d3_event, d) {
62485 utilHighlightEntities(d.entityIds, false, context);
62487 buttons.each(function(d) {
62488 var iconName = d.icon || "iD-icon-wrench";
62489 if (iconName.startsWith("maki")) {
62492 select_default2(this).call(svgIcon("#" + iconName, "fix-icon"));
62494 buttons.append("span").attr("class", "fix-message").each(function(d) {
62495 return d.title(select_default2(this));
62497 fixesEnter.merge(fixes).selectAll("button").classed("actionable", function(d) {
62499 }).attr("disabled", function(d) {
62500 return d.onClick ? null : "true";
62501 }).attr("title", function(d) {
62502 if (d.disabledReason) {
62503 return d.disabledReason;
62508 section.entityIDs = function(val) {
62509 if (!arguments.length)
62511 if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
62513 _activeIssueID = null;
62521 // modules/ui/preset_icon.js
62522 function uiPresetIcon() {
62525 function presetIcon(selection2) {
62526 selection2.each(render);
62528 function getIcon(p, geom) {
62529 if (p.isFallback && p.isFallback())
62530 return geom === "vertex" ? "" : "iD-icon-" + p.id;
62533 if (geom === "line")
62534 return "iD-other-line";
62535 if (geom === "vertex")
62536 return "temaki-vertex";
62537 return "maki-marker-stroked";
62539 function renderPointBorder(container, drawPoint) {
62540 let pointBorder = container.selectAll(".preset-icon-point-border").data(drawPoint ? [0] : []);
62541 pointBorder.exit().remove();
62542 let pointBorderEnter = pointBorder.enter();
62545 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");
62546 pointBorder = pointBorderEnter.merge(pointBorder);
62548 function renderCategoryBorder(container, category) {
62549 let categoryBorder = container.selectAll(".preset-icon-category-border").data(category ? [0] : []);
62550 categoryBorder.exit().remove();
62551 let categoryBorderEnter = categoryBorder.enter();
62553 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}`);
62554 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");
62555 categoryBorder = categoryBorderEnter.merge(categoryBorder);
62557 categoryBorder.selectAll("path").attr("class", `area ${category.id}`);
62560 function renderCircleFill(container, drawVertex) {
62561 let vertexFill = container.selectAll(".preset-icon-fill-vertex").data(drawVertex ? [0] : []);
62562 vertexFill.exit().remove();
62563 let vertexFillEnter = vertexFill.enter();
62567 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);
62568 vertexFill = vertexFillEnter.merge(vertexFill);
62570 function renderSquareFill(container, drawArea, tagClasses) {
62571 let fill = container.selectAll(".preset-icon-fill-area").data(drawArea ? [0] : []);
62572 fill.exit().remove();
62573 let fillEnter = fill.enter();
62577 const l = d * 2 / 3;
62578 const c1 = (w - l) / 2;
62580 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}`);
62581 ["fill", "stroke"].forEach((klass) => {
62582 fillEnter.append("path").attr("d", `M${c1} ${c1} L${c1} ${c2} L${c2} ${c2} L${c2} ${c1} Z`).attr("class", `area ${klass}`);
62584 const rVertex = 2.5;
62585 [[c1, c1], [c1, c2], [c2, c2], [c2, c1]].forEach((point2) => {
62586 fillEnter.append("circle").attr("class", "vertex").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", rVertex);
62588 const rMidpoint = 1.25;
62589 [[c1, w / 2], [c2, w / 2], [h / 2, c1], [h / 2, c2]].forEach((point2) => {
62590 fillEnter.append("circle").attr("class", "midpoint").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", rMidpoint);
62592 fill = fillEnter.merge(fill);
62593 fill.selectAll("path.stroke").attr("class", `area stroke ${tagClasses}`);
62594 fill.selectAll("path.fill").attr("class", `area fill ${tagClasses}`);
62596 function renderLine(container, drawLine, tagClasses) {
62597 let line = container.selectAll(".preset-icon-line").data(drawLine ? [0] : []);
62598 line.exit().remove();
62599 let lineEnter = line.enter();
62603 const y = Math.round(d * 0.72);
62604 const l = Math.round(d * 0.6);
62606 const x12 = (w - l) / 2;
62607 const x2 = x12 + l;
62608 lineEnter = lineEnter.append("svg").attr("class", "preset-icon-line").attr("width", w).attr("height", h).attr("viewBox", `0 0 ${w} ${h}`);
62609 ["casing", "stroke"].forEach((klass) => {
62610 lineEnter.append("path").attr("d", `M${x12} ${y} L${x2} ${y}`).attr("class", `line ${klass}`);
62612 [[x12 - 1, y], [x2 + 1, y]].forEach((point2) => {
62613 lineEnter.append("circle").attr("class", "vertex").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", r);
62615 line = lineEnter.merge(line);
62616 line.selectAll("path.stroke").attr("class", `line stroke ${tagClasses}`);
62617 line.selectAll("path.casing").attr("class", `line casing ${tagClasses}`);
62619 function renderRoute(container, drawRoute, p) {
62620 let route = container.selectAll(".preset-icon-route").data(drawRoute ? [0] : []);
62621 route.exit().remove();
62622 let routeEnter = route.enter();
62626 const y12 = Math.round(d * 0.8);
62627 const y2 = Math.round(d * 0.68);
62628 const l = Math.round(d * 0.6);
62630 const x12 = (w - l) / 2;
62631 const x2 = x12 + l / 3;
62632 const x3 = x2 + l / 3;
62633 const x4 = x3 + l / 3;
62634 routeEnter = routeEnter.append("svg").attr("class", "preset-icon-route").attr("width", w).attr("height", h).attr("viewBox", `0 0 ${w} ${h}`);
62635 ["casing", "stroke"].forEach((klass) => {
62636 routeEnter.append("path").attr("d", `M${x12} ${y12} L${x2} ${y2}`).attr("class", `segment0 line ${klass}`);
62637 routeEnter.append("path").attr("d", `M${x2} ${y2} L${x3} ${y12}`).attr("class", `segment1 line ${klass}`);
62638 routeEnter.append("path").attr("d", `M${x3} ${y12} L${x4} ${y2}`).attr("class", `segment2 line ${klass}`);
62640 [[x12, y12], [x2, y2], [x3, y12], [x4, y2]].forEach((point2) => {
62641 routeEnter.append("circle").attr("class", "vertex").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", r);
62643 route = routeEnter.merge(route);
62645 let routeType = p.tags.type === "waterway" ? "waterway" : p.tags.route;
62646 const segmentPresetIDs = routeSegments[routeType];
62647 for (let i2 in segmentPresetIDs) {
62648 const segmentPreset = _mainPresetIndex.item(segmentPresetIDs[i2]);
62649 const segmentTagClasses = svgTagClasses().getClassesString(segmentPreset.tags, "");
62650 route.selectAll(`path.stroke.segment${i2}`).attr("class", `segment${i2} line stroke ${segmentTagClasses}`);
62651 route.selectAll(`path.casing.segment${i2}`).attr("class", `segment${i2} line casing ${segmentTagClasses}`);
62655 function renderSvgIcon(container, picon, geom, isFramed, category, tagClasses) {
62656 const isMaki = picon && /^maki-/.test(picon);
62657 const isTemaki = picon && /^temaki-/.test(picon);
62658 const isFa = picon && /^fa[srb]-/.test(picon);
62659 const isiDIcon = picon && !(isMaki || isTemaki || isFa);
62660 let icon2 = container.selectAll(".preset-icon").data(picon ? [0] : []);
62661 icon2.exit().remove();
62662 icon2 = icon2.enter().append("div").attr("class", "preset-icon").call(svgIcon("")).merge(icon2);
62663 icon2.attr("class", "preset-icon " + (geom ? geom + "-geom" : "")).classed("category", category).classed("framed", isFramed).classed("preset-icon-iD", isiDIcon);
62664 icon2.selectAll("svg").attr("class", "icon " + picon + " " + (!isiDIcon && geom !== "line" ? "" : tagClasses));
62665 icon2.selectAll("use").attr("href", "#" + picon);
62667 function renderImageIcon(container, imageURL) {
62668 let imageIcon = container.selectAll("img.image-icon").data(imageURL ? [0] : []);
62669 imageIcon.exit().remove();
62670 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);
62671 imageIcon.attr("src", imageURL);
62673 const routeSegments = {
62674 bicycle: ["highway/cycleway", "highway/cycleway", "highway/cycleway"],
62675 bus: ["highway/unclassified", "highway/secondary", "highway/primary"],
62676 trolleybus: ["highway/unclassified", "highway/secondary", "highway/primary"],
62677 detour: ["highway/tertiary", "highway/residential", "highway/unclassified"],
62678 ferry: ["route/ferry", "route/ferry", "route/ferry"],
62679 foot: ["highway/footway", "highway/footway", "highway/footway"],
62680 hiking: ["highway/path", "highway/path", "highway/path"],
62681 horse: ["highway/bridleway", "highway/bridleway", "highway/bridleway"],
62682 light_rail: ["railway/light_rail", "railway/light_rail", "railway/light_rail"],
62683 monorail: ["railway/monorail", "railway/monorail", "railway/monorail"],
62684 mtb: ["highway/path", "highway/track", "highway/bridleway"],
62685 pipeline: ["man_made/pipeline", "man_made/pipeline", "man_made/pipeline"],
62686 piste: ["piste/downhill", "piste/hike", "piste/nordic"],
62687 power: ["power/line", "power/line", "power/line"],
62688 road: ["highway/secondary", "highway/primary", "highway/trunk"],
62689 subway: ["railway/subway", "railway/subway", "railway/subway"],
62690 train: ["railway/rail", "railway/rail", "railway/rail"],
62691 tram: ["railway/tram", "railway/tram", "railway/tram"],
62692 waterway: ["waterway/stream", "waterway/stream", "waterway/stream"]
62694 function render() {
62695 let p = _preset.apply(this, arguments);
62696 let geom = _geometry ? _geometry.apply(this, arguments) : null;
62697 if (geom === "relation" && p.tags && (p.tags.type === "route" && p.tags.route && routeSegments[p.tags.route] || p.tags.type === "waterway")) {
62700 const showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
62701 const isFallback = p.isFallback && p.isFallback();
62702 const imageURL = showThirdPartyIcons === "true" && p.imageURL;
62703 const picon = getIcon(p, geom);
62704 const isCategory = !p.setTags;
62705 const drawPoint = false;
62706 const drawVertex = picon !== null && geom === "vertex";
62707 const drawLine = picon && geom === "line" && !isFallback && !isCategory;
62708 const drawArea = picon && geom === "area" && !isFallback && !isCategory;
62709 const drawRoute = picon && geom === "route";
62710 const isFramed = drawVertex || drawArea || drawLine || drawRoute || isCategory;
62711 let tags = !isCategory ? p.setTags({}, geom) : {};
62712 for (let k in tags) {
62713 if (tags[k] === "*") {
62717 let tagClasses = svgTagClasses().getClassesString(tags, "");
62718 let selection2 = select_default2(this);
62719 let container = selection2.selectAll(".preset-icon-container").data([0]);
62720 container = container.enter().append("div").attr("class", "preset-icon-container").merge(container);
62721 container.classed("showing-img", !!imageURL).classed("fallback", isFallback);
62722 renderCategoryBorder(container, isCategory && p);
62723 renderPointBorder(container, drawPoint);
62724 renderCircleFill(container, drawVertex);
62725 renderSquareFill(container, drawArea, tagClasses);
62726 renderLine(container, drawLine, tagClasses);
62727 renderRoute(container, drawRoute, p);
62728 renderSvgIcon(container, picon, geom, isFramed, isCategory, tagClasses);
62729 renderImageIcon(container, imageURL);
62731 presetIcon.preset = function(val) {
62732 if (!arguments.length)
62734 _preset = utilFunctor(val);
62737 presetIcon.geometry = function(val) {
62738 if (!arguments.length)
62740 _geometry = utilFunctor(val);
62746 // modules/ui/sections/feature_type.js
62747 function uiSectionFeatureType(context) {
62748 var dispatch10 = dispatch_default("choose");
62749 var _entityIDs = [];
62752 var section = uiSection("feature-type", context).label(() => _t.append("inspector.feature_type")).disclosureContent(renderDisclosureContent);
62753 function renderDisclosureContent(selection2) {
62754 selection2.classed("preset-list-item", true);
62755 selection2.classed("mixed-types", _presets.length > 1);
62756 var presetButtonWrap = selection2.selectAll(".preset-list-button-wrap").data([0]).enter().append("div").attr("class", "preset-list-button-wrap");
62757 var presetButton = presetButtonWrap.append("button").attr("class", "preset-list-button preset-reset").call(
62758 uiTooltip().title(() => _t.append("inspector.back_tooltip")).placement("bottom")
62760 presetButton.append("div").attr("class", "preset-icon-container");
62761 presetButton.append("div").attr("class", "label").append("div").attr("class", "label-inner");
62762 presetButtonWrap.append("div").attr("class", "accessory-buttons");
62763 var tagReferenceBodyWrap = selection2.selectAll(".tag-reference-body-wrap").data([0]);
62764 tagReferenceBodyWrap = tagReferenceBodyWrap.enter().append("div").attr("class", "tag-reference-body-wrap").merge(tagReferenceBodyWrap);
62765 if (_tagReference) {
62766 selection2.selectAll(".preset-list-button-wrap .accessory-buttons").style("display", _presets.length === 1 ? null : "none").call(_tagReference.button);
62767 tagReferenceBodyWrap.style("display", _presets.length === 1 ? null : "none").call(_tagReference.body);
62769 selection2.selectAll(".preset-reset").on("click", function() {
62770 dispatch10.call("choose", this, _presets);
62771 }).on("pointerdown pointerup mousedown mouseup", function(d3_event) {
62772 d3_event.preventDefault();
62773 d3_event.stopPropagation();
62775 var geometries = entityGeometries();
62776 selection2.select(".preset-list-item button").call(
62777 uiPresetIcon().geometry(_presets.length === 1 ? geometries.length === 1 && geometries[0] : null).preset(_presets.length === 1 ? _presets[0] : _mainPresetIndex.item("point"))
62779 var names = _presets.length === 1 ? [
62780 _presets[0].nameLabel(),
62781 _presets[0].subtitleLabel()
62782 ].filter(Boolean) : [_t.append("inspector.multiple_types")];
62783 var label = selection2.select(".label-inner");
62784 var nameparts = label.selectAll(".namepart").data(names, (d) => d.stringId);
62785 nameparts.exit().remove();
62786 nameparts.enter().append("div").attr("class", "namepart").text("").each(function(d) {
62787 d(select_default2(this));
62790 section.entityIDs = function(val) {
62791 if (!arguments.length)
62796 section.presets = function(val) {
62797 if (!arguments.length)
62799 if (!utilArrayIdentical(val, _presets)) {
62801 if (_presets.length === 1) {
62802 _tagReference = uiTagReference(_presets[0].reference(), context).showing(false);
62807 function entityGeometries() {
62809 for (var i2 in _entityIDs) {
62810 var geometry = context.graph().geometry(_entityIDs[i2]);
62811 if (!counts[geometry])
62812 counts[geometry] = 0;
62813 counts[geometry] += 1;
62815 return Object.keys(counts).sort(function(geom1, geom2) {
62816 return counts[geom2] - counts[geom1];
62819 return utilRebind(section, dispatch10, "on");
62822 // modules/ui/sections/preset_fields.js
62823 function uiSectionPresetFields(context) {
62824 var section = uiSection("preset-fields", context).label(() => _t.append("inspector.fields")).disclosureContent(renderDisclosureContent);
62825 var dispatch10 = dispatch_default("change", "revert");
62826 var formFields = uiFormFields(context);
62832 function renderDisclosureContent(selection2) {
62834 var graph = context.graph();
62835 var geometries = Object.keys(_entityIDs.reduce(function(geoms, entityID) {
62836 geoms[graph.entity(entityID).geometry(graph)] = true;
62839 var presetsManager = _mainPresetIndex;
62840 var allFields = [];
62841 var allMoreFields = [];
62842 var sharedTotalFields;
62843 _presets.forEach(function(preset) {
62844 var fields = preset.fields();
62845 var moreFields = preset.moreFields();
62846 allFields = utilArrayUnion(allFields, fields);
62847 allMoreFields = utilArrayUnion(allMoreFields, moreFields);
62848 if (!sharedTotalFields) {
62849 sharedTotalFields = utilArrayUnion(fields, moreFields);
62851 sharedTotalFields = sharedTotalFields.filter(function(field) {
62852 return fields.indexOf(field) !== -1 || moreFields.indexOf(field) !== -1;
62856 var sharedFields = allFields.filter(function(field) {
62857 return sharedTotalFields.indexOf(field) !== -1;
62859 var sharedMoreFields = allMoreFields.filter(function(field) {
62860 return sharedTotalFields.indexOf(field) !== -1;
62863 sharedFields.forEach(function(field) {
62864 if (field.matchAllGeometry(geometries)) {
62866 uiField(context, field, _entityIDs)
62870 var singularEntity = _entityIDs.length === 1 && graph.hasEntity(_entityIDs[0]);
62871 if (singularEntity && singularEntity.isHighwayIntersection(graph) && presetsManager.field("restrictions")) {
62873 uiField(context, presetsManager.field("restrictions"), _entityIDs)
62876 var additionalFields = utilArrayUnion(sharedMoreFields, presetsManager.universal());
62877 additionalFields.sort(function(field1, field2) {
62878 return field1.title().localeCompare(field2.title(), _mainLocalizer.localeCode());
62880 additionalFields.forEach(function(field) {
62881 if (sharedFields.indexOf(field) === -1 && field.matchAllGeometry(geometries)) {
62883 uiField(context, field, _entityIDs, { show: false })
62887 _fieldsArr.forEach(function(field) {
62888 field.on("change", function(t, onInput) {
62889 dispatch10.call("change", field, _entityIDs, t, onInput);
62890 }).on("revert", function(keys) {
62891 dispatch10.call("revert", field, keys);
62895 _fieldsArr.forEach(function(field) {
62896 field.state(_state).tags(_tags);
62899 formFields.fieldsArr(_fieldsArr).state(_state).klass("grouped-items-area")
62902 section.presets = function(val) {
62903 if (!arguments.length)
62905 if (!_presets || !val || !utilArrayIdentical(_presets, val)) {
62911 section.state = function(val) {
62912 if (!arguments.length)
62917 section.tags = function(val) {
62918 if (!arguments.length)
62923 section.entityIDs = function(val) {
62924 if (!arguments.length)
62926 if (!val || !_entityIDs || !utilArrayIdentical(_entityIDs, val)) {
62932 return utilRebind(section, dispatch10, "on");
62935 // modules/ui/sections/raw_member_editor.js
62936 function uiSectionRawMemberEditor(context) {
62937 var section = uiSection("raw-member-editor", context).shouldDisplay(function() {
62938 if (!_entityIDs || _entityIDs.length !== 1)
62940 var entity = context.hasEntity(_entityIDs[0]);
62941 return entity && entity.type === "relation";
62942 }).label(function() {
62943 var entity = context.hasEntity(_entityIDs[0]);
62946 var gt = entity.members.length > _maxMembers ? ">" : "";
62947 var count = gt + entity.members.slice(0, _maxMembers).length;
62948 return _t.append("inspector.title_count", { title: _t("inspector.members"), count });
62949 }).disclosureContent(renderDisclosureContent);
62950 var taginfo = services.taginfo;
62952 var _maxMembers = 1e3;
62953 function downloadMember(d3_event, d) {
62954 d3_event.preventDefault();
62955 select_default2(this.parentNode).classed("tag-reference-loading", true);
62956 context.loadEntity(d.id, function() {
62957 section.reRender();
62960 function zoomToMember(d3_event, d) {
62961 d3_event.preventDefault();
62962 var entity = context.entity(d.id);
62963 context.map().zoomToEase(entity);
62964 utilHighlightEntities([d.id], true, context);
62966 function selectMember(d3_event, d) {
62967 d3_event.preventDefault();
62968 utilHighlightEntities([d.id], false, context);
62969 var entity = context.entity(d.id);
62970 var mapExtent = context.map().extent();
62971 if (!entity.intersects(mapExtent, context.graph())) {
62972 context.map().zoomToEase(entity);
62974 context.enter(modeSelect(context, [d.id]));
62976 function changeRole(d3_event, d) {
62977 var oldRole = d.role;
62978 var newRole = context.cleanRelationRole(select_default2(this).property("value"));
62979 if (oldRole !== newRole) {
62980 var member = { id: d.id, type: d.type, role: newRole };
62982 actionChangeMember(d.relation.id, member, d.index),
62983 _t("operations.change_role.annotation", {
62987 context.validator().validate();
62990 function deleteMember(d3_event, d) {
62991 utilHighlightEntities([d.id], false, context);
62993 actionDeleteMember(d.relation.id, d.index),
62994 _t("operations.delete_member.annotation", {
62998 if (!context.hasEntity(d.relation.id)) {
62999 context.enter(modeBrowse(context));
63001 context.validator().validate();
63004 function renderDisclosureContent(selection2) {
63005 var entityID = _entityIDs[0];
63006 var memberships = [];
63007 var entity = context.entity(entityID);
63008 entity.members.slice(0, _maxMembers).forEach(function(member, index) {
63015 member: context.hasEntity(member.id),
63016 domId: utilUniqueDomId(entityID + "-member-" + index)
63019 var list = selection2.selectAll(".member-list").data([0]);
63020 list = list.enter().append("ul").attr("class", "member-list").merge(list);
63021 var items = list.selectAll("li").data(memberships, function(d) {
63022 return osmEntity.key(d.relation) + "," + d.index + "," + (d.member ? osmEntity.key(d.member) : "incomplete");
63024 items.exit().each(unbind).remove();
63025 var itemsEnter = items.enter().append("li").attr("class", "member-row form-field").classed("member-incomplete", function(d) {
63028 itemsEnter.each(function(d) {
63029 var item = select_default2(this);
63030 var label = item.append("label").attr("class", "field-label").attr("for", d.domId);
63032 item.on("mouseover", function() {
63033 utilHighlightEntities([d.id], true, context);
63034 }).on("mouseout", function() {
63035 utilHighlightEntities([d.id], false, context);
63037 var labelLink = label.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectMember);
63038 labelLink.append("span").attr("class", "member-entity-type").text(function(d2) {
63039 var matched = _mainPresetIndex.match(d2.member, context.graph());
63040 return matched && matched.name() || utilDisplayType(d2.member.id);
63042 labelLink.append("span").attr("class", "member-entity-name").text(function(d2) {
63043 return utilDisplayName(d2.member);
63045 label.append("button").attr("title", _t("icons.remove")).attr("class", "remove member-delete").call(svgIcon("#iD-operation-delete"));
63046 label.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToMember);
63048 var labelText = label.append("span").attr("class", "label-text");
63049 labelText.append("span").attr("class", "member-entity-type").call(_t.append("inspector." + d.type, { id: d.id }));
63050 labelText.append("span").attr("class", "member-entity-name").call(_t.append("inspector.incomplete", { id: d.id }));
63051 label.append("button").attr("class", "member-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMember);
63054 var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
63055 wrapEnter.append("input").attr("class", "member-role").attr("id", function(d) {
63057 }).property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
63059 wrapEnter.each(bindTypeahead);
63061 items = items.merge(itemsEnter).order();
63062 items.select("input.member-role").property("value", function(d) {
63064 }).on("blur", changeRole).on("change", changeRole);
63065 items.select("button.member-delete").on("click", deleteMember);
63066 var dragOrigin, targetIndex;
63068 drag_default().on("start", function(d3_event) {
63073 targetIndex = null;
63074 }).on("drag", function(d3_event) {
63075 var x = d3_event.x - dragOrigin.x, y = d3_event.y - dragOrigin.y;
63076 if (!select_default2(this).classed("dragging") && Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) <= 5)
63078 var index = items.nodes().indexOf(this);
63079 select_default2(this).classed("dragging", true);
63080 targetIndex = null;
63081 selection2.selectAll("li.member-row").style("transform", function(d2, index2) {
63082 var node = select_default2(this).node();
63083 if (index === index2) {
63084 return "translate(" + x + "px, " + y + "px)";
63085 } else if (index2 > index && d3_event.y > node.offsetTop) {
63086 if (targetIndex === null || index2 > targetIndex) {
63087 targetIndex = index2;
63089 return "translateY(-100%)";
63090 } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
63091 if (targetIndex === null || index2 < targetIndex) {
63092 targetIndex = index2;
63094 return "translateY(100%)";
63098 }).on("end", function(d3_event, d) {
63099 if (!select_default2(this).classed("dragging"))
63101 var index = items.nodes().indexOf(this);
63102 select_default2(this).classed("dragging", false);
63103 selection2.selectAll("li.member-row").style("transform", null);
63104 if (targetIndex !== null) {
63106 actionMoveMember(d.relation.id, index, targetIndex),
63107 _t("operations.reorder_members.annotation")
63109 context.validator().validate();
63113 function bindTypeahead(d) {
63114 var row = select_default2(this);
63115 var role = row.selectAll("input.member-role");
63116 var origValue = role.property("value");
63117 function sort(value, data) {
63118 var sameletter = [];
63120 for (var i2 = 0; i2 < data.length; i2++) {
63121 if (data[i2].value.substring(0, value.length) === value) {
63122 sameletter.push(data[i2]);
63124 other.push(data[i2]);
63127 return sameletter.concat(other);
63130 uiCombobox(context, "member-role").fetcher(function(role2, callback) {
63133 geometry = context.graph().geometry(d.member.id);
63134 } else if (d.type === "relation") {
63135 geometry = "relation";
63136 } else if (d.type === "way") {
63139 geometry = "point";
63141 var rtype = entity.tags.type;
63144 rtype: rtype || "",
63147 }, function(err, data) {
63149 callback(sort(role2, data));
63151 }).on("cancel", function() {
63152 role.property("value", origValue);
63156 function unbind() {
63157 var row = select_default2(this);
63158 row.selectAll("input.member-role").call(uiCombobox.off, context);
63161 section.entityIDs = function(val) {
63162 if (!arguments.length)
63170 // modules/actions/delete_members.js
63171 function actionDeleteMembers(relationId, memberIndexes) {
63172 return function(graph) {
63173 memberIndexes.sort((a, b) => b - a);
63174 for (var i2 in memberIndexes) {
63175 graph = actionDeleteMember(relationId, memberIndexes[i2])(graph);
63181 // modules/ui/sections/raw_membership_editor.js
63182 function uiSectionRawMembershipEditor(context) {
63183 var section = uiSection("raw-membership-editor", context).shouldDisplay(function() {
63184 return _entityIDs && _entityIDs.length;
63185 }).label(function() {
63186 var parents = getSharedParentRelations();
63187 var gt = parents.length > _maxMemberships ? ">" : "";
63188 var count = gt + parents.slice(0, _maxMemberships).length;
63189 return _t.append("inspector.title_count", { title: _t("inspector.relations"), count });
63190 }).disclosureContent(renderDisclosureContent);
63191 var taginfo = services.taginfo;
63192 var nearbyCombo = uiCombobox(context, "parent-relation").minItems(1).fetcher(fetchNearbyRelations).itemsMouseEnter(function(d3_event, d) {
63194 utilHighlightEntities([d.relation.id], true, context);
63195 }).itemsMouseLeave(function(d3_event, d) {
63197 utilHighlightEntities([d.relation.id], false, context);
63199 var _inChange = false;
63200 var _entityIDs = [];
63202 var _maxMemberships = 1e3;
63203 function getSharedParentRelations() {
63205 for (var i2 = 0; i2 < _entityIDs.length; i2++) {
63206 var entity = context.graph().hasEntity(_entityIDs[i2]);
63210 parents = context.graph().parentRelations(entity);
63212 parents = utilArrayIntersection(parents, context.graph().parentRelations(entity));
63214 if (!parents.length)
63219 function getMemberships() {
63220 var memberships = [];
63221 var relations = getSharedParentRelations().slice(0, _maxMemberships);
63222 var isMultiselect = _entityIDs.length > 1;
63223 var i2, relation, membership, index, member, indexedMember;
63224 for (i2 = 0; i2 < relations.length; i2++) {
63225 relation = relations[i2];
63229 hash: osmEntity.key(relation)
63231 for (index = 0; index < relation.members.length; index++) {
63232 member = relation.members[index];
63233 if (_entityIDs.indexOf(member.id) !== -1) {
63234 indexedMember = Object.assign({}, member, { index });
63235 membership.members.push(indexedMember);
63236 membership.hash += "," + index.toString();
63237 if (!isMultiselect) {
63238 memberships.push(membership);
63242 hash: osmEntity.key(relation)
63247 if (membership.members.length)
63248 memberships.push(membership);
63250 memberships.forEach(function(membership2) {
63251 membership2.domId = utilUniqueDomId("membership-" + membership2.relation.id);
63253 membership2.members.forEach(function(member2) {
63254 if (roles.indexOf(member2.role) === -1)
63255 roles.push(member2.role);
63257 membership2.role = roles.length === 1 ? roles[0] : roles;
63259 return memberships;
63261 function selectRelation(d3_event, d) {
63262 d3_event.preventDefault();
63263 utilHighlightEntities([d.relation.id], false, context);
63264 context.enter(modeSelect(context, [d.relation.id]));
63266 function zoomToRelation(d3_event, d) {
63267 d3_event.preventDefault();
63268 var entity = context.entity(d.relation.id);
63269 context.map().zoomToEase(entity);
63270 utilHighlightEntities([d.relation.id], true, context);
63272 function changeRole(d3_event, d) {
63277 var newRole = context.cleanRelationRole(select_default2(this).property("value"));
63278 if (!newRole.trim() && typeof d.role !== "string")
63280 var membersToUpdate = d.members.filter(function(member) {
63281 return member.role !== newRole;
63283 if (membersToUpdate.length) {
63286 function actionChangeMemberRoles(graph) {
63287 membersToUpdate.forEach(function(member) {
63288 var newMember = Object.assign({}, member, { role: newRole });
63289 delete newMember.index;
63290 graph = actionChangeMember(d.relation.id, newMember, member.index)(graph);
63294 _t("operations.change_role.annotation", {
63295 n: membersToUpdate.length
63298 context.validator().validate();
63302 function addMembership(d, role) {
63304 _showBlank = false;
63305 function actionAddMembers(relationId, ids, role2) {
63306 return function(graph) {
63307 for (var i2 in ids) {
63308 var member = { id: ids[i2], type: graph.entity(ids[i2]).type, role: role2 };
63309 graph = actionAddMember(relationId, member)(graph);
63316 actionAddMembers(d.relation.id, _entityIDs, role),
63317 _t("operations.add_member.annotation", {
63318 n: _entityIDs.length
63321 context.validator().validate();
63323 var relation = osmRelation();
63325 actionAddEntity(relation),
63326 actionAddMembers(relation.id, _entityIDs, role),
63327 _t("operations.add.annotation.relation")
63329 context.enter(modeSelect(context, [relation.id]).newFeature(true));
63332 function deleteMembership(d3_event, d) {
63336 utilHighlightEntities([d.relation.id], false, context);
63337 var indexes = d.members.map(function(member) {
63338 return member.index;
63341 actionDeleteMembers(d.relation.id, indexes),
63342 _t("operations.delete_member.annotation", {
63343 n: _entityIDs.length
63346 context.validator().validate();
63348 function fetchNearbyRelations(q, callback) {
63349 var newRelation = {
63351 value: _t("inspector.new_relation"),
63352 display: _t.append("inspector.new_relation")
63354 var entityID = _entityIDs[0];
63356 var graph = context.graph();
63357 function baseDisplayLabel(entity) {
63358 var matched = _mainPresetIndex.match(entity, graph);
63359 var presetName = matched && matched.name() || _t("inspector.relation");
63360 var entityName = utilDisplayName(entity) || "";
63361 return presetName + " " + entityName;
63363 var explicitRelation = q && context.hasEntity(q.toLowerCase());
63364 if (explicitRelation && explicitRelation.type === "relation" && explicitRelation.id !== entityID) {
63366 relation: explicitRelation,
63367 value: baseDisplayLabel(explicitRelation) + " " + explicitRelation.id
63370 context.history().intersects(context.map().extent()).forEach(function(entity) {
63371 if (entity.type !== "relation" || entity.id === entityID)
63373 var value = baseDisplayLabel(entity);
63374 if (q && (value + " " + entity.id).toLowerCase().indexOf(q.toLowerCase()) === -1)
63376 result.push({ relation: entity, value });
63378 result.sort(function(a, b) {
63379 return osmRelation.creationOrder(a.relation, b.relation);
63381 var dupeGroups = Object.values(utilArrayGroupBy(result, "value")).filter(function(v) {
63382 return v.length > 1;
63384 dupeGroups.forEach(function(group) {
63385 group.forEach(function(obj) {
63386 obj.value += " " + obj.relation.id;
63390 result.forEach(function(obj) {
63391 obj.title = obj.value;
63393 result.unshift(newRelation);
63396 function renderDisclosureContent(selection2) {
63397 var memberships = getMemberships();
63398 var list = selection2.selectAll(".member-list").data([0]);
63399 list = list.enter().append("ul").attr("class", "member-list").merge(list);
63400 var items = list.selectAll("li.member-row-normal").data(memberships, function(d) {
63403 items.exit().each(unbind).remove();
63404 var itemsEnter = items.enter().append("li").attr("class", "member-row member-row-normal form-field");
63405 itemsEnter.on("mouseover", function(d3_event, d) {
63406 utilHighlightEntities([d.relation.id], true, context);
63407 }).on("mouseout", function(d3_event, d) {
63408 utilHighlightEntities([d.relation.id], false, context);
63410 var labelEnter = itemsEnter.append("label").attr("class", "field-label").attr("for", function(d) {
63413 var labelLink = labelEnter.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectRelation);
63414 labelLink.append("span").attr("class", "member-entity-type").text(function(d) {
63415 var matched = _mainPresetIndex.match(d.relation, context.graph());
63416 return matched && matched.name() || _t.html("inspector.relation");
63418 labelLink.append("span").attr("class", "member-entity-name").text(function(d) {
63419 return utilDisplayName(d.relation);
63421 labelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", deleteMembership);
63422 labelEnter.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToRelation);
63423 var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
63424 wrapEnter.append("input").attr("class", "member-role").attr("id", function(d) {
63426 }).property("type", "text").property("value", function(d) {
63427 return typeof d.role === "string" ? d.role : "";
63428 }).attr("title", function(d) {
63429 return Array.isArray(d.role) ? d.role.filter(Boolean).join("\n") : d.role;
63430 }).attr("placeholder", function(d) {
63431 return Array.isArray(d.role) ? _t("inspector.multiple_roles") : _t("inspector.role");
63432 }).classed("mixed", function(d) {
63433 return Array.isArray(d.role);
63434 }).call(utilNoAuto).on("blur", changeRole).on("change", changeRole);
63436 wrapEnter.each(bindTypeahead);
63438 var newMembership = list.selectAll(".member-row-new").data(_showBlank ? [0] : []);
63439 newMembership.exit().remove();
63440 var newMembershipEnter = newMembership.enter().append("li").attr("class", "member-row member-row-new form-field");
63441 var newLabelEnter = newMembershipEnter.append("label").attr("class", "field-label");
63442 newLabelEnter.append("input").attr("placeholder", _t("inspector.choose_relation")).attr("type", "text").attr("class", "member-entity-input").call(utilNoAuto);
63443 newLabelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", function() {
63444 list.selectAll(".member-row-new").remove();
63446 var newWrapEnter = newMembershipEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
63447 newWrapEnter.append("input").attr("class", "member-role").property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
63448 newMembership = newMembership.merge(newMembershipEnter);
63449 newMembership.selectAll(".member-entity-input").on("blur", cancelEntity).call(
63450 nearbyCombo.on("accept", acceptEntity).on("cancel", cancelEntity)
63452 var addRow = selection2.selectAll(".add-row").data([0]);
63453 var addRowEnter = addRow.enter().append("div").attr("class", "add-row");
63454 var addRelationButton = addRowEnter.append("button").attr("class", "add-relation").attr("aria-label", _t("inspector.add_to_relation"));
63455 addRelationButton.call(svgIcon("#iD-icon-plus", "light"));
63456 addRelationButton.call(uiTooltip().title(() => _t.append("inspector.add_to_relation")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left"));
63457 addRowEnter.append("div").attr("class", "space-value");
63458 addRowEnter.append("div").attr("class", "space-buttons");
63459 addRow = addRow.merge(addRowEnter);
63460 addRow.select(".add-relation").on("click", function() {
63462 section.reRender();
63463 list.selectAll(".member-entity-input").node().focus();
63465 function acceptEntity(d) {
63471 utilHighlightEntities([d.relation.id], false, context);
63472 var role = context.cleanRelationRole(list.selectAll(".member-row-new .member-role").property("value"));
63473 addMembership(d, role);
63475 function cancelEntity() {
63476 var input = newMembership.selectAll(".member-entity-input");
63477 input.property("value", "");
63478 context.surface().selectAll(".highlighted").classed("highlighted", false);
63480 function bindTypeahead(d) {
63481 var row = select_default2(this);
63482 var role = row.selectAll("input.member-role");
63483 var origValue = role.property("value");
63484 function sort(value, data) {
63485 var sameletter = [];
63487 for (var i2 = 0; i2 < data.length; i2++) {
63488 if (data[i2].value.substring(0, value.length) === value) {
63489 sameletter.push(data[i2]);
63491 other.push(data[i2]);
63494 return sameletter.concat(other);
63497 uiCombobox(context, "member-role").fetcher(function(role2, callback) {
63498 var rtype = d.relation.tags.type;
63501 rtype: rtype || "",
63502 geometry: context.graph().geometry(_entityIDs[0]),
63504 }, function(err, data) {
63506 callback(sort(role2, data));
63508 }).on("cancel", function() {
63509 role.property("value", origValue);
63513 function unbind() {
63514 var row = select_default2(this);
63515 row.selectAll("input.member-role").call(uiCombobox.off, context);
63518 section.entityIDs = function(val) {
63519 if (!arguments.length)
63522 _showBlank = false;
63528 // modules/ui/sections/selection_list.js
63529 function uiSectionSelectionList(context) {
63530 var _selectedIDs = [];
63531 var section = uiSection("selected-features", context).shouldDisplay(function() {
63532 return _selectedIDs.length > 1;
63533 }).label(function() {
63534 return _t.append("inspector.title_count", { title: _t("inspector.features"), count: _selectedIDs.length });
63535 }).disclosureContent(renderDisclosureContent);
63536 context.history().on("change.selectionList", function(difference) {
63538 section.reRender();
63541 section.entityIDs = function(val) {
63542 if (!arguments.length)
63543 return _selectedIDs;
63544 _selectedIDs = val;
63547 function selectEntity(d3_event, entity) {
63548 context.enter(modeSelect(context, [entity.id]));
63550 function deselectEntity(d3_event, entity) {
63551 var selectedIDs = _selectedIDs.slice();
63552 var index = selectedIDs.indexOf(entity.id);
63554 selectedIDs.splice(index, 1);
63555 context.enter(modeSelect(context, selectedIDs));
63558 function renderDisclosureContent(selection2) {
63559 var list = selection2.selectAll(".feature-list").data([0]);
63560 list = list.enter().append("ul").attr("class", "feature-list").merge(list);
63561 var entities = _selectedIDs.map(function(id2) {
63562 return context.hasEntity(id2);
63563 }).filter(Boolean);
63564 var items = list.selectAll(".feature-list-item").data(entities, osmEntity.key);
63565 items.exit().remove();
63566 var enter = items.enter().append("li").attr("class", "feature-list-item").each(function(d) {
63567 select_default2(this).on("mouseover", function() {
63568 utilHighlightEntities([d.id], true, context);
63569 }).on("mouseout", function() {
63570 utilHighlightEntities([d.id], false, context);
63573 var label = enter.append("button").attr("class", "label").on("click", selectEntity);
63574 label.append("span").attr("class", "entity-geom-icon").call(svgIcon("", "pre-text"));
63575 label.append("span").attr("class", "entity-type");
63576 label.append("span").attr("class", "entity-name");
63577 enter.append("button").attr("class", "close").attr("title", _t("icons.deselect")).on("click", deselectEntity).call(svgIcon("#iD-icon-close"));
63578 items = items.merge(enter);
63579 items.selectAll(".entity-geom-icon use").attr("href", function() {
63580 var entity = this.parentNode.parentNode.__data__;
63581 return "#iD-icon-" + entity.geometry(context.graph());
63583 items.selectAll(".entity-type").text(function(entity) {
63584 return _mainPresetIndex.match(entity, context.graph()).name();
63586 items.selectAll(".entity-name").text(function(d) {
63587 var entity = context.entity(d.id);
63588 return utilDisplayName(entity);
63594 // modules/ui/entity_editor.js
63595 function uiEntityEditor(context) {
63596 var dispatch10 = dispatch_default("choose");
63597 var _state = "select";
63598 var _coalesceChanges = false;
63599 var _modified = false;
63602 var _activePresets = [];
63605 function entityEditor(selection2) {
63606 var combinedTags = utilCombinedTags(_entityIDs, context.graph());
63607 var header = selection2.selectAll(".header").data([0]);
63608 var headerEnter = header.enter().append("div").attr("class", "header fillL");
63609 var direction = _mainLocalizer.textDirection() === "rtl" ? "forward" : "backward";
63610 headerEnter.append("button").attr("class", "preset-reset preset-choose").attr("title", _t("inspector.back_tooltip")).call(svgIcon(`#iD-icon-${direction}`));
63611 headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
63612 context.enter(modeBrowse(context));
63613 }).call(svgIcon(_modified ? "#iD-icon-apply" : "#iD-icon-close"));
63614 headerEnter.append("h2");
63615 header = header.merge(headerEnter);
63616 header.selectAll("h2").text("").call(_entityIDs.length === 1 ? _t.append("inspector.edit") : _t.append("inspector.edit_features"));
63617 header.selectAll(".preset-reset").on("click", function() {
63618 dispatch10.call("choose", this, _activePresets);
63620 var body = selection2.selectAll(".inspector-body").data([0]);
63621 var bodyEnter = body.enter().append("div").attr("class", "entity-editor inspector-body sep-top");
63622 body = body.merge(bodyEnter);
63625 uiSectionSelectionList(context),
63626 uiSectionFeatureType(context).on("choose", function(presets) {
63627 dispatch10.call("choose", this, presets);
63629 uiSectionEntityIssues(context),
63630 uiSectionPresetFields(context).on("change", changeTags).on("revert", revertTags),
63631 uiSectionRawTagEditor("raw-tag-editor", context).on("change", changeTags),
63632 uiSectionRawMemberEditor(context),
63633 uiSectionRawMembershipEditor(context)
63636 _sections.forEach(function(section) {
63637 if (section.entityIDs) {
63638 section.entityIDs(_entityIDs);
63640 if (section.presets) {
63641 section.presets(_activePresets);
63643 if (section.tags) {
63644 section.tags(combinedTags);
63646 if (section.state) {
63647 section.state(_state);
63649 body.call(section.render);
63651 context.history().on("change.entity-editor", historyChanged);
63652 function historyChanged(difference) {
63653 if (selection2.selectAll(".entity-editor").empty())
63655 if (_state === "hide")
63657 var significant = !difference || difference.didChange.properties || difference.didChange.addition || difference.didChange.deletion;
63660 _entityIDs = _entityIDs.filter(context.hasEntity);
63661 if (!_entityIDs.length)
63663 var priorActivePreset = _activePresets.length === 1 && _activePresets[0];
63664 loadActivePresets();
63665 var graph = context.graph();
63666 entityEditor.modified(_base !== graph);
63667 entityEditor(selection2);
63668 if (priorActivePreset && _activePresets.length === 1 && priorActivePreset !== _activePresets[0]) {
63669 context.container().selectAll(".entity-editor button.preset-reset .label").style("background-color", "#fff").transition().duration(750).style("background-color", null);
63673 function changeTags(entityIDs, changed, onInput) {
63675 for (var i2 in entityIDs) {
63676 var entityID = entityIDs[i2];
63677 var entity = context.entity(entityID);
63678 var tags = Object.assign({}, entity.tags);
63679 for (var k in changed) {
63682 var v = changed[k];
63683 if (typeof v === "object") {
63684 tags[k] = tags[v.oldKey];
63685 } else if (v !== void 0 || tags.hasOwnProperty(k)) {
63690 tags = utilCleanTags(tags);
63692 if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
63693 actions.push(actionChangeTags(entityID, tags));
63696 if (actions.length) {
63697 var combinedAction = function(graph) {
63698 actions.forEach(function(action) {
63699 graph = action(graph);
63703 var annotation = _t("operations.change_tags.annotation");
63704 if (_coalesceChanges) {
63705 context.overwrite(combinedAction, annotation);
63707 context.perform(combinedAction, annotation);
63708 _coalesceChanges = !!onInput;
63712 context.validator().validate();
63715 function revertTags(keys) {
63717 for (var i2 in _entityIDs) {
63718 var entityID = _entityIDs[i2];
63719 var original = context.graph().base().entities[entityID];
63721 for (var j2 in keys) {
63722 var key = keys[j2];
63723 changed[key] = original ? original.tags[key] : void 0;
63725 var entity = context.entity(entityID);
63726 var tags = Object.assign({}, entity.tags);
63727 for (var k in changed) {
63730 var v = changed[k];
63731 if (v !== void 0 || tags.hasOwnProperty(k)) {
63735 tags = utilCleanTags(tags);
63736 if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
63737 actions.push(actionChangeTags(entityID, tags));
63740 if (actions.length) {
63741 var combinedAction = function(graph) {
63742 actions.forEach(function(action) {
63743 graph = action(graph);
63747 var annotation = _t("operations.change_tags.annotation");
63748 if (_coalesceChanges) {
63749 context.overwrite(combinedAction, annotation);
63751 context.perform(combinedAction, annotation);
63752 _coalesceChanges = false;
63755 context.validator().validate();
63757 entityEditor.modified = function(val) {
63758 if (!arguments.length)
63761 return entityEditor;
63763 entityEditor.state = function(val) {
63764 if (!arguments.length)
63767 return entityEditor;
63769 entityEditor.entityIDs = function(val) {
63770 if (!arguments.length)
63772 _base = context.graph();
63773 _coalesceChanges = false;
63774 if (val && _entityIDs && utilArrayIdentical(_entityIDs, val))
63775 return entityEditor;
63777 loadActivePresets(true);
63778 return entityEditor.modified(false);
63780 entityEditor.newFeature = function(val) {
63781 if (!arguments.length)
63782 return _newFeature;
63784 return entityEditor;
63786 function loadActivePresets(isForNewSelection) {
63787 var graph = context.graph();
63789 for (var i2 in _entityIDs) {
63790 var entity = graph.hasEntity(_entityIDs[i2]);
63793 var match = _mainPresetIndex.match(entity, graph);
63794 if (!counts[match.id])
63795 counts[match.id] = 0;
63796 counts[match.id] += 1;
63798 var matches = Object.keys(counts).sort(function(p1, p2) {
63799 return counts[p2] - counts[p1];
63800 }).map(function(pID) {
63801 return _mainPresetIndex.item(pID);
63803 if (!isForNewSelection) {
63804 var weakPreset = _activePresets.length === 1 && !_activePresets[0].isFallback() && Object.keys(_activePresets[0].addTags || {}).length === 0;
63805 if (weakPreset && matches.length === 1 && matches[0].isFallback())
63808 entityEditor.presets(matches);
63810 entityEditor.presets = function(val) {
63811 if (!arguments.length)
63812 return _activePresets;
63813 if (!utilArrayIdentical(val, _activePresets)) {
63814 _activePresets = val;
63816 return entityEditor;
63818 return utilRebind(entityEditor, dispatch10, "on");
63821 // modules/ui/feature_list.js
63822 var sexagesimal = __toESM(require_sexagesimal());
63823 function uiFeatureList(context) {
63824 var _geocodeResults;
63825 function featureList(selection2) {
63826 var header = selection2.append("div").attr("class", "header fillL");
63827 header.append("h2").call(_t.append("inspector.feature_list"));
63828 var searchWrap = selection2.append("div").attr("class", "search-header");
63829 searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
63830 var search = searchWrap.append("input").attr("placeholder", _t("inspector.search")).attr("type", "search").call(utilNoAuto).on("keypress", keypress).on("keydown", keydown).on("input", inputevent);
63831 var listWrap = selection2.append("div").attr("class", "inspector-body");
63832 var list = listWrap.append("div").attr("class", "feature-list");
63833 context.on("exit.feature-list", clearSearch);
63834 context.map().on("drawn.feature-list", mapDrawn);
63835 context.keybinding().on(uiCmd("\u2318F"), focusSearch);
63836 function focusSearch(d3_event) {
63837 var mode = context.mode() && context.mode().id;
63838 if (mode !== "browse")
63840 d3_event.preventDefault();
63841 search.node().focus();
63843 function keydown(d3_event) {
63844 if (d3_event.keyCode === 27) {
63845 search.node().blur();
63848 function keypress(d3_event) {
63849 var q = search.property("value"), items = list.selectAll(".feature-list-item");
63850 if (d3_event.keyCode === 13 && q.length && items.size()) {
63851 click(d3_event, items.datum());
63854 function inputevent() {
63855 _geocodeResults = void 0;
63858 function clearSearch() {
63859 search.property("value", "");
63862 function mapDrawn(e) {
63867 function features2() {
63869 var graph = context.graph();
63870 var visibleCenter = context.map().extent().center();
63871 var q = search.property("value").toLowerCase();
63874 var locationMatch = sexagesimal.pair(q.toUpperCase()) || q.match(/^(-?\d+\.?\d*)\s+(-?\d+\.?\d*)$/);
63875 if (locationMatch) {
63876 var loc = [parseFloat(locationMatch[0]), parseFloat(locationMatch[1])];
63880 type: _t("inspector.location"),
63881 name: dmsCoordinatePair([loc[1], loc[0]]),
63885 var idMatch = !locationMatch && q.match(/(?:^|\W)(node|way|relation|[nwr])\W?0*([1-9]\d*)(?:\W|$)/i);
63887 var elemType = idMatch[1].charAt(0);
63888 var elemId = idMatch[2];
63890 id: elemType + elemId,
63891 geometry: elemType === "n" ? "point" : elemType === "w" ? "line" : "relation",
63892 type: elemType === "n" ? _t("inspector.node") : elemType === "w" ? _t("inspector.way") : _t("inspector.relation"),
63896 var allEntities = graph.entities;
63897 var localResults = [];
63898 for (var id2 in allEntities) {
63899 var entity = allEntities[id2];
63902 var name = utilDisplayName(entity) || "";
63903 if (name.toLowerCase().indexOf(q) < 0)
63905 var matched = _mainPresetIndex.match(entity, graph);
63906 var type3 = matched && matched.name() || utilDisplayType(entity.id);
63907 var extent = entity.extent(graph);
63908 var distance = extent ? geoSphericalDistance(visibleCenter, extent.center()) : 0;
63909 localResults.push({
63912 geometry: entity.geometry(graph),
63917 if (localResults.length > 100)
63920 localResults = localResults.sort(function byDistance(a, b) {
63921 return a.distance - b.distance;
63923 result = result.concat(localResults);
63924 (_geocodeResults || []).forEach(function(d) {
63925 if (d.osm_type && d.osm_id) {
63926 var id3 = osmEntity.id.fromOSM(d.osm_type, d.osm_id);
63928 tags[d.class] = d.type;
63929 var attrs = { id: id3, type: d.osm_type, tags };
63930 if (d.osm_type === "way") {
63931 attrs.nodes = ["a", "a"];
63933 var tempEntity = osmEntity(attrs);
63934 var tempGraph = coreGraph([tempEntity]);
63935 var matched2 = _mainPresetIndex.match(tempEntity, tempGraph);
63936 var type4 = matched2 && matched2.name() || utilDisplayType(id3);
63939 geometry: tempEntity.geometry(tempGraph),
63941 name: d.display_name,
63942 extent: new geoExtent(
63943 [parseFloat(d.boundingbox[3]), parseFloat(d.boundingbox[0])],
63944 [parseFloat(d.boundingbox[2]), parseFloat(d.boundingbox[1])]
63949 if (q.match(/^[0-9]+$/)) {
63953 type: _t("inspector.node"),
63959 type: _t("inspector.way"),
63964 geometry: "relation",
63965 type: _t("inspector.relation"),
63971 function drawList() {
63972 var value = search.property("value");
63973 var results = features2();
63974 list.classed("filtered", value.length);
63975 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"));
63976 resultsIndicator.append("span").attr("class", "entity-name");
63977 list.selectAll(".no-results-item .entity-name").html("").call(_t.append("geocoder.no_results_worldwide"));
63978 if (services.geocoder) {
63979 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"));
63981 list.selectAll(".no-results-item").style("display", value.length && !results.length ? "block" : "none");
63982 list.selectAll(".geocode-item").style("display", value && _geocodeResults === void 0 ? "block" : "none");
63983 list.selectAll(".feature-list-item").data([-1]).remove();
63984 var items = list.selectAll(".feature-list-item").data(results, function(d) {
63987 var enter = items.enter().insert("button", ".geocode-item").attr("class", "feature-list-item").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
63988 var label = enter.append("div").attr("class", "label");
63989 label.each(function(d) {
63990 select_default2(this).call(svgIcon("#iD-icon-" + d.geometry, "pre-text"));
63992 label.append("span").attr("class", "entity-type").text(function(d) {
63995 label.append("span").attr("class", "entity-name").text(function(d) {
63998 enter.style("opacity", 0).transition().style("opacity", 1);
64000 items.exit().remove();
64002 function mouseover(d3_event, d) {
64005 utilHighlightEntities([d.id], true, context);
64007 function mouseout(d3_event, d) {
64010 utilHighlightEntities([d.id], false, context);
64012 function click(d3_event, d) {
64013 d3_event.preventDefault();
64015 context.map().centerZoomEase([d.location[1], d.location[0]], 19);
64016 } else if (d.entity) {
64017 utilHighlightEntities([d.id], false, context);
64018 context.enter(modeSelect(context, [d.entity.id]));
64019 context.map().zoomToEase(d.entity);
64021 context.zoomToEntity(d.id);
64024 function geocoderSearch() {
64025 services.geocoder.search(search.property("value"), function(err, resp) {
64026 _geocodeResults = resp || [];
64031 return featureList;
64034 // modules/ui/improveOSM_comments.js
64035 function uiImproveOsmComments() {
64037 function issueComments(selection2) {
64038 let comments = selection2.selectAll(".comments-container").data([0]);
64039 comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
64040 services.improveOSM.getComments(_qaItem).then((d) => {
64043 const commentEnter = comments.selectAll(".comment").data(d.comments).enter().append("div").attr("class", "comment");
64044 commentEnter.append("div").attr("class", "comment-avatar").call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
64045 const mainEnter = commentEnter.append("div").attr("class", "comment-main");
64046 const metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
64047 metadataEnter.append("div").attr("class", "comment-author").each(function(d2) {
64048 const osm = services.osm;
64049 let selection3 = select_default2(this);
64050 if (osm && d2.username) {
64051 selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d2.username)).attr("target", "_blank");
64053 selection3.text((d4) => d4.username);
64055 metadataEnter.append("div").attr("class", "comment-date").html((d2) => _t.html("note.status.commented", { when: localeDateString2(d2.timestamp) }));
64056 mainEnter.append("div").attr("class", "comment-text").append("p").text((d2) => d2.text);
64057 }).catch((err) => {
64061 function localeDateString2(s) {
64064 const options2 = { day: "numeric", month: "short", year: "numeric" };
64065 const d = new Date(s * 1e3);
64066 if (isNaN(d.getTime()))
64068 return d.toLocaleDateString(_mainLocalizer.localeCode(), options2);
64070 issueComments.issue = function(val) {
64071 if (!arguments.length)
64074 return issueComments;
64076 return issueComments;
64079 // modules/ui/improveOSM_details.js
64080 function uiImproveOsmDetails(context) {
64082 function issueDetail(d) {
64085 const issueKey = d.issueKey;
64086 d.replacements = d.replacements || {};
64087 d.replacements.default = { html: _t.html("inspector.unknown") };
64088 return _t.html(`QA.improveOSM.error_types.${issueKey}.description`, d.replacements);
64090 function improveOsmDetails(selection2) {
64091 const details = selection2.selectAll(".error-details").data(
64092 _qaItem ? [_qaItem] : [],
64093 (d) => `${d.id}-${d.status || 0}`
64095 details.exit().remove();
64096 const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
64097 const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
64098 descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
64099 descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
64100 let relatedEntities = [];
64101 descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
64102 const link2 = select_default2(this);
64103 const isObjectLink = link2.classed("error_object_link");
64104 const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
64105 const entity = context.hasEntity(entityID);
64106 relatedEntities.push(entityID);
64107 link2.on("mouseenter", () => {
64108 utilHighlightEntities([entityID], true, context);
64109 }).on("mouseleave", () => {
64110 utilHighlightEntities([entityID], false, context);
64111 }).on("click", (d3_event) => {
64112 d3_event.preventDefault();
64113 utilHighlightEntities([entityID], false, context);
64114 const osmlayer = context.layers().layer("osm");
64115 if (!osmlayer.enabled()) {
64116 osmlayer.enabled(true);
64118 context.map().centerZoom(_qaItem.loc, 20);
64120 context.enter(modeSelect(context, [entityID]));
64122 context.loadEntity(entityID, (err, result) => {
64125 const entity2 = result.data.find((e) => e.id === entityID);
64127 context.enter(modeSelect(context, [entityID]));
64132 let name = utilDisplayName(entity);
64133 if (!name && !isObjectLink) {
64134 const preset = _mainPresetIndex.match(entity, context.graph());
64135 name = preset && !preset.isFallback() && preset.name();
64138 this.innerText = name;
64142 context.features().forceVisible(relatedEntities);
64143 context.map().pan([0, 0]);
64145 improveOsmDetails.issue = function(val) {
64146 if (!arguments.length)
64149 return improveOsmDetails;
64151 return improveOsmDetails;
64154 // modules/ui/improveOSM_header.js
64155 function uiImproveOsmHeader() {
64157 function issueTitle(d) {
64158 const issueKey = d.issueKey;
64159 d.replacements = d.replacements || {};
64160 d.replacements.default = { html: _t.html("inspector.unknown") };
64161 return _t.html(`QA.improveOSM.error_types.${issueKey}.title`, d.replacements);
64163 function improveOsmHeader(selection2) {
64164 const header = selection2.selectAll(".qa-header").data(
64165 _qaItem ? [_qaItem] : [],
64166 (d) => `${d.id}-${d.status || 0}`
64168 header.exit().remove();
64169 const headerEnter = header.enter().append("div").attr("class", "qa-header");
64170 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}`);
64171 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");
64172 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 : "");
64173 headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
64175 improveOsmHeader.issue = function(val) {
64176 if (!arguments.length)
64179 return improveOsmHeader;
64181 return improveOsmHeader;
64184 // modules/ui/improveOSM_editor.js
64185 function uiImproveOsmEditor(context) {
64186 const dispatch10 = dispatch_default("change");
64187 const qaDetails = uiImproveOsmDetails(context);
64188 const qaComments = uiImproveOsmComments(context);
64189 const qaHeader = uiImproveOsmHeader(context);
64191 function improveOsmEditor(selection2) {
64192 const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
64193 headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
64194 headerEnter.append("h2").call(_t.append("QA.improveOSM.title"));
64195 let body = selection2.selectAll(".body").data([0]);
64196 body = body.enter().append("div").attr("class", "body").merge(body);
64197 const editor = body.selectAll(".qa-editor").data([0]);
64198 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);
64200 function improveOsmSaveSection(selection2) {
64201 const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
64202 const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
64203 let saveSection = selection2.selectAll(".qa-save").data(
64204 isShown ? [_qaItem] : [],
64205 (d) => `${d.id}-${d.status || 0}`
64207 saveSection.exit().remove();
64208 const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
64209 saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("note.newComment"));
64210 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);
64211 saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
64212 function changeInput() {
64213 const input = select_default2(this);
64214 let val = input.property("value").trim();
64218 _qaItem = _qaItem.update({ newComment: val });
64219 const qaService = services.improveOSM;
64221 qaService.replaceItem(_qaItem);
64223 saveSection.call(qaSaveButtons);
64226 function qaSaveButtons(selection2) {
64227 const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
64228 let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d) => d.status + d.id);
64229 buttonSection.exit().remove();
64230 const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
64231 buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
64232 buttonEnter.append("button").attr("class", "button close-button action");
64233 buttonEnter.append("button").attr("class", "button ignore-button action");
64234 buttonSection = buttonSection.merge(buttonEnter);
64235 buttonSection.select(".comment-button").attr("disabled", (d) => d.newComment ? null : true).on("click.comment", function(d3_event, d) {
64237 const qaService = services.improveOSM;
64239 qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
64242 buttonSection.select(".close-button").html((d) => {
64243 const andComment = d.newComment ? "_comment" : "";
64244 return _t.html(`QA.keepRight.close${andComment}`);
64245 }).on("click.close", function(d3_event, d) {
64247 const qaService = services.improveOSM;
64249 d.newStatus = "SOLVED";
64250 qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
64253 buttonSection.select(".ignore-button").html((d) => {
64254 const andComment = d.newComment ? "_comment" : "";
64255 return _t.html(`QA.keepRight.ignore${andComment}`);
64256 }).on("click.ignore", function(d3_event, d) {
64258 const qaService = services.improveOSM;
64260 d.newStatus = "INVALID";
64261 qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
64265 improveOsmEditor.error = function(val) {
64266 if (!arguments.length)
64269 return improveOsmEditor;
64271 return utilRebind(improveOsmEditor, dispatch10, "on");
64274 // modules/ui/preset_list.js
64275 function uiPresetList(context) {
64276 var dispatch10 = dispatch_default("cancel", "choose");
64279 var _currentPresets;
64280 var _autofocus = false;
64281 function presetList(selection2) {
64284 var presets = _mainPresetIndex.matchAllGeometry(entityGeometries());
64285 selection2.html("");
64286 var messagewrap = selection2.append("div").attr("class", "header fillL");
64287 var message = messagewrap.append("h2").call(_t.append("inspector.choose"));
64288 var direction = _mainLocalizer.textDirection() === "rtl" ? "backward" : "forward";
64289 messagewrap.append("button").attr("class", "preset-choose").attr("title", _entityIDs.length === 1 ? _t("inspector.edit") : _t("inspector.edit_features")).on("click", function() {
64290 dispatch10.call("cancel", this);
64291 }).call(svgIcon(`#iD-icon-${direction}`));
64292 function initialKeydown(d3_event) {
64293 if (search.property("value").length === 0 && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
64294 d3_event.preventDefault();
64295 d3_event.stopPropagation();
64296 operationDelete(context, _entityIDs)();
64297 } else if (search.property("value").length === 0 && (d3_event.ctrlKey || d3_event.metaKey) && d3_event.keyCode === utilKeybinding.keyCodes.z) {
64298 d3_event.preventDefault();
64299 d3_event.stopPropagation();
64301 } else if (!d3_event.ctrlKey && !d3_event.metaKey) {
64302 select_default2(this).on("keydown", keydown);
64303 keydown.call(this, d3_event);
64306 function keydown(d3_event) {
64307 if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"] && search.node().selectionStart === search.property("value").length) {
64308 d3_event.preventDefault();
64309 d3_event.stopPropagation();
64310 var buttons = list.selectAll(".preset-list-button");
64311 if (!buttons.empty())
64312 buttons.nodes()[0].focus();
64315 function keypress(d3_event) {
64316 var value = search.property("value");
64317 if (d3_event.keyCode === 13 && value.length) {
64318 list.selectAll(".preset-list-item:first-child").each(function(d) {
64319 d.choose.call(this);
64323 function inputevent() {
64324 var value = search.property("value");
64325 list.classed("filtered", value.length);
64326 var results, messageText;
64327 if (value.length) {
64328 results = presets.search(value, entityGeometries()[0], _currLoc);
64329 messageText = _t.html("inspector.results", {
64330 n: results.collection.length,
64334 var entityPresets2 = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
64335 results = _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets2);
64336 messageText = _t.html("inspector.choose");
64338 list.call(drawList, results);
64339 message.html(messageText);
64341 var searchWrap = selection2.append("div").attr("class", "search-header");
64342 searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
64343 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));
64345 search.node().focus();
64346 setTimeout(function() {
64347 search.node().focus();
64350 var listWrap = selection2.append("div").attr("class", "inspector-body");
64351 var entityPresets = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
64352 var list = listWrap.append("div").attr("class", "preset-list").call(drawList, _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets));
64353 context.features().on("change.preset-list", updateForFeatureHiddenState);
64355 function drawList(list, presets) {
64356 presets = presets.matchAllGeometry(entityGeometries());
64357 var collection = presets.collection.reduce(function(collection2, preset) {
64359 return collection2;
64360 if (preset.members) {
64361 if (preset.members.collection.filter(function(preset2) {
64362 return preset2.addable();
64364 collection2.push(CategoryItem(preset));
64366 } else if (preset.addable()) {
64367 collection2.push(PresetItem(preset));
64369 return collection2;
64371 var items = list.selectAll(".preset-list-item").data(collection, function(d) {
64372 return d.preset.id;
64375 items.exit().remove();
64376 items.enter().append("div").attr("class", function(item) {
64377 return "preset-list-item preset-" + item.preset.id.replace("/", "-");
64378 }).classed("current", function(item) {
64379 return _currentPresets.indexOf(item.preset) !== -1;
64380 }).each(function(item) {
64381 select_default2(this).call(item);
64382 }).style("opacity", 0).transition().style("opacity", 1);
64383 updateForFeatureHiddenState();
64385 function itemKeydown(d3_event) {
64386 var item = select_default2(this.closest(".preset-list-item"));
64387 var parentItem = select_default2(item.node().parentNode.closest(".preset-list-item"));
64388 if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"]) {
64389 d3_event.preventDefault();
64390 d3_event.stopPropagation();
64391 var nextItem = select_default2(item.node().nextElementSibling);
64392 if (nextItem.empty()) {
64393 if (!parentItem.empty()) {
64394 nextItem = select_default2(parentItem.node().nextElementSibling);
64396 } else if (select_default2(this).classed("expanded")) {
64397 nextItem = item.select(".subgrid .preset-list-item:first-child");
64399 if (!nextItem.empty()) {
64400 nextItem.select(".preset-list-button").node().focus();
64402 } else if (d3_event.keyCode === utilKeybinding.keyCodes["\u2191"]) {
64403 d3_event.preventDefault();
64404 d3_event.stopPropagation();
64405 var previousItem = select_default2(item.node().previousElementSibling);
64406 if (previousItem.empty()) {
64407 if (!parentItem.empty()) {
64408 previousItem = parentItem;
64410 } else if (previousItem.select(".preset-list-button").classed("expanded")) {
64411 previousItem = previousItem.select(".subgrid .preset-list-item:last-child");
64413 if (!previousItem.empty()) {
64414 previousItem.select(".preset-list-button").node().focus();
64416 var search = select_default2(this.closest(".preset-list-pane")).select(".preset-search-input");
64417 search.node().focus();
64419 } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
64420 d3_event.preventDefault();
64421 d3_event.stopPropagation();
64422 if (!parentItem.empty()) {
64423 parentItem.select(".preset-list-button").node().focus();
64425 } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
64426 d3_event.preventDefault();
64427 d3_event.stopPropagation();
64428 item.datum().choose.call(select_default2(this).node());
64431 function CategoryItem(preset) {
64432 var box, sublist, shown = false;
64433 function item(selection2) {
64434 var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap category");
64436 var isExpanded = select_default2(this).classed("expanded");
64437 var iconName = isExpanded ? _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward" : "#iD-icon-down";
64438 select_default2(this).classed("expanded", !isExpanded).attr("title", !isExpanded ? _t("icons.collapse") : _t("icons.expand"));
64439 select_default2(this).selectAll("div.label-inner svg.icon use").attr("href", iconName);
64442 var geometries = entityGeometries();
64443 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) {
64444 if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
64445 d3_event.preventDefault();
64446 d3_event.stopPropagation();
64447 if (!select_default2(this).classed("expanded")) {
64448 click.call(this, d3_event);
64450 } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
64451 d3_event.preventDefault();
64452 d3_event.stopPropagation();
64453 if (select_default2(this).classed("expanded")) {
64454 click.call(this, d3_event);
64457 itemKeydown.call(this, d3_event);
64460 var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
64461 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");
64462 box = selection2.append("div").attr("class", "subgrid").style("max-height", "0px").style("opacity", 0);
64463 box.append("div").attr("class", "arrow");
64464 sublist = box.append("div").attr("class", "preset-list fillL3");
64466 item.choose = function() {
64467 if (!box || !sublist)
64471 box.transition().duration(200).style("opacity", "0").style("max-height", "0px").style("padding-bottom", "0px");
64474 var members = preset.members.matchAllGeometry(entityGeometries());
64475 sublist.call(drawList, members);
64476 box.transition().duration(200).style("opacity", "1").style("max-height", 200 + members.collection.length * 190 + "px").style("padding-bottom", "10px");
64479 item.preset = preset;
64482 function PresetItem(preset) {
64483 function item(selection2) {
64484 var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap");
64485 var geometries = entityGeometries();
64486 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);
64487 var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
64489 preset.nameLabel(),
64490 preset.subtitleLabel()
64492 label.selectAll(".namepart").data(nameparts, (d) => d.stringId).enter().append("div").attr("class", "namepart").text("").each(function(d) {
64493 d(select_default2(this));
64495 wrap2.call(item.reference.button);
64496 selection2.call(item.reference.body);
64498 item.choose = function() {
64499 if (select_default2(this).classed("disabled"))
64501 if (!context.inIntro()) {
64502 _mainPresetIndex.setMostRecent(preset, entityGeometries()[0]);
64506 for (var i2 in _entityIDs) {
64507 var entityID = _entityIDs[i2];
64508 var oldPreset = _mainPresetIndex.match(graph.entity(entityID), graph);
64509 graph = actionChangePreset(entityID, oldPreset, preset)(graph);
64513 _t("operations.change_tags.annotation")
64515 context.validator().validate();
64516 dispatch10.call("choose", this, preset);
64518 item.help = function(d3_event) {
64519 d3_event.stopPropagation();
64520 item.reference.toggle();
64522 item.preset = preset;
64523 item.reference = uiTagReference(preset.reference(), context);
64526 function updateForFeatureHiddenState() {
64527 if (!_entityIDs.every(context.hasEntity))
64529 var geometries = entityGeometries();
64530 var button = context.container().selectAll(".preset-list .preset-list-button");
64531 button.call(uiTooltip().destroyAny);
64532 button.each(function(item, index) {
64533 var hiddenPresetFeaturesId;
64534 for (var i2 in geometries) {
64535 hiddenPresetFeaturesId = context.features().isHiddenPreset(item.preset, geometries[i2]);
64536 if (hiddenPresetFeaturesId)
64539 var isHiddenPreset = !context.inIntro() && !!hiddenPresetFeaturesId && (_currentPresets.length !== 1 || item.preset !== _currentPresets[0]);
64540 select_default2(this).classed("disabled", isHiddenPreset);
64541 if (isHiddenPreset) {
64542 var isAutoHidden = context.features().autoHidden(hiddenPresetFeaturesId);
64543 select_default2(this).call(
64544 uiTooltip().title(() => _t.append("inspector.hidden_preset." + (isAutoHidden ? "zoom" : "manual"), {
64545 features: _t("feature." + hiddenPresetFeaturesId + ".description")
64546 })).placement(index < 2 ? "bottom" : "top")
64551 presetList.autofocus = function(val) {
64552 if (!arguments.length)
64557 presetList.entityIDs = function(val) {
64558 if (!arguments.length)
64562 if (_entityIDs && _entityIDs.length) {
64563 const extent = _entityIDs.reduce(function(extent2, entityID) {
64564 var entity = context.graph().entity(entityID);
64565 return extent2.extend(entity.extent(context.graph()));
64567 _currLoc = extent.center();
64568 var presets = _entityIDs.map(function(entityID) {
64569 return _mainPresetIndex.match(context.entity(entityID), context.graph());
64571 presetList.presets(presets);
64575 presetList.presets = function(val) {
64576 if (!arguments.length)
64577 return _currentPresets;
64578 _currentPresets = val;
64581 function entityGeometries() {
64583 for (var i2 in _entityIDs) {
64584 var entityID = _entityIDs[i2];
64585 var entity = context.entity(entityID);
64586 var geometry = entity.geometry(context.graph());
64587 if (geometry === "vertex" && entity.isOnAddressLine(context.graph())) {
64588 geometry = "point";
64590 if (!counts[geometry])
64591 counts[geometry] = 0;
64592 counts[geometry] += 1;
64594 return Object.keys(counts).sort(function(geom1, geom2) {
64595 return counts[geom2] - counts[geom1];
64598 return utilRebind(presetList, dispatch10, "on");
64601 // modules/ui/view_on_osm.js
64602 function uiViewOnOSM(context) {
64604 function viewOnOSM(selection2) {
64606 if (_what instanceof osmEntity) {
64607 url = context.connection().entityURL(_what);
64608 } else if (_what instanceof osmNote) {
64609 url = context.connection().noteURL(_what);
64611 var data = !_what || _what.isNew() ? [] : [_what];
64612 var link2 = selection2.selectAll(".view-on-osm").data(data, function(d) {
64615 link2.exit().remove();
64616 var linkEnter = link2.enter().append("a").attr("class", "view-on-osm").attr("target", "_blank").attr("href", url).call(svgIcon("#iD-icon-out-link", "inline"));
64617 linkEnter.append("span").call(_t.append("inspector.view_on_osm"));
64619 viewOnOSM.what = function(_) {
64620 if (!arguments.length)
64628 // modules/ui/inspector.js
64629 function uiInspector(context) {
64630 var presetList = uiPresetList(context);
64631 var entityEditor = uiEntityEditor(context);
64632 var wrap2 = select_default2(null), presetPane = select_default2(null), editorPane = select_default2(null);
64633 var _state = "select";
64635 var _newFeature = false;
64636 function inspector(selection2) {
64637 presetList.entityIDs(_entityIDs).autofocus(_newFeature).on("choose", inspector.setPreset).on("cancel", function() {
64638 inspector.setPreset();
64640 entityEditor.state(_state).entityIDs(_entityIDs).on("choose", inspector.showList);
64641 wrap2 = selection2.selectAll(".panewrap").data([0]);
64642 var enter = wrap2.enter().append("div").attr("class", "panewrap");
64643 enter.append("div").attr("class", "preset-list-pane pane");
64644 enter.append("div").attr("class", "entity-editor-pane pane");
64645 wrap2 = wrap2.merge(enter);
64646 presetPane = wrap2.selectAll(".preset-list-pane");
64647 editorPane = wrap2.selectAll(".entity-editor-pane");
64648 function shouldDefaultToPresetList() {
64649 if (_state !== "select")
64651 if (_entityIDs.length !== 1)
64653 var entityID = _entityIDs[0];
64654 var entity = context.hasEntity(entityID);
64657 if (entity.hasNonGeometryTags())
64661 if (entity.geometry(context.graph()) !== "vertex")
64663 if (context.graph().parentRelations(entity).length)
64665 if (context.validator().getEntityIssues(entityID).length)
64667 if (entity.isHighwayIntersection(context.graph()))
64671 if (shouldDefaultToPresetList()) {
64672 wrap2.style("right", "-100%");
64673 editorPane.classed("hide", true);
64674 presetPane.classed("hide", false).call(presetList);
64676 wrap2.style("right", "0%");
64677 presetPane.classed("hide", true);
64678 editorPane.classed("hide", false).call(entityEditor);
64680 var footer = selection2.selectAll(".footer").data([0]);
64681 footer = footer.enter().append("div").attr("class", "footer").merge(footer);
64683 uiViewOnOSM(context).what(context.hasEntity(_entityIDs.length === 1 && _entityIDs[0]))
64686 inspector.showList = function(presets) {
64687 presetPane.classed("hide", false);
64688 wrap2.transition().styleTween("right", function() {
64689 return value_default("0%", "-100%");
64690 }).on("end", function() {
64691 editorPane.classed("hide", true);
64694 presetList.presets(presets);
64696 presetPane.call(presetList.autofocus(true));
64698 inspector.setPreset = function(preset) {
64699 if (preset && preset.id === "type/multipolygon") {
64700 presetPane.call(presetList.autofocus(true));
64702 editorPane.classed("hide", false);
64703 wrap2.transition().styleTween("right", function() {
64704 return value_default("-100%", "0%");
64705 }).on("end", function() {
64706 presetPane.classed("hide", true);
64709 entityEditor.presets([preset]);
64711 editorPane.call(entityEditor);
64714 inspector.state = function(val) {
64715 if (!arguments.length)
64718 entityEditor.state(_state);
64719 context.container().selectAll(".field-help-body").remove();
64722 inspector.entityIDs = function(val) {
64723 if (!arguments.length)
64728 inspector.newFeature = function(val) {
64729 if (!arguments.length)
64730 return _newFeature;
64737 // modules/ui/keepRight_details.js
64738 function uiKeepRightDetails(context) {
64740 function issueDetail(d) {
64741 const { itemType, parentIssueType } = d;
64742 const unknown = { html: _t.html("inspector.unknown") };
64743 let replacements = d.replacements || {};
64744 replacements.default = unknown;
64745 if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
64746 return _t.html(`QA.keepRight.errorTypes.${itemType}.description`, replacements);
64748 return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.description`, replacements);
64751 function keepRightDetails(selection2) {
64752 const details = selection2.selectAll(".error-details").data(
64753 _qaItem ? [_qaItem] : [],
64754 (d) => `${d.id}-${d.status || 0}`
64756 details.exit().remove();
64757 const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
64758 const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
64759 descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
64760 descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
64761 let relatedEntities = [];
64762 descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
64763 const link2 = select_default2(this);
64764 const isObjectLink = link2.classed("error_object_link");
64765 const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
64766 const entity = context.hasEntity(entityID);
64767 relatedEntities.push(entityID);
64768 link2.on("mouseenter", () => {
64769 utilHighlightEntities([entityID], true, context);
64770 }).on("mouseleave", () => {
64771 utilHighlightEntities([entityID], false, context);
64772 }).on("click", (d3_event) => {
64773 d3_event.preventDefault();
64774 utilHighlightEntities([entityID], false, context);
64775 const osmlayer = context.layers().layer("osm");
64776 if (!osmlayer.enabled()) {
64777 osmlayer.enabled(true);
64779 context.map().centerZoomEase(_qaItem.loc, 20);
64781 context.enter(modeSelect(context, [entityID]));
64783 context.loadEntity(entityID, (err, result) => {
64786 const entity2 = result.data.find((e) => e.id === entityID);
64788 context.enter(modeSelect(context, [entityID]));
64793 let name = utilDisplayName(entity);
64794 if (!name && !isObjectLink) {
64795 const preset = _mainPresetIndex.match(entity, context.graph());
64796 name = preset && !preset.isFallback() && preset.name();
64799 this.innerText = name;
64803 context.features().forceVisible(relatedEntities);
64804 context.map().pan([0, 0]);
64806 keepRightDetails.issue = function(val) {
64807 if (!arguments.length)
64810 return keepRightDetails;
64812 return keepRightDetails;
64815 // modules/ui/keepRight_header.js
64816 function uiKeepRightHeader() {
64818 function issueTitle(d) {
64819 const { itemType, parentIssueType } = d;
64820 const unknown = _t.html("inspector.unknown");
64821 let replacements = d.replacements || {};
64822 replacements.default = { html: unknown };
64823 if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
64824 return _t.html(`QA.keepRight.errorTypes.${itemType}.title`, replacements);
64826 return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.title`, replacements);
64829 function keepRightHeader(selection2) {
64830 const header = selection2.selectAll(".qa-header").data(
64831 _qaItem ? [_qaItem] : [],
64832 (d) => `${d.id}-${d.status || 0}`
64834 header.exit().remove();
64835 const headerEnter = header.enter().append("div").attr("class", "qa-header");
64836 const iconEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d) => d.id < 0);
64837 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"));
64838 headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
64840 keepRightHeader.issue = function(val) {
64841 if (!arguments.length)
64844 return keepRightHeader;
64846 return keepRightHeader;
64849 // modules/ui/view_on_keepRight.js
64850 function uiViewOnKeepRight() {
64852 function viewOnKeepRight(selection2) {
64854 if (services.keepRight && _qaItem instanceof QAItem) {
64855 url = services.keepRight.issueURL(_qaItem);
64857 const link2 = selection2.selectAll(".view-on-keepRight").data(url ? [url] : []);
64858 link2.exit().remove();
64859 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"));
64860 linkEnter.append("span").call(_t.append("inspector.view_on_keepRight"));
64862 viewOnKeepRight.what = function(val) {
64863 if (!arguments.length)
64866 return viewOnKeepRight;
64868 return viewOnKeepRight;
64871 // modules/ui/keepRight_editor.js
64872 function uiKeepRightEditor(context) {
64873 const dispatch10 = dispatch_default("change");
64874 const qaDetails = uiKeepRightDetails(context);
64875 const qaHeader = uiKeepRightHeader(context);
64877 function keepRightEditor(selection2) {
64878 const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
64879 headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
64880 headerEnter.append("h2").call(_t.append("QA.keepRight.title"));
64881 let body = selection2.selectAll(".body").data([0]);
64882 body = body.enter().append("div").attr("class", "body").merge(body);
64883 const editor = body.selectAll(".qa-editor").data([0]);
64884 editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(keepRightSaveSection);
64885 const footer = selection2.selectAll(".footer").data([0]);
64886 footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnKeepRight(context).what(_qaItem));
64888 function keepRightSaveSection(selection2) {
64889 const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
64890 const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
64891 let saveSection = selection2.selectAll(".qa-save").data(
64892 isShown ? [_qaItem] : [],
64893 (d) => `${d.id}-${d.status || 0}`
64895 saveSection.exit().remove();
64896 const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
64897 saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("QA.keepRight.comment"));
64898 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);
64899 saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
64900 function changeInput() {
64901 const input = select_default2(this);
64902 let val = input.property("value").trim();
64903 if (val === _qaItem.comment) {
64906 _qaItem = _qaItem.update({ newComment: val });
64907 const qaService = services.keepRight;
64909 qaService.replaceItem(_qaItem);
64911 saveSection.call(qaSaveButtons);
64914 function qaSaveButtons(selection2) {
64915 const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
64916 let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d) => d.status + d.id);
64917 buttonSection.exit().remove();
64918 const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
64919 buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
64920 buttonEnter.append("button").attr("class", "button close-button action");
64921 buttonEnter.append("button").attr("class", "button ignore-button action");
64922 buttonSection = buttonSection.merge(buttonEnter);
64923 buttonSection.select(".comment-button").attr("disabled", (d) => d.newComment ? null : true).on("click.comment", function(d3_event, d) {
64925 const qaService = services.keepRight;
64927 qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
64930 buttonSection.select(".close-button").html((d) => {
64931 const andComment = d.newComment ? "_comment" : "";
64932 return _t.html(`QA.keepRight.close${andComment}`);
64933 }).on("click.close", function(d3_event, d) {
64935 const qaService = services.keepRight;
64937 d.newStatus = "ignore_t";
64938 qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
64941 buttonSection.select(".ignore-button").html((d) => {
64942 const andComment = d.newComment ? "_comment" : "";
64943 return _t.html(`QA.keepRight.ignore${andComment}`);
64944 }).on("click.ignore", function(d3_event, d) {
64946 const qaService = services.keepRight;
64948 d.newStatus = "ignore";
64949 qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
64953 keepRightEditor.error = function(val) {
64954 if (!arguments.length)
64957 return keepRightEditor;
64959 return utilRebind(keepRightEditor, dispatch10, "on");
64962 // modules/ui/lasso.js
64963 function uiLasso(context) {
64964 var group, polygon2;
64965 lasso.coordinates = [];
64966 function lasso(selection2) {
64967 context.container().classed("lasso", true);
64968 group = selection2.append("g").attr("class", "lasso hide");
64969 polygon2 = group.append("path").attr("class", "lasso-path");
64970 group.call(uiToggle(true));
64974 polygon2.data([lasso.coordinates]).attr("d", function(d) {
64975 return "M" + d.join(" L") + " Z";
64979 lasso.extent = function() {
64980 return lasso.coordinates.reduce(function(extent, point2) {
64981 return extent.extend(geoExtent(point2));
64984 lasso.p = function(_) {
64985 if (!arguments.length)
64987 lasso.coordinates.push(_);
64991 lasso.close = function() {
64993 group.call(uiToggle(false, function() {
64994 select_default2(this).remove();
64997 context.container().classed("lasso", false);
65002 // modules/ui/note_comments.js
65003 function uiNoteComments() {
65005 function noteComments(selection2) {
65008 var comments = selection2.selectAll(".comments-container").data([0]);
65009 comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
65010 var commentEnter = comments.selectAll(".comment").data(_note.comments).enter().append("div").attr("class", "comment");
65011 commentEnter.append("div").attr("class", function(d) {
65012 return "comment-avatar user-" + d.uid;
65013 }).call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
65014 var mainEnter = commentEnter.append("div").attr("class", "comment-main");
65015 var metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
65016 metadataEnter.append("div").attr("class", "comment-author").each(function(d) {
65017 var selection3 = select_default2(this);
65018 var osm = services.osm;
65019 if (osm && d.user) {
65020 selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d.user)).attr("target", "_blank");
65023 selection3.text(d.user);
65025 selection3.call(_t.append("note.anonymous"));
65028 metadataEnter.append("div").attr("class", "comment-date").html(function(d) {
65029 return _t.html("note.status." + d.action, { when: localeDateString2(d.date) });
65031 mainEnter.append("div").attr("class", "comment-text").html(function(d) {
65033 }).selectAll("a").attr("rel", "noopener nofollow").attr("target", "_blank");
65034 comments.call(replaceAvatars);
65036 function replaceAvatars(selection2) {
65037 var showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
65038 var osm = services.osm;
65039 if (showThirdPartyIcons !== "true" || !osm)
65042 _note.comments.forEach(function(d) {
65044 uids[d.uid] = true;
65046 Object.keys(uids).forEach(function(uid) {
65047 osm.loadUser(uid, function(err, user) {
65048 if (!user || !user.image_url)
65050 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);
65054 function localeDateString2(s) {
65057 var options2 = { day: "numeric", month: "short", year: "numeric" };
65058 s = s.replace(/-/g, "/");
65059 var d = new Date(s);
65060 if (isNaN(d.getTime()))
65062 return d.toLocaleDateString(_mainLocalizer.localeCode(), options2);
65064 noteComments.note = function(val) {
65065 if (!arguments.length)
65068 return noteComments;
65070 return noteComments;
65073 // modules/ui/note_header.js
65074 function uiNoteHeader() {
65076 function noteHeader(selection2) {
65077 var header = selection2.selectAll(".note-header").data(
65078 _note ? [_note] : [],
65080 return d.status + d.id;
65083 header.exit().remove();
65084 var headerEnter = header.enter().append("div").attr("class", "note-header");
65085 var iconEnter = headerEnter.append("div").attr("class", function(d) {
65086 return "note-header-icon " + d.status;
65087 }).classed("new", function(d) {
65090 iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-note", "note-fill"));
65091 iconEnter.each(function(d) {
65094 statusIcon = "#iD-icon-plus";
65095 } else if (d.status === "open") {
65096 statusIcon = "#iD-icon-close";
65098 statusIcon = "#iD-icon-apply";
65100 iconEnter.append("div").attr("class", "note-icon-annotation").attr("title", _t("icons.close")).call(svgIcon(statusIcon, "icon-annotation"));
65102 headerEnter.append("div").attr("class", "note-header-label").html(function(d) {
65103 if (_note.isNew()) {
65104 return _t.html("note.new");
65106 return _t.html("note.note") + " " + d.id + " " + (d.status === "closed" ? _t.html("note.closed") : "");
65109 noteHeader.note = function(val) {
65110 if (!arguments.length)
65118 // modules/ui/note_report.js
65119 function uiNoteReport() {
65121 function noteReport(selection2) {
65123 if (services.osm && _note instanceof osmNote && !_note.isNew()) {
65124 url = services.osm.noteReportURL(_note);
65126 var link2 = selection2.selectAll(".note-report").data(url ? [url] : []);
65127 link2.exit().remove();
65128 var linkEnter = link2.enter().append("a").attr("class", "note-report").attr("target", "_blank").attr("href", function(d) {
65130 }).call(svgIcon("#iD-icon-out-link", "inline"));
65131 linkEnter.append("span").call(_t.append("note.report"));
65133 noteReport.note = function(val) {
65134 if (!arguments.length)
65142 // modules/ui/note_editor.js
65143 function uiNoteEditor(context) {
65144 var dispatch10 = dispatch_default("change");
65145 var noteComments = uiNoteComments(context);
65146 var noteHeader = uiNoteHeader();
65149 function noteEditor(selection2) {
65150 var header = selection2.selectAll(".header").data([0]);
65151 var headerEnter = header.enter().append("div").attr("class", "header fillL");
65152 headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
65153 context.enter(modeBrowse(context));
65154 }).call(svgIcon("#iD-icon-close"));
65155 headerEnter.append("h2").call(_t.append("note.title"));
65156 var body = selection2.selectAll(".body").data([0]);
65157 body = body.enter().append("div").attr("class", "body").merge(body);
65158 var editor = body.selectAll(".note-editor").data([0]);
65159 editor.enter().append("div").attr("class", "modal-section note-editor").merge(editor).call(noteHeader.note(_note)).call(noteComments.note(_note)).call(noteSaveSection);
65160 var footer = selection2.selectAll(".footer").data([0]);
65161 footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOSM(context).what(_note)).call(uiNoteReport(context).note(_note));
65162 var osm = services.osm;
65164 osm.on("change.note-save", function() {
65165 selection2.call(noteEditor);
65169 function noteSaveSection(selection2) {
65170 var isSelected = _note && _note.id === context.selectedNoteID();
65171 var noteSave = selection2.selectAll(".note-save").data(isSelected ? [_note] : [], function(d) {
65172 return d.status + d.id;
65174 noteSave.exit().remove();
65175 var noteSaveEnter = noteSave.enter().append("div").attr("class", "note-save save-section cf");
65176 noteSaveEnter.append("h4").attr("class", ".note-save-header").html(function() {
65177 return _note.isNew() ? _t.html("note.newDescription") : _t.html("note.newComment");
65179 var commentTextarea = noteSaveEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("note.inputPlaceholder")).attr("maxlength", 1e3).property("value", function(d) {
65180 return d.newComment;
65181 }).call(utilNoAuto).on("keydown.note-input", keydown).on("input.note-input", changeInput).on("blur.note-input", changeInput);
65182 if (!commentTextarea.empty() && _newNote) {
65183 commentTextarea.node().focus();
65185 noteSave = noteSaveEnter.merge(noteSave).call(userDetails).call(noteSaveButtons);
65186 function keydown(d3_event) {
65187 if (!(d3_event.keyCode === 13 && d3_event.metaKey))
65189 var osm = services.osm;
65192 var hasAuth = osm.authenticated();
65195 if (!_note.newComment)
65197 d3_event.preventDefault();
65198 select_default2(this).on("keydown.note-input", null);
65199 window.setTimeout(function() {
65200 if (_note.isNew()) {
65201 noteSave.selectAll(".save-button").node().focus();
65204 noteSave.selectAll(".comment-button").node().focus();
65205 clickComment(_note);
65209 function changeInput() {
65210 var input = select_default2(this);
65211 var val = input.property("value").trim() || void 0;
65212 _note = _note.update({ newComment: val });
65213 var osm = services.osm;
65215 osm.replaceNote(_note);
65217 noteSave.call(noteSaveButtons);
65220 function userDetails(selection2) {
65221 var detailSection = selection2.selectAll(".detail-section").data([0]);
65222 detailSection = detailSection.enter().append("div").attr("class", "detail-section").merge(detailSection);
65223 var osm = services.osm;
65226 var hasAuth = osm.authenticated();
65227 var authWarning = detailSection.selectAll(".auth-warning").data(hasAuth ? [] : [0]);
65228 authWarning.exit().transition().duration(200).style("opacity", 0).remove();
65229 var authEnter = authWarning.enter().insert("div", ".tag-reference-body").attr("class", "field-warning auth-warning").style("opacity", 0);
65230 authEnter.call(svgIcon("#iD-icon-alert", "inline"));
65231 authEnter.append("span").call(_t.append("note.login"));
65232 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) {
65233 d3_event.preventDefault();
65234 osm.authenticate();
65236 authEnter.transition().duration(200).style("opacity", 1);
65237 var prose = detailSection.selectAll(".note-save-prose").data(hasAuth ? [0] : []);
65238 prose.exit().remove();
65239 prose = prose.enter().append("p").attr("class", "note-save-prose").call(_t.append("note.upload_explanation")).merge(prose);
65240 osm.userDetails(function(err, user) {
65243 var userLink = select_default2(document.createElement("div"));
65244 if (user.image_url) {
65245 userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
65247 userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
65248 prose.html(_t.html("note.upload_explanation_with_user", { user: { html: userLink.html() } }));
65251 function noteSaveButtons(selection2) {
65252 var osm = services.osm;
65253 var hasAuth = osm && osm.authenticated();
65254 var isSelected = _note && _note.id === context.selectedNoteID();
65255 var buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_note] : [], function(d) {
65256 return d.status + d.id;
65258 buttonSection.exit().remove();
65259 var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
65260 if (_note.isNew()) {
65261 buttonEnter.append("button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
65262 buttonEnter.append("button").attr("class", "button save-button action").call(_t.append("note.save"));
65264 buttonEnter.append("button").attr("class", "button status-button action");
65265 buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("note.comment"));
65267 buttonSection = buttonSection.merge(buttonEnter);
65268 buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
65269 buttonSection.select(".save-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
65270 buttonSection.select(".status-button").attr("disabled", hasAuth ? null : true).html(function(d) {
65271 var action = d.status === "open" ? "close" : "open";
65272 var andComment = d.newComment ? "_comment" : "";
65273 return _t.html("note." + action + andComment);
65274 }).on("click.status", clickStatus);
65275 buttonSection.select(".comment-button").attr("disabled", isSaveDisabled).on("click.comment", clickComment);
65276 function isSaveDisabled(d) {
65277 return hasAuth && d.status === "open" && d.newComment ? null : true;
65280 function clickCancel(d3_event, d) {
65282 var osm = services.osm;
65286 context.enter(modeBrowse(context));
65287 dispatch10.call("change");
65289 function clickSave(d3_event, d) {
65291 var osm = services.osm;
65293 osm.postNoteCreate(d, function(err, note) {
65294 dispatch10.call("change", note);
65298 function clickStatus(d3_event, d) {
65300 var osm = services.osm;
65302 var setStatus = d.status === "open" ? "closed" : "open";
65303 osm.postNoteUpdate(d, setStatus, function(err, note) {
65304 dispatch10.call("change", note);
65308 function clickComment(d3_event, d) {
65310 var osm = services.osm;
65312 osm.postNoteUpdate(d, d.status, function(err, note) {
65313 dispatch10.call("change", note);
65317 noteEditor.note = function(val) {
65318 if (!arguments.length)
65323 noteEditor.newNote = function(val) {
65324 if (!arguments.length)
65329 return utilRebind(noteEditor, dispatch10, "on");
65332 // modules/ui/source_switch.js
65333 function uiSourceSwitch(context) {
65335 function click(d3_event) {
65336 d3_event.preventDefault();
65337 var osm = context.connection();
65340 if (context.inIntro())
65342 if (context.history().hasChanges() && !window.confirm(_t("source_switch.lose_changes")))
65344 var isLive = select_default2(this).classed("live");
65346 context.enter(modeBrowse(context));
65347 context.history().clearSaved();
65349 select_default2(this).html(isLive ? _t.html("source_switch.live") : _t.html("source_switch.dev")).classed("live", isLive).classed("chip", isLive);
65350 osm.switch(isLive ? keys[0] : keys[1]);
65352 var sourceSwitch = function(selection2) {
65353 selection2.append("a").attr("href", "#").call(_t.append("source_switch.live")).attr("class", "live chip").on("click", click);
65355 sourceSwitch.keys = function(_) {
65356 if (!arguments.length)
65359 return sourceSwitch;
65361 return sourceSwitch;
65364 // modules/ui/spinner.js
65365 function uiSpinner(context) {
65366 var osm = context.connection();
65367 return function(selection2) {
65368 var img = selection2.append("img").attr("src", context.imagePath("loader-black.gif")).style("opacity", 0);
65370 osm.on("loading.spinner", function() {
65371 img.transition().style("opacity", 1);
65372 }).on("loaded.spinner", function() {
65373 img.transition().style("opacity", 0);
65379 // modules/ui/sections/privacy.js
65380 function uiSectionPrivacy(context) {
65381 let section = uiSection("preferences-third-party", context).label(() => _t.append("preferences.privacy.title")).disclosureContent(renderDisclosureContent);
65382 function renderDisclosureContent(selection2) {
65383 selection2.selectAll(".privacy-options-list").data([0]).enter().append("ul").attr("class", "layer-list privacy-options-list");
65384 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(
65385 uiTooltip().title(() => _t.append("preferences.privacy.third_party_icons.tooltip")).placement("bottom")
65387 thirdPartyIconsEnter.append("input").attr("type", "checkbox").on("change", (d3_event, d) => {
65388 d3_event.preventDefault();
65389 corePreferences("preferences.privacy.thirdpartyicons", d === "true" ? "false" : "true");
65391 thirdPartyIconsEnter.append("span").call(_t.append("preferences.privacy.third_party_icons.description"));
65392 selection2.selectAll(".privacy-third-party-icons-item").classed("active", (d) => d === "true").select("input").property("checked", (d) => d === "true");
65393 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"));
65395 corePreferences.onChange("preferences.privacy.thirdpartyicons", section.reRender);
65399 // modules/ui/splash.js
65400 function uiSplash(context) {
65401 return (selection2) => {
65402 if (context.history().hasRestorableChanges())
65404 let updateMessage = "";
65405 const sawPrivacyVersion = corePreferences("sawPrivacyVersion");
65406 let showSplash = !corePreferences("sawSplash");
65407 if (sawPrivacyVersion !== context.privacyVersion) {
65408 updateMessage = _t("splash.privacy_update");
65413 corePreferences("sawSplash", true);
65414 corePreferences("sawPrivacyVersion", context.privacyVersion);
65415 _mainFileFetcher.get("intro_graph");
65416 let modalSelection = uiModal(selection2);
65417 modalSelection.select(".modal").attr("class", "modal-splash modal");
65418 let introModal = modalSelection.select(".content").append("div").attr("class", "fillL");
65419 introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("splash.welcome"));
65420 let modalSection = introModal.append("div").attr("class", "modal-section");
65421 modalSection.append("p").html(_t.html("splash.text", {
65422 version: context.version,
65423 website: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/develop/CHANGELOG.md#whats-new">' + _t.html("splash.changelog") + "</a>" },
65424 github: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/issues">github.com</a>' }
65426 modalSection.append("p").html(_t.html("splash.privacy", {
65428 privacyLink: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/release/PRIVACY.md">' + _t("splash.privacy_policy") + "</a>" }
65430 uiSectionPrivacy(context).label(() => _t.append("splash.privacy_settings")).render(modalSection);
65431 let buttonWrap = introModal.append("div").attr("class", "modal-actions");
65432 let walkthrough = buttonWrap.append("button").attr("class", "walkthrough").on("click", () => {
65433 context.container().call(uiIntro(context));
65434 modalSelection.close();
65436 walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
65437 walkthrough.append("div").call(_t.append("splash.walkthrough"));
65438 let startEditing = buttonWrap.append("button").attr("class", "start-editing").on("click", modalSelection.close);
65439 startEditing.append("svg").attr("class", "logo logo-features").append("use").attr("xlink:href", "#iD-logo-features");
65440 startEditing.append("div").call(_t.append("splash.start"));
65441 modalSelection.select("button.close").attr("class", "hide");
65445 // modules/ui/status.js
65446 function uiStatus(context) {
65447 var osm = context.connection();
65448 return function(selection2) {
65451 function update(err, apiStatus) {
65452 selection2.html("");
65454 if (apiStatus === "connectionSwitched") {
65456 } else if (apiStatus === "rateLimited") {
65457 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) {
65458 d3_event.preventDefault();
65459 osm.authenticate();
65462 var throttledRetry = throttle_default(function() {
65463 context.loadTiles(context.projection);
65464 osm.reloadApiStatus();
65466 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) {
65467 d3_event.preventDefault();
65471 } else if (apiStatus === "readonly") {
65472 selection2.call(_t.append("osm_api_status.message.readonly"));
65473 } else if (apiStatus === "offline") {
65474 selection2.call(_t.append("osm_api_status.message.offline"));
65476 selection2.attr("class", "api-status " + (err ? "error" : apiStatus));
65478 osm.on("apiStatusChange.uiStatus", update);
65479 context.history().on("storage_error", () => {
65480 selection2.selectAll("span.local-storage-full").remove();
65481 selection2.append("span").attr("class", "local-storage-full").call(_t.append("osm_api_status.message.local_storage_full"));
65482 selection2.classed("error", true);
65484 window.setInterval(function() {
65485 osm.reloadApiStatus();
65487 osm.reloadApiStatus();
65491 // node_modules/osm-community-index/lib/simplify.js
65492 var import_diacritics3 = __toESM(require_diacritics(), 1);
65493 function simplify2(str2) {
65494 if (typeof str2 !== "string")
65496 return import_diacritics3.default.remove(
65497 str2.replace(/&/g, "and").replace(/İ/ig, "i").replace(/[\s\-=_!"#%'*{},.\/:;?\(\)\[\]@\\$\^*+<>«»~`’\u00a1\u00a7\u00b6\u00b7\u00bf\u037e\u0387\u055a-\u055f\u0589\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0af0\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f14\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1360-\u1368\u166d\u166e\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cc0-\u1cc7\u1cd3\u200b-\u200f\u2016\u2017\u2020-\u2027\u2030-\u2038\u203b-\u203e\u2041-\u2043\u2047-\u2051\u2053\u2055-\u205e\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00\u2e01\u2e06-\u2e08\u2e0b\u2e0e-\u2e16\u2e18\u2e19\u2e1b\u2e1e\u2e1f\u2e2a-\u2e2e\u2e30-\u2e39\u3001-\u3003\u303d\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uaaf0\uaaf1\uabeb\ufe10-\ufe16\ufe19\ufe30\ufe45\ufe46\ufe49-\ufe4c\ufe50-\ufe52\ufe54-\ufe57\ufe5f-\ufe61\ufe68\ufe6a\ufe6b\ufeff\uff01-\uff03\uff05-\uff07\uff0a\uff0c\uff0e\uff0f\uff1a\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65]+/g, "").toLowerCase()
65501 // node_modules/osm-community-index/lib/resolve_strings.js
65502 function resolveStrings(item, defaults2, localizerFn) {
65503 let itemStrings = Object.assign({}, item.strings);
65504 let defaultStrings = Object.assign({}, defaults2[item.type]);
65505 const anyToken = new RegExp(/(\{\w+\})/, "gi");
65507 if (itemStrings.community) {
65508 const communityID = simplify2(itemStrings.community);
65509 itemStrings.community = localizerFn(`_communities.${communityID}`);
65511 ["name", "description", "extendedDescription"].forEach((prop) => {
65512 if (defaultStrings[prop])
65513 defaultStrings[prop] = localizerFn(`_defaults.${item.type}.${prop}`);
65514 if (itemStrings[prop])
65515 itemStrings[prop] = localizerFn(`${item.id}.${prop}`);
65518 let replacements = {
65519 account: item.account,
65520 community: itemStrings.community,
65521 signupUrl: itemStrings.signupUrl,
65522 url: itemStrings.url
65524 if (!replacements.signupUrl) {
65525 replacements.signupUrl = resolve(itemStrings.signupUrl || defaultStrings.signupUrl);
65527 if (!replacements.url) {
65528 replacements.url = resolve(itemStrings.url || defaultStrings.url);
65531 name: resolve(itemStrings.name || defaultStrings.name),
65532 url: resolve(itemStrings.url || defaultStrings.url),
65533 signupUrl: resolve(itemStrings.signupUrl || defaultStrings.signupUrl),
65534 description: resolve(itemStrings.description || defaultStrings.description),
65535 extendedDescription: resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription)
65537 resolved.nameHTML = linkify(resolved.url, resolved.name);
65538 resolved.urlHTML = linkify(resolved.url);
65539 resolved.signupUrlHTML = linkify(resolved.signupUrl);
65540 resolved.descriptionHTML = resolve(itemStrings.description || defaultStrings.description, true);
65541 resolved.extendedDescriptionHTML = resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription, true);
65543 function resolve(s, addLinks) {
65547 for (let key in replacements) {
65548 const token = `{${key}}`;
65549 const regex = new RegExp(token, "g");
65550 if (regex.test(result)) {
65551 let replacement = replacements[key];
65552 if (!replacement) {
65553 throw new Error(`Cannot resolve token: ${token}`);
65555 if (addLinks && (key === "signupUrl" || key === "url")) {
65556 replacement = linkify(replacement);
65558 result = result.replace(regex, replacement);
65562 const leftovers = result.match(anyToken);
65564 throw new Error(`Cannot resolve tokens: ${leftovers}`);
65566 if (addLinks && item.type === "reddit") {
65567 result = result.replace(/(\/r\/\w+\/*)/i, (match) => linkify(resolved.url, match));
65571 function linkify(url, text2) {
65574 text2 = text2 || url;
65575 return `<a target="_blank" href="${url}">${text2}</a>`;
65579 // modules/ui/success.js
65581 function uiSuccess(context) {
65582 const MAXEVENTS = 2;
65583 const dispatch10 = dispatch_default("cancel");
65586 ensureOSMCommunityIndex();
65587 function ensureOSMCommunityIndex() {
65588 const data = _mainFileFetcher;
65589 return Promise.all([
65590 data.get("oci_features"),
65591 data.get("oci_resources"),
65592 data.get("oci_defaults")
65593 ]).then((vals) => {
65596 if (vals[0] && Array.isArray(vals[0].features)) {
65597 _sharedLocationManager.mergeCustomGeoJSON(vals[0]);
65599 let ociResources = Object.values(vals[1].resources);
65600 if (ociResources.length) {
65601 return _sharedLocationManager.mergeLocationSets(ociResources).then(() => {
65603 resources: ociResources,
65604 defaults: vals[2].defaults
65611 defaults: vals[2].defaults
65617 function parseEventDate(when) {
65620 let raw = when.trim();
65623 if (!/Z$/.test(raw)) {
65626 const parsed = new Date(raw);
65627 return new Date(parsed.toUTCString().slice(0, 25));
65629 function success(selection2) {
65630 let header = selection2.append("div").attr("class", "header fillL");
65631 header.append("h2").call(_t.append("success.just_edited"));
65632 header.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => dispatch10.call("cancel")).call(svgIcon("#iD-icon-close"));
65633 let body = selection2.append("div").attr("class", "body save-success fillL");
65634 let summary = body.append("div").attr("class", "save-summary");
65635 summary.append("h3").call(_t.append("success.thank_you" + (_location ? "_location" : ""), { where: _location }));
65636 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"));
65637 let osm = context.connection();
65640 let changesetURL = osm.changesetURL(_changeset2.id);
65641 let table = summary.append("table").attr("class", "summary-table");
65642 let row = table.append("tr").attr("class", "summary-row");
65643 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");
65644 let summaryDetail = row.append("td").attr("class", "cell-detail summary-detail");
65645 summaryDetail.append("a").attr("class", "cell-detail summary-view-on-osm").attr("target", "_blank").attr("href", changesetURL).call(_t.append("success.view_on_osm"));
65646 summaryDetail.append("div").html(_t.html("success.changeset_id", {
65647 changeset_id: { html: `<a href="${changesetURL}" target="_blank">${_changeset2.id}</a>` }
65649 ensureOSMCommunityIndex().then((oci) => {
65650 const loc = context.map().center();
65651 const validHere = _sharedLocationManager.locationSetsAt(loc);
65652 let communities = [];
65653 oci.resources.forEach((resource) => {
65654 let area = validHere[resource.locationSetID];
65657 const localizer = (stringID) => _t.html(`community.${stringID}`);
65658 resource.resolved = resolveStrings(resource, oci.defaults, localizer);
65661 order: resource.order || 0,
65665 communities.sort((a, b) => a.area - b.area || b.order - a.order);
65666 body.call(showCommunityLinks, communities.map((c) => c.resource));
65669 function showCommunityLinks(selection2, resources) {
65670 let communityLinks = selection2.append("div").attr("class", "save-communityLinks");
65671 communityLinks.append("h3").call(_t.append("success.like_osm"));
65672 let table = communityLinks.append("table").attr("class", "community-table");
65673 let row = table.selectAll(".community-row").data(resources);
65674 let rowEnter = row.enter().append("tr").attr("class", "community-row");
65675 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}`);
65676 let communityDetail = rowEnter.append("td").attr("class", "cell-detail community-detail");
65677 communityDetail.each(showCommunityDetails);
65678 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"));
65680 function showCommunityDetails(d) {
65681 let selection2 = select_default2(this);
65682 let communityID = d.id;
65683 selection2.append("div").attr("class", "community-name").html(d.resolved.nameHTML);
65684 selection2.append("div").attr("class", "community-description").html(d.resolved.descriptionHTML);
65685 if (d.resolved.extendedDescriptionHTML || d.languageCodes && d.languageCodes.length) {
65686 selection2.append("div").call(
65687 uiDisclosure(context, `community-more-${d.id}`, false).expanded(false).updatePreference(false).label(() => _t.append("success.more")).content(showMore)
65690 let nextEvents = (d.events || []).map((event) => {
65691 event.date = parseEventDate(event.when);
65693 }).filter((event) => {
65694 const t = event.date.getTime();
65695 const now3 = new Date().setHours(0, 0, 0, 0);
65696 return !isNaN(t) && t >= now3;
65697 }).sort((a, b) => {
65698 return a.date < b.date ? -1 : a.date > b.date ? 1 : 0;
65699 }).slice(0, MAXEVENTS);
65700 if (nextEvents.length) {
65701 selection2.append("div").call(
65702 uiDisclosure(context, `community-events-${d.id}`, false).expanded(false).updatePreference(false).label(_t.html("success.events")).content(showNextEvents)
65703 ).select(".hide-toggle").append("span").attr("class", "badge-text").text(nextEvents.length);
65705 function showMore(selection3) {
65706 let more = selection3.selectAll(".community-more").data([0]);
65707 let moreEnter = more.enter().append("div").attr("class", "community-more");
65708 if (d.resolved.extendedDescriptionHTML) {
65709 moreEnter.append("div").attr("class", "community-extended-description").html(d.resolved.extendedDescriptionHTML);
65711 if (d.languageCodes && d.languageCodes.length) {
65712 const languageList = d.languageCodes.map((code) => _mainLocalizer.languageName(code)).join(", ");
65713 moreEnter.append("div").attr("class", "community-languages").call(_t.append("success.languages", { languages: languageList }));
65716 function showNextEvents(selection3) {
65717 let events = selection3.append("div").attr("class", "community-events");
65718 let item = events.selectAll(".community-event").data(nextEvents);
65719 let itemEnter = item.enter().append("div").attr("class", "community-event");
65720 itemEnter.append("div").attr("class", "community-event-name").append("a").attr("target", "_blank").attr("href", (d2) => d2.url).text((d2) => {
65721 let name = d2.name;
65722 if (d2.i18n && d2.id) {
65723 name = _t(`community.${communityID}.events.${d2.id}.name`, { default: name });
65727 itemEnter.append("div").attr("class", "community-event-when").text((d2) => {
65728 let options2 = { weekday: "short", day: "numeric", month: "short", year: "numeric" };
65729 if (d2.date.getHours() || d2.date.getMinutes()) {
65730 options2.hour = "numeric";
65731 options2.minute = "numeric";
65733 return d2.date.toLocaleString(_mainLocalizer.localeCode(), options2);
65735 itemEnter.append("div").attr("class", "community-event-where").text((d2) => {
65736 let where = d2.where;
65737 if (d2.i18n && d2.id) {
65738 where = _t(`community.${communityID}.events.${d2.id}.where`, { default: where });
65742 itemEnter.append("div").attr("class", "community-event-description").text((d2) => {
65743 let description = d2.description;
65744 if (d2.i18n && d2.id) {
65745 description = _t(`community.${communityID}.events.${d2.id}.description`, { default: description });
65747 return description;
65751 success.changeset = function(val) {
65752 if (!arguments.length)
65753 return _changeset2;
65757 success.location = function(val) {
65758 if (!arguments.length)
65763 return utilRebind(success, dispatch10, "on");
65766 // modules/ui/version.js
65767 var sawVersion = null;
65768 var isNewVersion = false;
65769 var isNewUser = false;
65770 function uiVersion(context) {
65771 var currVersion = context.version;
65772 var matchedVersion = currVersion.match(/\d+\.\d+\.\d+.*/);
65773 if (sawVersion === null && matchedVersion !== null) {
65774 if (corePreferences("sawVersion")) {
65776 isNewVersion = corePreferences("sawVersion") !== currVersion && currVersion.indexOf("-") === -1;
65779 isNewVersion = true;
65781 corePreferences("sawVersion", currVersion);
65782 sawVersion = currVersion;
65784 return function(selection2) {
65785 selection2.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD").text(currVersion);
65786 if (isNewVersion && !isNewUser) {
65787 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(
65788 uiTooltip().title(() => _t.append("version.whats_new", { version: currVersion })).placement("top").scrollContainer(context.container().select(".main-footer-wrap"))
65794 // modules/ui/zoom.js
65795 function uiZoom(context) {
65798 icon: "iD-icon-plus",
65799 title: _t.append("zoom.in"),
65801 disabled: function() {
65802 return !context.map().canZoomIn();
65804 disabledTitle: _t.append("zoom.disabled.in"),
65808 icon: "iD-icon-minus",
65809 title: _t.append("zoom.out"),
65811 disabled: function() {
65812 return !context.map().canZoomOut();
65814 disabledTitle: _t.append("zoom.disabled.out"),
65817 function zoomIn(d3_event) {
65818 if (d3_event.shiftKey)
65820 d3_event.preventDefault();
65821 context.map().zoomIn();
65823 function zoomOut(d3_event) {
65824 if (d3_event.shiftKey)
65826 d3_event.preventDefault();
65827 context.map().zoomOut();
65829 function zoomInFurther(d3_event) {
65830 if (d3_event.shiftKey)
65832 d3_event.preventDefault();
65833 context.map().zoomInFurther();
65835 function zoomOutFurther(d3_event) {
65836 if (d3_event.shiftKey)
65838 d3_event.preventDefault();
65839 context.map().zoomOutFurther();
65841 return function(selection2) {
65842 var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function(d) {
65843 if (d.disabled()) {
65844 return d.disabledTitle;
65847 }).keys(function(d) {
65850 var lastPointerUpType;
65851 var buttons = selection2.selectAll("button").data(zooms).enter().append("button").attr("class", function(d) {
65853 }).on("pointerup.editor", function(d3_event) {
65854 lastPointerUpType = d3_event.pointerType;
65855 }).on("click.editor", function(d3_event, d) {
65856 if (!d.disabled()) {
65857 d.action(d3_event);
65858 } else if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
65859 context.ui().flash.duration(2e3).iconName("#" + d.icon).iconClass("disabled").label(d.disabledTitle)();
65861 lastPointerUpType = null;
65862 }).call(tooltipBehavior);
65863 buttons.each(function(d) {
65864 select_default2(this).call(svgIcon("#" + d.icon, "light"));
65866 utilKeybinding.plusKeys.forEach(function(key) {
65867 context.keybinding().on([key], zoomIn);
65868 context.keybinding().on([uiCmd("\u2325" + key)], zoomInFurther);
65870 utilKeybinding.minusKeys.forEach(function(key) {
65871 context.keybinding().on([key], zoomOut);
65872 context.keybinding().on([uiCmd("\u2325" + key)], zoomOutFurther);
65874 function updateButtonStates() {
65875 buttons.classed("disabled", function(d) {
65876 return d.disabled();
65877 }).each(function() {
65878 var selection3 = select_default2(this);
65879 if (!selection3.select(".tooltip.in").empty()) {
65880 selection3.call(tooltipBehavior.updateContent);
65884 updateButtonStates();
65885 context.map().on("move.uiZoom", updateButtonStates);
65889 // modules/ui/sections/raw_tag_editor.js
65890 function uiSectionRawTagEditor(id2, context) {
65891 var section = uiSection(id2, context).classes("raw-tag-editor").label(function() {
65892 var count = Object.keys(_tags).filter(function(d) {
65895 return _t.append("inspector.title_count", { title: _t("inspector.tags"), count });
65896 }).expandedByDefault(false).disclosureContent(renderDisclosureContent);
65897 var taginfo = services.taginfo;
65898 var dispatch10 = dispatch_default("change");
65899 var availableViews = [
65900 { id: "list", icon: "#fas-th-list" },
65901 { id: "text", icon: "#fas-i-cursor" }
65903 var _tagView = corePreferences("raw-tag-editor-view") || "list";
65904 var _readOnlyTags = [];
65905 var _orderedKeys = [];
65906 var _showBlank = false;
65907 var _pendingChange = null;
65912 var _didInteract = false;
65913 function interacted() {
65914 _didInteract = true;
65916 function renderDisclosureContent(wrap2) {
65917 _orderedKeys = _orderedKeys.filter(function(key) {
65918 return _tags[key] !== void 0;
65920 var all = Object.keys(_tags).sort();
65921 var missingKeys = utilArrayDifference(all, _orderedKeys);
65922 for (var i2 in missingKeys) {
65923 _orderedKeys.push(missingKeys[i2]);
65925 var rowData = _orderedKeys.map(function(key, i3) {
65926 return { index: i3, key, value: _tags[key] };
65928 if (!rowData.length || _showBlank) {
65929 _showBlank = false;
65930 rowData.push({ index: rowData.length, key: "", value: "" });
65932 var options2 = wrap2.selectAll(".raw-tag-options").data([0]);
65933 options2.exit().remove();
65934 var optionsEnter = options2.enter().insert("div", ":first-child").attr("class", "raw-tag-options").attr("role", "tablist");
65935 var optionEnter = optionsEnter.selectAll(".raw-tag-option").data(availableViews, function(d) {
65938 optionEnter.append("button").attr("class", function(d) {
65939 return "raw-tag-option raw-tag-option-" + d.id + (_tagView === d.id ? " selected" : "");
65940 }).attr("aria-selected", function(d) {
65941 return _tagView === d.id;
65942 }).attr("role", "tab").attr("title", function(d) {
65943 return _t("icons." + d.id);
65944 }).on("click", function(d3_event, d) {
65946 corePreferences("raw-tag-editor-view", d.id);
65947 wrap2.selectAll(".raw-tag-option").classed("selected", function(datum2) {
65948 return datum2 === d;
65949 }).attr("aria-selected", function(datum2) {
65950 return datum2 === d;
65952 wrap2.selectAll(".tag-text").classed("hide", d.id !== "text").each(setTextareaHeight);
65953 wrap2.selectAll(".tag-list, .add-row").classed("hide", d.id !== "list");
65954 }).each(function(d) {
65955 select_default2(this).call(svgIcon(d.icon));
65957 var textData = rowsToText(rowData);
65958 var textarea = wrap2.selectAll(".tag-text").data([0]);
65959 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);
65960 textarea.call(utilGetSetValue, textData).each(setTextareaHeight).on("input", setTextareaHeight).on("focus", interacted).on("blur", textChanged).on("change", textChanged);
65961 var list = wrap2.selectAll(".tag-list").data([0]);
65962 list = list.enter().append("ul").attr("class", "tag-list" + (_tagView !== "list" ? " hide" : "")).merge(list);
65963 var addRowEnter = wrap2.selectAll(".add-row").data([0]).enter().append("div").attr("class", "add-row" + (_tagView !== "list" ? " hide" : ""));
65964 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);
65965 addRowEnter.append("div").attr("class", "space-value");
65966 addRowEnter.append("div").attr("class", "space-buttons");
65967 var items = list.selectAll(".tag-row").data(rowData, function(d) {
65970 items.exit().each(unbind).remove();
65971 var itemsEnter = items.enter().append("li").attr("class", "tag-row").classed("readonly", isReadOnly);
65972 var innerWrap = itemsEnter.append("div").attr("class", "inner-wrap");
65973 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);
65974 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);
65975 innerWrap.append("button").attr("class", "form-field-button remove").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
65976 items = items.merge(itemsEnter).sort(function(a, b) {
65977 return a.index - b.index;
65979 items.each(function(d) {
65980 var row = select_default2(this);
65981 var key = row.select("input.key");
65982 var value = row.select("input.value");
65983 if (_entityIDs && taginfo && _state !== "hover") {
65984 bindTypeahead(key, value);
65986 var referenceOptions = { key: d.key };
65987 if (typeof d.value === "string") {
65988 referenceOptions.value = d.value;
65990 var reference = uiTagReference(referenceOptions, context);
65991 if (_state === "hover") {
65992 reference.showing(false);
65994 row.select(".inner-wrap").call(reference.button);
65995 row.call(reference.body);
65996 row.select("button.remove");
65998 items.selectAll("input.key").attr("title", function(d) {
66000 }).call(utilGetSetValue, function(d) {
66002 }).attr("readonly", function(d) {
66003 return isReadOnly(d) || null;
66005 items.selectAll("input.value").attr("title", function(d) {
66006 return Array.isArray(d.value) ? d.value.filter(Boolean).join("\n") : d.value;
66007 }).classed("mixed", function(d) {
66008 return Array.isArray(d.value);
66009 }).attr("placeholder", function(d) {
66010 return typeof d.value === "string" ? null : _t("inspector.multiple_values");
66011 }).call(utilGetSetValue, function(d) {
66012 return typeof d.value === "string" ? d.value : "";
66013 }).attr("readonly", function(d) {
66014 return isReadOnly(d) || null;
66016 items.selectAll("button.remove").on(("PointerEvent" in window ? "pointer" : "mouse") + "down", removeTag);
66018 function isReadOnly(d) {
66019 for (var i2 = 0; i2 < _readOnlyTags.length; i2++) {
66020 if (d.key.match(_readOnlyTags[i2]) !== null) {
66026 function setTextareaHeight() {
66027 if (_tagView !== "text")
66029 var selection2 = select_default2(this);
66030 var matches = selection2.node().value.match(/\n/g);
66031 var lineCount = 2 + Number(matches && matches.length);
66032 var lineHeight = 20;
66033 selection2.style("height", lineCount * lineHeight + "px");
66035 function stringify3(s) {
66036 return JSON.stringify(s).slice(1, -1);
66038 function unstringify(s) {
66041 if (s.length < 1 || s.charAt(0) !== '"') {
66044 if (s.length < 2 || s.charAt(s.length - 1) !== '"' || s.charAt(s.length - 1) === '"' && s.charAt(s.length - 2) === "\\") {
66047 return JSON.parse(leading + s + trailing);
66049 function rowsToText(rows) {
66050 var str2 = rows.filter(function(row) {
66051 return row.key && row.key.trim() !== "";
66052 }).map(function(row) {
66053 var rawVal = row.value;
66054 if (typeof rawVal !== "string")
66056 var val = rawVal ? stringify3(rawVal) : "";
66057 return stringify3(row.key) + "=" + val;
66059 if (_state !== "hover" && str2.length) {
66060 return str2 + "\n";
66064 function textChanged() {
66065 var newText = this.value.trim();
66067 newText.split("\n").forEach(function(row) {
66068 var m = row.match(/^\s*([^=]+)=(.*)$/);
66070 var k = context.cleanTagKey(unstringify(m[1].trim()));
66071 var v = context.cleanTagValue(unstringify(m[2].trim()));
66075 var tagDiff = utilTagDiff(_tags, newTags);
66076 if (!tagDiff.length)
66078 _pendingChange = _pendingChange || {};
66079 tagDiff.forEach(function(change) {
66080 if (isReadOnly({ key: change.key }))
66082 if (change.newVal === "*" && typeof change.oldVal !== "string")
66084 if (change.type === "-") {
66085 _pendingChange[change.key] = void 0;
66086 } else if (change.type === "+") {
66087 _pendingChange[change.key] = change.newVal || "";
66090 if (Object.keys(_pendingChange).length === 0) {
66091 _pendingChange = null;
66096 function pushMore(d3_event) {
66097 if (d3_event.keyCode === 9 && !d3_event.shiftKey && section.selection().selectAll(".tag-list li:last-child input.value").node() === this && utilGetSetValue(select_default2(this))) {
66101 function bindTypeahead(key, value) {
66102 if (isReadOnly(key.datum()))
66104 if (Array.isArray(value.datum().value)) {
66105 value.call(uiCombobox(context, "tag-value").minItems(1).fetcher(function(value2, callback) {
66106 var keyString = utilGetSetValue(key);
66107 if (!_tags[keyString])
66109 var data = _tags[keyString].filter(Boolean).map(function(tagValue) {
66119 var geometry = context.graph().geometry(_entityIDs[0]);
66120 key.call(uiCombobox(context, "tag-key").fetcher(function(value2, callback) {
66125 }, function(err, data) {
66127 var filtered = data.filter(function(d) {
66128 return _tags[d.value] === void 0;
66130 callback(sort(value2, filtered));
66134 value.call(uiCombobox(context, "tag-value").fetcher(function(value2, callback) {
66137 key: utilGetSetValue(key),
66140 }, function(err, data) {
66142 callback(sort(value2, data));
66145 function sort(value2, data) {
66146 var sameletter = [];
66148 for (var i2 = 0; i2 < data.length; i2++) {
66149 if (data[i2].value.substring(0, value2.length) === value2) {
66150 sameletter.push(data[i2]);
66152 other.push(data[i2]);
66155 return sameletter.concat(other);
66158 function unbind() {
66159 var row = select_default2(this);
66160 row.selectAll("input.key").call(uiCombobox.off, context);
66161 row.selectAll("input.value").call(uiCombobox.off, context);
66163 function keyChange(d3_event, d) {
66164 if (select_default2(this).attr("readonly"))
66167 if (_pendingChange && _pendingChange.hasOwnProperty(kOld) && _pendingChange[kOld] === void 0)
66169 var kNew = context.cleanTagKey(this.value.trim());
66170 if (isReadOnly({ key: kNew })) {
66174 if (kNew && kNew !== kOld && _tags[kNew] !== void 0) {
66176 section.selection().selectAll(".tag-list input.value").each(function(d2) {
66177 if (d2.key === kNew) {
66178 var input = select_default2(this).node();
66185 _pendingChange = _pendingChange || {};
66189 _pendingChange[kNew] = _pendingChange[kOld] || { oldKey: kOld };
66190 _pendingChange[kOld] = void 0;
66192 let row = this.parentNode.parentNode;
66193 let inputVal = select_default2(row).selectAll("input.value");
66194 let vNew = context.cleanTagValue(utilGetSetValue(inputVal));
66195 _pendingChange[kNew] = vNew;
66196 utilGetSetValue(inputVal, vNew);
66198 var existingKeyIndex = _orderedKeys.indexOf(kOld);
66199 if (existingKeyIndex !== -1)
66200 _orderedKeys[existingKeyIndex] = kNew;
66205 function valueChange(d3_event, d) {
66208 if (typeof d.value !== "string" && !this.value)
66210 if (_pendingChange && _pendingChange.hasOwnProperty(d.key) && _pendingChange[d.key] === void 0)
66212 _pendingChange = _pendingChange || {};
66213 _pendingChange[d.key] = context.cleanTagValue(this.value);
66216 function removeTag(d3_event, d) {
66219 if (d.key === "") {
66220 _showBlank = false;
66221 section.reRender();
66223 _orderedKeys = _orderedKeys.filter(function(key) {
66224 return key !== d.key;
66226 _pendingChange = _pendingChange || {};
66227 _pendingChange[d.key] = void 0;
66231 function addTag() {
66232 window.setTimeout(function() {
66234 section.reRender();
66235 section.selection().selectAll(".tag-list li:last-child input.key").node().focus();
66238 function scheduleChange() {
66239 var entityIDs = _entityIDs;
66240 window.setTimeout(function() {
66241 if (!_pendingChange)
66243 dispatch10.call("change", this, entityIDs, _pendingChange);
66244 _pendingChange = null;
66247 section.state = function(val) {
66248 if (!arguments.length)
66250 if (_state !== val) {
66256 section.presets = function(val) {
66257 if (!arguments.length)
66260 if (_presets && _presets.length && _presets[0].isFallback()) {
66261 section.disclosureExpanded(true);
66262 } else if (!_didInteract) {
66263 section.disclosureExpanded(null);
66267 section.tags = function(val) {
66268 if (!arguments.length)
66273 section.entityIDs = function(val) {
66274 if (!arguments.length)
66276 if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
66282 section.readOnlyTags = function(val) {
66283 if (!arguments.length)
66284 return _readOnlyTags;
66285 _readOnlyTags = val;
66288 return utilRebind(section, dispatch10, "on");
66291 // modules/ui/data_editor.js
66292 function uiDataEditor(context) {
66293 var dataHeader = uiDataHeader();
66294 var rawTagEditor = uiSectionRawTagEditor("custom-data-tag-editor", context).expandedByDefault(true).readOnlyTags([/./]);
66296 function dataEditor(selection2) {
66297 var header = selection2.selectAll(".header").data([0]);
66298 var headerEnter = header.enter().append("div").attr("class", "header fillL");
66299 headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
66300 context.enter(modeBrowse(context));
66301 }).call(svgIcon("#iD-icon-close"));
66302 headerEnter.append("h2").call(_t.append("map_data.title"));
66303 var body = selection2.selectAll(".body").data([0]);
66304 body = body.enter().append("div").attr("class", "body").merge(body);
66305 var editor = body.selectAll(".data-editor").data([0]);
66306 editor.enter().append("div").attr("class", "modal-section data-editor").merge(editor).call(dataHeader.datum(_datum));
66307 var rte = body.selectAll(".raw-tag-editor").data([0]);
66308 rte.enter().append("div").attr("class", "raw-tag-editor data-editor").merge(rte).call(
66309 rawTagEditor.tags(_datum && _datum.properties || {}).state("hover").render
66310 ).selectAll("textarea.tag-text").attr("readonly", true).classed("readonly", true);
66312 dataEditor.datum = function(val) {
66313 if (!arguments.length)
66321 // modules/ui/osmose_details.js
66322 function uiOsmoseDetails(context) {
66324 function issueString(d, type3) {
66327 const s = services.osmose.getStrings(d.itemType);
66328 return type3 in s ? s[type3] : "";
66330 function osmoseDetails(selection2) {
66331 const details = selection2.selectAll(".error-details").data(
66332 _qaItem ? [_qaItem] : [],
66333 (d) => `${d.id}-${d.status || 0}`
66335 details.exit().remove();
66336 const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
66337 if (issueString(_qaItem, "detail")) {
66338 const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
66339 div.append("h4").call(_t.append("QA.keepRight.detail_description"));
66340 div.append("p").attr("class", "qa-details-description-text").html((d) => issueString(d, "detail")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
66342 const detailsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
66343 const elemsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
66344 if (issueString(_qaItem, "fix")) {
66345 const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
66346 div.append("h4").call(_t.append("QA.osmose.fix_title"));
66347 div.append("p").html((d) => issueString(d, "fix")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
66349 if (issueString(_qaItem, "trap")) {
66350 const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
66351 div.append("h4").call(_t.append("QA.osmose.trap_title"));
66352 div.append("p").html((d) => issueString(d, "trap")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
66354 const thisItem = _qaItem;
66355 services.osmose.loadIssueDetail(_qaItem).then((d) => {
66356 if (!d.elems || d.elems.length === 0)
66358 if (context.selectedErrorID() !== thisItem.id && context.container().selectAll(`.qaItem.osmose.hover.itemId-${thisItem.id}`).empty())
66361 detailsDiv.append("h4").call(_t.append("QA.osmose.detail_title"));
66362 detailsDiv.append("p").html((d2) => d2.detail).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
66364 elemsDiv.append("h4").call(_t.append("QA.osmose.elems_title"));
66365 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() {
66366 const link2 = select_default2(this);
66367 const entityID = this.textContent;
66368 const entity = context.hasEntity(entityID);
66369 link2.on("mouseenter", () => {
66370 utilHighlightEntities([entityID], true, context);
66371 }).on("mouseleave", () => {
66372 utilHighlightEntities([entityID], false, context);
66373 }).on("click", (d3_event) => {
66374 d3_event.preventDefault();
66375 utilHighlightEntities([entityID], false, context);
66376 const osmlayer = context.layers().layer("osm");
66377 if (!osmlayer.enabled()) {
66378 osmlayer.enabled(true);
66380 context.map().centerZoom(d.loc, 20);
66382 context.enter(modeSelect(context, [entityID]));
66384 context.loadEntity(entityID, (err, result) => {
66387 const entity2 = result.data.find((e) => e.id === entityID);
66389 context.enter(modeSelect(context, [entityID]));
66394 let name = utilDisplayName(entity);
66396 const preset = _mainPresetIndex.match(entity, context.graph());
66397 name = preset && !preset.isFallback() && preset.name();
66400 this.innerText = name;
66404 context.features().forceVisible(d.elems);
66405 context.map().pan([0, 0]);
66406 }).catch((err) => {
66410 osmoseDetails.issue = function(val) {
66411 if (!arguments.length)
66414 return osmoseDetails;
66416 return osmoseDetails;
66419 // modules/ui/osmose_header.js
66420 function uiOsmoseHeader() {
66422 function issueTitle(d) {
66423 const unknown = _t("inspector.unknown");
66426 const s = services.osmose.getStrings(d.itemType);
66427 return "title" in s ? s.title : unknown;
66429 function osmoseHeader(selection2) {
66430 const header = selection2.selectAll(".qa-header").data(
66431 _qaItem ? [_qaItem] : [],
66432 (d) => `${d.id}-${d.status || 0}`
66434 header.exit().remove();
66435 const headerEnter = header.enter().append("div").attr("class", "qa-header");
66436 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}`);
66437 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");
66438 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 : "");
66439 headerEnter.append("div").attr("class", "qa-header-label").text(issueTitle);
66441 osmoseHeader.issue = function(val) {
66442 if (!arguments.length)
66445 return osmoseHeader;
66447 return osmoseHeader;
66450 // modules/ui/view_on_osmose.js
66451 function uiViewOnOsmose() {
66453 function viewOnOsmose(selection2) {
66455 if (services.osmose && _qaItem instanceof QAItem) {
66456 url = services.osmose.itemURL(_qaItem);
66458 const link2 = selection2.selectAll(".view-on-osmose").data(url ? [url] : []);
66459 link2.exit().remove();
66460 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"));
66461 linkEnter.append("span").call(_t.append("inspector.view_on_osmose"));
66463 viewOnOsmose.what = function(val) {
66464 if (!arguments.length)
66467 return viewOnOsmose;
66469 return viewOnOsmose;
66472 // modules/ui/osmose_editor.js
66473 function uiOsmoseEditor(context) {
66474 const dispatch10 = dispatch_default("change");
66475 const qaDetails = uiOsmoseDetails(context);
66476 const qaHeader = uiOsmoseHeader(context);
66478 function osmoseEditor(selection2) {
66479 const header = selection2.selectAll(".header").data([0]);
66480 const headerEnter = header.enter().append("div").attr("class", "header fillL");
66481 headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
66482 headerEnter.append("h2").call(_t.append("QA.osmose.title"));
66483 let body = selection2.selectAll(".body").data([0]);
66484 body = body.enter().append("div").attr("class", "body").merge(body);
66485 let editor = body.selectAll(".qa-editor").data([0]);
66486 editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(osmoseSaveSection);
66487 const footer = selection2.selectAll(".footer").data([0]);
66488 footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOsmose(context).what(_qaItem));
66490 function osmoseSaveSection(selection2) {
66491 const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
66492 const isShown = _qaItem && isSelected;
66493 let saveSection = selection2.selectAll(".qa-save").data(
66494 isShown ? [_qaItem] : [],
66495 (d) => `${d.id}-${d.status || 0}`
66497 saveSection.exit().remove();
66498 const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
66499 saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
66501 function qaSaveButtons(selection2) {
66502 const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
66503 let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d) => d.status + d.id);
66504 buttonSection.exit().remove();
66505 const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
66506 buttonEnter.append("button").attr("class", "button close-button action");
66507 buttonEnter.append("button").attr("class", "button ignore-button action");
66508 buttonSection = buttonSection.merge(buttonEnter);
66509 buttonSection.select(".close-button").call(_t.append("QA.keepRight.close")).on("click.close", function(d3_event, d) {
66511 const qaService = services.osmose;
66513 d.newStatus = "done";
66514 qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
66517 buttonSection.select(".ignore-button").call(_t.append("QA.keepRight.ignore")).on("click.ignore", function(d3_event, d) {
66519 const qaService = services.osmose;
66521 d.newStatus = "false";
66522 qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
66526 osmoseEditor.error = function(val) {
66527 if (!arguments.length)
66530 return osmoseEditor;
66532 return utilRebind(osmoseEditor, dispatch10, "on");
66535 // modules/ui/sidebar.js
66536 function uiSidebar(context) {
66537 var inspector = uiInspector(context);
66538 var dataEditor = uiDataEditor(context);
66539 var noteEditor = uiNoteEditor(context);
66540 var improveOsmEditor = uiImproveOsmEditor(context);
66541 var keepRightEditor = uiKeepRightEditor(context);
66542 var osmoseEditor = uiOsmoseEditor(context);
66544 var _wasData = false;
66545 var _wasNote = false;
66546 var _wasQaItem = false;
66547 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
66548 function sidebar(selection2) {
66549 var container = context.container();
66550 var minWidth = 240;
66552 var containerWidth;
66554 selection2.style("min-width", minWidth + "px").style("max-width", "400px").style("width", "33.3333%");
66555 var resizer = selection2.append("div").attr("class", "sidebar-resizer").on(_pointerPrefix + "down.sidebar-resizer", pointerdown);
66556 var downPointerId, lastClientX, containerLocGetter;
66557 function pointerdown(d3_event) {
66560 if ("button" in d3_event && d3_event.button !== 0)
66562 downPointerId = d3_event.pointerId || "mouse";
66563 lastClientX = d3_event.clientX;
66564 containerLocGetter = utilFastMouse(container.node());
66565 dragOffset = utilFastMouse(resizer.node())(d3_event)[0] - 1;
66566 sidebarWidth = selection2.node().getBoundingClientRect().width;
66567 containerWidth = container.node().getBoundingClientRect().width;
66568 var widthPct = sidebarWidth / containerWidth * 100;
66569 selection2.style("width", widthPct + "%").style("max-width", "85%");
66570 resizer.classed("dragging", true);
66571 select_default2(window).on("touchmove.sidebar-resizer", function(d3_event2) {
66572 d3_event2.preventDefault();
66573 }, { passive: false }).on(_pointerPrefix + "move.sidebar-resizer", pointermove).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", pointerup);
66575 function pointermove(d3_event) {
66576 if (downPointerId !== (d3_event.pointerId || "mouse"))
66578 d3_event.preventDefault();
66579 var dx = d3_event.clientX - lastClientX;
66580 lastClientX = d3_event.clientX;
66581 var isRTL = _mainLocalizer.textDirection() === "rtl";
66582 var scaleX = isRTL ? 0 : 1;
66583 var xMarginProperty = isRTL ? "margin-right" : "margin-left";
66584 var x = containerLocGetter(d3_event)[0] - dragOffset;
66585 sidebarWidth = isRTL ? containerWidth - x : x;
66586 var isCollapsed = selection2.classed("collapsed");
66587 var shouldCollapse = sidebarWidth < minWidth;
66588 selection2.classed("collapsed", shouldCollapse);
66589 if (shouldCollapse) {
66590 if (!isCollapsed) {
66591 selection2.style(xMarginProperty, "-400px").style("width", "400px");
66592 context.ui().onResize([(sidebarWidth - dx) * scaleX, 0]);
66595 var widthPct = sidebarWidth / containerWidth * 100;
66596 selection2.style(xMarginProperty, null).style("width", widthPct + "%");
66598 context.ui().onResize([-sidebarWidth * scaleX, 0]);
66600 context.ui().onResize([-dx * scaleX, 0]);
66604 function pointerup(d3_event) {
66605 if (downPointerId !== (d3_event.pointerId || "mouse"))
66607 downPointerId = null;
66608 resizer.classed("dragging", false);
66609 select_default2(window).on("touchmove.sidebar-resizer", null).on(_pointerPrefix + "move.sidebar-resizer", null).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", null);
66611 var featureListWrap = selection2.append("div").attr("class", "feature-list-pane").call(uiFeatureList(context));
66612 var inspectorWrap = selection2.append("div").attr("class", "inspector-hidden inspector-wrap");
66613 var hoverModeSelect = function(targets) {
66614 context.container().selectAll(".feature-list-item button").classed("hover", false);
66615 if (context.selectedIDs().length > 1 && targets && targets.length) {
66616 var elements = context.container().selectAll(".feature-list-item button").filter(function(node) {
66617 return targets.indexOf(node) !== -1;
66619 if (!elements.empty()) {
66620 elements.classed("hover", true);
66624 sidebar.hoverModeSelect = throttle_default(hoverModeSelect, 200);
66625 function hover(targets) {
66626 var datum2 = targets && targets.length && targets[0];
66627 if (datum2 && datum2.__featurehash__) {
66629 sidebar.show(dataEditor.datum(datum2));
66630 selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
66631 } else if (datum2 instanceof osmNote) {
66632 if (context.mode().id === "drag-note")
66635 var osm = services.osm;
66637 datum2 = osm.getNote(datum2.id);
66639 sidebar.show(noteEditor.note(datum2));
66640 selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
66641 } else if (datum2 instanceof QAItem) {
66643 var errService = services[datum2.service];
66645 datum2 = errService.getError(datum2.id);
66648 if (datum2.service === "keepRight") {
66649 errEditor = keepRightEditor;
66650 } else if (datum2.service === "osmose") {
66651 errEditor = osmoseEditor;
66653 errEditor = improveOsmEditor;
66655 context.container().selectAll(".qaItem." + datum2.service).classed("hover", function(d) {
66656 return d.id === datum2.id;
66658 sidebar.show(errEditor.error(datum2));
66659 selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
66660 } else if (!_current && datum2 instanceof osmEntity) {
66661 featureListWrap.classed("inspector-hidden", true);
66662 inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", true);
66663 if (!inspector.entityIDs() || !utilArrayIdentical(inspector.entityIDs(), [datum2.id]) || inspector.state() !== "hover") {
66664 inspector.state("hover").entityIDs([datum2.id]).newFeature(false);
66665 inspectorWrap.call(inspector);
66667 } else if (!_current) {
66668 featureListWrap.classed("inspector-hidden", false);
66669 inspectorWrap.classed("inspector-hidden", true);
66670 inspector.state("hide");
66671 } else if (_wasData || _wasNote || _wasQaItem) {
66674 _wasQaItem = false;
66675 context.container().selectAll(".note").classed("hover", false);
66676 context.container().selectAll(".qaItem").classed("hover", false);
66680 sidebar.hover = throttle_default(hover, 200);
66681 sidebar.intersects = function(extent) {
66682 var rect = selection2.node().getBoundingClientRect();
66683 return extent.intersects([
66684 context.projection.invert([0, rect.height]),
66685 context.projection.invert([rect.width, 0])
66688 sidebar.select = function(ids, newFeature) {
66690 if (ids && ids.length) {
66691 var entity = ids.length === 1 && context.entity(ids[0]);
66692 if (entity && newFeature && selection2.classed("collapsed")) {
66693 var extent = entity.extent(context.graph());
66694 sidebar.expand(sidebar.intersects(extent));
66696 featureListWrap.classed("inspector-hidden", true);
66697 inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", false);
66698 inspector.state("select").entityIDs(ids).newFeature(newFeature);
66699 inspectorWrap.call(inspector);
66701 inspector.state("hide");
66704 sidebar.showPresetList = function() {
66705 inspector.showList();
66707 sidebar.show = function(component, element) {
66708 featureListWrap.classed("inspector-hidden", true);
66709 inspectorWrap.classed("inspector-hidden", true);
66712 _current = selection2.append("div").attr("class", "sidebar-component").call(component, element);
66714 sidebar.hide = function() {
66715 featureListWrap.classed("inspector-hidden", false);
66716 inspectorWrap.classed("inspector-hidden", true);
66721 sidebar.expand = function(moveMap) {
66722 if (selection2.classed("collapsed")) {
66723 sidebar.toggle(moveMap);
66726 sidebar.collapse = function(moveMap) {
66727 if (!selection2.classed("collapsed")) {
66728 sidebar.toggle(moveMap);
66731 sidebar.toggle = function(moveMap) {
66732 if (context.inIntro())
66734 var isCollapsed = selection2.classed("collapsed");
66735 var isCollapsing = !isCollapsed;
66736 var isRTL = _mainLocalizer.textDirection() === "rtl";
66737 var scaleX = isRTL ? 0 : 1;
66738 var xMarginProperty = isRTL ? "margin-right" : "margin-left";
66739 sidebarWidth = selection2.node().getBoundingClientRect().width;
66740 selection2.style("width", sidebarWidth + "px");
66741 var startMargin, endMargin, lastMargin;
66742 if (isCollapsing) {
66743 startMargin = lastMargin = 0;
66744 endMargin = -sidebarWidth;
66746 startMargin = lastMargin = -sidebarWidth;
66749 if (!isCollapsing) {
66750 selection2.classed("collapsed", isCollapsing);
66752 selection2.transition().style(xMarginProperty, endMargin + "px").tween("panner", function() {
66753 var i2 = number_default(startMargin, endMargin);
66754 return function(t) {
66755 var dx = lastMargin - Math.round(i2(t));
66756 lastMargin = lastMargin - dx;
66757 context.ui().onResize(moveMap ? void 0 : [dx * scaleX, 0]);
66759 }).on("end", function() {
66760 if (isCollapsing) {
66761 selection2.classed("collapsed", isCollapsing);
66763 if (!isCollapsing) {
66764 var containerWidth2 = container.node().getBoundingClientRect().width;
66765 var widthPct = sidebarWidth / containerWidth2 * 100;
66766 selection2.style(xMarginProperty, null).style("width", widthPct + "%");
66770 resizer.on("dblclick", function(d3_event) {
66771 d3_event.preventDefault();
66772 if (d3_event.sourceEvent) {
66773 d3_event.sourceEvent.preventDefault();
66777 context.map().on("crossEditableZoom.sidebar", function(within) {
66778 if (!within && !selection2.select(".inspector-hover").empty()) {
66783 sidebar.showPresetList = function() {
66785 sidebar.hover = function() {
66787 sidebar.hover.cancel = function() {
66789 sidebar.intersects = function() {
66791 sidebar.select = function() {
66793 sidebar.show = function() {
66795 sidebar.hide = function() {
66797 sidebar.expand = function() {
66799 sidebar.collapse = function() {
66801 sidebar.toggle = function() {
66806 // modules/modes/draw_area.js
66807 function modeDrawArea(context, wayID, startGraph, button) {
66812 var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawArea", function() {
66813 context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.areas"))();
66815 mode.wayID = wayID;
66816 mode.enter = function() {
66817 context.install(behavior);
66819 mode.exit = function() {
66820 context.uninstall(behavior);
66822 mode.selectedIDs = function() {
66825 mode.activeID = function() {
66826 return behavior && behavior.activeID() || [];
66831 // modules/modes/add_area.js
66832 function modeAddArea(context, mode) {
66833 mode.id = "add-area";
66834 var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
66835 var defaultTags = { area: "yes" };
66837 defaultTags = mode.preset.setTags(defaultTags, "area");
66838 function actionClose(wayId) {
66839 return function(graph) {
66840 return graph.replace(graph.entity(wayId).close());
66843 function start2(loc) {
66844 var startGraph = context.graph();
66845 var node = osmNode({ loc });
66846 var way = osmWay({ tags: defaultTags });
66848 actionAddEntity(node),
66849 actionAddEntity(way),
66850 actionAddVertex(way.id, node.id),
66851 actionClose(way.id)
66853 context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
66855 function startFromWay(loc, edge) {
66856 var startGraph = context.graph();
66857 var node = osmNode({ loc });
66858 var way = osmWay({ tags: defaultTags });
66860 actionAddEntity(node),
66861 actionAddEntity(way),
66862 actionAddVertex(way.id, node.id),
66863 actionClose(way.id),
66864 actionAddMidpoint({ loc, edge }, node)
66866 context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
66868 function startFromNode(node) {
66869 var startGraph = context.graph();
66870 var way = osmWay({ tags: defaultTags });
66872 actionAddEntity(way),
66873 actionAddVertex(way.id, node.id),
66874 actionClose(way.id)
66876 context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
66878 mode.enter = function() {
66879 context.install(behavior);
66881 mode.exit = function() {
66882 context.uninstall(behavior);
66887 // modules/modes/add_line.js
66888 function modeAddLine(context, mode) {
66889 mode.id = "add-line";
66890 var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
66891 var defaultTags = {};
66893 defaultTags = mode.preset.setTags(defaultTags, "line");
66894 function start2(loc) {
66895 var startGraph = context.graph();
66896 var node = osmNode({ loc });
66897 var way = osmWay({ tags: defaultTags });
66899 actionAddEntity(node),
66900 actionAddEntity(way),
66901 actionAddVertex(way.id, node.id)
66903 context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
66905 function startFromWay(loc, edge) {
66906 var startGraph = context.graph();
66907 var node = osmNode({ loc });
66908 var way = osmWay({ tags: defaultTags });
66910 actionAddEntity(node),
66911 actionAddEntity(way),
66912 actionAddVertex(way.id, node.id),
66913 actionAddMidpoint({ loc, edge }, node)
66915 context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
66917 function startFromNode(node) {
66918 var startGraph = context.graph();
66919 var way = osmWay({ tags: defaultTags });
66921 actionAddEntity(way),
66922 actionAddVertex(way.id, node.id)
66924 context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
66926 mode.enter = function() {
66927 context.install(behavior);
66929 mode.exit = function() {
66930 context.uninstall(behavior);
66935 // modules/modes/add_point.js
66936 function modeAddPoint(context, mode) {
66937 mode.id = "add-point";
66938 var behavior = behaviorDraw(context).on("click", add).on("clickWay", addWay).on("clickNode", addNode).on("cancel", cancel).on("finish", cancel);
66939 var defaultTags = {};
66941 defaultTags = mode.preset.setTags(defaultTags, "point");
66942 function add(loc) {
66943 var node = osmNode({ loc, tags: defaultTags });
66945 actionAddEntity(node),
66946 _t("operations.add.annotation.point")
66948 enterSelectMode(node);
66950 function addWay(loc, edge) {
66951 var node = osmNode({ tags: defaultTags });
66953 actionAddMidpoint({ loc, edge }, node),
66954 _t("operations.add.annotation.vertex")
66956 enterSelectMode(node);
66958 function enterSelectMode(node) {
66960 modeSelect(context, [node.id]).newFeature(true)
66963 function addNode(node) {
66964 if (Object.keys(defaultTags).length === 0) {
66965 enterSelectMode(node);
66968 var tags = Object.assign({}, node.tags);
66969 for (var key in defaultTags) {
66970 tags[key] = defaultTags[key];
66973 actionChangeTags(node.id, tags),
66974 _t("operations.add.annotation.point")
66976 enterSelectMode(node);
66978 function cancel() {
66979 context.enter(modeBrowse(context));
66981 mode.enter = function() {
66982 context.install(behavior);
66984 mode.exit = function() {
66985 context.uninstall(behavior);
66990 // modules/modes/select_note.js
66991 function modeSelectNote(context, selectedNoteID) {
66996 var _keybinding = utilKeybinding("select-note");
66997 var _noteEditor = uiNoteEditor(context).on("change", function() {
66998 context.map().pan([0, 0]);
66999 var note = checkSelectedID();
67002 context.ui().sidebar.show(_noteEditor.note(note));
67005 behaviorBreathe(context),
67006 behaviorHover(context),
67007 behaviorSelect(context),
67008 behaviorLasso(context),
67009 modeDragNode(context).behavior,
67010 modeDragNote(context).behavior
67012 var _newFeature = false;
67013 function checkSelectedID() {
67016 var note = services.osm.getNote(selectedNoteID);
67018 context.enter(modeBrowse(context));
67022 function selectNote(d3_event, drawn) {
67023 if (!checkSelectedID())
67025 var selection2 = context.surface().selectAll(".layer-notes .note-" + selectedNoteID);
67026 if (selection2.empty()) {
67027 var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
67028 if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
67029 context.enter(modeBrowse(context));
67032 selection2.classed("selected", true);
67033 context.selectedNoteID(selectedNoteID);
67037 if (context.container().select(".combobox").size())
67039 context.enter(modeBrowse(context));
67041 mode.zoomToSelected = function() {
67044 var note = services.osm.getNote(selectedNoteID);
67046 context.map().centerZoomEase(note.loc, 20);
67049 mode.newFeature = function(val) {
67050 if (!arguments.length)
67051 return _newFeature;
67055 mode.enter = function() {
67056 var note = checkSelectedID();
67059 _behaviors.forEach(context.install);
67060 _keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
67061 select_default2(document).call(_keybinding);
67063 var sidebar = context.ui().sidebar;
67064 sidebar.show(_noteEditor.note(note).newNote(_newFeature));
67065 sidebar.expand(sidebar.intersects(note.extent()));
67066 context.map().on("drawn.select", selectNote);
67068 mode.exit = function() {
67069 _behaviors.forEach(context.uninstall);
67070 select_default2(document).call(_keybinding.unbind);
67071 context.surface().selectAll(".layer-notes .selected").classed("selected hover", false);
67072 context.map().on("drawn.select", null);
67073 context.ui().sidebar.hide();
67074 context.selectedNoteID(null);
67079 // modules/modes/add_note.js
67080 function modeAddNote(context) {
67084 description: _t.append("modes.add_note.description"),
67085 key: _t("modes.add_note.key")
67087 var behavior = behaviorDraw(context).on("click", add).on("cancel", cancel).on("finish", cancel);
67088 function add(loc) {
67089 var osm = services.osm;
67092 var note = osmNote({ loc, status: "open", comments: [] });
67093 osm.replaceNote(note);
67094 context.map().pan([0, 0]);
67095 context.selectedNoteID(note.id).enter(modeSelectNote(context, note.id).newFeature(true));
67097 function cancel() {
67098 context.enter(modeBrowse(context));
67100 mode.enter = function() {
67101 context.install(behavior);
67103 mode.exit = function() {
67104 context.uninstall(behavior);
67109 // modules/modes/save.js
67110 function modeSave(context) {
67111 var mode = { id: "save" };
67112 var keybinding = utilKeybinding("modeSave");
67113 var commit = uiCommit(context).on("cancel", cancel);
67117 var uploader = context.uploader().on("saveStarted.modeSave", function() {
67119 }).on("willAttemptUpload.modeSave", prepareForSuccess).on("progressChanged.modeSave", showProgress).on("resultNoChanges.modeSave", function() {
67121 }).on("resultErrors.modeSave", showErrors).on("resultConflicts.modeSave", showConflicts).on("resultSuccess.modeSave", showSuccess);
67122 function cancel() {
67123 context.enter(modeBrowse(context));
67125 function showProgress(num, total) {
67126 var modal = context.container().select(".loading-modal .modal-section");
67127 var progress = modal.selectAll(".progress").data([0]);
67128 progress.enter().append("div").attr("class", "progress").merge(progress).text(_t("save.conflict_progress", { num, total }));
67130 function showConflicts(changeset, conflicts, origChanges) {
67131 var selection2 = context.container().select(".sidebar").append("div").attr("class", "sidebar-component");
67132 context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
67133 _conflictsUi = uiConflicts(context).conflictList(conflicts).origChanges(origChanges).on("cancel", function() {
67134 context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
67135 selection2.remove();
67137 uploader.cancelConflictResolution();
67138 }).on("save", function() {
67139 context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
67140 selection2.remove();
67141 uploader.processResolvedConflicts(changeset);
67143 selection2.call(_conflictsUi);
67145 function showErrors(errors) {
67147 var selection2 = uiConfirm(context.container());
67148 selection2.select(".modal-section.header").append("h3").text(_t("save.error"));
67149 addErrors(selection2, errors);
67150 selection2.okButton();
67152 function addErrors(selection2, data) {
67153 var message = selection2.select(".modal-section.message-text");
67154 var items = message.selectAll(".error-container").data(data);
67155 var enter = items.enter().append("div").attr("class", "error-container");
67156 enter.append("a").attr("class", "error-description").attr("href", "#").classed("hide-toggle", true).text(function(d) {
67157 return d.msg || _t("save.unknown_error_details");
67158 }).on("click", function(d3_event) {
67159 d3_event.preventDefault();
67160 var error = select_default2(this);
67161 var detail = select_default2(this.nextElementSibling);
67162 var exp2 = error.classed("expanded");
67163 detail.style("display", exp2 ? "none" : "block");
67164 error.classed("expanded", !exp2);
67166 var details = enter.append("div").attr("class", "error-detail-container").style("display", "none");
67167 details.append("ul").attr("class", "error-detail-list").selectAll("li").data(function(d) {
67168 return d.details || [];
67169 }).enter().append("li").attr("class", "error-detail-item").text(function(d) {
67172 items.exit().remove();
67174 function showSuccess(changeset) {
67176 var ui = _success.changeset(changeset).location(_location).on("cancel", function() {
67177 context.ui().sidebar.hide();
67179 context.enter(modeBrowse(context).sidebar(ui));
67181 function keybindingOn() {
67182 select_default2(document).call(keybinding.on("\u238B", cancel, true));
67184 function keybindingOff() {
67185 select_default2(document).call(keybinding.unbind);
67187 function prepareForSuccess() {
67188 _success = uiSuccess(context);
67190 if (!services.geocoder)
67192 services.geocoder.reverse(context.map().center(), function(err, result) {
67193 if (err || !result || !result.address)
67195 var addr = result.address;
67196 var place = addr && (addr.town || addr.city || addr.county) || "";
67197 var region = addr && (addr.state || addr.country) || "";
67198 var separator = place && region ? _t("success.thank_you_where.separator") : "";
67200 "success.thank_you_where.format",
67201 { place, separator, region }
67205 mode.selectedIDs = function() {
67206 return _conflictsUi ? _conflictsUi.shownEntityIds() : [];
67208 mode.enter = function() {
67209 context.ui().sidebar.expand();
67211 context.ui().sidebar.show(commit);
67214 context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
67215 var osm = context.connection();
67220 if (osm.authenticated()) {
67223 osm.authenticate(function(err) {
67232 mode.exit = function() {
67234 context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
67235 context.ui().sidebar.hide();
67240 // modules/modes/select_error.js
67241 function modeSelectError(context, selectedErrorID, selectedErrorService) {
67243 id: "select-error",
67246 var keybinding = utilKeybinding("select-error");
67247 var errorService = services[selectedErrorService];
67249 switch (selectedErrorService) {
67251 errorEditor = uiImproveOsmEditor(context).on("change", function() {
67252 context.map().pan([0, 0]);
67253 var error = checkSelectedID();
67256 context.ui().sidebar.show(errorEditor.error(error));
67260 errorEditor = uiKeepRightEditor(context).on("change", function() {
67261 context.map().pan([0, 0]);
67262 var error = checkSelectedID();
67265 context.ui().sidebar.show(errorEditor.error(error));
67269 errorEditor = uiOsmoseEditor(context).on("change", function() {
67270 context.map().pan([0, 0]);
67271 var error = checkSelectedID();
67274 context.ui().sidebar.show(errorEditor.error(error));
67279 behaviorBreathe(context),
67280 behaviorHover(context),
67281 behaviorSelect(context),
67282 behaviorLasso(context),
67283 modeDragNode(context).behavior,
67284 modeDragNote(context).behavior
67286 function checkSelectedID() {
67289 var error = errorService.getError(selectedErrorID);
67291 context.enter(modeBrowse(context));
67295 mode.zoomToSelected = function() {
67298 var error = errorService.getError(selectedErrorID);
67300 context.map().centerZoomEase(error.loc, 20);
67303 mode.enter = function() {
67304 var error = checkSelectedID();
67307 behaviors.forEach(context.install);
67308 keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
67309 select_default2(document).call(keybinding);
67311 var sidebar = context.ui().sidebar;
67312 sidebar.show(errorEditor.error(error));
67313 context.map().on("drawn.select-error", selectError);
67314 function selectError(d3_event, drawn) {
67315 if (!checkSelectedID())
67317 var selection2 = context.surface().selectAll(".itemId-" + selectedErrorID + "." + selectedErrorService);
67318 if (selection2.empty()) {
67319 var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
67320 if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
67321 context.enter(modeBrowse(context));
67324 selection2.classed("selected", true);
67325 context.selectedErrorID(selectedErrorID);
67329 if (context.container().select(".combobox").size())
67331 context.enter(modeBrowse(context));
67334 mode.exit = function() {
67335 behaviors.forEach(context.uninstall);
67336 select_default2(document).call(keybinding.unbind);
67337 context.surface().selectAll(".qaItem.selected").classed("selected hover", false);
67338 context.map().on("drawn.select-error", null);
67339 context.ui().sidebar.hide();
67340 context.selectedErrorID(null);
67341 context.features().forceVisible([]);
67346 // modules/ui/tools/modes.js
67347 function uiToolDrawModes(context) {
67350 label: _t.append("toolbar.add_feature")
67353 modeAddPoint(context, {
67354 title: _t.append("modes.add_point.title"),
67356 description: _t.append("modes.add_point.description"),
67357 preset: _mainPresetIndex.item("point"),
67360 modeAddLine(context, {
67361 title: _t.append("modes.add_line.title"),
67363 description: _t.append("modes.add_line.description"),
67364 preset: _mainPresetIndex.item("line"),
67367 modeAddArea(context, {
67368 title: _t.append("modes.add_area.title"),
67370 description: _t.append("modes.add_area.description"),
67371 preset: _mainPresetIndex.item("area"),
67375 function enabled(_mode) {
67376 return osmEditable();
67378 function osmEditable() {
67379 return context.editable();
67381 modes.forEach(function(mode) {
67382 context.keybinding().on(mode.key, function() {
67383 if (!enabled(mode))
67385 if (mode.id === context.mode().id) {
67386 context.enter(modeBrowse(context));
67388 context.enter(mode);
67392 tool.render = function(selection2) {
67393 var wrap2 = selection2.append("div").attr("class", "joined").style("display", "flex");
67394 var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
67395 context.map().on("move.modes", debouncedUpdate).on("drawn.modes", debouncedUpdate);
67396 context.on("enter.modes", update);
67398 function update() {
67399 var buttons = wrap2.selectAll("button.add-button").data(modes, function(d) {
67402 buttons.exit().remove();
67403 var buttonsEnter = buttons.enter().append("button").attr("class", function(d) {
67404 return d.id + " add-button bar-button";
67405 }).on("click.mode-buttons", function(d3_event, d) {
67408 var currMode = context.mode().id;
67409 if (/^draw/.test(currMode))
67411 if (d.id === currMode) {
67412 context.enter(modeBrowse(context));
67417 uiTooltip().placement("bottom").title(function(d) {
67418 return d.description;
67419 }).keys(function(d) {
67421 }).scrollContainer(context.container().select(".top-toolbar"))
67423 buttonsEnter.each(function(d) {
67424 select_default2(this).call(svgIcon("#iD-icon-" + d.button));
67426 buttonsEnter.append("span").attr("class", "label").text("").each(function(mode) {
67427 mode.title(select_default2(this));
67429 if (buttons.enter().size() || buttons.exit().size()) {
67430 context.ui().checkOverflow(".top-toolbar", true);
67432 buttons = buttons.merge(buttonsEnter).attr("aria-disabled", function(d) {
67433 return !enabled(d);
67434 }).classed("disabled", function(d) {
67435 return !enabled(d);
67436 }).attr("aria-pressed", function(d) {
67437 return context.mode() && context.mode().button === d.button;
67438 }).classed("active", function(d) {
67439 return context.mode() && context.mode().button === d.button;
67446 // modules/ui/tools/notes.js
67447 function uiToolNotes(context) {
67450 label: _t.append("modes.add_note.label")
67452 var mode = modeAddNote(context);
67453 function enabled() {
67454 return notesEnabled() && notesEditable();
67456 function notesEnabled() {
67457 var noteLayer = context.layers().layer("notes");
67458 return noteLayer && noteLayer.enabled();
67460 function notesEditable() {
67461 var mode2 = context.mode();
67462 return context.map().notesEditable() && mode2 && mode2.id !== "save";
67464 context.keybinding().on(mode.key, function() {
67467 if (mode.id === context.mode().id) {
67468 context.enter(modeBrowse(context));
67470 context.enter(mode);
67473 tool.render = function(selection2) {
67474 var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
67475 context.map().on("move.notes", debouncedUpdate).on("drawn.notes", debouncedUpdate);
67476 context.on("enter.notes", update);
67478 function update() {
67479 var showNotes = notesEnabled();
67480 var data = showNotes ? [mode] : [];
67481 var buttons = selection2.selectAll("button.add-button").data(data, function(d) {
67484 buttons.exit().remove();
67485 var buttonsEnter = buttons.enter().append("button").attr("class", function(d) {
67486 return d.id + " add-button bar-button";
67487 }).on("click.notes", function(d3_event, d) {
67490 var currMode = context.mode().id;
67491 if (/^draw/.test(currMode))
67493 if (d.id === currMode) {
67494 context.enter(modeBrowse(context));
67499 uiTooltip().placement("bottom").title(function(d) {
67500 return d.description;
67501 }).keys(function(d) {
67503 }).scrollContainer(context.container().select(".top-toolbar"))
67505 buttonsEnter.each(function(d) {
67506 select_default2(this).call(svgIcon(d.icon || "#iD-icon-" + d.button));
67508 if (buttons.enter().size() || buttons.exit().size()) {
67509 context.ui().checkOverflow(".top-toolbar", true);
67511 buttons = buttons.merge(buttonsEnter).classed("disabled", function() {
67513 }).attr("aria-disabled", function() {
67515 }).classed("active", function(d) {
67516 return context.mode() && context.mode().button === d.button;
67517 }).attr("aria-pressed", function(d) {
67518 return context.mode() && context.mode().button === d.button;
67522 tool.uninstall = function() {
67523 context.on("enter.editor.notes", null).on("exit.editor.notes", null).on("enter.notes", null);
67524 context.map().on("move.notes", null).on("drawn.notes", null);
67529 // modules/ui/tools/save.js
67530 function uiToolSave(context) {
67533 label: _t.append("save.title")
67536 var tooltipBehavior = null;
67537 var history = context.history();
67538 var key = uiCmd("\u2318S");
67539 var _numChanges = 0;
67540 function isSaving() {
67541 var mode = context.mode();
67542 return mode && mode.id === "save";
67544 function isDisabled() {
67545 return _numChanges === 0 || isSaving();
67547 function save(d3_event) {
67548 d3_event.preventDefault();
67549 if (!context.inIntro() && !isSaving() && history.hasChanges()) {
67550 context.enter(modeSave(context));
67553 function bgColor(numChanges) {
67555 if (numChanges === 0) {
67557 } else if (numChanges <= 50) {
67558 step = numChanges / 50;
67559 return rgb_default("#fff", "#ff8")(step);
67561 step = Math.min((numChanges - 50) / 50, 1);
67562 return rgb_default("#ff8", "#f88")(step);
67565 function updateCount() {
67566 var val = history.difference().summary().length;
67567 if (val === _numChanges)
67570 if (tooltipBehavior) {
67571 tooltipBehavior.title(() => _t.append(_numChanges > 0 ? "save.help" : "save.no_changes")).keys([key]);
67574 button.classed("disabled", isDisabled()).style("background", bgColor(_numChanges));
67575 button.select("span.count").text(_numChanges);
67578 tool.render = function(selection2) {
67579 tooltipBehavior = uiTooltip().placement("bottom").title(() => _t.append("save.no_changes")).keys([key]).scrollContainer(context.container().select(".top-toolbar"));
67580 var lastPointerUpType;
67581 button = selection2.append("button").attr("class", "save disabled bar-button").on("pointerup", function(d3_event) {
67582 lastPointerUpType = d3_event.pointerType;
67583 }).on("click", function(d3_event) {
67585 if (_numChanges === 0 && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
67586 context.ui().flash.duration(2e3).iconName("#iD-icon-save").iconClass("disabled").label(_t.append("save.no_changes"))();
67588 lastPointerUpType = null;
67589 }).call(tooltipBehavior);
67590 button.call(svgIcon("#iD-icon-save"));
67591 button.append("span").attr("class", "count").attr("aria-hidden", "true").text("0");
67593 context.keybinding().on(key, save, true);
67594 context.history().on("change.save", updateCount);
67595 context.on("enter.save", function() {
67597 button.classed("disabled", isDisabled());
67599 button.call(tooltipBehavior.hide);
67604 tool.uninstall = function() {
67605 context.keybinding().off(key, true);
67606 context.history().on("change.save", null);
67607 context.on("enter.save", null);
67609 tooltipBehavior = null;
67614 // modules/ui/tools/sidebar_toggle.js
67615 function uiToolSidebarToggle(context) {
67617 id: "sidebar_toggle",
67618 label: _t.append("toolbar.inspect")
67620 tool.render = function(selection2) {
67621 selection2.append("button").attr("class", "bar-button").attr("aria-label", _t("sidebar.tooltip")).on("click", function() {
67622 context.ui().sidebar.toggle();
67624 uiTooltip().placement("bottom").title(() => _t.append("sidebar.tooltip")).keys([_t("sidebar.key")]).scrollContainer(context.container().select(".top-toolbar"))
67625 ).call(svgIcon("#iD-icon-sidebar-" + (_mainLocalizer.textDirection() === "rtl" ? "right" : "left")));
67630 // modules/ui/tools/undo_redo.js
67631 function uiToolUndoRedo(context) {
67634 label: _t.append("toolbar.undo_redo")
67638 cmd: uiCmd("\u2318Z"),
67639 action: function() {
67642 annotation: function() {
67643 return context.history().undoAnnotation();
67645 icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")
67648 cmd: uiCmd("\u2318\u21E7Z"),
67649 action: function() {
67652 annotation: function() {
67653 return context.history().redoAnnotation();
67655 icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "undo" : "redo")
67657 function editable() {
67658 return context.mode() && context.mode().id !== "save" && context.map().editableDataEnabled(true);
67660 tool.render = function(selection2) {
67661 var tooltipBehavior = uiTooltip().placement("bottom").title(function(d) {
67662 return d.annotation() ? _t.append(d.id + ".tooltip", { action: d.annotation() }) : _t.append(d.id + ".nothing");
67663 }).keys(function(d) {
67665 }).scrollContainer(context.container().select(".top-toolbar"));
67666 var lastPointerUpType;
67667 var buttons = selection2.selectAll("button").data(commands).enter().append("button").attr("class", function(d) {
67668 return "disabled " + d.id + "-button bar-button";
67669 }).on("pointerup", function(d3_event) {
67670 lastPointerUpType = d3_event.pointerType;
67671 }).on("click", function(d3_event, d) {
67672 d3_event.preventDefault();
67673 var annotation = d.annotation();
67674 if (editable() && annotation) {
67677 if (editable() && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
67678 var label = annotation ? _t.append(d.id + ".tooltip", { action: annotation }) : _t.append(d.id + ".nothing");
67679 context.ui().flash.duration(2e3).iconName("#" + d.icon).iconClass(annotation ? "" : "disabled").label(label)();
67681 lastPointerUpType = null;
67682 }).call(tooltipBehavior);
67683 buttons.each(function(d) {
67684 select_default2(this).call(svgIcon("#" + d.icon));
67686 context.keybinding().on(commands[0].cmd, function(d3_event) {
67687 d3_event.preventDefault();
67689 commands[0].action();
67690 }).on(commands[1].cmd, function(d3_event) {
67691 d3_event.preventDefault();
67693 commands[1].action();
67695 var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
67696 context.map().on("move.undo_redo", debouncedUpdate).on("drawn.undo_redo", debouncedUpdate);
67697 context.history().on("change.undo_redo", function(difference) {
67701 context.on("enter.undo_redo", update);
67702 function update() {
67703 buttons.classed("disabled", function(d) {
67704 return !editable() || !d.annotation();
67705 }).each(function() {
67706 var selection3 = select_default2(this);
67707 if (!selection3.select(".tooltip.in").empty()) {
67708 selection3.call(tooltipBehavior.updateContent);
67713 tool.uninstall = function() {
67714 context.keybinding().off(commands[0].cmd).off(commands[1].cmd);
67715 context.map().on("move.undo_redo", null).on("drawn.undo_redo", null);
67716 context.history().on("change.undo_redo", null);
67717 context.on("enter.undo_redo", null);
67722 // modules/ui/top_toolbar.js
67723 function uiTopToolbar(context) {
67724 var sidebarToggle = uiToolSidebarToggle(context), modes = uiToolDrawModes(context), notes = uiToolNotes(context), undoRedo = uiToolUndoRedo(context), save = uiToolSave(context);
67725 function notesEnabled() {
67726 var noteLayer = context.layers().layer("notes");
67727 return noteLayer && noteLayer.enabled();
67729 function topToolbar(bar) {
67730 bar.on("wheel.topToolbar", function(d3_event) {
67731 if (!d3_event.deltaX) {
67732 bar.node().scrollLeft += d3_event.deltaY;
67735 var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
67736 context.layers().on("change.topToolbar", debouncedUpdate);
67738 function update() {
67744 tools.push("spacer");
67745 if (notesEnabled()) {
67746 tools = tools.concat([notes, "spacer"]);
67748 tools = tools.concat([undoRedo, save]);
67749 var toolbarItems = bar.selectAll(".toolbar-item").data(tools, function(d) {
67752 toolbarItems.exit().each(function(d) {
67757 var itemsEnter = toolbarItems.enter().append("div").attr("class", function(d) {
67758 var classes = "toolbar-item " + (d.id || d).replace("_", "-");
67760 classes += " " + d.klass;
67763 var actionableItems = itemsEnter.filter(function(d) {
67764 return d !== "spacer";
67766 actionableItems.append("div").attr("class", "item-content").each(function(d) {
67767 select_default2(this).call(d.render, bar);
67769 actionableItems.append("div").attr("class", "item-label").each(function(d) {
67770 d.label(select_default2(this));
67777 // modules/ui/zoom_to_selection.js
67778 function uiZoomToSelection(context) {
67779 function isDisabled() {
67780 var mode = context.mode();
67781 return !mode || !mode.zoomToSelected;
67783 var _lastPointerUpType;
67784 function pointerup(d3_event) {
67785 _lastPointerUpType = d3_event.pointerType;
67787 function click(d3_event) {
67788 d3_event.preventDefault();
67789 if (isDisabled()) {
67790 if (_lastPointerUpType === "touch" || _lastPointerUpType === "pen") {
67791 context.ui().flash.duration(2e3).iconName("#iD-icon-framed-dot").iconClass("disabled").label(_t.append("inspector.zoom_to.no_selection"))();
67794 var mode = context.mode();
67795 if (mode && mode.zoomToSelected) {
67796 mode.zoomToSelected();
67799 _lastPointerUpType = null;
67801 return function(selection2) {
67802 var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function() {
67803 if (isDisabled()) {
67804 return _t.append("inspector.zoom_to.no_selection");
67806 return _t.append("inspector.zoom_to.title");
67807 }).keys([_t("inspector.zoom_to.key")]);
67808 var button = selection2.append("button").on("pointerup", pointerup).on("click", click).call(svgIcon("#iD-icon-framed-dot", "light")).call(tooltipBehavior);
67809 function setEnabledState() {
67810 button.classed("disabled", isDisabled());
67811 if (!button.select(".tooltip.in").empty()) {
67812 button.call(tooltipBehavior.updateContent);
67815 context.on("enter.uiZoomToSelection", setEnabledState);
67820 // modules/ui/pane.js
67821 function uiPane(id2, context) {
67824 var _description = "";
67825 var _iconName = "";
67827 var _paneSelection = select_default2(null);
67832 pane.label = function(val) {
67833 if (!arguments.length)
67838 pane.key = function(val) {
67839 if (!arguments.length)
67844 pane.description = function(val) {
67845 if (!arguments.length)
67846 return _description;
67847 _description = val;
67850 pane.iconName = function(val) {
67851 if (!arguments.length)
67856 pane.sections = function(val) {
67857 if (!arguments.length)
67862 pane.selection = function() {
67863 return _paneSelection;
67865 function hidePane() {
67866 context.ui().togglePanes();
67868 pane.togglePane = function(d3_event) {
67870 d3_event.preventDefault();
67871 _paneTooltip.hide();
67872 context.ui().togglePanes(!_paneSelection.classed("shown") ? _paneSelection : void 0);
67874 pane.renderToggleButton = function(selection2) {
67875 if (!_paneTooltip) {
67876 _paneTooltip = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _description).keys([_key]);
67878 selection2.append("button").on("click", pane.togglePane).call(svgIcon("#" + _iconName, "light")).call(_paneTooltip);
67880 pane.renderContent = function(selection2) {
67882 _sections.forEach(function(section) {
67883 selection2.call(section.render);
67887 pane.renderPane = function(selection2) {
67888 _paneSelection = selection2.append("div").attr("class", "fillL map-pane hide " + id2 + "-pane").attr("pane", id2);
67889 var heading = _paneSelection.append("div").attr("class", "pane-heading");
67890 heading.append("h2").text("").call(_label);
67891 heading.append("button").attr("title", _t("icons.close")).on("click", hidePane).call(svgIcon("#iD-icon-close"));
67892 _paneSelection.append("div").attr("class", "pane-content").call(pane.renderContent);
67894 context.keybinding().on(_key, pane.togglePane);
67900 // modules/ui/sections/background_display_options.js
67901 function uiSectionBackgroundDisplayOptions(context) {
67902 var section = uiSection("background-display-options", context).label(() => _t.append("background.display_options")).disclosureContent(renderDisclosureContent);
67903 var _storedOpacity = corePreferences("background-opacity");
67906 var _sliders = ["brightness", "contrast", "saturation", "sharpness"];
67908 brightness: _storedOpacity !== null ? +_storedOpacity : 1,
67913 function clamp3(x, min3, max3) {
67914 return Math.max(min3, Math.min(x, max3));
67916 function updateValue(d, val) {
67917 val = clamp3(val, _minVal, _maxVal);
67919 context.background()[d](val);
67920 if (d === "brightness") {
67921 corePreferences("background-opacity", val);
67923 section.reRender();
67925 function renderDisclosureContent(selection2) {
67926 var container = selection2.selectAll(".display-options-container").data([0]);
67927 var containerEnter = container.enter().append("div").attr("class", "display-options-container controls-list");
67928 var slidersEnter = containerEnter.selectAll(".display-control").data(_sliders).enter().append("label").attr("class", function(d) {
67929 return "display-control display-control-" + d;
67931 slidersEnter.html(function(d) {
67932 return _t.html("background." + d);
67933 }).append("span").attr("class", function(d) {
67934 return "display-option-value display-option-value-" + d;
67936 var sildersControlEnter = slidersEnter.append("div").attr("class", "control-wrap");
67937 sildersControlEnter.append("input").attr("class", function(d) {
67938 return "display-option-input display-option-input-" + d;
67939 }).attr("type", "range").attr("min", _minVal).attr("max", _maxVal).attr("step", "0.05").on("input", function(d3_event, d) {
67940 var val = select_default2(this).property("value");
67941 if (!val && d3_event && d3_event.target) {
67942 val = d3_event.target.value;
67944 updateValue(d, val);
67946 sildersControlEnter.append("button").attr("title", function(d) {
67947 return `${_t("background.reset")} ${_t("background." + d)}`;
67948 }).attr("class", function(d) {
67949 return "display-option-reset display-option-reset-" + d;
67950 }).on("click", function(d3_event, d) {
67951 if (d3_event.button !== 0)
67954 }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
67955 containerEnter.append("a").attr("class", "display-option-resetlink").attr("role", "button").attr("href", "#").call(_t.append("background.reset_all")).on("click", function(d3_event) {
67956 d3_event.preventDefault();
67957 for (var i2 = 0; i2 < _sliders.length; i2++) {
67958 updateValue(_sliders[i2], 1);
67961 container = containerEnter.merge(container);
67962 container.selectAll(".display-option-input").property("value", function(d) {
67963 return _options[d];
67965 container.selectAll(".display-option-value").text(function(d) {
67966 return Math.floor(_options[d] * 100) + "%";
67968 container.selectAll(".display-option-reset").classed("disabled", function(d) {
67969 return _options[d] === 1;
67971 if (containerEnter.size() && _options.brightness !== 1) {
67972 context.background().brightness(_options.brightness);
67978 // modules/ui/settings/custom_background.js
67979 function uiSettingsCustomBackground() {
67980 var dispatch10 = dispatch_default("change");
67981 function render(selection2) {
67982 var _origSettings = {
67983 template: corePreferences("background-custom-template")
67985 var _currSettings = {
67986 template: corePreferences("background-custom-template")
67988 var example = "https://{switch:a,b,c}.tile.openstreetmap.org/{zoom}/{x}/{y}.png";
67989 var modal = uiConfirm(selection2).okButton();
67990 modal.classed("settings-modal settings-custom-background", true);
67991 modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_background.header"));
67992 var textSection = modal.select(".modal-section.message-text");
67993 var instructions = `${_t.html("settings.custom_background.instructions.info")}
67995 #### ${_t.html("settings.custom_background.instructions.wms.tokens_label")}
67996 * ${_t.html("settings.custom_background.instructions.wms.tokens.proj")}
67997 * ${_t.html("settings.custom_background.instructions.wms.tokens.wkid")}
67998 * ${_t.html("settings.custom_background.instructions.wms.tokens.dimensions")}
67999 * ${_t.html("settings.custom_background.instructions.wms.tokens.bbox")}
68001 #### ${_t.html("settings.custom_background.instructions.tms.tokens_label")}
68002 * ${_t.html("settings.custom_background.instructions.tms.tokens.xyz")}
68003 * ${_t.html("settings.custom_background.instructions.tms.tokens.flipped_y")}
68004 * ${_t.html("settings.custom_background.instructions.tms.tokens.switch")}
68005 * ${_t.html("settings.custom_background.instructions.tms.tokens.quadtile")}
68006 * ${_t.html("settings.custom_background.instructions.tms.tokens.scale_factor")}
68008 #### ${_t.html("settings.custom_background.instructions.example")}
68010 textSection.append("div").attr("class", "instructions-template").html(marked(instructions));
68011 textSection.append("textarea").attr("class", "field-template").attr("placeholder", _t("settings.custom_background.template.placeholder")).call(utilNoAuto).property("value", _currSettings.template);
68012 var buttonSection = modal.select(".modal-section.buttons");
68013 buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
68014 buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
68015 buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
68016 function isSaveDisabled() {
68019 function clickCancel() {
68020 textSection.select(".field-template").property("value", _origSettings.template);
68021 corePreferences("background-custom-template", _origSettings.template);
68025 function clickSave() {
68026 _currSettings.template = textSection.select(".field-template").property("value");
68027 corePreferences("background-custom-template", _currSettings.template);
68030 dispatch10.call("change", this, _currSettings);
68033 return utilRebind(render, dispatch10, "on");
68036 // modules/ui/sections/background_list.js
68037 function uiSectionBackgroundList(context) {
68038 var _backgroundList = select_default2(null);
68039 var _customSource = context.background().findSource("custom");
68040 var _settingsCustomBackground = uiSettingsCustomBackground(context).on("change", customChanged);
68041 var section = uiSection("background-list", context).label(() => _t.append("background.backgrounds")).disclosureContent(renderDisclosureContent);
68042 function previousBackgroundID() {
68043 return corePreferences("background-last-used-toggle");
68045 function renderDisclosureContent(selection2) {
68046 var container = selection2.selectAll(".layer-background-list").data([0]);
68047 _backgroundList = container.enter().append("ul").attr("class", "layer-list layer-background-list").attr("dir", "auto").merge(container);
68048 var bgExtrasListEnter = selection2.selectAll(".bg-extras-list").data([0]).enter().append("ul").attr("class", "layer-list bg-extras-list");
68049 var minimapLabelEnter = bgExtrasListEnter.append("li").attr("class", "minimap-toggle-item").append("label").call(
68050 uiTooltip().title(() => _t.append("background.minimap.tooltip")).keys([_t("background.minimap.key")]).placement("top")
68052 minimapLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
68053 d3_event.preventDefault();
68054 uiMapInMap.toggle();
68056 minimapLabelEnter.append("span").call(_t.append("background.minimap.description"));
68057 var panelLabelEnter = bgExtrasListEnter.append("li").attr("class", "background-panel-toggle-item").append("label").call(
68058 uiTooltip().title(() => _t.append("background.panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.background.key"))]).placement("top")
68060 panelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
68061 d3_event.preventDefault();
68062 context.ui().info.toggle("background");
68064 panelLabelEnter.append("span").call(_t.append("background.panel.description"));
68065 var locPanelLabelEnter = bgExtrasListEnter.append("li").attr("class", "location-panel-toggle-item").append("label").call(
68066 uiTooltip().title(() => _t.append("background.location_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.location.key"))]).placement("top")
68068 locPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
68069 d3_event.preventDefault();
68070 context.ui().info.toggle("location");
68072 locPanelLabelEnter.append("span").call(_t.append("background.location_panel.description"));
68073 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"));
68074 _backgroundList.call(drawListItems, "radio", function(d3_event, d) {
68075 chooseBackground(d);
68077 return !d.isHidden() && !d.overlay;
68080 function setTooltips(selection2) {
68081 selection2.each(function(d, i2, nodes) {
68082 var item = select_default2(this).select("label");
68083 var span = item.select("span");
68084 var placement = i2 < nodes.length / 2 ? "bottom" : "top";
68085 var hasDescription = d.hasDescription();
68086 var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
68087 item.call(uiTooltip().destroyAny);
68088 if (d.id === previousBackgroundID()) {
68090 uiTooltip().placement(placement).title(() => _t.append("background.switch")).keys([uiCmd("\u2318" + _t("background.key"))])
68092 } else if (hasDescription || isOverflowing) {
68094 uiTooltip().placement(placement).title(() => hasDescription ? d.description() : d.label())
68099 function drawListItems(layerList, type3, change, filter2) {
68100 var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2).sort(function(a, b) {
68101 return a.best() && !b.best() ? -1 : b.best() && !a.best() ? 1 : descending(a.area(), b.area()) || ascending(a.name(), b.name()) || 0;
68103 var layerLinks = layerList.selectAll("li").data(sources, function(d, i2) {
68104 return d.id + "---" + i2;
68106 layerLinks.exit().remove();
68107 var enter = layerLinks.enter().append("li").classed("layer-custom", function(d) {
68108 return d.id === "custom";
68109 }).classed("best", function(d) {
68112 var label = enter.append("label");
68113 label.append("input").attr("type", type3).attr("name", "background-layer").attr("value", function(d) {
68115 }).on("change", change);
68116 label.append("span").each(function(d) {
68117 d.label()(select_default2(this));
68119 enter.filter(function(d) {
68120 return d.id === "custom";
68121 }).append("button").attr("class", "layer-browse").call(
68122 uiTooltip().title(() => _t.append("settings.custom_background.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
68123 ).on("click", function(d3_event) {
68124 d3_event.preventDefault();
68126 }).call(svgIcon("#iD-icon-more"));
68127 enter.filter(function(d) {
68129 }).append("div").attr("class", "best").call(
68130 uiTooltip().title(() => _t.append("background.best_imagery")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
68131 ).append("span").text("\u2605");
68132 layerList.call(updateLayerSelections);
68134 function updateLayerSelections(selection2) {
68135 function active(d) {
68136 return context.background().showsLayer(d);
68138 selection2.selectAll("li").classed("active", active).classed("switch", function(d) {
68139 return d.id === previousBackgroundID();
68140 }).call(setTooltips).selectAll("input").property("checked", active);
68142 function chooseBackground(d) {
68143 if (d.id === "custom" && !d.template()) {
68144 return editCustom();
68146 var previousBackground = context.background().baseLayerSource();
68147 corePreferences("background-last-used-toggle", previousBackground.id);
68148 corePreferences("background-last-used", d.id);
68149 context.background().baseLayerSource(d);
68151 function customChanged(d) {
68152 if (d && d.template) {
68153 _customSource.template(d.template);
68154 chooseBackground(_customSource);
68156 _customSource.template("");
68157 chooseBackground(context.background().findSource("none"));
68160 function editCustom() {
68161 context.container().call(_settingsCustomBackground);
68163 context.background().on("change.background_list", function() {
68164 _backgroundList.call(updateLayerSelections);
68167 "move.background_list",
68168 debounce_default(function() {
68169 window.requestIdleCallback(section.reRender);
68175 // modules/ui/sections/background_offset.js
68176 function uiSectionBackgroundOffset(context) {
68177 var section = uiSection("background-offset", context).label(() => _t.append("background.fix_misalignment")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
68178 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
68179 var _directions = [
68180 ["top", [0, -0.5]],
68181 ["left", [-0.5, 0]],
68182 ["right", [0.5, 0]],
68183 ["bottom", [0, 0.5]]
68185 function updateValue() {
68186 var meters = geoOffsetToMeters(context.background().offset());
68187 var x = +meters[0].toFixed(2);
68188 var y = +meters[1].toFixed(2);
68189 context.container().selectAll(".nudge-inner-rect").select("input").classed("error", false).property("value", x + ", " + y);
68190 context.container().selectAll(".nudge-reset").classed("disabled", function() {
68191 return x === 0 && y === 0;
68194 function resetOffset() {
68195 context.background().offset([0, 0]);
68198 function nudge(d) {
68199 context.background().nudge(d, context.map().zoom());
68202 function inputOffset() {
68203 var input = select_default2(this);
68204 var d = input.node().value;
68206 return resetOffset();
68207 d = d.replace(/;/g, ",").split(",").map(function(n2) {
68208 return !isNaN(n2) && n2;
68210 if (d.length !== 2 || !d[0] || !d[1]) {
68211 input.classed("error", true);
68214 context.background().offset(geoMetersToOffset(d));
68217 function dragOffset(d3_event) {
68218 if (d3_event.button !== 0)
68220 var origin = [d3_event.clientX, d3_event.clientY];
68221 var pointerId = d3_event.pointerId || "mouse";
68222 context.container().append("div").attr("class", "nudge-surface");
68223 select_default2(window).on(_pointerPrefix + "move.drag-bg-offset", pointermove).on(_pointerPrefix + "up.drag-bg-offset", pointerup);
68224 if (_pointerPrefix === "pointer") {
68225 select_default2(window).on("pointercancel.drag-bg-offset", pointerup);
68227 function pointermove(d3_event2) {
68228 if (pointerId !== (d3_event2.pointerId || "mouse"))
68230 var latest = [d3_event2.clientX, d3_event2.clientY];
68232 -(origin[0] - latest[0]) / 4,
68233 -(origin[1] - latest[1]) / 4
68238 function pointerup(d3_event2) {
68239 if (pointerId !== (d3_event2.pointerId || "mouse"))
68241 if (d3_event2.button !== 0)
68243 context.container().selectAll(".nudge-surface").remove();
68244 select_default2(window).on(".drag-bg-offset", null);
68247 function renderDisclosureContent(selection2) {
68248 var container = selection2.selectAll(".nudge-container").data([0]);
68249 var containerEnter = container.enter().append("div").attr("class", "nudge-container");
68250 containerEnter.append("div").attr("class", "nudge-instructions").call(_t.append("background.offset"));
68251 var nudgeWrapEnter = containerEnter.append("div").attr("class", "nudge-controls-wrap");
68252 var nudgeEnter = nudgeWrapEnter.append("div").attr("class", "nudge-outer-rect").on(_pointerPrefix + "down", dragOffset);
68253 nudgeEnter.append("div").attr("class", "nudge-inner-rect").append("input").attr("type", "text").attr("aria-label", _t("background.offset_label")).on("change", inputOffset);
68254 nudgeWrapEnter.append("div").selectAll("button").data(_directions).enter().append("button").attr("title", function(d) {
68255 return _t(`background.nudge.${d[0]}`);
68256 }).attr("class", function(d) {
68257 return d[0] + " nudge";
68258 }).on("click", function(d3_event, d) {
68261 nudgeWrapEnter.append("button").attr("title", _t("background.reset")).attr("class", "nudge-reset disabled").on("click", function(d3_event) {
68262 d3_event.preventDefault();
68264 }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
68267 context.background().on("change.backgroundOffset-update", updateValue);
68271 // modules/ui/sections/overlay_list.js
68272 function uiSectionOverlayList(context) {
68273 var section = uiSection("overlay-list", context).label(() => _t.append("background.overlays")).disclosureContent(renderDisclosureContent);
68274 var _overlayList = select_default2(null);
68275 function setTooltips(selection2) {
68276 selection2.each(function(d, i2, nodes) {
68277 var item = select_default2(this).select("label");
68278 var span = item.select("span");
68279 var placement = i2 < nodes.length / 2 ? "bottom" : "top";
68280 var description = d.description();
68281 var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
68282 item.call(uiTooltip().destroyAny);
68283 if (description || isOverflowing) {
68285 uiTooltip().placement(placement).title(() => description || d.name())
68290 function updateLayerSelections(selection2) {
68291 function active(d) {
68292 return context.background().showsLayer(d);
68294 selection2.selectAll("li").classed("active", active).call(setTooltips).selectAll("input").property("checked", active);
68296 function chooseOverlay(d3_event, d) {
68297 d3_event.preventDefault();
68298 context.background().toggleOverlayLayer(d);
68299 _overlayList.call(updateLayerSelections);
68300 document.activeElement.blur();
68302 function drawListItems(layerList, type3, change, filter2) {
68303 var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2);
68304 var layerLinks = layerList.selectAll("li").data(sources, function(d) {
68307 layerLinks.exit().remove();
68308 var enter = layerLinks.enter().append("li");
68309 var label = enter.append("label");
68310 label.append("input").attr("type", type3).attr("name", "layers").on("change", change);
68311 label.append("span").each(function(d) {
68312 d.label()(select_default2(this));
68314 layerList.selectAll("li").sort(sortSources);
68315 layerList.call(updateLayerSelections);
68316 function sortSources(a, b) {
68317 return a.best() && !b.best() ? -1 : b.best() && !a.best() ? 1 : descending(a.area(), b.area()) || ascending(a.name(), b.name()) || 0;
68320 function renderDisclosureContent(selection2) {
68321 var container = selection2.selectAll(".layer-overlay-list").data([0]);
68322 _overlayList = container.enter().append("ul").attr("class", "layer-list layer-overlay-list").attr("dir", "auto").merge(container);
68323 _overlayList.call(drawListItems, "checkbox", chooseOverlay, function(d) {
68324 return !d.isHidden() && d.overlay;
68328 "move.overlay_list",
68329 debounce_default(function() {
68330 window.requestIdleCallback(section.reRender);
68336 // modules/ui/panes/background.js
68337 function uiPaneBackground(context) {
68338 var backgroundPane = uiPane("background", context).key(_t("background.key")).label(_t.append("background.title")).description(_t.append("background.description")).iconName("iD-icon-layers").sections([
68339 uiSectionBackgroundList(context),
68340 uiSectionOverlayList(context),
68341 uiSectionBackgroundDisplayOptions(context),
68342 uiSectionBackgroundOffset(context)
68344 return backgroundPane;
68347 // modules/ui/panes/help.js
68348 function uiPaneHelp(context) {
68370 "select_left_click",
68371 "select_right_click",
68375 "multiselect_shift_click",
68376 "multiselect_lasso",
68389 ["feature_editor", [
68396 "fields_all_fields",
68398 "fields_add_field",
68407 "add_point_finish",
68412 "delete_point_command"
68419 "add_line_continue",
68422 "modify_line_dragnode",
68423 "modify_line_addnode",
68426 "connect_line_display",
68427 "connect_line_drag",
68428 "connect_line_tag",
68429 "disconnect_line_h",
68430 "disconnect_line_command",
68432 "move_line_command",
68433 "move_line_connected",
68436 "delete_line_command"
68443 "add_area_command",
68445 "add_area_continue",
68448 "square_area_command",
68450 "modify_area_dragnode",
68451 "modify_area_addnode",
68454 "delete_area_command"
68460 "edit_relation_add",
68461 "edit_relation_delete",
68462 "maintain_relation_h",
68463 "maintain_relation",
68464 "relation_types_h",
68467 "multipolygon_create",
68468 "multipolygon_merge",
68469 "turn_restriction_h",
68470 "turn_restriction",
68471 "turn_restriction_field",
68472 "turn_restriction_editing",
68543 "help.help.open_data_h": 3,
68544 "help.help.before_start_h": 3,
68545 "help.help.open_source_h": 3,
68546 "help.overview.navigation_h": 3,
68547 "help.overview.features_h": 3,
68548 "help.editing.select_h": 3,
68549 "help.editing.multiselect_h": 3,
68550 "help.editing.undo_redo_h": 3,
68551 "help.editing.save_h": 3,
68552 "help.editing.upload_h": 3,
68553 "help.editing.backups_h": 3,
68554 "help.editing.keyboard_h": 3,
68555 "help.feature_editor.type_h": 3,
68556 "help.feature_editor.fields_h": 3,
68557 "help.feature_editor.tags_h": 3,
68558 "help.points.add_point_h": 3,
68559 "help.points.move_point_h": 3,
68560 "help.points.delete_point_h": 3,
68561 "help.lines.add_line_h": 3,
68562 "help.lines.modify_line_h": 3,
68563 "help.lines.connect_line_h": 3,
68564 "help.lines.disconnect_line_h": 3,
68565 "help.lines.move_line_h": 3,
68566 "help.lines.delete_line_h": 3,
68567 "help.areas.point_or_area_h": 3,
68568 "help.areas.add_area_h": 3,
68569 "help.areas.square_area_h": 3,
68570 "help.areas.modify_area_h": 3,
68571 "help.areas.delete_area_h": 3,
68572 "help.relations.edit_relation_h": 3,
68573 "help.relations.maintain_relation_h": 3,
68574 "help.relations.relation_types_h": 2,
68575 "help.relations.multipolygon_h": 3,
68576 "help.relations.turn_restriction_h": 3,
68577 "help.relations.route_h": 3,
68578 "help.relations.boundary_h": 3,
68579 "help.notes.add_note_h": 3,
68580 "help.notes.update_note_h": 3,
68581 "help.notes.save_note_h": 3,
68582 "help.imagery.sources_h": 3,
68583 "help.imagery.offsets_h": 3,
68584 "help.streetlevel.using_h": 3,
68585 "help.gps.using_h": 3,
68586 "help.qa.tools_h": 3,
68587 "help.qa.issues_h": 3
68589 var docs = docKeys.map(function(key) {
68590 var helpkey = "help." + key[0];
68591 var helpPaneReplacements = { version: context.version };
68592 var text2 = key[1].reduce(function(all, part) {
68593 var subkey = helpkey + "." + part;
68594 var depth = headings[subkey];
68595 var hhh = depth ? Array(depth + 1).join("#") + " " : "";
68596 return all + hhh + helpHtml(subkey, helpPaneReplacements) + "\n\n";
68599 title: _t.html(helpkey + ".title"),
68600 content: marked(text2.trim()).replace(/<code>/g, "<kbd>").replace(/<\/code>/g, "</kbd>")
68603 var helpPane = uiPane("help", context).key(_t("help.key")).label(_t.append("help.title")).description(_t.append("help.title")).iconName("iD-icon-help");
68604 helpPane.renderContent = function(content) {
68605 function clickHelp(d, i2) {
68606 var rtl = _mainLocalizer.textDirection() === "rtl";
68607 content.property("scrollTop", 0);
68608 helpPane.selection().select(".pane-heading h2").html(d.title);
68609 body.html(d.content);
68610 body.selectAll("a").attr("target", "_blank");
68611 menuItems.classed("selected", function(m) {
68612 return m.title === d.title;
68616 nav.call(drawNext).call(drawPrevious);
68618 nav.call(drawPrevious).call(drawNext);
68620 function drawNext(selection2) {
68621 if (i2 < docs.length - 1) {
68622 var nextLink = selection2.append("a").attr("href", "#").attr("class", "next").on("click", function(d3_event) {
68623 d3_event.preventDefault();
68624 clickHelp(docs[i2 + 1], i2 + 1);
68626 nextLink.append("span").html(docs[i2 + 1].title).call(svgIcon(rtl ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
68629 function drawPrevious(selection2) {
68631 var prevLink = selection2.append("a").attr("href", "#").attr("class", "previous").on("click", function(d3_event) {
68632 d3_event.preventDefault();
68633 clickHelp(docs[i2 - 1], i2 - 1);
68635 prevLink.call(svgIcon(rtl ? "#iD-icon-forward" : "#iD-icon-backward", "inline")).append("span").html(docs[i2 - 1].title);
68639 function clickWalkthrough(d3_event) {
68640 d3_event.preventDefault();
68641 if (context.inIntro())
68643 context.container().call(uiIntro(context));
68644 context.ui().togglePanes();
68646 function clickShortcuts(d3_event) {
68647 d3_event.preventDefault();
68648 context.container().call(context.ui().shortcuts, true);
68650 var toc = content.append("ul").attr("class", "toc");
68651 var menuItems = toc.selectAll("li").data(docs).enter().append("li").append("a").attr("role", "button").attr("href", "#").html(function(d) {
68653 }).on("click", function(d3_event, d) {
68654 d3_event.preventDefault();
68655 clickHelp(d, docs.indexOf(d));
68657 var shortcuts = toc.append("li").attr("class", "shortcuts").call(
68658 uiTooltip().title(() => _t.append("shortcuts.tooltip")).keys(["?"]).placement("top")
68659 ).append("a").attr("href", "#").on("click", clickShortcuts);
68660 shortcuts.append("div").call(_t.append("shortcuts.title"));
68661 var walkthrough = toc.append("li").attr("class", "walkthrough").append("a").attr("href", "#").on("click", clickWalkthrough);
68662 walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
68663 walkthrough.append("div").call(_t.append("splash.walkthrough"));
68664 var helpContent = content.append("div").attr("class", "left-content");
68665 var body = helpContent.append("div").attr("class", "body");
68666 var nav = helpContent.append("div").attr("class", "nav");
68667 clickHelp(docs[0], 0);
68672 // modules/ui/sections/validation_issues.js
68673 function uiSectionValidationIssues(id2, severity, context) {
68675 var section = uiSection(id2, context).label(function() {
68678 var issueCountText = _issues.length > 1e3 ? "1000+" : String(_issues.length);
68679 return _t.append("inspector.title_count", { title: _t("issues." + severity + "s.list_title"), count: issueCountText });
68680 }).disclosureContent(renderDisclosureContent).shouldDisplay(function() {
68681 return _issues && _issues.length;
68683 function getOptions() {
68685 what: corePreferences("validate-what") || "edited",
68686 where: corePreferences("validate-where") || "all"
68689 function reloadIssues() {
68690 _issues = context.validator().getIssuesBySeverity(getOptions())[severity];
68692 function renderDisclosureContent(selection2) {
68693 var center = context.map().center();
68694 var graph = context.graph();
68695 var issues = _issues.map(function withDistance(issue) {
68696 var extent = issue.extent(graph);
68697 var dist = extent ? geoSphericalDistance(center, extent.center()) : 0;
68698 return Object.assign(issue, { dist });
68699 }).sort(function byDistance(a, b) {
68700 return a.dist - b.dist;
68702 issues = issues.slice(0, 1e3);
68703 selection2.call(drawIssuesList, issues);
68705 function drawIssuesList(selection2, issues) {
68706 var list = selection2.selectAll(".issues-list").data([0]);
68707 list = list.enter().append("ul").attr("class", "layer-list issues-list " + severity + "s-list").merge(list);
68708 var items = list.selectAll("li").data(issues, function(d) {
68711 items.exit().remove();
68712 var itemsEnter = items.enter().append("li").attr("class", function(d) {
68713 return "issue severity-" + d.severity;
68715 var labelsEnter = itemsEnter.append("button").attr("class", "issue-label").on("click", function(d3_event, d) {
68716 context.validator().focusIssue(d);
68717 }).on("mouseover", function(d3_event, d) {
68718 utilHighlightEntities(d.entityIds, true, context);
68719 }).on("mouseout", function(d3_event, d) {
68720 utilHighlightEntities(d.entityIds, false, context);
68722 var textEnter = labelsEnter.append("span").attr("class", "issue-text");
68723 textEnter.append("span").attr("class", "issue-icon").each(function(d) {
68724 var iconName = "#iD-icon-" + (d.severity === "warning" ? "alert" : "error");
68725 select_default2(this).call(svgIcon(iconName));
68727 textEnter.append("span").attr("class", "issue-message");
68728 items = items.merge(itemsEnter).order();
68729 items.selectAll(".issue-message").text("").each(function(d) {
68730 return d.message(context)(select_default2(this));
68733 context.validator().on("validated.uiSectionValidationIssues" + id2, function() {
68734 window.requestIdleCallback(function() {
68736 section.reRender();
68740 "move.uiSectionValidationIssues" + id2,
68741 debounce_default(function() {
68742 window.requestIdleCallback(function() {
68743 if (getOptions().where === "visible") {
68746 section.reRender();
68753 // modules/ui/sections/validation_options.js
68754 function uiSectionValidationOptions(context) {
68755 var section = uiSection("issues-options", context).content(renderContent);
68756 function renderContent(selection2) {
68757 var container = selection2.selectAll(".issues-options-container").data([0]);
68758 container = container.enter().append("div").attr("class", "issues-options-container").merge(container);
68760 { key: "what", values: ["edited", "all"] },
68761 { key: "where", values: ["visible", "all"] }
68763 var options2 = container.selectAll(".issues-option").data(data, function(d) {
68766 var optionsEnter = options2.enter().append("div").attr("class", function(d) {
68767 return "issues-option issues-option-" + d.key;
68769 optionsEnter.append("div").attr("class", "issues-option-title").html(function(d) {
68770 return _t.html("issues.options." + d.key + ".title");
68772 var valuesEnter = optionsEnter.selectAll("label").data(function(d) {
68773 return d.values.map(function(val) {
68774 return { value: val, key: d.key };
68776 }).enter().append("label");
68777 valuesEnter.append("input").attr("type", "radio").attr("name", function(d) {
68778 return "issues-option-" + d.key;
68779 }).attr("value", function(d) {
68781 }).property("checked", function(d) {
68782 return getOptions()[d.key] === d.value;
68783 }).on("change", function(d3_event, d) {
68784 updateOptionValue(d3_event, d.key, d.value);
68786 valuesEnter.append("span").html(function(d) {
68787 return _t.html("issues.options." + d.key + "." + d.value);
68790 function getOptions() {
68792 what: corePreferences("validate-what") || "edited",
68793 where: corePreferences("validate-where") || "all"
68796 function updateOptionValue(d3_event, d, val) {
68797 if (!val && d3_event && d3_event.target) {
68798 val = d3_event.target.value;
68800 corePreferences("validate-" + d, val);
68801 context.validator().validate();
68806 // modules/ui/sections/validation_rules.js
68807 function uiSectionValidationRules(context) {
68809 var MAXSQUARE = 20;
68810 var DEFAULTSQUARE = 5;
68811 var section = uiSection("issues-rules", context).disclosureContent(renderDisclosureContent).label(() => _t.append("issues.rules.title"));
68812 var _ruleKeys = context.validator().getRuleKeys().filter(function(key) {
68813 return key !== "maprules";
68814 }).sort(function(key1, key2) {
68815 return _t("issues." + key1 + ".title") < _t("issues." + key2 + ".title") ? -1 : 1;
68817 function renderDisclosureContent(selection2) {
68818 var container = selection2.selectAll(".issues-rulelist-container").data([0]);
68819 var containerEnter = container.enter().append("div").attr("class", "issues-rulelist-container");
68820 containerEnter.append("ul").attr("class", "layer-list issue-rules-list");
68821 var ruleLinks = containerEnter.append("div").attr("class", "issue-rules-links section-footer");
68822 ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
68823 d3_event.preventDefault();
68824 context.validator().disableRules(_ruleKeys);
68826 ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
68827 d3_event.preventDefault();
68828 context.validator().disableRules([]);
68830 container = container.merge(containerEnter);
68831 container.selectAll(".issue-rules-list").call(drawListItems, _ruleKeys, "checkbox", "rule", toggleRule, isRuleEnabled);
68833 function drawListItems(selection2, data, type3, name, change, active) {
68834 var items = selection2.selectAll("li").data(data);
68835 items.exit().remove();
68836 var enter = items.enter().append("li");
68837 if (name === "rule") {
68839 uiTooltip().title(function(d) {
68840 return _t.append("issues." + d + ".tip");
68841 }).placement("top")
68844 var label = enter.append("label");
68845 label.append("input").attr("type", type3).attr("name", name).on("change", change);
68846 label.append("span").html(function(d) {
68848 if (d === "unsquare_way") {
68849 params.val = { html: '<span class="square-degrees"></span>' };
68851 return _t.html("issues." + d + ".title", params);
68853 items = items.merge(enter);
68854 items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
68855 var degStr = corePreferences("validate-square-degrees");
68856 if (degStr === null) {
68857 degStr = DEFAULTSQUARE.toString();
68859 var span = items.selectAll(".square-degrees");
68860 var input = span.selectAll(".square-degrees-input").data([0]);
68861 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) {
68862 d3_event.preventDefault();
68863 d3_event.stopPropagation();
68865 }).on("keyup", function(d3_event) {
68866 if (d3_event.keyCode === 13) {
68870 }).on("blur", changeSquare).merge(input).property("value", degStr);
68872 function changeSquare() {
68873 var input = select_default2(this);
68874 var degStr = utilGetSetValue(input).trim();
68875 var degNum = parseFloat(degStr, 10);
68876 if (!isFinite(degNum)) {
68877 degNum = DEFAULTSQUARE;
68878 } else if (degNum > MAXSQUARE) {
68879 degNum = MAXSQUARE;
68880 } else if (degNum < MINSQUARE) {
68881 degNum = MINSQUARE;
68883 degNum = Math.round(degNum * 10) / 10;
68884 degStr = degNum.toString();
68885 input.property("value", degStr);
68886 corePreferences("validate-square-degrees", degStr);
68887 context.validator().revalidateUnsquare();
68889 function isRuleEnabled(d) {
68890 return context.validator().isRuleEnabled(d);
68892 function toggleRule(d3_event, d) {
68893 context.validator().toggleRule(d);
68895 context.validator().on("validated.uiSectionValidationRules", function() {
68896 window.requestIdleCallback(section.reRender);
68901 // modules/ui/sections/validation_status.js
68902 function uiSectionValidationStatus(context) {
68903 var section = uiSection("issues-status", context).content(renderContent).shouldDisplay(function() {
68904 var issues = context.validator().getIssues(getOptions());
68905 return issues.length === 0;
68907 function getOptions() {
68909 what: corePreferences("validate-what") || "edited",
68910 where: corePreferences("validate-where") || "all"
68913 function renderContent(selection2) {
68914 var box = selection2.selectAll(".box").data([0]);
68915 var boxEnter = box.enter().append("div").attr("class", "box");
68916 boxEnter.append("div").call(svgIcon("#iD-icon-apply", "pre-text"));
68917 var noIssuesMessage = boxEnter.append("span");
68918 noIssuesMessage.append("strong").attr("class", "message");
68919 noIssuesMessage.append("br");
68920 noIssuesMessage.append("span").attr("class", "details");
68921 renderIgnoredIssuesReset(selection2);
68922 setNoIssuesText(selection2);
68924 function renderIgnoredIssuesReset(selection2) {
68925 var ignoredIssues = context.validator().getIssues({ what: "all", where: "all", includeDisabledRules: true, includeIgnored: "only" });
68926 var resetIgnored = selection2.selectAll(".reset-ignored").data(ignoredIssues.length ? [0] : []);
68927 resetIgnored.exit().remove();
68928 var resetIgnoredEnter = resetIgnored.enter().append("div").attr("class", "reset-ignored section-footer");
68929 resetIgnoredEnter.append("a").attr("href", "#");
68930 resetIgnored = resetIgnored.merge(resetIgnoredEnter);
68931 resetIgnored.select("a").html(_t.html("inspector.title_count", { title: { html: _t.html("issues.reset_ignored") }, count: ignoredIssues.length }));
68932 resetIgnored.on("click", function(d3_event) {
68933 d3_event.preventDefault();
68934 context.validator().resetIgnoredIssues();
68937 function setNoIssuesText(selection2) {
68938 var opts = getOptions();
68939 function checkForHiddenIssues(cases) {
68940 for (var type3 in cases) {
68941 var hiddenOpts = cases[type3];
68942 var hiddenIssues = context.validator().getIssues(hiddenOpts);
68943 if (hiddenIssues.length) {
68944 selection2.select(".box .details").html("").call(_t.append(
68945 "issues.no_issues.hidden_issues." + type3,
68946 { count: hiddenIssues.length.toString() }
68951 selection2.select(".box .details").html("").call(_t.append("issues.no_issues.hidden_issues.none"));
68954 if (opts.what === "edited" && opts.where === "visible") {
68955 messageType = "edits_in_view";
68956 checkForHiddenIssues({
68957 elsewhere: { what: "edited", where: "all" },
68958 everything_else: { what: "all", where: "visible" },
68959 disabled_rules: { what: "edited", where: "visible", includeDisabledRules: "only" },
68960 everything_else_elsewhere: { what: "all", where: "all" },
68961 disabled_rules_elsewhere: { what: "edited", where: "all", includeDisabledRules: "only" },
68962 ignored_issues: { what: "edited", where: "visible", includeIgnored: "only" },
68963 ignored_issues_elsewhere: { what: "edited", where: "all", includeIgnored: "only" }
68965 } else if (opts.what === "edited" && opts.where === "all") {
68966 messageType = "edits";
68967 checkForHiddenIssues({
68968 everything_else: { what: "all", where: "all" },
68969 disabled_rules: { what: "edited", where: "all", includeDisabledRules: "only" },
68970 ignored_issues: { what: "edited", where: "all", includeIgnored: "only" }
68972 } else if (opts.what === "all" && opts.where === "visible") {
68973 messageType = "everything_in_view";
68974 checkForHiddenIssues({
68975 elsewhere: { what: "all", where: "all" },
68976 disabled_rules: { what: "all", where: "visible", includeDisabledRules: "only" },
68977 disabled_rules_elsewhere: { what: "all", where: "all", includeDisabledRules: "only" },
68978 ignored_issues: { what: "all", where: "visible", includeIgnored: "only" },
68979 ignored_issues_elsewhere: { what: "all", where: "all", includeIgnored: "only" }
68981 } else if (opts.what === "all" && opts.where === "all") {
68982 messageType = "everything";
68983 checkForHiddenIssues({
68984 disabled_rules: { what: "all", where: "all", includeDisabledRules: "only" },
68985 ignored_issues: { what: "all", where: "all", includeIgnored: "only" }
68988 if (opts.what === "edited" && context.history().difference().summary().length === 0) {
68989 messageType = "no_edits";
68991 selection2.select(".box .message").html("").call(_t.append("issues.no_issues.message." + messageType));
68993 context.validator().on("validated.uiSectionValidationStatus", function() {
68994 window.requestIdleCallback(section.reRender);
68997 "move.uiSectionValidationStatus",
68998 debounce_default(function() {
68999 window.requestIdleCallback(section.reRender);
69005 // modules/ui/panes/issues.js
69006 function uiPaneIssues(context) {
69007 var issuesPane = uiPane("issues", context).key(_t("issues.key")).label(_t.append("issues.title")).description(_t.append("issues.title")).iconName("iD-icon-alert").sections([
69008 uiSectionValidationOptions(context),
69009 uiSectionValidationStatus(context),
69010 uiSectionValidationIssues("issues-errors", "error", context),
69011 uiSectionValidationIssues("issues-warnings", "warning", context),
69012 uiSectionValidationRules(context)
69017 // modules/ui/settings/custom_data.js
69018 function uiSettingsCustomData(context) {
69019 var dispatch10 = dispatch_default("change");
69020 function render(selection2) {
69021 var dataLayer = context.layers().layer("data");
69022 var _origSettings = {
69023 fileList: dataLayer && dataLayer.fileList() || null,
69024 url: corePreferences("settings-custom-data-url")
69026 var _currSettings = {
69027 fileList: dataLayer && dataLayer.fileList() || null,
69028 url: corePreferences("settings-custom-data-url")
69030 var modal = uiConfirm(selection2).okButton();
69031 modal.classed("settings-modal settings-custom-data", true);
69032 modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_data.header"));
69033 var textSection = modal.select(".modal-section.message-text");
69034 textSection.append("pre").attr("class", "instructions-file").call(_t.append("settings.custom_data.file.instructions"));
69035 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) {
69036 var files = d3_event.target.files;
69037 if (files && files.length) {
69038 _currSettings.url = "";
69039 textSection.select(".field-url").property("value", "");
69040 _currSettings.fileList = files;
69042 _currSettings.fileList = null;
69045 textSection.append("h4").call(_t.append("settings.custom_data.or"));
69046 textSection.append("pre").attr("class", "instructions-url").call(_t.append("settings.custom_data.url.instructions"));
69047 textSection.append("textarea").attr("class", "field-url").attr("placeholder", _t("settings.custom_data.url.placeholder")).call(utilNoAuto).property("value", _currSettings.url);
69048 var buttonSection = modal.select(".modal-section.buttons");
69049 buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
69050 buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
69051 buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
69052 function isSaveDisabled() {
69055 function clickCancel() {
69056 textSection.select(".field-url").property("value", _origSettings.url);
69057 corePreferences("settings-custom-data-url", _origSettings.url);
69061 function clickSave() {
69062 _currSettings.url = textSection.select(".field-url").property("value").trim();
69063 if (_currSettings.url) {
69064 _currSettings.fileList = null;
69066 if (_currSettings.fileList) {
69067 _currSettings.url = "";
69069 corePreferences("settings-custom-data-url", _currSettings.url);
69072 dispatch10.call("change", this, _currSettings);
69075 return utilRebind(render, dispatch10, "on");
69078 // modules/ui/sections/data_layers.js
69079 function uiSectionDataLayers(context) {
69080 var settingsCustomData = uiSettingsCustomData(context).on("change", customChanged);
69081 var layers = context.layers();
69082 var section = uiSection("data-layers", context).label(() => _t.append("map_data.data_layers")).disclosureContent(renderDisclosureContent);
69083 function renderDisclosureContent(selection2) {
69084 var container = selection2.selectAll(".data-layer-container").data([0]);
69085 container.enter().append("div").attr("class", "data-layer-container").merge(container).call(drawOsmItems).call(drawQAItems).call(drawCustomDataItems).call(drawVectorItems).call(drawPanelItems);
69087 function showsLayer(which) {
69088 var layer = layers.layer(which);
69090 return layer.enabled();
69094 function setLayer(which, enabled) {
69095 var mode = context.mode();
69096 if (mode && /^draw/.test(mode.id))
69098 var layer = layers.layer(which);
69100 layer.enabled(enabled);
69101 if (!enabled && (which === "osm" || which === "notes")) {
69102 context.enter(modeBrowse(context));
69106 function toggleLayer(which) {
69107 setLayer(which, !showsLayer(which));
69109 function drawOsmItems(selection2) {
69110 var osmKeys = ["osm", "notes"];
69111 var osmLayers = layers.all().filter(function(obj) {
69112 return osmKeys.indexOf(obj.id) !== -1;
69114 var ul = selection2.selectAll(".layer-list-osm").data([0]);
69115 ul = ul.enter().append("ul").attr("class", "layer-list layer-list-osm").merge(ul);
69116 var li = ul.selectAll(".list-item").data(osmLayers);
69117 li.exit().remove();
69118 var liEnter = li.enter().append("li").attr("class", function(d) {
69119 return "list-item list-item-" + d.id;
69121 var labelEnter = liEnter.append("label").each(function(d) {
69122 if (d.id === "osm") {
69123 select_default2(this).call(
69124 uiTooltip().title(() => _t.append("map_data.layers." + d.id + ".tooltip")).keys([uiCmd("\u2325" + _t("area_fill.wireframe.key"))]).placement("bottom")
69127 select_default2(this).call(
69128 uiTooltip().title(() => _t.append("map_data.layers." + d.id + ".tooltip")).placement("bottom")
69132 labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
69135 labelEnter.append("span").html(function(d) {
69136 return _t.html("map_data.layers." + d.id + ".title");
69138 li.merge(liEnter).classed("active", function(d) {
69139 return d.layer.enabled();
69140 }).selectAll("input").property("checked", function(d) {
69141 return d.layer.enabled();
69144 function drawQAItems(selection2) {
69145 var qaKeys = ["keepRight", "improveOSM", "osmose"];
69146 var qaLayers = layers.all().filter(function(obj) {
69147 return qaKeys.indexOf(obj.id) !== -1;
69149 var ul = selection2.selectAll(".layer-list-qa").data([0]);
69150 ul = ul.enter().append("ul").attr("class", "layer-list layer-list-qa").merge(ul);
69151 var li = ul.selectAll(".list-item").data(qaLayers);
69152 li.exit().remove();
69153 var liEnter = li.enter().append("li").attr("class", function(d) {
69154 return "list-item list-item-" + d.id;
69156 var labelEnter = liEnter.append("label").each(function(d) {
69157 select_default2(this).call(
69158 uiTooltip().title(() => _t.append("map_data.layers." + d.id + ".tooltip")).placement("bottom")
69161 labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
69164 labelEnter.append("span").each(function(d) {
69165 _t.append("map_data.layers." + d.id + ".title")(select_default2(this));
69167 li.merge(liEnter).classed("active", function(d) {
69168 return d.layer.enabled();
69169 }).selectAll("input").property("checked", function(d) {
69170 return d.layer.enabled();
69173 function drawVectorItems(selection2) {
69174 var dataLayer = layers.layer("data");
69177 name: "Detroit Neighborhoods/Parks",
69178 src: "neighborhoods-parks",
69179 tooltip: "Neighborhood boundaries and parks as compiled by City of Detroit in concert with community groups.",
69180 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"
69183 name: "Detroit Composite POIs",
69184 src: "composite-poi",
69185 tooltip: "Fire Inspections, Business Licenses, and other public location data collated from the City of Detroit.",
69186 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"
69189 name: "Detroit All-The-Places POIs",
69190 src: "alltheplaces-poi",
69191 tooltip: "Public domain business location data created by web scrapers.",
69192 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"
69195 var detroit = geoExtent([-83.5, 42.1], [-82.8, 42.5]);
69196 var showVectorItems = context.map().zoom() > 9 && detroit.contains(context.map().center());
69197 var container = selection2.selectAll(".vectortile-container").data(showVectorItems ? [0] : []);
69198 container.exit().remove();
69199 var containerEnter = container.enter().append("div").attr("class", "vectortile-container");
69200 containerEnter.append("h4").attr("class", "vectortile-header").text("Detroit Vector Tiles (Beta)");
69201 containerEnter.append("ul").attr("class", "layer-list layer-list-vectortile");
69202 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");
69203 container = container.merge(containerEnter);
69204 var ul = container.selectAll(".layer-list-vectortile");
69205 var li = ul.selectAll(".list-item").data(vtData);
69206 li.exit().remove();
69207 var liEnter = li.enter().append("li").attr("class", function(d) {
69208 return "list-item list-item-" + d.src;
69210 var labelEnter = liEnter.append("label").each(function(d) {
69211 select_default2(this).call(
69212 uiTooltip().title(d.tooltip).placement("top")
69215 labelEnter.append("input").attr("type", "radio").attr("name", "vectortile").on("change", selectVTLayer);
69216 labelEnter.append("span").text(function(d) {
69219 li.merge(liEnter).classed("active", isVTLayerSelected).selectAll("input").property("checked", isVTLayerSelected);
69220 function isVTLayerSelected(d) {
69221 return dataLayer && dataLayer.template() === d.template;
69223 function selectVTLayer(d3_event, d) {
69224 corePreferences("settings-custom-data-url", d.template);
69226 dataLayer.template(d.template, d.src);
69227 dataLayer.enabled(true);
69231 function drawCustomDataItems(selection2) {
69232 var dataLayer = layers.layer("data");
69233 var hasData = dataLayer && dataLayer.hasData();
69234 var showsData = hasData && dataLayer.enabled();
69235 var ul = selection2.selectAll(".layer-list-data").data(dataLayer ? [0] : []);
69236 ul.exit().remove();
69237 var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-data");
69238 var liEnter = ulEnter.append("li").attr("class", "list-item-data");
69239 var labelEnter = liEnter.append("label").call(
69240 uiTooltip().title(() => _t.append("map_data.layers.custom.tooltip")).placement("top")
69242 labelEnter.append("input").attr("type", "checkbox").on("change", function() {
69243 toggleLayer("data");
69245 labelEnter.append("span").call(_t.append("map_data.layers.custom.title"));
69246 liEnter.append("button").attr("class", "open-data-options").call(
69247 uiTooltip().title(() => _t.append("settings.custom_data.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
69248 ).on("click", function(d3_event) {
69249 d3_event.preventDefault();
69251 }).call(svgIcon("#iD-icon-more"));
69252 liEnter.append("button").attr("class", "zoom-to-data").call(
69253 uiTooltip().title(() => _t.append("map_data.layers.custom.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
69254 ).on("click", function(d3_event) {
69255 if (select_default2(this).classed("disabled"))
69257 d3_event.preventDefault();
69258 d3_event.stopPropagation();
69259 dataLayer.fitZoom();
69260 }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
69261 ul = ul.merge(ulEnter);
69262 ul.selectAll(".list-item-data").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
69263 ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
69265 function editCustom() {
69266 context.container().call(settingsCustomData);
69268 function customChanged(d) {
69269 var dataLayer = layers.layer("data");
69271 dataLayer.url(d.url);
69272 } else if (d && d.fileList) {
69273 dataLayer.fileList(d.fileList);
69276 function drawPanelItems(selection2) {
69277 var panelsListEnter = selection2.selectAll(".md-extras-list").data([0]).enter().append("ul").attr("class", "layer-list md-extras-list");
69278 var historyPanelLabelEnter = panelsListEnter.append("li").attr("class", "history-panel-toggle-item").append("label").call(
69279 uiTooltip().title(() => _t.append("map_data.history_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.history.key"))]).placement("top")
69281 historyPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
69282 d3_event.preventDefault();
69283 context.ui().info.toggle("history");
69285 historyPanelLabelEnter.append("span").call(_t.append("map_data.history_panel.title"));
69286 var measurementPanelLabelEnter = panelsListEnter.append("li").attr("class", "measurement-panel-toggle-item").append("label").call(
69287 uiTooltip().title(() => _t.append("map_data.measurement_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.measurement.key"))]).placement("top")
69289 measurementPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
69290 d3_event.preventDefault();
69291 context.ui().info.toggle("measurement");
69293 measurementPanelLabelEnter.append("span").call(_t.append("map_data.measurement_panel.title"));
69295 context.layers().on("change.uiSectionDataLayers", section.reRender);
69297 "move.uiSectionDataLayers",
69298 debounce_default(function() {
69299 window.requestIdleCallback(section.reRender);
69305 // modules/ui/sections/map_features.js
69306 function uiSectionMapFeatures(context) {
69307 var _features = context.features().keys();
69308 var section = uiSection("map-features", context).label(() => _t.append("map_data.map_features")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
69309 function renderDisclosureContent(selection2) {
69310 var container = selection2.selectAll(".layer-feature-list-container").data([0]);
69311 var containerEnter = container.enter().append("div").attr("class", "layer-feature-list-container");
69312 containerEnter.append("ul").attr("class", "layer-list layer-feature-list");
69313 var footer = containerEnter.append("div").attr("class", "feature-list-links section-footer");
69314 footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
69315 d3_event.preventDefault();
69316 context.features().disableAll();
69318 footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
69319 d3_event.preventDefault();
69320 context.features().enableAll();
69322 container = container.merge(containerEnter);
69323 container.selectAll(".layer-feature-list").call(drawListItems, _features, "checkbox", "feature", clickFeature, showsFeature);
69325 function drawListItems(selection2, data, type3, name, change, active) {
69326 var items = selection2.selectAll("li").data(data);
69327 items.exit().remove();
69328 var enter = items.enter().append("li").call(
69329 uiTooltip().title(function(d) {
69330 var tip = _t.append(name + "." + d + ".tooltip");
69331 if (autoHiddenFeature(d)) {
69332 var msg = showsLayer("osm") ? _t.append("map_data.autohidden") : _t.append("map_data.osmhidden");
69333 return (selection3) => {
69334 selection3.call(tip);
69335 selection3.append("div").call(msg);
69339 }).placement("top")
69341 var label = enter.append("label");
69342 label.append("input").attr("type", type3).attr("name", name).on("change", change);
69343 label.append("span").html(function(d) {
69344 return _t.html(name + "." + d + ".description");
69346 items = items.merge(enter);
69347 items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", autoHiddenFeature);
69349 function autoHiddenFeature(d) {
69350 return context.features().autoHidden(d);
69352 function showsFeature(d) {
69353 return context.features().enabled(d);
69355 function clickFeature(d3_event, d) {
69356 context.features().toggle(d);
69358 function showsLayer(id2) {
69359 var layer = context.layers().layer(id2);
69360 return layer && layer.enabled();
69362 context.features().on("change.map_features", section.reRender);
69366 // modules/ui/sections/map_style_options.js
69367 function uiSectionMapStyleOptions(context) {
69368 var section = uiSection("fill-area", context).label(() => _t.append("map_data.style_options")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
69369 function renderDisclosureContent(selection2) {
69370 var container = selection2.selectAll(".layer-fill-list").data([0]);
69371 container.enter().append("ul").attr("class", "layer-list layer-fill-list").merge(container).call(drawListItems, context.map().areaFillOptions, "radio", "area_fill", setFill, isActiveFill);
69372 var container2 = selection2.selectAll(".layer-visual-diff-list").data([0]);
69373 container2.enter().append("ul").attr("class", "layer-list layer-visual-diff-list").merge(container2).call(drawListItems, ["highlight_edits"], "checkbox", "visual_diff", toggleHighlightEdited, function() {
69374 return context.surface().classed("highlight-edited");
69377 function drawListItems(selection2, data, type3, name, change, active) {
69378 var items = selection2.selectAll("li").data(data);
69379 items.exit().remove();
69380 var enter = items.enter().append("li").call(
69381 uiTooltip().title(function(d) {
69382 return _t.append(name + "." + d + ".tooltip");
69383 }).keys(function(d) {
69384 var key = d === "wireframe" ? _t("area_fill.wireframe.key") : null;
69385 if (d === "highlight_edits")
69386 key = _t("map_data.highlight_edits.key");
69387 return key ? [key] : null;
69388 }).placement("top")
69390 var label = enter.append("label");
69391 label.append("input").attr("type", type3).attr("name", name).on("change", change);
69392 label.append("span").html(function(d) {
69393 return _t.html(name + "." + d + ".description");
69395 items = items.merge(enter);
69396 items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
69398 function isActiveFill(d) {
69399 return context.map().activeAreaFill() === d;
69401 function toggleHighlightEdited(d3_event) {
69402 d3_event.preventDefault();
69403 context.map().toggleHighlightEdited();
69405 function setFill(d3_event, d) {
69406 context.map().activeAreaFill(d);
69408 context.map().on("changeHighlighting.ui_style, changeAreaFill.ui_style", section.reRender);
69412 // modules/ui/sections/photo_overlays.js
69413 function uiSectionPhotoOverlays(context) {
69414 var layers = context.layers();
69415 var section = uiSection("photo-overlays", context).label(() => _t.append("photo_overlays.title")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
69416 function renderDisclosureContent(selection2) {
69417 var container = selection2.selectAll(".photo-overlay-container").data([0]);
69418 container.enter().append("div").attr("class", "photo-overlay-container").merge(container).call(drawPhotoItems).call(drawPhotoTypeItems).call(drawDateFilter).call(drawUsernameFilter);
69420 function drawPhotoItems(selection2) {
69421 var photoKeys = context.photos().overlayLayerIDs();
69422 var photoLayers = layers.all().filter(function(obj) {
69423 return photoKeys.indexOf(obj.id) !== -1;
69425 var data = photoLayers.filter(function(obj) {
69426 return obj.layer.supported();
69428 function layerSupported(d) {
69429 return d.layer && d.layer.supported();
69431 function layerEnabled(d) {
69432 return layerSupported(d) && d.layer.enabled();
69434 var ul = selection2.selectAll(".layer-list-photos").data([0]);
69435 ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photos").merge(ul);
69436 var li = ul.selectAll(".list-item-photos").data(data);
69437 li.exit().remove();
69438 var liEnter = li.enter().append("li").attr("class", function(d) {
69439 var classes = "list-item-photos list-item-" + d.id;
69440 if (d.id === "mapillary-signs" || d.id === "mapillary-map-features") {
69441 classes += " indented";
69445 var labelEnter = liEnter.append("label").each(function(d) {
69447 if (d.id === "mapillary-signs")
69448 titleID = "mapillary.signs.tooltip";
69449 else if (d.id === "mapillary")
69450 titleID = "mapillary_images.tooltip";
69451 else if (d.id === "kartaview")
69452 titleID = "kartaview_images.tooltip";
69454 titleID = d.id.replace(/-/g, "_") + ".tooltip";
69455 select_default2(this).call(
69456 uiTooltip().title(() => _t.append(titleID)).placement("top")
69459 labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
69462 labelEnter.append("span").html(function(d) {
69464 if (id2 === "mapillary-signs")
69465 id2 = "photo_overlays.traffic_signs";
69466 return _t.html(id2.replace(/-/g, "_") + ".title");
69468 li.merge(liEnter).classed("active", layerEnabled).selectAll("input").property("checked", layerEnabled);
69470 function drawPhotoTypeItems(selection2) {
69471 var data = context.photos().allPhotoTypes();
69472 function typeEnabled(d) {
69473 return context.photos().showsPhotoType(d);
69475 var ul = selection2.selectAll(".layer-list-photo-types").data([0]);
69476 ul.exit().remove();
69477 ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photo-types").merge(ul);
69478 var li = ul.selectAll(".list-item-photo-types").data(context.photos().shouldFilterByPhotoType() ? data : []);
69479 li.exit().remove();
69480 var liEnter = li.enter().append("li").attr("class", function(d) {
69481 return "list-item-photo-types list-item-" + d;
69483 var labelEnter = liEnter.append("label").each(function(d) {
69484 select_default2(this).call(
69485 uiTooltip().title(() => _t.append("photo_overlays.photo_type." + d + ".tooltip")).placement("top")
69488 labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
69489 context.photos().togglePhotoType(d);
69491 labelEnter.append("span").html(function(d) {
69492 return _t.html("photo_overlays.photo_type." + d + ".title");
69494 li.merge(liEnter).classed("active", typeEnabled).selectAll("input").property("checked", typeEnabled);
69496 function drawDateFilter(selection2) {
69497 var data = context.photos().dateFilters();
69498 function filterEnabled(d) {
69499 return context.photos().dateFilterValue(d);
69501 var ul = selection2.selectAll(".layer-list-date-filter").data([0]);
69502 ul.exit().remove();
69503 ul = ul.enter().append("ul").attr("class", "layer-list layer-list-date-filter").merge(ul);
69504 var li = ul.selectAll(".list-item-date-filter").data(context.photos().shouldFilterByDate() ? data : []);
69505 li.exit().remove();
69506 var liEnter = li.enter().append("li").attr("class", "list-item-date-filter");
69507 var labelEnter = liEnter.append("label").each(function(d) {
69508 select_default2(this).call(
69509 uiTooltip().title(() => _t.append("photo_overlays.date_filter." + d + ".tooltip")).placement("top")
69512 labelEnter.append("span").each(function(d) {
69513 _t.append("photo_overlays.date_filter." + d + ".title")(select_default2(this));
69515 labelEnter.append("input").attr("type", "date").attr("class", "list-item-input").attr("placeholder", _t("units.year_month_day")).call(utilNoAuto).each(function(d) {
69516 utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d) || "");
69517 }).on("change", function(d3_event, d) {
69518 var value = utilGetSetValue(select_default2(this)).trim();
69519 context.photos().setDateFilter(d, value, true);
69520 li.selectAll("input").each(function(d2) {
69521 utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d2) || "");
69524 li = li.merge(liEnter).classed("active", filterEnabled);
69526 function drawUsernameFilter(selection2) {
69527 function filterEnabled() {
69528 return context.photos().usernames();
69530 var ul = selection2.selectAll(".layer-list-username-filter").data([0]);
69531 ul.exit().remove();
69532 ul = ul.enter().append("ul").attr("class", "layer-list layer-list-username-filter").merge(ul);
69533 var li = ul.selectAll(".list-item-username-filter").data(context.photos().shouldFilterByUsername() ? ["username-filter"] : []);
69534 li.exit().remove();
69535 var liEnter = li.enter().append("li").attr("class", "list-item-username-filter");
69536 var labelEnter = liEnter.append("label").each(function() {
69537 select_default2(this).call(
69538 uiTooltip().title(() => _t.append("photo_overlays.username_filter.tooltip")).placement("top")
69541 labelEnter.append("span").call(_t.append("photo_overlays.username_filter.title"));
69542 labelEnter.append("input").attr("type", "text").attr("class", "list-item-input").call(utilNoAuto).property("value", usernameValue).on("change", function() {
69543 var value = select_default2(this).property("value");
69544 context.photos().setUsernameFilter(value, true);
69545 select_default2(this).property("value", usernameValue);
69547 li.merge(liEnter).classed("active", filterEnabled);
69548 function usernameValue() {
69549 var usernames = context.photos().usernames();
69551 return usernames.join("; ");
69555 function toggleLayer(which) {
69556 setLayer(which, !showsLayer(which));
69558 function showsLayer(which) {
69559 var layer = layers.layer(which);
69561 return layer.enabled();
69565 function setLayer(which, enabled) {
69566 var layer = layers.layer(which);
69568 layer.enabled(enabled);
69571 context.layers().on("change.uiSectionPhotoOverlays", section.reRender);
69572 context.photos().on("change.uiSectionPhotoOverlays", section.reRender);
69576 // modules/ui/panes/map_data.js
69577 function uiPaneMapData(context) {
69578 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([
69579 uiSectionDataLayers(context),
69580 uiSectionPhotoOverlays(context),
69581 uiSectionMapStyleOptions(context),
69582 uiSectionMapFeatures(context)
69584 return mapDataPane;
69587 // modules/ui/panes/preferences.js
69588 function uiPanePreferences(context) {
69589 let preferencesPane = uiPane("preferences", context).key(_t("preferences.key")).label(_t.append("preferences.title")).description(_t.append("preferences.description")).iconName("fas-user-cog").sections([
69590 uiSectionPrivacy(context)
69592 return preferencesPane;
69595 // modules/ui/init.js
69596 function uiInit(context) {
69597 var _initCounter = 0;
69598 var _needWidth = {};
69599 var _lastPointerType;
69600 function render(container) {
69601 container.on("click.ui", function(d3_event) {
69602 if (d3_event.button !== 0)
69604 if (!d3_event.composedPath)
69606 var isOkayTarget = d3_event.composedPath().some(function(node) {
69607 return node.nodeType === 1 && (node.nodeName === "INPUT" || node.nodeName === "LABEL" || node.nodeName === "A");
69611 d3_event.preventDefault();
69613 var detected = utilDetect();
69614 if ("GestureEvent" in window && !detected.isMobileWebKit) {
69615 container.on("gesturestart.ui gesturechange.ui gestureend.ui", function(d3_event) {
69616 d3_event.preventDefault();
69619 if ("PointerEvent" in window) {
69620 select_default2(window).on("pointerdown.ui pointerup.ui", function(d3_event) {
69621 var pointerType = d3_event.pointerType || "mouse";
69622 if (_lastPointerType !== pointerType) {
69623 _lastPointerType = pointerType;
69624 container.attr("pointer", pointerType);
69628 _lastPointerType = "mouse";
69629 container.attr("pointer", "mouse");
69631 container.attr("lang", _mainLocalizer.localeCode()).attr("dir", _mainLocalizer.textDirection());
69632 container.call(uiFullScreen(context));
69633 var map2 = context.map();
69634 map2.redrawEnable(false);
69635 map2.on("hitMinZoom.ui", function() {
69636 ui.flash.iconName("#iD-icon-no").label(_t.append("cannot_zoom"))();
69638 container.append("svg").attr("id", "ideditor-defs").call(ui.svgDefs);
69639 container.append("div").attr("class", "sidebar").call(ui.sidebar);
69640 var content = container.append("div").attr("class", "main-content active");
69641 content.append("div").attr("class", "top-toolbar-wrap").append("div").attr("class", "top-toolbar fillD").call(uiTopToolbar(context));
69642 content.append("div").attr("class", "main-map").attr("dir", "ltr").call(map2);
69643 var overMap = content.append("div").attr("class", "over-map");
69644 overMap.append("div").attr("class", "select-trap").text("t");
69645 overMap.call(uiMapInMap(context)).call(uiNotice(context));
69646 overMap.append("div").attr("class", "spinner").call(uiSpinner(context));
69647 var controlsWrap = overMap.append("div").attr("class", "map-controls-wrap");
69648 var controls = controlsWrap.append("div").attr("class", "map-controls");
69649 controls.append("div").attr("class", "map-control zoombuttons").call(uiZoom(context));
69650 controls.append("div").attr("class", "map-control zoom-to-selection-control").call(uiZoomToSelection(context));
69651 controls.append("div").attr("class", "map-control geolocate-control").call(uiGeolocate(context));
69652 controlsWrap.on("wheel.mapControls", function(d3_event) {
69653 if (!d3_event.deltaX) {
69654 controlsWrap.node().scrollTop += d3_event.deltaY;
69657 var panes = overMap.append("div").attr("class", "map-panes");
69659 uiPaneBackground(context),
69660 uiPaneMapData(context),
69661 uiPaneIssues(context),
69662 uiPanePreferences(context),
69663 uiPaneHelp(context)
69665 uiPanes.forEach(function(pane) {
69666 controls.append("div").attr("class", "map-control map-pane-control " + pane.id + "-control").call(pane.renderToggleButton);
69667 panes.call(pane.renderPane);
69669 ui.info = uiInfo(context);
69670 overMap.call(ui.info);
69671 overMap.append("div").attr("class", "photoviewer").classed("al", true).classed("hide", true).call(ui.photoviewer);
69672 overMap.append("div").attr("class", "attribution-wrap").attr("dir", "ltr").call(uiAttribution(context));
69673 var about = content.append("div").attr("class", "map-footer");
69674 about.append("div").attr("class", "api-status").call(uiStatus(context));
69675 var footer = about.append("div").attr("class", "map-footer-bar fillD");
69676 footer.append("div").attr("class", "flash-wrap footer-hide");
69677 var footerWrap = footer.append("div").attr("class", "main-footer-wrap footer-show");
69678 footerWrap.append("div").attr("class", "scale-block").call(uiScale(context));
69679 var aboutList = footerWrap.append("div").attr("class", "info-block").append("ul").attr("class", "map-footer-list");
69680 aboutList.append("li").attr("class", "user-list").call(uiContributors(context));
69681 var apiConnections = context.connection().apiConnections();
69682 if (apiConnections && apiConnections.length > 1) {
69683 aboutList.append("li").attr("class", "source-switch").call(
69684 uiSourceSwitch(context).keys(apiConnections)
69687 aboutList.append("li").attr("class", "issues-info").call(uiIssuesInfo(context));
69688 aboutList.append("li").attr("class", "feature-warning").call(uiFeatureInfo(context));
69689 var issueLinks = aboutList.append("li");
69690 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"));
69691 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"));
69692 aboutList.append("li").attr("class", "version").call(uiVersion(context));
69693 if (!context.embed()) {
69694 aboutList.call(uiAccount(context));
69697 map2.redrawEnable(true);
69698 ui.hash = behaviorHash(context);
69700 if (!ui.hash.hadLocation) {
69701 map2.centerZoom([0, 0], 2);
69703 window.onbeforeunload = function() {
69704 return context.save();
69706 window.onunload = function() {
69707 context.history().unlock();
69709 select_default2(window).on("resize.editor", function() {
69712 var panPixels = 80;
69713 context.keybinding().on("\u232B", function(d3_event) {
69714 d3_event.preventDefault();
69715 }).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) {
69717 d3_event.stopImmediatePropagation();
69718 d3_event.preventDefault();
69720 var previousBackground = context.background().findSource(corePreferences("background-last-used-toggle"));
69721 if (previousBackground) {
69722 var currentBackground = context.background().baseLayerSource();
69723 corePreferences("background-last-used-toggle", currentBackground.id);
69724 corePreferences("background-last-used", previousBackground.id);
69725 context.background().baseLayerSource(previousBackground);
69727 }).on(_t("area_fill.wireframe.key"), function toggleWireframe(d3_event) {
69728 d3_event.preventDefault();
69729 d3_event.stopPropagation();
69730 context.map().toggleWireframe();
69731 }).on(uiCmd("\u2325" + _t("area_fill.wireframe.key")), function toggleOsmData(d3_event) {
69732 d3_event.preventDefault();
69733 d3_event.stopPropagation();
69734 var mode = context.mode();
69735 if (mode && /^draw/.test(mode.id))
69737 var layer = context.layers().layer("osm");
69739 layer.enabled(!layer.enabled());
69740 if (!layer.enabled()) {
69741 context.enter(modeBrowse(context));
69744 }).on(_t("map_data.highlight_edits.key"), function toggleHighlightEdited(d3_event) {
69745 d3_event.preventDefault();
69746 context.map().toggleHighlightEdited();
69748 context.on("enter.editor", function(entered) {
69749 container.classed("mode-" + entered.id, true);
69750 }).on("exit.editor", function(exited) {
69751 container.classed("mode-" + exited.id, false);
69753 context.enter(modeBrowse(context));
69754 if (!_initCounter++) {
69755 if (!ui.hash.startWalkthrough) {
69756 context.container().call(uiSplash(context)).call(uiRestore(context));
69758 context.container().call(ui.shortcuts);
69760 var osm = context.connection();
69761 var auth = uiLoading(context).message(_t.html("loading_auth")).blocking(true);
69763 osm.on("authLoading.ui", function() {
69764 context.container().call(auth);
69765 }).on("authDone.ui", function() {
69770 if (ui.hash.startWalkthrough) {
69771 ui.hash.startWalkthrough = false;
69772 context.container().call(uiIntro(context));
69775 return function(d3_event) {
69776 if (d3_event.shiftKey)
69778 if (context.container().select(".combobox").size())
69780 d3_event.preventDefault();
69781 context.map().pan(d, 100);
69787 ui.ensureLoaded = () => {
69789 return _loadPromise;
69790 return _loadPromise = Promise.all([
69791 _mainLocalizer.ensureLoaded(),
69792 _mainPresetIndex.ensureLoaded()
69794 if (!context.container().empty())
69795 render(context.container());
69796 }).catch((err) => console.error(err));
69798 ui.restart = function() {
69799 context.keybinding().clear();
69800 _loadPromise = null;
69801 context.container().selectAll("*").remove();
69804 ui.lastPointerType = function() {
69805 return _lastPointerType;
69807 ui.svgDefs = svgDefs(context);
69808 ui.flash = uiFlash(context);
69809 ui.sidebar = uiSidebar(context);
69810 ui.photoviewer = uiPhotoviewer(context);
69811 ui.shortcuts = uiShortcuts(context);
69812 ui.onResize = function(withPan) {
69813 var map2 = context.map();
69814 var mapDimensions = utilGetDimensions(context.container().select(".main-content"), true);
69815 utilGetDimensions(context.container().select(".sidebar"), true);
69816 if (withPan !== void 0) {
69817 map2.redrawEnable(false);
69819 map2.redrawEnable(true);
69821 map2.dimensions(mapDimensions);
69822 ui.photoviewer.onMapResize();
69823 ui.checkOverflow(".top-toolbar");
69824 ui.checkOverflow(".map-footer-bar");
69825 var resizeWindowEvent = document.createEvent("Event");
69826 resizeWindowEvent.initEvent("resizeWindow", true, true);
69827 document.dispatchEvent(resizeWindowEvent);
69829 ui.checkOverflow = function(selector, reset) {
69831 delete _needWidth[selector];
69833 var selection2 = context.container().select(selector);
69834 if (selection2.empty())
69836 var scrollWidth = selection2.property("scrollWidth");
69837 var clientWidth = selection2.property("clientWidth");
69838 var needed = _needWidth[selector] || scrollWidth;
69839 if (scrollWidth > clientWidth) {
69840 selection2.classed("narrow", true);
69841 if (!_needWidth[selector]) {
69842 _needWidth[selector] = scrollWidth;
69844 } else if (scrollWidth >= needed) {
69845 selection2.classed("narrow", false);
69848 ui.togglePanes = function(showPane) {
69849 var hidePanes = context.container().selectAll(".map-pane.shown");
69850 var side = _mainLocalizer.textDirection() === "ltr" ? "right" : "left";
69851 hidePanes.classed("shown", false).classed("hide", true);
69852 context.container().selectAll(".map-pane-control button").classed("active", false);
69854 hidePanes.classed("shown", false).classed("hide", true).style(side, "-500px");
69855 context.container().selectAll("." + showPane.attr("pane") + "-control button").classed("active", true);
69856 showPane.classed("shown", true).classed("hide", false);
69857 if (hidePanes.empty()) {
69858 showPane.style(side, "-500px").transition().duration(200).style(side, "0px");
69860 showPane.style(side, "0px");
69863 hidePanes.classed("shown", true).classed("hide", false).style(side, "0px").transition().duration(200).style(side, "-500px").on("end", function() {
69864 select_default2(this).classed("shown", false).classed("hide", true);
69868 var _editMenu = uiEditMenu(context);
69869 ui.editMenu = function() {
69872 ui.showEditMenu = function(anchorPoint, triggerType, operations) {
69873 ui.closeEditMenu();
69874 if (!operations && context.mode().operations)
69875 operations = context.mode().operations();
69876 if (!operations || !operations.length)
69878 if (!context.map().editableDataEnabled())
69880 var surfaceNode = context.surface().node();
69881 if (surfaceNode.focus) {
69882 surfaceNode.focus();
69884 operations.forEach(function(operation) {
69885 if (operation.point)
69886 operation.point(anchorPoint);
69888 _editMenu.anchorLoc(anchorPoint).triggerType(triggerType).operations(operations);
69889 context.map().supersurface.call(_editMenu);
69891 ui.closeEditMenu = function() {
69892 context.map().supersurface.select(".edit-menu").remove();
69894 var _saveLoading = select_default2(null);
69895 context.uploader().on("saveStarted.ui", function() {
69896 _saveLoading = uiLoading(context).message(_t.html("save.uploading")).blocking(true);
69897 context.container().call(_saveLoading);
69898 }).on("saveEnded.ui", function() {
69899 _saveLoading.close();
69900 _saveLoading = select_default2(null);
69905 // modules/core/context.js
69906 function coreContext() {
69907 const dispatch10 = dispatch_default("enter", "exit", "change");
69908 let context = utilRebind({}, dispatch10, "on");
69909 let _deferred2 = /* @__PURE__ */ new Set();
69910 context.version = "2.23.2";
69911 context.privacyVersion = "20201202";
69912 context.initialHashParams = window.location.hash ? utilStringQs(window.location.hash) : {};
69913 context.changeset = null;
69914 let _defaultChangesetComment = context.initialHashParams.comment;
69915 let _defaultChangesetSource = context.initialHashParams.source;
69916 let _defaultChangesetHashtags = context.initialHashParams.hashtags;
69917 context.defaultChangesetComment = function(val) {
69918 if (!arguments.length)
69919 return _defaultChangesetComment;
69920 _defaultChangesetComment = val;
69923 context.defaultChangesetSource = function(val) {
69924 if (!arguments.length)
69925 return _defaultChangesetSource;
69926 _defaultChangesetSource = val;
69929 context.defaultChangesetHashtags = function(val) {
69930 if (!arguments.length)
69931 return _defaultChangesetHashtags;
69932 _defaultChangesetHashtags = val;
69935 let _setsDocumentTitle = true;
69936 context.setsDocumentTitle = function(val) {
69937 if (!arguments.length)
69938 return _setsDocumentTitle;
69939 _setsDocumentTitle = val;
69942 let _documentTitleBase = document.title;
69943 context.documentTitleBase = function(val) {
69944 if (!arguments.length)
69945 return _documentTitleBase;
69946 _documentTitleBase = val;
69950 context.ui = () => _ui;
69951 context.lastPointerType = () => _ui.lastPointerType();
69952 let _keybinding = utilKeybinding("context");
69953 context.keybinding = () => _keybinding;
69954 select_default2(document).call(_keybinding);
69955 let _connection = services.osm;
69959 context.connection = () => _connection;
69960 context.history = () => _history;
69961 context.validator = () => _validator;
69962 context.uploader = () => _uploader;
69963 context.preauth = (options2) => {
69965 _connection.switch(options2);
69969 context.locale = function(locale2) {
69970 if (!arguments.length)
69971 return _mainLocalizer.localeCode();
69972 _mainLocalizer.preferredLocaleCodes(locale2);
69975 function afterLoad(cid, callback) {
69976 return (err, result) => {
69978 if (err.status === 400 || err.status === 401 || err.status === 403) {
69980 _connection.logout();
69983 if (typeof callback === "function") {
69987 } else if (_connection && _connection.getConnectionId() !== cid) {
69988 if (typeof callback === "function") {
69989 callback({ message: "Connection Switched", status: -1 });
69993 _history.merge(result.data, result.extent);
69994 if (typeof callback === "function") {
69995 callback(err, result);
70001 context.loadTiles = (projection2, callback) => {
70002 const handle = window.requestIdleCallback(() => {
70003 _deferred2.delete(handle);
70004 if (_connection && context.editableDataEnabled()) {
70005 const cid = _connection.getConnectionId();
70006 _connection.loadTiles(projection2, afterLoad(cid, callback));
70009 _deferred2.add(handle);
70011 context.loadTileAtLoc = (loc, callback) => {
70012 const handle = window.requestIdleCallback(() => {
70013 _deferred2.delete(handle);
70014 if (_connection && context.editableDataEnabled()) {
70015 const cid = _connection.getConnectionId();
70016 _connection.loadTileAtLoc(loc, afterLoad(cid, callback));
70019 _deferred2.add(handle);
70021 context.loadEntity = (entityID, callback) => {
70023 const cid = _connection.getConnectionId();
70024 _connection.loadEntity(entityID, afterLoad(cid, callback));
70025 _connection.loadEntityRelations(entityID, afterLoad(cid, callback));
70028 context.zoomToEntity = (entityID, zoomTo) => {
70029 context.loadEntity(entityID, (err, result) => {
70032 if (zoomTo !== false) {
70033 const entity = result.data.find((e) => e.id === entityID);
70035 _map.zoomTo(entity);
70039 _map.on("drawn.zoomToEntity", () => {
70040 if (!context.hasEntity(entityID))
70042 _map.on("drawn.zoomToEntity", null);
70043 context.on("enter.zoomToEntity", null);
70044 context.enter(modeSelect(context, [entityID]));
70046 context.on("enter.zoomToEntity", () => {
70047 if (_mode.id !== "browse") {
70048 _map.on("drawn.zoomToEntity", null);
70049 context.on("enter.zoomToEntity", null);
70053 let _minEditableZoom = 16;
70054 context.minEditableZoom = function(val) {
70055 if (!arguments.length)
70056 return _minEditableZoom;
70057 _minEditableZoom = val;
70059 _connection.tileZoom(val);
70063 context.maxCharsForTagKey = () => 255;
70064 context.maxCharsForTagValue = () => 255;
70065 context.maxCharsForRelationRole = () => 255;
70066 function cleanOsmString(val, maxChars) {
70067 if (val === void 0 || val === null) {
70070 val = val.toString();
70074 val = val.normalize("NFC");
70075 return utilUnicodeCharsTruncated(val, maxChars);
70077 context.cleanTagKey = (val) => cleanOsmString(val, context.maxCharsForTagKey());
70078 context.cleanTagValue = (val) => cleanOsmString(val, context.maxCharsForTagValue());
70079 context.cleanRelationRole = (val) => cleanOsmString(val, context.maxCharsForRelationRole());
70080 let _inIntro = false;
70081 context.inIntro = function(val) {
70082 if (!arguments.length)
70087 context.save = () => {
70088 if (_inIntro || context.container().select(".modal").size())
70091 if (_mode && _mode.id === "save") {
70093 if (services.osm && services.osm.isChangesetInflight()) {
70094 _history.clearSaved();
70098 canSave = context.selectedIDs().every((id2) => {
70099 const entity = context.hasEntity(id2);
70100 return entity && !entity.isDegenerate();
70106 if (_history.hasChanges()) {
70107 return _t("save.unsaved_changes");
70110 context.debouncedSave = debounce_default(context.save, 350);
70111 function withDebouncedSave(fn) {
70112 return function() {
70113 const result = fn.apply(_history, arguments);
70114 context.debouncedSave();
70118 context.hasEntity = (id2) => _history.graph().hasEntity(id2);
70119 context.entity = (id2) => _history.graph().entity(id2);
70121 context.mode = () => _mode;
70122 context.enter = (newMode) => {
70125 dispatch10.call("exit", this, _mode);
70129 dispatch10.call("enter", this, _mode);
70131 context.selectedIDs = () => _mode && _mode.selectedIDs && _mode.selectedIDs() || [];
70132 context.activeID = () => _mode && _mode.activeID && _mode.activeID();
70133 let _selectedNoteID;
70134 context.selectedNoteID = function(noteID) {
70135 if (!arguments.length)
70136 return _selectedNoteID;
70137 _selectedNoteID = noteID;
70140 let _selectedErrorID;
70141 context.selectedErrorID = function(errorID) {
70142 if (!arguments.length)
70143 return _selectedErrorID;
70144 _selectedErrorID = errorID;
70147 context.install = (behavior) => context.surface().call(behavior);
70148 context.uninstall = (behavior) => context.surface().call(behavior.off);
70150 context.copyGraph = () => _copyGraph;
70152 context.copyIDs = function(val) {
70153 if (!arguments.length)
70156 _copyGraph = _history.graph();
70160 context.copyLonLat = function(val) {
70161 if (!arguments.length)
70162 return _copyLonLat;
70167 context.background = () => _background;
70169 context.features = () => _features;
70170 context.hasHiddenConnections = (id2) => {
70171 const graph = _history.graph();
70172 const entity = graph.entity(id2);
70173 return _features.hasHiddenConnections(entity, graph);
70176 context.photos = () => _photos;
70178 context.map = () => _map;
70179 context.layers = () => _map.layers();
70180 context.surface = () => _map.surface;
70181 context.editableDataEnabled = () => _map.editableDataEnabled();
70182 context.surfaceRect = () => _map.surface.node().getBoundingClientRect();
70183 context.editable = () => {
70184 const mode = context.mode();
70185 if (!mode || mode.id === "save")
70187 return _map.editableDataEnabled();
70189 let _debugFlags = {
70196 context.debugFlags = () => _debugFlags;
70197 context.getDebug = (flag) => flag && _debugFlags[flag];
70198 context.setDebug = function(flag, val) {
70199 if (arguments.length === 1)
70201 _debugFlags[flag] = val;
70202 dispatch10.call("change");
70205 let _container = select_default2(null);
70206 context.container = function(val) {
70207 if (!arguments.length)
70210 _container.classed("ideditor", true);
70213 context.containerNode = function(val) {
70214 if (!arguments.length)
70215 return context.container().node();
70216 context.container(select_default2(val));
70220 context.embed = function(val) {
70221 if (!arguments.length)
70226 let _assetPath = "";
70227 context.assetPath = function(val) {
70228 if (!arguments.length)
70231 _mainFileFetcher.assetPath(val);
70234 let _assetMap = {};
70235 context.assetMap = function(val) {
70236 if (!arguments.length)
70239 _mainFileFetcher.assetMap(val);
70242 context.asset = (val) => {
70243 if (/^http(s)?:\/\//i.test(val))
70245 const filename = _assetPath + val;
70246 return _assetMap[filename] || filename;
70248 context.imagePath = (val) => context.asset(`img/${val}`);
70249 context.reset = context.flush = () => {
70250 context.debouncedSave.cancel();
70251 Array.from(_deferred2).forEach((handle) => {
70252 window.cancelIdleCallback(handle);
70253 _deferred2.delete(handle);
70255 Object.values(services).forEach((service) => {
70256 if (service && typeof service.reset === "function") {
70257 service.reset(context);
70260 context.changeset = null;
70261 _validator.reset();
70265 context.container().select(".inspector-wrap *").remove();
70268 context.projection = geoRawMercator();
70269 context.curtainProjection = geoRawMercator();
70270 context.init = () => {
70271 instantiateInternal();
70272 initializeDependents();
70274 function instantiateInternal() {
70275 _history = coreHistory(context);
70276 context.graph = _history.graph;
70277 context.pauseChangeDispatch = _history.pauseChangeDispatch;
70278 context.resumeChangeDispatch = _history.resumeChangeDispatch;
70279 context.perform = withDebouncedSave(_history.perform);
70280 context.replace = withDebouncedSave(_history.replace);
70281 context.pop = withDebouncedSave(_history.pop);
70282 context.overwrite = withDebouncedSave(_history.overwrite);
70283 context.undo = withDebouncedSave(_history.undo);
70284 context.redo = withDebouncedSave(_history.redo);
70285 _validator = coreValidator(context);
70286 _uploader = coreUploader(context);
70287 _background = rendererBackground(context);
70288 _features = rendererFeatures(context);
70289 _map = rendererMap(context);
70290 _photos = rendererPhotos(context);
70291 _ui = uiInit(context);
70293 function initializeDependents() {
70294 if (context.initialHashParams.presets) {
70295 _mainPresetIndex.addablePresetIDs(new Set(context.initialHashParams.presets.split(",")));
70297 if (context.initialHashParams.locale) {
70298 _mainLocalizer.preferredLocaleCodes(context.initialHashParams.locale);
70300 _mainLocalizer.ensureLoaded();
70301 _mainPresetIndex.ensureLoaded();
70302 _background.ensureLoaded();
70303 Object.values(services).forEach((service) => {
70304 if (service && typeof service.init === "function") {
70311 if (services.maprules && context.initialHashParams.maprules) {
70312 json_default(context.initialHashParams.maprules).then((mapcss) => {
70313 services.maprules.init();
70314 mapcss.forEach((mapcssSelector) => services.maprules.addRule(mapcssSelector));
70318 if (!context.container().empty()) {
70319 _ui.ensureLoaded().then(() => {
70320 _background.init();
70329 // modules/services/nsi.js
70330 var _nsiStatus = "loading";
70332 var buildingPreset = {
70333 "building/commercial": true,
70334 "building/government": true,
70335 "building/hotel": true,
70336 "building/retail": true,
70337 "building/office": true,
70338 "building/supermarket": true,
70339 "building/yes": true
70341 var notNames = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
70342 var notBranches = /(coop|express|wireless|factory|outlet)/i;
70343 function setNsiSources() {
70344 const nsiVersion = package_default.dependencies["name-suggestion-index"] || package_default.devDependencies["name-suggestion-index"];
70345 const v = (0, import_vparse2.default)(nsiVersion);
70346 const vMinor = `${v.major}.${v.minor}`;
70347 const cdn = nsiCdnUrl.replace("{version}", vMinor);
70349 "nsi_data": cdn + "dist/nsi.min.json",
70350 "nsi_dissolved": cdn + "dist/dissolved.min.json",
70351 "nsi_features": cdn + "dist/featureCollection.min.json",
70352 "nsi_generics": cdn + "dist/genericWords.min.json",
70353 "nsi_presets": cdn + "dist/presets/nsi-id-presets.min.json",
70354 "nsi_replacements": cdn + "dist/replacements.min.json",
70355 "nsi_trees": cdn + "dist/trees.min.json"
70357 let fileMap = _mainFileFetcher.fileMap();
70358 for (const k in sources) {
70360 fileMap[k] = sources[k];
70363 function loadNsiPresets() {
70364 return Promise.all([
70365 _mainFileFetcher.get("nsi_presets"),
70366 _mainFileFetcher.get("nsi_features")
70367 ]).then((vals) => {
70368 Object.values(vals[0].presets).forEach((preset) => preset.suggestion = true);
70369 _mainPresetIndex.merge({
70370 presets: vals[0].presets,
70371 featureCollection: vals[1]
70375 function loadNsiData() {
70376 return Promise.all([
70377 _mainFileFetcher.get("nsi_data"),
70378 _mainFileFetcher.get("nsi_dissolved"),
70379 _mainFileFetcher.get("nsi_replacements"),
70380 _mainFileFetcher.get("nsi_trees")
70381 ]).then((vals) => {
70384 dissolved: vals[1].dissolved,
70385 replacements: vals[2].replacements,
70386 trees: vals[3].trees,
70387 kvt: /* @__PURE__ */ new Map(),
70388 qids: /* @__PURE__ */ new Map(),
70389 ids: /* @__PURE__ */ new Map()
70391 const matcher = _nsi.matcher = new Matcher();
70392 matcher.buildMatchIndex(_nsi.data);
70393 matcher.itemLocation = /* @__PURE__ */ new Map();
70394 matcher.locationSets = /* @__PURE__ */ new Map();
70395 Object.keys(_nsi.data).forEach((tkv) => {
70396 const items = _nsi.data[tkv].items;
70397 if (!Array.isArray(items) || !items.length)
70399 items.forEach((item) => {
70400 if (matcher.itemLocation.has(item.id))
70402 const locationSetID = _sharedLocationManager.locationSetID(item.locationSet);
70403 matcher.itemLocation.set(item.id, locationSetID);
70404 if (matcher.locationSets.has(locationSetID))
70406 const fakeFeature = { id: locationSetID, properties: { id: locationSetID, area: 1 } };
70407 matcher.locationSets.set(locationSetID, fakeFeature);
70410 matcher.locationIndex = (bbox2) => {
70411 const validHere = _sharedLocationManager.locationSetsAt([bbox2[0], bbox2[1]]);
70412 const results = [];
70413 for (const [locationSetID, area] of Object.entries(validHere)) {
70414 const fakeFeature = matcher.locationSets.get(locationSetID);
70416 fakeFeature.properties.area = area;
70417 results.push(fakeFeature);
70422 Object.keys(_nsi.data).forEach((tkv) => {
70423 const category = _nsi.data[tkv];
70424 const parts = tkv.split("/", 3);
70425 const t = parts[0];
70426 const k = parts[1];
70427 const v = parts[2];
70428 let vmap = _nsi.kvt.get(k);
70430 vmap = /* @__PURE__ */ new Map();
70431 _nsi.kvt.set(k, vmap);
70434 const tree = _nsi.trees[t];
70435 const mainTag = tree.mainTag;
70436 const items = category.items || [];
70437 items.forEach((item) => {
70439 item.mainTag = mainTag;
70440 _nsi.ids.set(item.id, item);
70441 const wd = item.tags[mainTag];
70442 const wp = item.tags[mainTag.replace("wikidata", "wikipedia")];
70444 _nsi.qids.set(wd, wd);
70446 _nsi.qids.set(wp, wd);
70451 function gatherKVs(tags) {
70452 let primary = /* @__PURE__ */ new Set();
70453 let alternate = /* @__PURE__ */ new Set();
70454 Object.keys(tags).forEach((osmkey) => {
70455 const osmvalue = tags[osmkey];
70458 if (osmkey === "route_master")
70460 const vmap = _nsi.kvt.get(osmkey);
70463 if (vmap.get(osmvalue)) {
70464 primary.add(`${osmkey}/${osmvalue}`);
70465 } else if (osmvalue === "yes") {
70466 alternate.add(`${osmkey}/${osmvalue}`);
70469 const preset = _mainPresetIndex.matchTags(tags, "area");
70470 if (buildingPreset[preset.id]) {
70471 alternate.add("building/yes");
70473 return { primary, alternate };
70475 function identifyTree(tags) {
70478 Object.keys(tags).forEach((osmkey) => {
70481 const osmvalue = tags[osmkey];
70484 if (osmkey === "route_master")
70486 const vmap = _nsi.kvt.get(osmkey);
70489 if (osmvalue === "yes") {
70490 unknown = "unknown";
70492 t = vmap.get(osmvalue);
70495 return t || unknown || null;
70497 function gatherNames(tags) {
70498 const empty2 = { primary: /* @__PURE__ */ new Set(), alternate: /* @__PURE__ */ new Set() };
70499 let primary = /* @__PURE__ */ new Set();
70500 let alternate = /* @__PURE__ */ new Set();
70501 let foundSemi = false;
70502 let testNameFragments = false;
70504 let t = identifyTree(tags);
70507 if (t === "transit") {
70509 primary: /^network$/i,
70510 alternate: /^(operator|operator:\w+|network:\w+|\w+_name|\w+_name:\w+)$/i
70512 } else if (t === "flags") {
70514 primary: /^(flag:name|flag:name:\w+)$/i,
70515 alternate: /^(flag|flag:\w+|subject|subject:\w+)$/i
70517 } else if (t === "brands") {
70518 testNameFragments = true;
70520 primary: /^(name|name:\w+)$/i,
70521 alternate: /^(brand|brand:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
70523 } else if (t === "operators") {
70524 testNameFragments = true;
70526 primary: /^(name|name:\w+|operator|operator:\w+)$/i,
70527 alternate: /^(brand|brand:\w+|\w+_name|\w+_name:\w+)/i
70530 testNameFragments = true;
70532 primary: /^(name|name:\w+)$/i,
70533 alternate: /^(brand|brand:\w+|network|network:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
70536 if (tags.name && testNameFragments) {
70537 const nameParts = tags.name.split(/[\s\-\/,.]/);
70538 for (let split = nameParts.length; split > 0; split--) {
70539 const name = nameParts.slice(0, split).join(" ");
70543 Object.keys(tags).forEach((osmkey) => {
70544 const osmvalue = tags[osmkey];
70547 if (isNamelike(osmkey, "primary")) {
70548 if (/;/.test(osmvalue)) {
70551 primary.add(osmvalue);
70552 alternate.delete(osmvalue);
70554 } else if (!primary.has(osmvalue) && isNamelike(osmkey, "alternate")) {
70555 if (/;/.test(osmvalue)) {
70558 alternate.add(osmvalue);
70562 if (tags.man_made === "flagpole" && !primary.size && !alternate.size && !!tags.country) {
70563 const osmvalue = tags.country;
70564 if (/;/.test(osmvalue)) {
70567 alternate.add(osmvalue);
70573 return { primary, alternate };
70575 function isNamelike(osmkey, which) {
70576 if (osmkey === "old_name")
70578 return patterns2[which].test(osmkey) && !notNames.test(osmkey);
70581 function gatherTuples(tryKVs, tryNames) {
70583 ["primary", "alternate"].forEach((whichName) => {
70584 const arr = Array.from(tryNames[whichName]).sort((a, b) => b.length - a.length);
70585 arr.forEach((n2) => {
70586 ["primary", "alternate"].forEach((whichKV) => {
70587 tryKVs[whichKV].forEach((kv) => {
70588 const parts = kv.split("/", 2);
70589 const k = parts[0];
70590 const v = parts[1];
70591 tuples.push({ k, v, n: n2 });
70598 function _upgradeTags(tags, loc) {
70599 let newTags = Object.assign({}, tags);
70600 let changed = false;
70601 Object.keys(newTags).forEach((osmkey) => {
70602 const matchTag = osmkey.match(/^(\w+:)?wikidata$/);
70604 const prefix = matchTag[1] || "";
70605 const wd = newTags[osmkey];
70606 const replace = _nsi.replacements[wd];
70607 if (replace && replace.wikidata !== void 0) {
70609 if (replace.wikidata) {
70610 newTags[osmkey] = replace.wikidata;
70612 delete newTags[osmkey];
70615 if (replace && replace.wikipedia !== void 0) {
70617 const wpkey = `${prefix}wikipedia`;
70618 if (replace.wikipedia) {
70619 newTags[wpkey] = replace.wikipedia;
70621 delete newTags[wpkey];
70626 const isRouteMaster = tags.type === "route_master";
70627 const tryKVs = gatherKVs(tags);
70628 if (!tryKVs.primary.size && !tryKVs.alternate.size) {
70629 return changed ? { newTags, matched: null } : null;
70631 const tryNames = gatherNames(tags);
70632 const foundQID = _nsi.qids.get(tags.wikidata) || _nsi.qids.get(tags.wikipedia);
70634 tryNames.primary.add(foundQID);
70635 if (!tryNames.primary.size && !tryNames.alternate.size) {
70636 return changed ? { newTags, matched: null } : null;
70638 const tuples = gatherTuples(tryKVs, tryNames);
70639 for (let i2 = 0; i2 < tuples.length; i2++) {
70640 const tuple = tuples[i2];
70641 const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n, loc);
70642 if (!hits || !hits.length)
70644 if (hits[0].match !== "primary" && hits[0].match !== "alternate")
70647 for (let j2 = 0; j2 < hits.length; j2++) {
70648 const hit = hits[j2];
70649 itemID = hit.itemID;
70650 if (_nsi.dissolved[itemID])
70652 item = _nsi.ids.get(itemID);
70655 const mainTag = item.mainTag;
70656 const itemQID = item.tags[mainTag];
70657 const notQID = newTags[`not:${mainTag}`];
70658 if (!itemQID || itemQID === notQID || newTags.office && !item.tags.office) {
70667 item = JSON.parse(JSON.stringify(item));
70668 const tkv = item.tkv;
70669 const parts = tkv.split("/", 3);
70670 const k = parts[1];
70671 const v = parts[2];
70672 const category = _nsi.data[tkv];
70673 const properties = category.properties || {};
70674 let preserveTags = item.preserveTags || properties.preserveTags || [];
70675 ["building", "emergency", "internet_access", "takeaway"].forEach((osmkey) => {
70677 preserveTags.push(`^${osmkey}$`);
70679 const regexes = preserveTags.map((s) => new RegExp(s, "i"));
70681 Object.keys(newTags).forEach((osmkey) => {
70682 if (regexes.some((regex) => regex.test(osmkey))) {
70683 keepTags[osmkey] = newTags[osmkey];
70686 _nsi.kvt.forEach((vmap, k2) => {
70687 if (newTags[k2] === "yes")
70688 delete newTags[k2];
70691 delete newTags.wikipedia;
70692 delete newTags.wikidata;
70694 Object.assign(newTags, item.tags, keepTags);
70695 if (isRouteMaster) {
70696 newTags.route_master = newTags.route;
70697 delete newTags.route;
70699 const origName = tags.name;
70700 const newName = newTags.name;
70701 if (newName && origName && newName !== origName && !newTags.branch) {
70702 const newNames = gatherNames(newTags);
70703 const newSet = /* @__PURE__ */ new Set([...newNames.primary, ...newNames.alternate]);
70704 const isMoved = newSet.has(origName);
70706 const nameParts = origName.split(/[\s\-\/,.]/);
70707 for (let split = nameParts.length; split > 0; split--) {
70708 const name = nameParts.slice(0, split).join(" ");
70709 const branch = nameParts.slice(split).join(" ");
70710 const nameHits = _nsi.matcher.match(k, v, name, loc);
70711 if (!nameHits || !nameHits.length)
70713 if (nameHits.some((hit) => hit.itemID === itemID)) {
70715 if (notBranches.test(branch)) {
70716 newTags.name = origName;
70718 const branchHits = _nsi.matcher.match(k, v, branch, loc);
70719 if (branchHits && branchHits.length) {
70720 if (branchHits[0].match === "primary" || branchHits[0].match === "alternate") {
70724 newTags.branch = branch;
70733 return { newTags, matched: item };
70735 return changed ? { newTags, matched: null } : null;
70737 function _isGenericName(tags) {
70738 const n2 = tags.name;
70741 const tryNames = { primary: /* @__PURE__ */ new Set([n2]), alternate: /* @__PURE__ */ new Set() };
70742 const tryKVs = gatherKVs(tags);
70743 if (!tryKVs.primary.size && !tryKVs.alternate.size)
70745 const tuples = gatherTuples(tryKVs, tryNames);
70746 for (let i2 = 0; i2 < tuples.length; i2++) {
70747 const tuple = tuples[i2];
70748 const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n);
70749 if (hits && hits.length && hits[0].match === "excludeGeneric")
70754 var nsi_default = {
70757 _mainPresetIndex.ensureLoaded().then(() => loadNsiPresets()).then(() => loadNsiData()).then(() => _nsiStatus = "ok").catch(() => _nsiStatus = "failed");
70761 status: () => _nsiStatus,
70762 isGenericName: (tags) => _isGenericName(tags),
70763 upgradeTags: (tags, loc) => _upgradeTags(tags, loc),
70767 // modules/services/kartaview.js
70768 var import_rbush8 = __toESM(require_rbush_min());
70769 var apibase2 = "https://kartaview.org";
70770 var maxResults = 1e3;
70772 var tiler4 = utilTiler().zoomExtent([tileZoom, tileZoom]).skipNullIsland(true);
70773 var dispatch6 = dispatch_default("loadedImages");
70774 var imgZoom = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
70776 var _oscSelectedImage;
70777 var _loadViewerPromise2;
70778 function abortRequest4(controller) {
70779 controller.abort();
70781 function maxPageAtZoom(z) {
70795 function loadTiles2(which, url, projection2) {
70796 var currZoom = Math.floor(geoScaleToZoom(projection2.scale()));
70797 var tiles = tiler4.getTiles(projection2);
70798 var cache = _oscCache[which];
70799 Object.keys(cache.inflight).forEach(function(k) {
70800 var wanted = tiles.find(function(tile) {
70801 return k.indexOf(tile.id + ",") === 0;
70804 abortRequest4(cache.inflight[k]);
70805 delete cache.inflight[k];
70808 tiles.forEach(function(tile) {
70809 loadNextTilePage(which, currZoom, url, tile);
70812 function loadNextTilePage(which, currZoom, url, tile) {
70813 var cache = _oscCache[which];
70814 var bbox2 = tile.extent.bbox();
70815 var maxPages = maxPageAtZoom(currZoom);
70816 var nextPage = cache.nextPage[tile.id] || 1;
70817 var params = utilQsString({
70820 bbTopLeft: [bbox2.maxY, bbox2.minX].join(","),
70821 bbBottomRight: [bbox2.minY, bbox2.maxX].join(",")
70823 if (nextPage > maxPages)
70825 var id2 = tile.id + "," + String(nextPage);
70826 if (cache.loaded[id2] || cache.inflight[id2])
70828 var controller = new AbortController();
70829 cache.inflight[id2] = controller;
70832 signal: controller.signal,
70834 headers: { "Content-Type": "application/x-www-form-urlencoded" }
70836 json_default(url, options2).then(function(data) {
70837 cache.loaded[id2] = true;
70838 delete cache.inflight[id2];
70839 if (!data || !data.currentPageItems || !data.currentPageItems.length) {
70840 throw new Error("No Data");
70842 var features2 = data.currentPageItems.map(function(item) {
70843 var loc = [+item.lng, +item.lat];
70845 if (which === "images") {
70850 captured_at: item.shot_date || item.date_added,
70851 captured_by: item.username,
70852 imagePath: item.lth_name,
70853 sequence_id: item.sequence_id,
70854 sequence_index: +item.sequence_index
70856 var seq = _oscCache.sequences[d.sequence_id];
70858 seq = { rotation: 0, images: [] };
70859 _oscCache.sequences[d.sequence_id] = seq;
70861 seq.images[d.sequence_index] = d;
70862 _oscCache.images.forImageKey[d.key] = d;
70872 cache.rtree.load(features2);
70873 if (data.currentPageItems.length === maxResults) {
70874 cache.nextPage[tile.id] = nextPage + 1;
70875 loadNextTilePage(which, currZoom, url, tile);
70877 cache.nextPage[tile.id] = Infinity;
70879 if (which === "images") {
70880 dispatch6.call("loadedImages");
70882 }).catch(function() {
70883 cache.loaded[id2] = true;
70884 delete cache.inflight[id2];
70887 function partitionViewport2(projection2) {
70888 var z = geoScaleToZoom(projection2.scale());
70889 var z2 = Math.ceil(z * 2) / 2 + 2.5;
70890 var tiler8 = utilTiler().zoomExtent([z2, z2]);
70891 return tiler8.getTiles(projection2).map(function(tile) {
70892 return tile.extent;
70895 function searchLimited2(limit, projection2, rtree) {
70896 limit = limit || 5;
70897 return partitionViewport2(projection2).reduce(function(result, extent) {
70898 var found = rtree.search(extent.bbox()).slice(0, limit).map(function(d) {
70901 return found.length ? result.concat(found) : result;
70904 var kartaview_default = {
70909 this.event = utilRebind(this, dispatch6, "on");
70911 reset: function() {
70913 Object.values(_oscCache.images.inflight).forEach(abortRequest4);
70916 images: { inflight: {}, loaded: {}, nextPage: {}, rtree: new import_rbush8.default(), forImageKey: {} },
70919 _oscSelectedImage = null;
70921 images: function(projection2) {
70923 return searchLimited2(limit, projection2, _oscCache.images.rtree);
70925 sequences: function(projection2) {
70926 var viewport = projection2.clipExtent();
70927 var min3 = [viewport[0][0], viewport[1][1]];
70928 var max3 = [viewport[1][0], viewport[0][1]];
70929 var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
70930 var sequenceKeys = {};
70931 _oscCache.images.rtree.search(bbox2).forEach(function(d) {
70932 sequenceKeys[d.data.sequence_id] = true;
70934 var lineStrings = [];
70935 Object.keys(sequenceKeys).forEach(function(sequenceKey) {
70936 var seq = _oscCache.sequences[sequenceKey];
70937 var images = seq && seq.images;
70940 type: "LineString",
70941 coordinates: images.map(function(d) {
70943 }).filter(Boolean),
70945 captured_at: images[0] ? images[0].captured_at : null,
70946 captured_by: images[0] ? images[0].captured_by : null,
70952 return lineStrings;
70954 cachedImage: function(imageKey) {
70955 return _oscCache.images.forImageKey[imageKey];
70957 loadImages: function(projection2) {
70958 var url = apibase2 + "/1.0/list/nearby-photos/";
70959 loadTiles2("images", url, projection2);
70961 ensureViewerLoaded: function(context) {
70962 if (_loadViewerPromise2)
70963 return _loadViewerPromise2;
70964 var wrap2 = context.container().select(".photoviewer").selectAll(".kartaview-wrapper").data([0]);
70966 var wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper kartaview-wrapper").classed("hide", true).call(imgZoom.on("zoom", zoomPan)).on("dblclick.zoom", null);
70967 wrapEnter.append("div").attr("class", "photo-attribution fillD");
70968 var controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
70969 controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
70970 controlsEnter.append("button").on("click.rotate-ccw", rotate(-90)).text("\u293F");
70971 controlsEnter.append("button").on("click.rotate-cw", rotate(90)).text("\u293E");
70972 controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
70973 wrapEnter.append("div").attr("class", "kartaview-image-wrap");
70974 context.ui().photoviewer.on("resize.kartaview", function(dimensions) {
70975 imgZoom = zoom_default2().extent([[0, 0], dimensions]).translateExtent([[0, 0], dimensions]).scaleExtent([1, 15]).on("zoom", zoomPan);
70977 function zoomPan(d3_event) {
70978 var t = d3_event.transform;
70979 context.container().select(".photoviewer .kartaview-image-wrap").call(utilSetTransform, t.x, t.y, t.k);
70981 function rotate(deg) {
70982 return function() {
70983 if (!_oscSelectedImage)
70985 var sequenceKey = _oscSelectedImage.sequence_id;
70986 var sequence = _oscCache.sequences[sequenceKey];
70989 var r = sequence.rotation || 0;
70995 sequence.rotation = r;
70996 var wrap3 = context.container().select(".photoviewer .kartaview-wrapper");
70997 wrap3.transition().duration(100).call(imgZoom.transform, identity2);
70998 wrap3.selectAll(".kartaview-image").transition().duration(100).style("transform", "rotate(" + r + "deg)");
71001 function step(stepBy) {
71002 return function() {
71003 if (!_oscSelectedImage)
71005 var sequenceKey = _oscSelectedImage.sequence_id;
71006 var sequence = _oscCache.sequences[sequenceKey];
71009 var nextIndex = _oscSelectedImage.sequence_index + stepBy;
71010 var nextImage = sequence.images[nextIndex];
71013 context.map().centerEase(nextImage.loc);
71014 that.selectImage(context, nextImage.key);
71017 _loadViewerPromise2 = Promise.resolve();
71018 return _loadViewerPromise2;
71020 showViewer: function(context) {
71021 var viewer = context.container().select(".photoviewer").classed("hide", false);
71022 var isHidden = viewer.selectAll(".photo-wrapper.kartaview-wrapper.hide").size();
71024 viewer.selectAll(".photo-wrapper:not(.kartaview-wrapper)").classed("hide", true);
71025 viewer.selectAll(".photo-wrapper.kartaview-wrapper").classed("hide", false);
71029 hideViewer: function(context) {
71030 _oscSelectedImage = null;
71031 this.updateUrlImage(null);
71032 var viewer = context.container().select(".photoviewer");
71033 if (!viewer.empty())
71034 viewer.datum(null);
71035 viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
71036 context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
71037 return this.setStyles(context, null, true);
71039 selectImage: function(context, imageKey) {
71040 var d = this.cachedImage(imageKey);
71041 _oscSelectedImage = d;
71042 this.updateUrlImage(imageKey);
71043 var viewer = context.container().select(".photoviewer");
71044 if (!viewer.empty())
71046 this.setStyles(context, null, true);
71047 context.container().selectAll(".icon-sign").classed("currentView", false);
71050 var wrap2 = context.container().select(".photoviewer .kartaview-wrapper");
71051 var imageWrap = wrap2.selectAll(".kartaview-image-wrap");
71052 var attribution = wrap2.selectAll(".photo-attribution").text("");
71053 wrap2.transition().duration(100).call(imgZoom.transform, identity2);
71054 imageWrap.selectAll(".kartaview-image").remove();
71056 var sequence = _oscCache.sequences[d.sequence_id];
71057 var r = sequence && sequence.rotation || 0;
71058 imageWrap.append("img").attr("class", "kartaview-image").attr("src", apibase2 + "/" + d.imagePath).style("transform", "rotate(" + r + "deg)");
71059 if (d.captured_by) {
71060 attribution.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://kartaview.org/user/" + encodeURIComponent(d.captured_by)).text("@" + d.captured_by);
71061 attribution.append("span").text("|");
71063 if (d.captured_at) {
71064 attribution.append("span").attr("class", "captured_at").text(localeDateString2(d.captured_at));
71065 attribution.append("span").text("|");
71067 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");
71070 function localeDateString2(s) {
71073 var options2 = { day: "numeric", month: "short", year: "numeric" };
71074 var d2 = new Date(s);
71075 if (isNaN(d2.getTime()))
71077 return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
71080 getSelectedImage: function() {
71081 return _oscSelectedImage;
71083 getSequenceKeyForImage: function(d) {
71084 return d && d.sequence_id;
71086 setStyles: function(context, hovered, reset) {
71088 context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
71089 context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
71091 var hoveredImageKey = hovered && hovered.key;
71092 var hoveredSequenceKey = this.getSequenceKeyForImage(hovered);
71093 var hoveredSequence = hoveredSequenceKey && _oscCache.sequences[hoveredSequenceKey];
71094 var hoveredImageKeys = hoveredSequence && hoveredSequence.images.map(function(d) {
71097 var viewer = context.container().select(".photoviewer");
71098 var selected = viewer.empty() ? void 0 : viewer.datum();
71099 var selectedImageKey = selected && selected.key;
71100 var selectedSequenceKey = this.getSequenceKeyForImage(selected);
71101 var selectedSequence = selectedSequenceKey && _oscCache.sequences[selectedSequenceKey];
71102 var selectedImageKeys = selectedSequence && selectedSequence.images.map(function(d) {
71105 var highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
71106 context.container().selectAll(".layer-kartaview .viewfield-group").classed("highlighted", function(d) {
71107 return highlightedImageKeys.indexOf(d.key) !== -1;
71108 }).classed("hovered", function(d) {
71109 return d.key === hoveredImageKey;
71110 }).classed("currentView", function(d) {
71111 return d.key === selectedImageKey;
71113 context.container().selectAll(".layer-kartaview .sequence").classed("highlighted", function(d) {
71114 return d.properties.key === hoveredSequenceKey;
71115 }).classed("currentView", function(d) {
71116 return d.properties.key === selectedSequenceKey;
71118 context.container().selectAll(".layer-kartaview .viewfield-group .viewfield").attr("d", viewfieldPath);
71119 function viewfieldPath() {
71120 var d = this.parentNode.__data__;
71121 if (d.pano && d.key !== selectedImageKey) {
71122 return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
71124 return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
71129 updateUrlImage: function(imageKey) {
71130 if (!window.mocha) {
71131 var hash = utilStringQs(window.location.hash);
71133 hash.photo = "kartaview/" + imageKey;
71137 window.location.replace("#" + utilQsString(hash, true));
71140 cache: function() {
71145 // node_modules/osm-auth/src/osm-auth.mjs
71146 var import_store = __toESM(require_store_legacy(), 1);
71147 function osmAuth(o) {
71149 oauth2.authenticated = function() {
71150 return !!token("oauth2_access_token");
71152 oauth2.logout = function() {
71153 token("oauth2_access_token", "");
71154 token("oauth_token", "");
71155 token("oauth_token_secret", "");
71156 token("oauth_request_token_secret", "");
71159 oauth2.authenticate = function(callback) {
71160 if (oauth2.authenticated()) {
71161 callback(null, oauth2);
71165 var url = o.url + "/oauth2/authorize?" + utilQsString2({
71166 client_id: o.client_id,
71167 redirect_uri: o.redirect_uri,
71168 response_type: "code",
71171 if (!o.singlepage) {
71177 ["left", screen.width / 2 - w / 2],
71178 ["top", screen.height / 2 - h / 2]
71179 ].map(function(x) {
71180 return x.join("=");
71182 var popup = window.open("about:blank", "oauth_window", settings);
71183 oauth2.popupWindow = popup;
71184 popup.location = url;
71186 var error = new Error("Popup was blocked");
71187 error.status = "popup-blocked";
71191 window.authComplete = function(url2) {
71192 var params = utilStringQs2(url2.split("?")[1]);
71193 getAccessToken(params.code);
71194 delete window.authComplete;
71196 function getAccessToken(auth_code) {
71197 var url2 = o.url + "/oauth2/token?" + utilQsString2({
71198 client_id: o.client_id,
71199 grant_type: "authorization_code",
71201 redirect_uri: o.redirect_uri,
71202 client_secret: o.client_secret
71204 oauth2.rawxhr("POST", url2, null, null, null, accessTokenDone);
71207 function accessTokenDone(err, xhr) {
71213 var access_token = JSON.parse(xhr.response);
71214 token("oauth2_access_token", access_token.access_token);
71215 callback(null, oauth2);
71218 oauth2.bringPopupWindowToFront = function() {
71219 var broughtPopupToFront = false;
71221 if (oauth2.popupWindow && !oauth2.popupWindow.closed) {
71222 oauth2.popupWindow.focus();
71223 broughtPopupToFront = true;
71227 return broughtPopupToFront;
71229 oauth2.bootstrapToken = function(auth_code, callback) {
71230 function getAccessToken(auth_code2) {
71231 var url = o.url + "/oauth2/token?" + utilQsString2({
71232 client_id: o.client_id,
71233 grant_type: "authorization_code",
71235 redirect_uri: o.redirect_uri,
71236 client_secret: o.client_secret
71238 oauth2.rawxhr("POST", url, null, null, null, accessTokenDone);
71241 function accessTokenDone(err, xhr) {
71247 var access_token = JSON.parse(xhr.response);
71248 token("oauth2_access_token", access_token.access_token);
71249 callback(null, oauth2);
71251 getAccessToken(auth_code);
71253 oauth2.xhr = function(options2, callback) {
71254 if (oauth2.authenticated()) {
71258 oauth2.authenticate(run);
71261 callback("not authenticated", null);
71266 var url = options2.prefix !== false ? o.url + options2.path : options2.path;
71267 return oauth2.rawxhr(
71270 token("oauth2_access_token"),
71276 function done(err, xhr) {
71279 } else if (xhr.responseXML) {
71280 callback(err, xhr.responseXML);
71282 callback(err, xhr.response);
71286 oauth2.rawxhr = function(method, url, access_token, data, headers, callback) {
71287 headers = headers || { "Content-Type": "application/x-www-form-urlencoded" };
71288 if (access_token) {
71289 headers.Authorization = "Bearer " + access_token;
71291 var xhr = new XMLHttpRequest();
71292 xhr.onreadystatechange = function() {
71293 if (4 === xhr.readyState && 0 !== xhr.status) {
71294 if (/^20\d$/.test(xhr.status)) {
71295 callback(null, xhr);
71297 callback(xhr, null);
71301 xhr.onerror = function(e) {
71304 xhr.open(method, url, true);
71305 for (var h in headers)
71306 xhr.setRequestHeader(h, headers[h]);
71310 oauth2.preauth = function(val) {
71311 if (val && val.access_token) {
71312 token("oauth2_access_token", val.access_token);
71316 oauth2.options = function(val) {
71317 if (!arguments.length)
71320 o.url = o.url || "https://www.openstreetmap.org";
71321 o.auto = o.auto || false;
71322 o.singlepage = o.singlepage || false;
71323 o.loading = o.loading || function() {
71325 o.done = o.done || function() {
71327 return oauth2.preauth(o);
71330 if (import_store.default.enabled) {
71331 token = function(x, y) {
71332 if (arguments.length === 1)
71333 return import_store.default.get(o.url + x);
71334 else if (arguments.length === 2)
71335 return import_store.default.set(o.url + x, y);
71339 token = function(x, y) {
71340 if (arguments.length === 1)
71341 return storage[o.url + x];
71342 else if (arguments.length === 2)
71343 return storage[o.url + x] = y;
71349 function utilQsString2(obj) {
71350 return Object.keys(obj).sort().map(function(key) {
71351 return encodeURIComponent(key) + "=" + encodeURIComponent(obj[key]);
71354 function utilStringQs2(str2) {
71356 while (i2 < str2.length && (str2[i2] === "?" || str2[i2] === "#"))
71358 str2 = str2.slice(i2);
71359 return str2.split("&").reduce(function(obj, pair2) {
71360 var parts = pair2.split("=");
71361 if (parts.length === 2) {
71362 obj[parts[0]] = decodeURIComponent(parts[1]);
71368 // modules/services/osm.js
71369 var import_rbush9 = __toESM(require_rbush_min());
71370 var tiler5 = utilTiler();
71371 var dispatch7 = dispatch_default("apiStatusChange", "authLoading", "authDone", "change", "loading", "loaded", "loadedNotes");
71372 var urlroot = osmApiConnections[0].url;
71373 var redirectPath = window.location.origin + window.location.pathname;
71374 var oauth = osmAuth({
71376 client_id: osmApiConnections[0].client_id,
71377 client_secret: osmApiConnections[0].client_secret,
71378 scope: "read_prefs write_prefs write_api read_gpx write_notes",
71379 redirect_uri: redirectPath + "land.html",
71380 loading: authLoading,
71383 var _apiConnections = osmApiConnections;
71384 var _imageryBlocklists = [/.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/];
71385 var _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new import_rbush9.default() };
71386 var _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new import_rbush9.default() };
71387 var _userCache = { toLoad: {}, user: {} };
71388 var _cachedApiStatus;
71389 var _changeset = {};
71390 var _deferred = /* @__PURE__ */ new Set();
71391 var _connectionID = 1;
71392 var _tileZoom4 = 16;
71393 var _noteZoom = 12;
71394 var _rateLimitError;
71395 var _userChangesets;
71398 var _maxWayNodes = 2e3;
71399 function authLoading() {
71400 dispatch7.call("authLoading");
71402 function authDone() {
71403 dispatch7.call("authDone");
71405 function abortRequest5(controllerOrXHR) {
71406 if (controllerOrXHR) {
71407 controllerOrXHR.abort();
71410 function hasInflightRequests(cache) {
71411 return Object.keys(cache.inflight).length;
71413 function abortUnwantedRequests4(cache, visibleTiles) {
71414 Object.keys(cache.inflight).forEach(function(k) {
71415 if (cache.toLoad[k])
71417 if (visibleTiles.find(function(tile) {
71418 return k === tile.id;
71421 abortRequest5(cache.inflight[k]);
71422 delete cache.inflight[k];
71425 function getLoc(attrs) {
71426 var lon = attrs.lon && attrs.lon.value;
71427 var lat = attrs.lat && attrs.lat.value;
71428 return [parseFloat(lon), parseFloat(lat)];
71430 function getNodes(obj) {
71431 var elems = obj.getElementsByTagName("nd");
71432 var nodes = new Array(elems.length);
71433 for (var i2 = 0, l = elems.length; i2 < l; i2++) {
71434 nodes[i2] = "n" + elems[i2].attributes.ref.value;
71438 function getNodesJSON(obj) {
71439 var elems = obj.nodes;
71440 var nodes = new Array(elems.length);
71441 for (var i2 = 0, l = elems.length; i2 < l; i2++) {
71442 nodes[i2] = "n" + elems[i2];
71446 function getTags(obj) {
71447 var elems = obj.getElementsByTagName("tag");
71449 for (var i2 = 0, l = elems.length; i2 < l; i2++) {
71450 var attrs = elems[i2].attributes;
71451 tags[attrs.k.value] = attrs.v.value;
71455 function getMembers(obj) {
71456 var elems = obj.getElementsByTagName("member");
71457 var members = new Array(elems.length);
71458 for (var i2 = 0, l = elems.length; i2 < l; i2++) {
71459 var attrs = elems[i2].attributes;
71461 id: attrs.type.value[0] + attrs.ref.value,
71462 type: attrs.type.value,
71463 role: attrs.role.value
71468 function getMembersJSON(obj) {
71469 var elems = obj.members;
71470 var members = new Array(elems.length);
71471 for (var i2 = 0, l = elems.length; i2 < l; i2++) {
71472 var attrs = elems[i2];
71474 id: attrs.type[0] + attrs.ref,
71481 function getVisible(attrs) {
71482 return !attrs.visible || attrs.visible.value !== "false";
71484 function parseComments(comments) {
71485 var parsedComments = [];
71486 for (var i2 = 0; i2 < comments.length; i2++) {
71487 var comment = comments[i2];
71488 if (comment.nodeName === "comment") {
71489 var childNodes = comment.childNodes;
71490 var parsedComment = {};
71491 for (var j2 = 0; j2 < childNodes.length; j2++) {
71492 var node = childNodes[j2];
71493 var nodeName = node.nodeName;
71494 if (nodeName === "#text")
71496 parsedComment[nodeName] = node.textContent;
71497 if (nodeName === "uid") {
71498 var uid = node.textContent;
71499 if (uid && !_userCache.user[uid]) {
71500 _userCache.toLoad[uid] = true;
71504 if (parsedComment) {
71505 parsedComments.push(parsedComment);
71509 return parsedComments;
71511 function encodeNoteRtree(note) {
71520 var jsonparsers = {
71521 node: function nodeData(obj, uid) {
71522 return new osmNode({
71524 visible: typeof obj.visible === "boolean" ? obj.visible : true,
71525 version: obj.version && obj.version.toString(),
71526 changeset: obj.changeset && obj.changeset.toString(),
71527 timestamp: obj.timestamp,
71529 uid: obj.uid && obj.uid.toString(),
71530 loc: [parseFloat(obj.lon), parseFloat(obj.lat)],
71534 way: function wayData(obj, uid) {
71535 return new osmWay({
71537 visible: typeof obj.visible === "boolean" ? obj.visible : true,
71538 version: obj.version && obj.version.toString(),
71539 changeset: obj.changeset && obj.changeset.toString(),
71540 timestamp: obj.timestamp,
71542 uid: obj.uid && obj.uid.toString(),
71544 nodes: getNodesJSON(obj)
71547 relation: function relationData(obj, uid) {
71548 return new osmRelation({
71550 visible: typeof obj.visible === "boolean" ? obj.visible : true,
71551 version: obj.version && obj.version.toString(),
71552 changeset: obj.changeset && obj.changeset.toString(),
71553 timestamp: obj.timestamp,
71555 uid: obj.uid && obj.uid.toString(),
71557 members: getMembersJSON(obj)
71560 user: function parseUser(obj, uid) {
71563 display_name: obj.display_name,
71564 account_created: obj.account_created,
71565 image_url: obj.img && obj.img.href,
71566 changesets_count: obj.changesets && obj.changesets.count && obj.changesets.count.toString() || "0",
71567 active_blocks: obj.blocks && obj.blocks.received && obj.blocks.received.active && obj.blocks.received.active.toString() || "0"
71571 function parseJSON(payload, callback, options2) {
71572 options2 = Object.assign({ skipSeen: true }, options2);
71574 return callback({ message: "No JSON", status: -1 });
71576 var json = payload;
71577 if (typeof json !== "object")
71578 json = JSON.parse(payload);
71579 if (!json.elements)
71580 return callback({ message: "No JSON", status: -1 });
71581 var children2 = json.elements;
71582 var handle = window.requestIdleCallback(function() {
71583 _deferred.delete(handle);
71586 for (var i2 = 0; i2 < children2.length; i2++) {
71587 result = parseChild(children2[i2]);
71589 results.push(result);
71591 callback(null, results);
71593 _deferred.add(handle);
71594 function parseChild(child) {
71595 var parser3 = jsonparsers[child.type];
71599 uid = osmEntity.id.fromOSM(child.type, child.id);
71600 if (options2.skipSeen) {
71601 if (_tileCache.seen[uid])
71603 _tileCache.seen[uid] = true;
71605 return parser3(child, uid);
71608 function parseUserJSON(payload, callback, options2) {
71609 options2 = Object.assign({ skipSeen: true }, options2);
71611 return callback({ message: "No JSON", status: -1 });
71613 var json = payload;
71614 if (typeof json !== "object")
71615 json = JSON.parse(payload);
71616 if (!json.users && !json.user)
71617 return callback({ message: "No JSON", status: -1 });
71618 var objs = json.users || [json];
71619 var handle = window.requestIdleCallback(function() {
71620 _deferred.delete(handle);
71623 for (var i2 = 0; i2 < objs.length; i2++) {
71624 result = parseObj(objs[i2]);
71626 results.push(result);
71628 callback(null, results);
71630 _deferred.add(handle);
71631 function parseObj(obj) {
71632 var uid = obj.user.id && obj.user.id.toString();
71633 if (options2.skipSeen && _userCache.user[uid]) {
71634 delete _userCache.toLoad[uid];
71637 var user = jsonparsers.user(obj.user, uid);
71638 _userCache.user[uid] = user;
71639 delete _userCache.toLoad[uid];
71644 node: function nodeData2(obj, uid) {
71645 var attrs = obj.attributes;
71646 return new osmNode({
71648 visible: getVisible(attrs),
71649 version: attrs.version.value,
71650 changeset: attrs.changeset && attrs.changeset.value,
71651 timestamp: attrs.timestamp && attrs.timestamp.value,
71652 user: attrs.user && attrs.user.value,
71653 uid: attrs.uid && attrs.uid.value,
71654 loc: getLoc(attrs),
71658 way: function wayData2(obj, uid) {
71659 var attrs = obj.attributes;
71660 return new osmWay({
71662 visible: getVisible(attrs),
71663 version: attrs.version.value,
71664 changeset: attrs.changeset && attrs.changeset.value,
71665 timestamp: attrs.timestamp && attrs.timestamp.value,
71666 user: attrs.user && attrs.user.value,
71667 uid: attrs.uid && attrs.uid.value,
71668 tags: getTags(obj),
71669 nodes: getNodes(obj)
71672 relation: function relationData2(obj, uid) {
71673 var attrs = obj.attributes;
71674 return new osmRelation({
71676 visible: getVisible(attrs),
71677 version: attrs.version.value,
71678 changeset: attrs.changeset && attrs.changeset.value,
71679 timestamp: attrs.timestamp && attrs.timestamp.value,
71680 user: attrs.user && attrs.user.value,
71681 uid: attrs.uid && attrs.uid.value,
71682 tags: getTags(obj),
71683 members: getMembers(obj)
71686 note: function parseNote(obj, uid) {
71687 var attrs = obj.attributes;
71688 var childNodes = obj.childNodes;
71691 props.loc = getLoc(attrs);
71692 var coincident = false;
71693 var epsilon3 = 1e-5;
71696 props.loc = geoVecAdd(props.loc, [epsilon3, epsilon3]);
71698 var bbox2 = geoExtent(props.loc).bbox();
71699 coincident = _noteCache.rtree.search(bbox2).length;
71700 } while (coincident);
71701 for (var i2 = 0; i2 < childNodes.length; i2++) {
71702 var node = childNodes[i2];
71703 var nodeName = node.nodeName;
71704 if (nodeName === "#text")
71706 if (nodeName === "comments") {
71707 props[nodeName] = parseComments(node.childNodes);
71709 props[nodeName] = node.textContent;
71712 var note = new osmNote(props);
71713 var item = encodeNoteRtree(note);
71714 _noteCache.note[note.id] = note;
71715 _noteCache.rtree.insert(item);
71718 user: function parseUser2(obj, uid) {
71719 var attrs = obj.attributes;
71722 display_name: attrs.display_name && attrs.display_name.value,
71723 account_created: attrs.account_created && attrs.account_created.value,
71724 changesets_count: "0",
71727 var img = obj.getElementsByTagName("img");
71728 if (img && img[0] && img[0].getAttribute("href")) {
71729 user.image_url = img[0].getAttribute("href");
71731 var changesets = obj.getElementsByTagName("changesets");
71732 if (changesets && changesets[0] && changesets[0].getAttribute("count")) {
71733 user.changesets_count = changesets[0].getAttribute("count");
71735 var blocks = obj.getElementsByTagName("blocks");
71736 if (blocks && blocks[0]) {
71737 var received = blocks[0].getElementsByTagName("received");
71738 if (received && received[0] && received[0].getAttribute("active")) {
71739 user.active_blocks = received[0].getAttribute("active");
71742 _userCache.user[uid] = user;
71743 delete _userCache.toLoad[uid];
71747 function parseXML(xml, callback, options2) {
71748 options2 = Object.assign({ skipSeen: true }, options2);
71749 if (!xml || !xml.childNodes) {
71750 return callback({ message: "No XML", status: -1 });
71752 var root3 = xml.childNodes[0];
71753 var children2 = root3.childNodes;
71754 var handle = window.requestIdleCallback(function() {
71755 _deferred.delete(handle);
71758 for (var i2 = 0; i2 < children2.length; i2++) {
71759 result = parseChild(children2[i2]);
71761 results.push(result);
71763 callback(null, results);
71765 _deferred.add(handle);
71766 function parseChild(child) {
71767 var parser3 = parsers[child.nodeName];
71771 if (child.nodeName === "user") {
71772 uid = child.attributes.id.value;
71773 if (options2.skipSeen && _userCache.user[uid]) {
71774 delete _userCache.toLoad[uid];
71777 } else if (child.nodeName === "note") {
71778 uid = child.getElementsByTagName("id")[0].textContent;
71780 uid = osmEntity.id.fromOSM(child.nodeName, child.attributes.id.value);
71781 if (options2.skipSeen) {
71782 if (_tileCache.seen[uid])
71784 _tileCache.seen[uid] = true;
71787 return parser3(child, uid);
71790 function updateRtree4(item, replace) {
71791 _noteCache.rtree.remove(item, function isEql(a, b) {
71792 return a.data.id === b.data.id;
71795 _noteCache.rtree.insert(item);
71798 function wrapcb(thisArg, callback, cid) {
71799 return function(err, result) {
71801 if (err.status === 400 || err.status === 401 || err.status === 403) {
71804 return callback.call(thisArg, err);
71805 } else if (thisArg.getConnectionId() !== cid) {
71806 return callback.call(thisArg, { message: "Connection Switched", status: -1 });
71808 return callback.call(thisArg, err, result);
71812 var osm_default = {
71814 utilRebind(this, dispatch7, "on");
71816 reset: function() {
71817 Array.from(_deferred).forEach(function(handle) {
71818 window.cancelIdleCallback(handle);
71819 _deferred.delete(handle);
71822 _userChangesets = void 0;
71823 _userDetails = void 0;
71824 _rateLimitError = void 0;
71825 Object.values(_tileCache.inflight).forEach(abortRequest5);
71826 Object.values(_noteCache.inflight).forEach(abortRequest5);
71827 Object.values(_noteCache.inflightPost).forEach(abortRequest5);
71828 if (_changeset.inflight)
71829 abortRequest5(_changeset.inflight);
71830 _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new import_rbush9.default() };
71831 _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new import_rbush9.default() };
71832 _userCache = { toLoad: {}, user: {} };
71833 _cachedApiStatus = void 0;
71837 getConnectionId: function() {
71838 return _connectionID;
71840 getUrlRoot: function() {
71843 changesetURL: function(changesetID) {
71844 return urlroot + "/changeset/" + changesetID;
71846 changesetsURL: function(center, zoom) {
71847 var precision2 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
71848 return urlroot + "/history#map=" + Math.floor(zoom) + "/" + center[1].toFixed(precision2) + "/" + center[0].toFixed(precision2);
71850 entityURL: function(entity) {
71851 return urlroot + "/" + entity.type + "/" + entity.osmId();
71853 historyURL: function(entity) {
71854 return urlroot + "/" + entity.type + "/" + entity.osmId() + "/history";
71856 userURL: function(username) {
71857 return urlroot + "/user/" + encodeURIComponent(username);
71859 noteURL: function(note) {
71860 return urlroot + "/note/" + note.id;
71862 noteReportURL: function(note) {
71863 return urlroot + "/reports/new?reportable_type=Note&reportable_id=" + note.id;
71865 loadFromAPI: function(path, callback, options2) {
71866 options2 = Object.assign({ skipSeen: true }, options2);
71868 var cid = _connectionID;
71869 function done(err, payload) {
71870 if (that.getConnectionId() !== cid) {
71872 callback({ message: "Connection Switched", status: -1 });
71875 var isAuthenticated = that.authenticated();
71876 if (isAuthenticated && err && err.status && (err.status === 400 || err.status === 401 || err.status === 403)) {
71878 that.loadFromAPI(path, callback, options2);
71880 if (!isAuthenticated && !_rateLimitError && err && err.status && (err.status === 509 || err.status === 429)) {
71881 _rateLimitError = err;
71882 dispatch7.call("change");
71883 that.reloadApiStatus();
71884 } else if (err && _cachedApiStatus === "online" || !err && _cachedApiStatus !== "online") {
71885 that.reloadApiStatus();
71889 return callback(err);
71891 if (path.indexOf(".json") !== -1) {
71892 return parseJSON(payload, callback, options2);
71894 return parseXML(payload, callback, options2);
71900 if (this.authenticated()) {
71901 return oauth.xhr({ method: "GET", path }, done);
71903 var url = urlroot + path;
71904 var controller = new AbortController();
71906 if (path.indexOf(".json") !== -1) {
71911 fn(url, { signal: controller.signal }).then(function(data) {
71913 }).catch(function(err) {
71914 if (err.name === "AbortError")
71916 var match = err.message.match(/^\d{3}/);
71918 done({ status: +match[0], statusText: err.message });
71926 loadEntity: function(id2, callback) {
71927 var type3 = osmEntity.id.type(id2);
71928 var osmID = osmEntity.id.toOSM(id2);
71929 var options2 = { skipSeen: false };
71931 "/api/0.6/" + type3 + "/" + osmID + (type3 !== "node" ? "/full" : "") + ".json",
71932 function(err, entities) {
71934 callback(err, { data: entities });
71939 loadEntityVersion: function(id2, version, callback) {
71940 var type3 = osmEntity.id.type(id2);
71941 var osmID = osmEntity.id.toOSM(id2);
71942 var options2 = { skipSeen: false };
71944 "/api/0.6/" + type3 + "/" + osmID + "/" + version + ".json",
71945 function(err, entities) {
71947 callback(err, { data: entities });
71952 loadEntityRelations: function(id2, callback) {
71953 var type3 = osmEntity.id.type(id2);
71954 var osmID = osmEntity.id.toOSM(id2);
71955 var options2 = { skipSeen: false };
71957 "/api/0.6/" + type3 + "/" + osmID + "/relations.json",
71958 function(err, entities) {
71960 callback(err, { data: entities });
71965 loadMultiple: function(ids, callback) {
71967 var groups = utilArrayGroupBy(utilArrayUniq(ids), osmEntity.id.type);
71968 Object.keys(groups).forEach(function(k) {
71969 var type3 = k + "s";
71970 var osmIDs = groups[k].map(function(id2) {
71971 return osmEntity.id.toOSM(id2);
71973 var options2 = { skipSeen: false };
71974 utilArrayChunk(osmIDs, 150).forEach(function(arr) {
71976 "/api/0.6/" + type3 + ".json?" + type3 + "=" + arr.join(),
71977 function(err, entities) {
71979 callback(err, { data: entities });
71986 putChangeset: function(changeset, changes, callback) {
71987 var cid = _connectionID;
71988 if (_changeset.inflight) {
71989 return callback({ message: "Changeset already inflight", status: -2 }, changeset);
71990 } else if (_changeset.open) {
71991 return createdChangeset.call(this, null, _changeset.open);
71995 path: "/api/0.6/changeset/create",
71996 headers: { "Content-Type": "text/xml" },
71997 content: JXON.stringify(changeset.asJXON())
71999 _changeset.inflight = oauth.xhr(
72001 wrapcb(this, createdChangeset, cid)
72004 function createdChangeset(err, changesetID) {
72005 _changeset.inflight = null;
72007 return callback(err, changeset);
72009 _changeset.open = changesetID;
72010 changeset = changeset.update({ id: changesetID });
72013 path: "/api/0.6/changeset/" + changesetID + "/upload",
72014 headers: { "Content-Type": "text/xml" },
72015 content: JXON.stringify(changeset.osmChangeJXON(changes))
72017 _changeset.inflight = oauth.xhr(
72019 wrapcb(this, uploadedChangeset, cid)
72022 function uploadedChangeset(err) {
72023 _changeset.inflight = null;
72025 return callback(err, changeset);
72026 window.setTimeout(function() {
72027 callback(null, changeset);
72029 _changeset.open = null;
72030 if (this.getConnectionId() === cid) {
72033 path: "/api/0.6/changeset/" + changeset.id + "/close",
72034 headers: { "Content-Type": "text/xml" }
72041 loadUsers: function(uids, callback) {
72044 utilArrayUniq(uids).forEach(function(uid) {
72045 if (_userCache.user[uid]) {
72046 delete _userCache.toLoad[uid];
72047 cached.push(_userCache.user[uid]);
72052 if (cached.length || !this.authenticated()) {
72053 callback(void 0, cached);
72054 if (!this.authenticated())
72057 utilArrayChunk(toLoad, 150).forEach(function(arr) {
72059 { method: "GET", path: "/api/0.6/users.json?users=" + arr.join() },
72060 wrapcb(this, done, _connectionID)
72063 function done(err, payload) {
72065 return callback(err);
72066 var options2 = { skipSeen: true };
72067 return parseUserJSON(payload, function(err2, results) {
72069 return callback(err2);
72070 return callback(void 0, results);
72074 loadUser: function(uid, callback) {
72075 if (_userCache.user[uid] || !this.authenticated()) {
72076 delete _userCache.toLoad[uid];
72077 return callback(void 0, _userCache.user[uid]);
72080 { method: "GET", path: "/api/0.6/user/" + uid + ".json" },
72081 wrapcb(this, done, _connectionID)
72083 function done(err, payload) {
72085 return callback(err);
72086 var options2 = { skipSeen: true };
72087 return parseUserJSON(payload, function(err2, results) {
72089 return callback(err2);
72090 return callback(void 0, results[0]);
72094 userDetails: function(callback) {
72095 if (_userDetails) {
72096 return callback(void 0, _userDetails);
72099 { method: "GET", path: "/api/0.6/user/details.json" },
72100 wrapcb(this, done, _connectionID)
72102 function done(err, payload) {
72104 return callback(err);
72105 var options2 = { skipSeen: false };
72106 return parseUserJSON(payload, function(err2, results) {
72108 return callback(err2);
72109 _userDetails = results[0];
72110 return callback(void 0, _userDetails);
72114 userChangesets: function(callback) {
72115 if (_userChangesets) {
72116 return callback(void 0, _userChangesets);
72119 wrapcb(this, gotDetails, _connectionID)
72121 function gotDetails(err, user) {
72123 return callback(err);
72126 { method: "GET", path: "/api/0.6/changesets?user=" + user.id },
72127 wrapcb(this, done, _connectionID)
72130 function done(err, xml) {
72132 return callback(err);
72134 _userChangesets = Array.prototype.map.call(
72135 xml.getElementsByTagName("changeset"),
72136 function(changeset) {
72137 return { tags: getTags(changeset) };
72139 ).filter(function(changeset) {
72140 var comment = changeset.tags.comment;
72141 return comment && comment !== "";
72143 return callback(void 0, _userChangesets);
72146 status: function(callback) {
72147 var url = urlroot + "/api/capabilities";
72148 var errback = wrapcb(this, done, _connectionID);
72149 xml_default(url).then(function(data) {
72150 errback(null, data);
72151 }).catch(function(err) {
72152 errback(err.message);
72154 function done(err, xml) {
72156 return callback(err, null);
72158 var elements = xml.getElementsByTagName("blacklist");
72160 for (var i2 = 0; i2 < elements.length; i2++) {
72161 var regexString = elements[i2].getAttribute("regex");
72164 var regex = new RegExp(regexString);
72165 regexes.push(regex);
72170 if (regexes.length) {
72171 _imageryBlocklists = regexes;
72173 if (_rateLimitError) {
72174 return callback(_rateLimitError, "rateLimited");
72176 var waynodes = xml.getElementsByTagName("waynodes");
72177 var maxWayNodes = waynodes.length && parseInt(waynodes[0].getAttribute("maximum"), 10);
72178 if (maxWayNodes && isFinite(maxWayNodes))
72179 _maxWayNodes = maxWayNodes;
72180 var apiStatus = xml.getElementsByTagName("status");
72181 var val = apiStatus[0].getAttribute("api");
72182 return callback(void 0, val);
72186 reloadApiStatus: function() {
72187 if (!this.throttledReloadApiStatus) {
72189 this.throttledReloadApiStatus = throttle_default(function() {
72190 that.status(function(err, status) {
72191 if (status !== _cachedApiStatus) {
72192 _cachedApiStatus = status;
72193 dispatch7.call("apiStatusChange", that, err, status);
72198 this.throttledReloadApiStatus();
72200 maxWayNodes: function() {
72201 return _maxWayNodes;
72203 loadTiles: function(projection2, callback) {
72206 var tiles = tiler5.zoomExtent([_tileZoom4, _tileZoom4]).getTiles(projection2);
72207 var hadRequests = hasInflightRequests(_tileCache);
72208 abortUnwantedRequests4(_tileCache, tiles);
72209 if (hadRequests && !hasInflightRequests(_tileCache)) {
72210 dispatch7.call("loaded");
72212 tiles.forEach(function(tile) {
72213 this.loadTile(tile, callback);
72216 loadTile: function(tile, callback) {
72219 if (_tileCache.loaded[tile.id] || _tileCache.inflight[tile.id])
72221 if (!hasInflightRequests(_tileCache)) {
72222 dispatch7.call("loading");
72224 var path = "/api/0.6/map.json?bbox=";
72225 var options2 = { skipSeen: true };
72226 _tileCache.inflight[tile.id] = this.loadFromAPI(
72227 path + tile.extent.toParam(),
72231 function tileCallback(err, parsed) {
72232 delete _tileCache.inflight[tile.id];
72234 delete _tileCache.toLoad[tile.id];
72235 _tileCache.loaded[tile.id] = true;
72236 var bbox2 = tile.extent.bbox();
72237 bbox2.id = tile.id;
72238 _tileCache.rtree.insert(bbox2);
72241 callback(err, Object.assign({ data: parsed }, tile));
72243 if (!hasInflightRequests(_tileCache)) {
72244 dispatch7.call("loaded");
72248 isDataLoaded: function(loc) {
72249 var bbox2 = { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] };
72250 return _tileCache.rtree.collides(bbox2);
72252 loadTileAtLoc: function(loc, callback) {
72253 if (Object.keys(_tileCache.toLoad).length > 50)
72255 var k = geoZoomToScale(_tileZoom4 + 1);
72256 var offset = geoRawMercator().scale(k)(loc);
72257 var projection2 = geoRawMercator().transform({ k, x: -offset[0], y: -offset[1] });
72258 var tiles = tiler5.zoomExtent([_tileZoom4, _tileZoom4]).getTiles(projection2);
72259 tiles.forEach(function(tile) {
72260 if (_tileCache.toLoad[tile.id] || _tileCache.loaded[tile.id] || _tileCache.inflight[tile.id])
72262 _tileCache.toLoad[tile.id] = true;
72263 this.loadTile(tile, callback);
72266 loadNotes: function(projection2, noteOptions) {
72267 noteOptions = Object.assign({ limit: 1e4, closed: 7 }, noteOptions);
72271 var path = "/api/0.6/notes?limit=" + noteOptions.limit + "&closed=" + noteOptions.closed + "&bbox=";
72272 var throttleLoadUsers = throttle_default(function() {
72273 var uids = Object.keys(_userCache.toLoad);
72276 that.loadUsers(uids, function() {
72279 var tiles = tiler5.zoomExtent([_noteZoom, _noteZoom]).getTiles(projection2);
72280 abortUnwantedRequests4(_noteCache, tiles);
72281 tiles.forEach(function(tile) {
72282 if (_noteCache.loaded[tile.id] || _noteCache.inflight[tile.id])
72284 var options2 = { skipSeen: false };
72285 _noteCache.inflight[tile.id] = that.loadFromAPI(
72286 path + tile.extent.toParam(),
72288 delete _noteCache.inflight[tile.id];
72290 _noteCache.loaded[tile.id] = true;
72292 throttleLoadUsers();
72293 dispatch7.call("loadedNotes");
72299 postNoteCreate: function(note, callback) {
72300 if (!this.authenticated()) {
72301 return callback({ message: "Not Authenticated", status: -3 }, note);
72303 if (_noteCache.inflightPost[note.id]) {
72304 return callback({ message: "Note update already inflight", status: -2 }, note);
72306 if (!note.loc[0] || !note.loc[1] || !note.newComment)
72308 var comment = note.newComment;
72309 if (note.newCategory && note.newCategory !== "None") {
72310 comment += " #" + note.newCategory;
72312 var path = "/api/0.6/notes?" + utilQsString({ lon: note.loc[0], lat: note.loc[1], text: comment });
72313 _noteCache.inflightPost[note.id] = oauth.xhr(
72314 { method: "POST", path },
72315 wrapcb(this, done, _connectionID)
72317 function done(err, xml) {
72318 delete _noteCache.inflightPost[note.id];
72320 return callback(err);
72322 this.removeNote(note);
72323 var options2 = { skipSeen: false };
72324 return parseXML(xml, function(err2, results) {
72326 return callback(err2);
72328 return callback(void 0, results[0]);
72333 postNoteUpdate: function(note, newStatus, callback) {
72334 if (!this.authenticated()) {
72335 return callback({ message: "Not Authenticated", status: -3 }, note);
72337 if (_noteCache.inflightPost[note.id]) {
72338 return callback({ message: "Note update already inflight", status: -2 }, note);
72341 if (note.status !== "closed" && newStatus === "closed") {
72343 } else if (note.status !== "open" && newStatus === "open") {
72346 action = "comment";
72347 if (!note.newComment)
72350 var path = "/api/0.6/notes/" + note.id + "/" + action;
72351 if (note.newComment) {
72352 path += "?" + utilQsString({ text: note.newComment });
72354 _noteCache.inflightPost[note.id] = oauth.xhr(
72355 { method: "POST", path },
72356 wrapcb(this, done, _connectionID)
72358 function done(err, xml) {
72359 delete _noteCache.inflightPost[note.id];
72361 return callback(err);
72363 this.removeNote(note);
72364 if (action === "close") {
72365 _noteCache.closed[note.id] = true;
72366 } else if (action === "reopen") {
72367 delete _noteCache.closed[note.id];
72369 var options2 = { skipSeen: false };
72370 return parseXML(xml, function(err2, results) {
72372 return callback(err2);
72374 return callback(void 0, results[0]);
72379 apiConnections: function(val) {
72380 if (!arguments.length)
72381 return _apiConnections;
72382 _apiConnections = val;
72385 switch: function(newOptions) {
72386 urlroot = newOptions.url;
72387 var oldOptions = utilObjectOmit(oauth.options(), "access_token");
72388 oauth.options(Object.assign(oldOptions, newOptions));
72390 this.userChangesets(function() {
72392 dispatch7.call("change");
72395 toggle: function(val) {
72399 isChangesetInflight: function() {
72400 return !!_changeset.inflight;
72402 caches: function(obj) {
72403 function cloneCache(source) {
72405 Object.keys(source).forEach(function(k) {
72406 if (k === "rtree") {
72407 target.rtree = new import_rbush9.default().fromJSON(source.rtree.toJSON());
72408 } else if (k === "note") {
72410 Object.keys(source.note).forEach(function(id2) {
72411 target.note[id2] = osmNote(source.note[id2]);
72414 target[k] = JSON.parse(JSON.stringify(source[k]));
72419 if (!arguments.length) {
72421 tile: cloneCache(_tileCache),
72422 note: cloneCache(_noteCache),
72423 user: cloneCache(_userCache)
72426 if (obj === "get") {
72434 _tileCache = obj.tile;
72435 _tileCache.inflight = {};
72438 _noteCache = obj.note;
72439 _noteCache.inflight = {};
72440 _noteCache.inflightPost = {};
72443 _userCache = obj.user;
72447 logout: function() {
72448 _userChangesets = void 0;
72449 _userDetails = void 0;
72451 dispatch7.call("change");
72454 authenticated: function() {
72455 return oauth.authenticated();
72457 authenticate: function(callback) {
72459 var cid = _connectionID;
72460 _userChangesets = void 0;
72461 _userDetails = void 0;
72462 function done(err, res) {
72468 if (that.getConnectionId() !== cid) {
72470 callback({ message: "Connection Switched", status: -1 });
72473 _rateLimitError = void 0;
72474 dispatch7.call("change");
72476 callback(err, res);
72477 that.userChangesets(function() {
72480 oauth.authenticate(done);
72482 imageryBlocklists: function() {
72483 return _imageryBlocklists;
72485 tileZoom: function(val) {
72486 if (!arguments.length)
72491 notes: function(projection2) {
72492 var viewport = projection2.clipExtent();
72493 var min3 = [viewport[0][0], viewport[1][1]];
72494 var max3 = [viewport[1][0], viewport[0][1]];
72495 var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
72496 return _noteCache.rtree.search(bbox2).map(function(d) {
72500 getNote: function(id2) {
72501 return _noteCache.note[id2];
72503 removeNote: function(note) {
72504 if (!(note instanceof osmNote) || !note.id)
72506 delete _noteCache.note[note.id];
72507 updateRtree4(encodeNoteRtree(note), false);
72509 replaceNote: function(note) {
72510 if (!(note instanceof osmNote) || !note.id)
72512 _noteCache.note[note.id] = note;
72513 updateRtree4(encodeNoteRtree(note), true);
72516 getClosedIDs: function() {
72517 return Object.keys(_noteCache.closed).sort();
72521 // modules/services/osm_wikibase.js
72522 var apibase3 = "https://wiki.openstreetmap.org/w/api.php";
72523 var _inflight2 = {};
72524 var _wikibaseCache = {};
72525 var _localeIDs = { en: false };
72526 var debouncedRequest = debounce_default(request, 500, { leading: false });
72527 function request(url, callback) {
72528 if (_inflight2[url])
72530 var controller = new AbortController();
72531 _inflight2[url] = controller;
72532 json_default(url, { signal: controller.signal }).then(function(result) {
72533 delete _inflight2[url];
72535 callback(null, result);
72536 }).catch(function(err) {
72537 delete _inflight2[url];
72538 if (err.name === "AbortError")
72541 callback(err.message);
72544 var osm_wikibase_default = {
72547 _wikibaseCache = {};
72550 reset: function() {
72551 Object.values(_inflight2).forEach(function(controller) {
72552 controller.abort();
72556 claimToValue: function(entity, property, langCode) {
72557 if (!entity.claims[property])
72559 var locale2 = _localeIDs[langCode];
72560 var preferredPick, localePick;
72561 entity.claims[property].forEach(function(stmt) {
72562 if (!preferredPick && stmt.rank === "preferred") {
72563 preferredPick = stmt;
72565 if (locale2 && stmt.qualifiers && stmt.qualifiers.P26 && stmt.qualifiers.P26[0].datavalue.value.id === locale2) {
72569 var result = localePick || preferredPick;
72571 var datavalue = result.mainsnak.datavalue;
72572 return datavalue.type === "wikibase-entityid" ? datavalue.value.id : datavalue.value;
72577 monolingualClaimToValueObj: function(entity, property) {
72578 if (!entity || !entity.claims[property])
72580 return entity.claims[property].reduce(function(acc, obj) {
72581 var value = obj.mainsnak.datavalue.value;
72582 acc[value.language] = value.text;
72586 toSitelink: function(key, value) {
72587 var result = value ? "Tag:" + key + "=" + value : "Key:" + key;
72588 return result.replace(/_/g, " ").trim();
72590 getEntity: function(params, callback) {
72591 var doRequest = params.debounce ? debouncedRequest : request;
72595 var rtypeSitelink = params.key === "type" && params.value ? ("Relation:" + params.value).replace(/_/g, " ").trim() : false;
72596 var keySitelink = params.key ? this.toSitelink(params.key) : false;
72597 var tagSitelink = params.key && params.value ? this.toSitelink(params.key, params.value) : false;
72598 var localeSitelink;
72599 if (params.langCodes) {
72600 params.langCodes.forEach(function(langCode) {
72601 if (_localeIDs[langCode] === void 0) {
72602 localeSitelink = ("Locale:" + langCode).replace(/_/g, " ").trim();
72603 titles.push(localeSitelink);
72607 if (rtypeSitelink) {
72608 if (_wikibaseCache[rtypeSitelink]) {
72609 result.rtype = _wikibaseCache[rtypeSitelink];
72611 titles.push(rtypeSitelink);
72615 if (_wikibaseCache[keySitelink]) {
72616 result.key = _wikibaseCache[keySitelink];
72618 titles.push(keySitelink);
72622 if (_wikibaseCache[tagSitelink]) {
72623 result.tag = _wikibaseCache[tagSitelink];
72625 titles.push(tagSitelink);
72628 if (!titles.length) {
72629 return callback(null, result);
72632 action: "wbgetentities",
72634 titles: titles.join("|"),
72635 languages: params.langCodes.join("|"),
72636 languagefallback: 1,
72640 var url = apibase3 + "?" + utilQsString(obj);
72641 doRequest(url, function(err, d) {
72644 } else if (!d.success || d.error) {
72645 callback(d.error.messages.map(function(v) {
72646 return v.html["*"];
72649 var localeID = false;
72650 Object.values(d.entities).forEach(function(res) {
72651 if (res.missing !== "") {
72652 var title = res.sitelinks.wiki.title;
72653 if (title === rtypeSitelink) {
72654 _wikibaseCache[rtypeSitelink] = res;
72655 result.rtype = res;
72656 } else if (title === keySitelink) {
72657 _wikibaseCache[keySitelink] = res;
72659 } else if (title === tagSitelink) {
72660 _wikibaseCache[tagSitelink] = res;
72662 } else if (title === localeSitelink) {
72665 console.log("Unexpected title " + title);
72669 if (localeSitelink) {
72670 that.addLocale(params.langCodes[0], localeID);
72672 callback(null, result);
72676 getDocs: function(params, callback) {
72678 var langCodes = _mainLocalizer.localeCodes().map(function(code) {
72679 return code.toLowerCase();
72681 params.langCodes = langCodes;
72682 this.getEntity(params, function(err, data) {
72687 var entity = data.rtype || data.tag || data.key;
72689 callback("No entity");
72694 for (i2 in langCodes) {
72695 let code2 = langCodes[i2];
72696 if (entity.descriptions[code2] && entity.descriptions[code2].language === code2) {
72697 description = entity.descriptions[code2];
72701 if (!description && Object.values(entity.descriptions).length)
72702 description = Object.values(entity.descriptions)[0];
72704 title: entity.title,
72705 description: description ? description.value : "",
72706 descriptionLocaleCode: description ? description.language : "",
72707 editURL: "https://wiki.openstreetmap.org/wiki/" + entity.title
72709 if (entity.claims) {
72711 var image = that.claimToValue(entity, "P4", langCodes[0]);
72713 imageroot = "https://commons.wikimedia.org/w/index.php";
72715 image = that.claimToValue(entity, "P28", langCodes[0]);
72717 imageroot = "https://wiki.openstreetmap.org/w/index.php";
72720 if (imageroot && image) {
72721 result.imageURL = imageroot + "?" + utilQsString({
72722 title: "Special:Redirect/file/" + image,
72727 var rtypeWiki = that.monolingualClaimToValueObj(data.rtype, "P31");
72728 var tagWiki = that.monolingualClaimToValueObj(data.tag, "P31");
72729 var keyWiki = that.monolingualClaimToValueObj(data.key, "P31");
72730 var wikis = [rtypeWiki, tagWiki, keyWiki];
72731 for (i2 in wikis) {
72732 var wiki = wikis[i2];
72733 for (var j2 in langCodes) {
72734 var code = langCodes[j2];
72735 var referenceId = langCodes[0].split("-")[0] !== "en" && code.split("-")[0] === "en" ? "inspector.wiki_en_reference" : "inspector.wiki_reference";
72736 var info = getWikiInfo(wiki, code, referenceId);
72738 result.wiki = info;
72745 callback(null, result);
72746 function getWikiInfo(wiki2, langCode, tKey) {
72747 if (wiki2 && wiki2[langCode]) {
72749 title: wiki2[langCode],
72751 url: "https://wiki.openstreetmap.org/wiki/" + wiki2[langCode]
72757 addLocale: function(langCode, qid) {
72758 _localeIDs[langCode] = qid;
72760 apibase: function(val) {
72761 if (!arguments.length)
72768 // modules/services/streetside.js
72769 var import_rbush10 = __toESM(require_rbush_min());
72771 // modules/util/jsonp_request.js
72772 var jsonpCache = {};
72773 window.jsonpCache = jsonpCache;
72774 function jsonpRequest(url, callback) {
72776 abort: function() {
72779 if (window.JSONP_FIX) {
72780 if (window.JSONP_DELAY === 0) {
72781 callback(window.JSONP_FIX);
72783 var t = window.setTimeout(function() {
72784 callback(window.JSONP_FIX);
72785 }, window.JSONP_DELAY || 0);
72786 request3.abort = function() {
72787 window.clearTimeout(t);
72793 var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
72797 c += chars.charAt(Math.floor(Math.random() * 52));
72800 function create2(url2) {
72801 var e = url2.match(/callback=(\w+)/);
72802 var c = e ? e[1] : rand();
72803 jsonpCache[c] = function(data) {
72804 if (jsonpCache[c]) {
72809 function finalize() {
72810 delete jsonpCache[c];
72813 request3.abort = finalize;
72814 return "jsonpCache." + c;
72816 var cb = create2(url);
72817 var script = select_default2("head").append("script").attr("type", "text/javascript").attr("src", url.replace(/(\{|%7B)callback(\}|%7D)/, cb));
72821 // modules/services/streetside.js
72822 var bubbleApi = "https://dev.virtualearth.net/mapcontrol/HumanScaleServices/GetBubbles.ashx?";
72823 var streetsideImagesApi = "https://t.ssl.ak.tiles.virtualearth.net/tiles/";
72824 var bubbleAppKey = "AuftgJsO0Xs8Ts4M1xZUQJQXJNsvmh3IV8DkNieCiy3tCwCUMq76-WpkrBtNAuEm";
72825 var pannellumViewerCSS = "pannellum-streetside/pannellum.css";
72826 var pannellumViewerJS = "pannellum-streetside/pannellum.js";
72827 var maxResults2 = 2e3;
72828 var tileZoom2 = 16.5;
72829 var tiler6 = utilTiler().zoomExtent([tileZoom2, tileZoom2]).skipNullIsland(true);
72830 var dispatch8 = dispatch_default("loadedImages", "viewerChanged");
72833 var defaultHfov = 45;
72834 var _hires = false;
72835 var _resolution = 512;
72836 var _currScene = 0;
72838 var _pannellumViewer;
72839 var _sceneOptions = {
72840 showFullscreenCtrl: false,
72850 var _loadViewerPromise3;
72851 function abortRequest6(i2) {
72854 function localeTimestamp(s) {
72857 const options2 = { day: "numeric", month: "short", year: "numeric" };
72858 const d = new Date(s);
72859 if (isNaN(d.getTime()))
72861 return d.toLocaleString(_mainLocalizer.localeCode(), options2);
72863 function loadTiles3(which, url, projection2, margin) {
72864 const tiles = tiler6.margin(margin).getTiles(projection2);
72865 const cache = _ssCache[which];
72866 Object.keys(cache.inflight).forEach((k) => {
72867 const wanted = tiles.find((tile) => k.indexOf(tile.id + ",") === 0);
72869 abortRequest6(cache.inflight[k]);
72870 delete cache.inflight[k];
72873 tiles.forEach((tile) => loadNextTilePage2(which, url, tile));
72875 function loadNextTilePage2(which, url, tile) {
72876 const cache = _ssCache[which];
72877 const nextPage = cache.nextPage[tile.id] || 0;
72878 const id2 = tile.id + "," + String(nextPage);
72879 if (cache.loaded[id2] || cache.inflight[id2])
72881 cache.inflight[id2] = getBubbles(url, tile, (bubbles) => {
72882 cache.loaded[id2] = true;
72883 delete cache.inflight[id2];
72887 const features2 = bubbles.map((bubble) => {
72888 if (cache.points[bubble.id])
72890 const loc = [bubble.lo, bubble.la];
72895 captured_at: bubble.cd,
72896 captured_by: "microsoft",
72902 cache.points[bubble.id] = d;
72903 if (bubble.pr === void 0) {
72904 cache.leaders.push(bubble.id);
72913 }).filter(Boolean);
72914 cache.rtree.load(features2);
72915 connectSequences();
72916 if (which === "bubbles") {
72917 dispatch8.call("loadedImages");
72921 function connectSequences() {
72922 let cache = _ssCache.bubbles;
72923 let keepLeaders = [];
72924 for (let i2 = 0; i2 < cache.leaders.length; i2++) {
72925 let bubble = cache.points[cache.leaders[i2]];
72927 let sequence = { key: bubble.key, bubbles: [] };
72928 let complete = false;
72930 sequence.bubbles.push(bubble);
72931 seen[bubble.key] = true;
72932 if (bubble.ne === void 0) {
72935 bubble = cache.points[bubble.ne];
72937 } while (bubble && !seen[bubble.key] && !complete);
72939 _ssCache.sequences[sequence.key] = sequence;
72940 for (let j2 = 0; j2 < sequence.bubbles.length; j2++) {
72941 sequence.bubbles[j2].sequenceKey = sequence.key;
72943 sequence.geojson = {
72944 type: "LineString",
72946 captured_at: sequence.bubbles[0] ? sequence.bubbles[0].captured_at : null,
72947 captured_by: sequence.bubbles[0] ? sequence.bubbles[0].captured_by : null,
72950 coordinates: sequence.bubbles.map((d) => d.loc)
72953 keepLeaders.push(cache.leaders[i2]);
72956 cache.leaders = keepLeaders;
72958 function getBubbles(url, tile, callback) {
72959 let rect = tile.extent.rectangle();
72960 let urlForRequest = url + utilQsString({
72966 appkey: bubbleAppKey,
72967 jsCallback: "{callback}"
72969 return jsonpRequest(urlForRequest, (data) => {
72970 if (!data || data.error) {
72977 function partitionViewport3(projection2) {
72978 let z = geoScaleToZoom(projection2.scale());
72979 let z2 = Math.ceil(z * 2) / 2 + 2.5;
72980 let tiler8 = utilTiler().zoomExtent([z2, z2]);
72981 return tiler8.getTiles(projection2).map((tile) => tile.extent);
72983 function searchLimited3(limit, projection2, rtree) {
72984 limit = limit || 5;
72985 return partitionViewport3(projection2).reduce((result, extent) => {
72986 let found = rtree.search(extent.bbox()).slice(0, limit).map((d) => d.data);
72987 return found.length ? result.concat(found) : result;
72990 function loadImage(imgInfo) {
72991 return new Promise((resolve) => {
72992 let img = new Image();
72993 img.onload = () => {
72994 let canvas = document.getElementById("ideditor-canvas" + imgInfo.face);
72995 let ctx = canvas.getContext("2d");
72996 ctx.drawImage(img, imgInfo.x, imgInfo.y);
72997 resolve({ imgInfo, status: "ok" });
72999 img.onerror = () => {
73000 resolve({ data: imgInfo, status: "error" });
73002 img.setAttribute("crossorigin", "");
73003 img.src = imgInfo.url;
73006 function loadCanvas(imageGroup) {
73007 return Promise.all(imageGroup.map(loadImage)).then((data) => {
73008 let canvas = document.getElementById("ideditor-canvas" + data[0].imgInfo.face);
73009 const which = { "01": 0, "02": 1, "03": 2, "10": 3, "11": 4, "12": 5 };
73010 let face = data[0].imgInfo.face;
73011 _sceneOptions.cubeMap[which[face]] = canvas.toDataURL("image/jpeg", 1);
73012 return { status: "loadCanvas for face " + data[0].imgInfo.face + "ok" };
73015 function loadFaces(faceGroup) {
73016 return Promise.all(faceGroup.map(loadCanvas)).then(() => {
73017 return { status: "loadFaces done" };
73020 function setupCanvas(selection2, reset) {
73022 selection2.selectAll("#ideditor-stitcher-canvases").remove();
73024 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);
73026 function qkToXY(qk) {
73030 for (let i2 = qk.length; i2 > 0; i2--) {
73031 const key = qk[i2 - 1];
73032 x += +(key === "1" || key === "3") * scale;
73033 y += +(key === "2" || key === "3") * scale;
73038 function getQuadKeys() {
73039 let dim = _resolution / 256;
73300 } else if (dim === 8) {
73367 } else if (dim === 4) {
73396 var streetside_default = {
73401 this.event = utilRebind(this, dispatch8, "on");
73403 reset: function() {
73405 Object.values(_ssCache.bubbles.inflight).forEach(abortRequest6);
73408 bubbles: { inflight: {}, loaded: {}, nextPage: {}, rtree: new import_rbush10.default(), points: {}, leaders: [] },
73412 bubbles: function(projection2) {
73414 return searchLimited3(limit, projection2, _ssCache.bubbles.rtree);
73416 cachedImage: function(imageKey) {
73417 return _ssCache.bubbles.points[imageKey];
73419 sequences: function(projection2) {
73420 const viewport = projection2.clipExtent();
73421 const min3 = [viewport[0][0], viewport[1][1]];
73422 const max3 = [viewport[1][0], viewport[0][1]];
73423 const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
73426 _ssCache.bubbles.rtree.search(bbox2).forEach((d) => {
73427 const key = d.data.sequenceKey;
73428 if (key && !seen[key]) {
73430 results.push(_ssCache.sequences[key].geojson);
73435 loadBubbles: function(projection2, margin) {
73436 if (margin === void 0)
73438 loadTiles3("bubbles", bubbleApi, projection2, margin);
73440 viewer: function() {
73441 return _pannellumViewer;
73443 initViewer: function() {
73444 if (!window.pannellum)
73446 if (_pannellumViewer)
73449 const sceneID = _currScene.toString();
73451 "default": { firstScene: sceneID },
73454 options2.scenes[sceneID] = _sceneOptions;
73455 _pannellumViewer = window.pannellum.viewer("ideditor-viewer-streetside", options2);
73457 ensureViewerLoaded: function(context) {
73458 if (_loadViewerPromise3)
73459 return _loadViewerPromise3;
73460 let wrap2 = context.container().select(".photoviewer").selectAll(".ms-wrapper").data([0]);
73461 let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper ms-wrapper").classed("hide", true);
73463 let pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
73464 wrapEnter.append("div").attr("id", "ideditor-viewer-streetside").on(pointerPrefix + "down.streetside", () => {
73465 select_default2(window).on(pointerPrefix + "move.streetside", () => {
73466 dispatch8.call("viewerChanged");
73468 }).on(pointerPrefix + "up.streetside pointercancel.streetside", () => {
73469 select_default2(window).on(pointerPrefix + "move.streetside", null);
73470 let t = timer((elapsed) => {
73471 dispatch8.call("viewerChanged");
73472 if (elapsed > 2e3) {
73476 }).append("div").attr("class", "photo-attribution fillD");
73477 let controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
73478 controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
73479 controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
73480 wrap2 = wrap2.merge(wrapEnter).call(setupCanvas, true);
73481 context.ui().photoviewer.on("resize.streetside", () => {
73482 if (_pannellumViewer) {
73483 _pannellumViewer.resize();
73486 _loadViewerPromise3 = new Promise((resolve, reject) => {
73487 let loadedCount = 0;
73488 function loaded() {
73490 if (loadedCount === 2)
73493 const head = select_default2("head");
73494 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() {
73497 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() {
73500 }).catch(function() {
73501 _loadViewerPromise3 = null;
73503 return _loadViewerPromise3;
73504 function step(stepBy) {
73506 let viewer = context.container().select(".photoviewer");
73507 let selected = viewer.empty() ? void 0 : viewer.datum();
73510 let nextID = stepBy === 1 ? selected.ne : selected.pr;
73511 let yaw = _pannellumViewer.getYaw();
73512 let ca = selected.ca + yaw;
73513 let origin = selected.loc;
73516 origin[0] + geoMetersToLon(meters / 5, origin[1]),
73520 origin[0] + geoMetersToLon(meters / 2, origin[1]),
73521 origin[1] + geoMetersToLat(meters)
73524 origin[0] - geoMetersToLon(meters / 2, origin[1]),
73525 origin[1] + geoMetersToLat(meters)
73528 origin[0] - geoMetersToLon(meters / 5, origin[1]),
73531 let poly = [p1, p2, p3, p4, p1];
73532 let angle2 = (stepBy === 1 ? ca : ca + 180) * (Math.PI / 180);
73533 poly = geoRotate(poly, -angle2, origin);
73534 let extent = poly.reduce((extent2, point2) => {
73535 return extent2.extend(geoExtent(point2));
73537 let minDist = Infinity;
73538 _ssCache.bubbles.rtree.search(extent.bbox()).forEach((d) => {
73539 if (d.data.key === selected.key)
73541 if (!geoPointInPolygon(d.data.loc, poly))
73543 let dist = geoVecLength(d.data.loc, selected.loc);
73544 let theta = selected.ca - d.data.ca;
73545 let minTheta = Math.min(Math.abs(theta), 360 - Math.abs(theta));
73546 if (minTheta > 20) {
73549 if (dist < minDist) {
73550 nextID = d.data.key;
73554 let nextBubble = nextID && that.cachedImage(nextID);
73557 context.map().centerEase(nextBubble.loc);
73558 that.selectImage(context, nextBubble.key).yaw(yaw).showViewer(context);
73562 yaw: function(yaw) {
73563 if (typeof yaw !== "number")
73565 _sceneOptions.yaw = yaw;
73568 showViewer: function(context) {
73569 let wrap2 = context.container().select(".photoviewer").classed("hide", false);
73570 let isHidden = wrap2.selectAll(".photo-wrapper.ms-wrapper.hide").size();
73572 wrap2.selectAll(".photo-wrapper:not(.ms-wrapper)").classed("hide", true);
73573 wrap2.selectAll(".photo-wrapper.ms-wrapper").classed("hide", false);
73577 hideViewer: function(context) {
73578 let viewer = context.container().select(".photoviewer");
73579 if (!viewer.empty())
73580 viewer.datum(null);
73581 viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
73582 context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
73583 this.updateUrlImage(null);
73584 return this.setStyles(context, null, true);
73586 selectImage: function(context, key) {
73588 let d = this.cachedImage(key);
73589 let viewer = context.container().select(".photoviewer");
73590 if (!viewer.empty())
73592 this.setStyles(context, null, true);
73593 let wrap2 = context.container().select(".photoviewer .ms-wrapper");
73594 let attribution = wrap2.selectAll(".photo-attribution").html("");
73595 wrap2.selectAll(".pnlm-load-box").style("display", "block");
73598 this.updateUrlImage(key);
73599 _sceneOptions.northOffset = d.ca;
73600 let line1 = attribution.append("div").attr("class", "attribution-row");
73601 const hiresDomId = utilUniqueDomId("streetside-hires");
73602 let label = line1.append("label").attr("for", hiresDomId).attr("class", "streetside-hires");
73603 label.append("input").attr("type", "checkbox").attr("id", hiresDomId).property("checked", _hires).on("click", (d3_event) => {
73604 d3_event.stopPropagation();
73606 _resolution = _hires ? 1024 : 512;
73607 wrap2.call(setupCanvas, true);
73609 yaw: _pannellumViewer.getYaw(),
73610 pitch: _pannellumViewer.getPitch(),
73611 hfov: _pannellumViewer.getHfov()
73613 _sceneOptions = Object.assign(_sceneOptions, viewstate);
73614 that.selectImage(context, d.key).showViewer(context);
73616 label.append("span").call(_t.append("streetside.hires"));
73617 let captureInfo = line1.append("div").attr("class", "attribution-capture-info");
73618 if (d.captured_by) {
73619 const yyyy = new Date().getFullYear();
73620 captureInfo.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://www.microsoft.com/en-us/maps/streetside").text("\xA9" + yyyy + " Microsoft");
73621 captureInfo.append("span").text("|");
73623 if (d.captured_at) {
73624 captureInfo.append("span").attr("class", "captured_at").text(localeTimestamp(d.captured_at));
73626 let line2 = attribution.append("div").attr("class", "attribution-row");
73627 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"));
73628 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"));
73629 let bubbleIdQuadKey = d.key.toString(4);
73630 const paddingNeeded = 16 - bubbleIdQuadKey.length;
73631 for (let i2 = 0; i2 < paddingNeeded; i2++) {
73632 bubbleIdQuadKey = "0" + bubbleIdQuadKey;
73634 const imgUrlPrefix = streetsideImagesApi + "hs" + bubbleIdQuadKey;
73635 const imgUrlSuffix = ".jpg?g=6338&n=z";
73636 const faceKeys = ["01", "02", "03", "10", "11", "12"];
73637 let quadKeys = getQuadKeys();
73638 let faces = faceKeys.map((faceKey) => {
73639 return quadKeys.map((quadKey) => {
73640 const xy = qkToXY(quadKey);
73643 url: imgUrlPrefix + faceKey + quadKey + imgUrlSuffix,
73649 loadFaces(faces).then(function() {
73650 if (!_pannellumViewer) {
73654 let sceneID = _currScene.toString();
73655 _pannellumViewer.addScene(sceneID, _sceneOptions).loadScene(sceneID);
73656 if (_currScene > 2) {
73657 sceneID = (_currScene - 1).toString();
73658 _pannellumViewer.removeScene(sceneID);
73664 getSequenceKeyForBubble: function(d) {
73665 return d && d.sequenceKey;
73667 setStyles: function(context, hovered, reset) {
73669 context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
73670 context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
73672 let hoveredBubbleKey = hovered && hovered.key;
73673 let hoveredSequenceKey = this.getSequenceKeyForBubble(hovered);
73674 let hoveredSequence = hoveredSequenceKey && _ssCache.sequences[hoveredSequenceKey];
73675 let hoveredBubbleKeys = hoveredSequence && hoveredSequence.bubbles.map((d) => d.key) || [];
73676 let viewer = context.container().select(".photoviewer");
73677 let selected = viewer.empty() ? void 0 : viewer.datum();
73678 let selectedBubbleKey = selected && selected.key;
73679 let selectedSequenceKey = this.getSequenceKeyForBubble(selected);
73680 let selectedSequence = selectedSequenceKey && _ssCache.sequences[selectedSequenceKey];
73681 let selectedBubbleKeys = selectedSequence && selectedSequence.bubbles.map((d) => d.key) || [];
73682 let highlightedBubbleKeys = utilArrayUnion(hoveredBubbleKeys, selectedBubbleKeys);
73683 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);
73684 context.container().selectAll(".layer-streetside-images .sequence").classed("highlighted", (d) => d.properties.key === hoveredSequenceKey).classed("currentView", (d) => d.properties.key === selectedSequenceKey);
73685 context.container().selectAll(".layer-streetside-images .viewfield-group .viewfield").attr("d", viewfieldPath);
73686 function viewfieldPath() {
73687 let d = this.parentNode.__data__;
73688 if (d.pano && d.key !== selectedBubbleKey) {
73689 return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
73691 return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
73696 updateUrlImage: function(imageKey) {
73697 if (!window.mocha) {
73698 var hash = utilStringQs(window.location.hash);
73700 hash.photo = "streetside/" + imageKey;
73704 window.location.replace("#" + utilQsString(hash, true));
73707 cache: function() {
73712 // modules/services/taginfo.js
73713 var apibase4 = taginfoApiUrl;
73714 var _inflight3 = {};
73715 var _popularKeys = {};
73716 var _taginfoCache = {};
73718 point: "count_nodes",
73719 vertex: "count_nodes",
73720 area: "count_ways",
73723 var tag_sort_members = {
73724 point: "count_node_members",
73725 vertex: "count_node_members",
73726 area: "count_way_members",
73727 line: "count_way_members",
73728 relation: "count_relation_members"
73730 var tag_filters = {
73736 var tag_members_fractions = {
73737 point: "count_node_members_fraction",
73738 vertex: "count_node_members_fraction",
73739 area: "count_way_members_fraction",
73740 line: "count_way_members_fraction",
73741 relation: "count_relation_members_fraction"
73743 function sets(params, n2, o) {
73744 if (params.geometry && o[params.geometry]) {
73745 params[n2] = o[params.geometry];
73749 function setFilter(params) {
73750 return sets(params, "filter", tag_filters);
73752 function setSort(params) {
73753 return sets(params, "sortname", tag_sorts);
73755 function setSortMembers(params) {
73756 return sets(params, "sortname", tag_sort_members);
73758 function clean(params) {
73759 return utilObjectOmit(params, ["geometry", "debounce"]);
73761 function filterKeys(type3) {
73762 var count_type = type3 ? "count_" + type3 : "count_all";
73763 return function(d) {
73764 return parseFloat(d[count_type]) > 2500 || d.in_wiki;
73767 function filterMultikeys(prefix) {
73768 return function(d) {
73769 var re2 = new RegExp("^" + prefix + "(.*)$", "i");
73770 var matches = d.key.match(re2) || [];
73771 return matches.length === 2 && matches[1].indexOf(":") === -1;
73774 function filterValues(allowUpperCase) {
73775 return function(d) {
73776 if (d.value.match(/[;,]/) !== null)
73778 if (!allowUpperCase && d.value.match(/[A-Z*]/) !== null)
73780 return d.count > 100 || d.in_wiki;
73783 function filterRoles(geometry) {
73784 return function(d) {
73787 if (d.role.match(/[A-Z*;,]/) !== null)
73789 return parseFloat(d[tag_members_fractions[geometry]]) > 0;
73792 function valKey(d) {
73798 function valKeyDescription(d) {
73801 title: d.description || d.value
73805 function roleKey(d) {
73811 function sortKeys(a, b) {
73812 return a.key.indexOf(":") === -1 && b.key.indexOf(":") !== -1 ? -1 : a.key.indexOf(":") !== -1 && b.key.indexOf(":") === -1 ? 1 : 0;
73814 var debouncedRequest2 = debounce_default(request2, 300, { leading: false });
73815 function request2(url, params, exactMatch, callback, loaded) {
73816 if (_inflight3[url])
73818 if (checkCache(url, params, exactMatch, callback))
73820 var controller = new AbortController();
73821 _inflight3[url] = controller;
73822 json_default(url, { signal: controller.signal }).then(function(result) {
73823 delete _inflight3[url];
73825 loaded(null, result);
73826 }).catch(function(err) {
73827 delete _inflight3[url];
73828 if (err.name === "AbortError")
73831 loaded(err.message);
73834 function checkCache(url, params, exactMatch, callback) {
73835 var rp = params.rp || 25;
73836 var testQuery = params.query || "";
73839 var hit = _taginfoCache[testUrl];
73840 if (hit && (url === testUrl || hit.length < rp)) {
73841 callback(null, hit);
73844 if (exactMatch || !testQuery.length)
73846 testQuery = testQuery.slice(0, -1);
73847 testUrl = url.replace(/&query=(.*?)&/, "&query=" + testQuery + "&");
73848 } while (testQuery.length >= 0);
73851 var taginfo_default = {
73854 _taginfoCache = {};
73861 sorting_name: true,
73866 "bridge:name": true
73870 sortname: "values_all",
73874 lang: _mainLocalizer.languageCode()
73876 this.keys(params, function(err, data) {
73879 data.forEach(function(d) {
73880 if (d.value === "opening_hours")
73882 _popularKeys[d.value] = true;
73886 reset: function() {
73887 Object.values(_inflight3).forEach(function(controller) {
73888 controller.abort();
73892 keys: function(params, callback) {
73893 var doRequest = params.debounce ? debouncedRequest2 : request2;
73894 params = clean(setSort(params));
73895 params = Object.assign({
73897 sortname: "count_all",
73900 lang: _mainLocalizer.languageCode()
73902 var url = apibase4 + "keys/all?" + utilQsString(params);
73903 doRequest(url, params, false, callback, function(err, d) {
73907 var f2 = filterKeys(params.filter);
73908 var result = d.data.filter(f2).sort(sortKeys).map(valKey);
73909 _taginfoCache[url] = result;
73910 callback(null, result);
73914 multikeys: function(params, callback) {
73915 var doRequest = params.debounce ? debouncedRequest2 : request2;
73916 params = clean(setSort(params));
73917 params = Object.assign({
73919 sortname: "count_all",
73922 lang: _mainLocalizer.languageCode()
73924 var prefix = params.query;
73925 var url = apibase4 + "keys/all?" + utilQsString(params);
73926 doRequest(url, params, true, callback, function(err, d) {
73930 var f2 = filterMultikeys(prefix);
73931 var result = d.data.filter(f2).map(valKey);
73932 _taginfoCache[url] = result;
73933 callback(null, result);
73937 values: function(params, callback) {
73938 var key = params.key;
73939 if (key && _popularKeys[key]) {
73940 callback(null, []);
73943 var doRequest = params.debounce ? debouncedRequest2 : request2;
73944 params = clean(setSort(setFilter(params)));
73945 params = Object.assign({
73947 sortname: "count_all",
73950 lang: _mainLocalizer.languageCode()
73952 var url = apibase4 + "key/values?" + utilQsString(params);
73953 doRequest(url, params, false, callback, function(err, d) {
73957 var re2 = /network|taxon|genus|species|brand|grape_variety|royal_cypher|listed_status|booth|rating|stars|:output|_hours|_times|_ref|manufacturer|country|target|brewery|cai_scale/;
73958 var allowUpperCase = re2.test(params.key);
73959 var f2 = filterValues(allowUpperCase);
73960 var result = d.data.filter(f2).map(valKeyDescription);
73961 _taginfoCache[url] = result;
73962 callback(null, result);
73966 roles: function(params, callback) {
73967 var doRequest = params.debounce ? debouncedRequest2 : request2;
73968 var geometry = params.geometry;
73969 params = clean(setSortMembers(params));
73970 params = Object.assign({
73972 sortname: "count_all_members",
73975 lang: _mainLocalizer.languageCode()
73977 var url = apibase4 + "relation/roles?" + utilQsString(params);
73978 doRequest(url, params, true, callback, function(err, d) {
73982 var f2 = filterRoles(geometry);
73983 var result = d.data.filter(f2).map(roleKey);
73984 _taginfoCache[url] = result;
73985 callback(null, result);
73989 docs: function(params, callback) {
73990 var doRequest = params.debounce ? debouncedRequest2 : request2;
73991 params = clean(setSort(params));
73992 var path = "key/wiki_pages?";
73993 if (params.value) {
73994 path = "tag/wiki_pages?";
73995 } else if (params.rtype) {
73996 path = "relation/wiki_pages?";
73998 var url = apibase4 + path + utilQsString(params);
73999 doRequest(url, params, true, callback, function(err, d) {
74003 _taginfoCache[url] = d.data;
74004 callback(null, d.data);
74008 apibase: function(_) {
74009 if (!arguments.length)
74016 // modules/services/vector_tile.js
74017 var import_fast_deep_equal11 = __toESM(require_fast_deep_equal());
74018 var import_fast_json_stable_stringify2 = __toESM(require_fast_json_stable_stringify());
74019 var import_polygon_clipping2 = __toESM(require_polygon_clipping_umd());
74020 var import_pbf2 = __toESM(require_pbf());
74021 var import_vector_tile2 = __toESM(require_vector_tile());
74022 var tiler7 = utilTiler().tileSize(512).margin(1);
74023 var dispatch9 = dispatch_default("loadedData");
74025 function abortRequest7(controller) {
74026 controller.abort();
74028 function vtToGeoJSON(data, tile, mergeCache) {
74029 var vectorTile = new import_vector_tile2.default.VectorTile(new import_pbf2.default(data));
74030 var layers = Object.keys(vectorTile.layers);
74031 if (!Array.isArray(layers)) {
74034 var features2 = [];
74035 layers.forEach(function(layerID) {
74036 var layer = vectorTile.layers[layerID];
74038 for (var i2 = 0; i2 < layer.length; i2++) {
74039 var feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
74040 var geometry = feature3.geometry;
74041 if (geometry.type === "Polygon") {
74042 geometry.type = "MultiPolygon";
74043 geometry.coordinates = [geometry.coordinates];
74045 var isClipped = false;
74046 if (geometry.type === "MultiPolygon") {
74047 var featureClip = bboxClip(feature3, tile.extent.rectangle());
74048 if (!(0, import_fast_deep_equal11.default)(feature3.geometry, featureClip.geometry)) {
74051 if (!feature3.geometry.coordinates.length)
74053 if (!feature3.geometry.coordinates[0].length)
74056 var featurehash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3));
74057 var propertyhash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3.properties || {}));
74058 feature3.__layerID__ = layerID.replace(/[^_a-zA-Z0-9\-]/g, "_");
74059 feature3.__featurehash__ = featurehash;
74060 feature3.__propertyhash__ = propertyhash;
74061 features2.push(feature3);
74062 if (isClipped && geometry.type === "MultiPolygon") {
74063 var merged = mergeCache[propertyhash];
74064 if (merged && merged.length) {
74065 var other = merged[0];
74066 var coords = import_polygon_clipping2.default.union(
74067 feature3.geometry.coordinates,
74068 other.geometry.coordinates
74070 if (!coords || !coords.length) {
74073 merged.push(feature3);
74074 for (var j2 = 0; j2 < merged.length; j2++) {
74075 merged[j2].geometry.coordinates = coords;
74076 merged[j2].__featurehash__ = featurehash;
74079 mergeCache[propertyhash] = [feature3];
74087 function loadTile2(source, tile) {
74088 if (source.loaded[tile.id] || source.inflight[tile.id])
74090 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) {
74091 var subdomains = r.split(",");
74092 return subdomains[(tile.xyz[0] + tile.xyz[1]) % subdomains.length];
74094 var controller = new AbortController();
74095 source.inflight[tile.id] = controller;
74096 fetch(url, { signal: controller.signal }).then(function(response) {
74097 if (!response.ok) {
74098 throw new Error(response.status + " " + response.statusText);
74100 source.loaded[tile.id] = [];
74101 delete source.inflight[tile.id];
74102 return response.arrayBuffer();
74103 }).then(function(data) {
74105 throw new Error("No Data");
74107 var z = tile.xyz[2];
74108 if (!source.canMerge[z]) {
74109 source.canMerge[z] = {};
74111 source.loaded[tile.id] = vtToGeoJSON(data, tile, source.canMerge[z]);
74112 dispatch9.call("loadedData");
74113 }).catch(function() {
74114 source.loaded[tile.id] = [];
74115 delete source.inflight[tile.id];
74118 var vector_tile_default = {
74123 this.event = utilRebind(this, dispatch9, "on");
74125 reset: function() {
74126 for (var sourceID in _vtCache) {
74127 var source = _vtCache[sourceID];
74128 if (source && source.inflight) {
74129 Object.values(source.inflight).forEach(abortRequest7);
74134 addSource: function(sourceID, template) {
74135 _vtCache[sourceID] = { template, inflight: {}, loaded: {}, canMerge: {} };
74136 return _vtCache[sourceID];
74138 data: function(sourceID, projection2) {
74139 var source = _vtCache[sourceID];
74142 var tiles = tiler7.getTiles(projection2);
74145 for (var i2 = 0; i2 < tiles.length; i2++) {
74146 var features2 = source.loaded[tiles[i2].id];
74147 if (!features2 || !features2.length)
74149 for (var j2 = 0; j2 < features2.length; j2++) {
74150 var feature3 = features2[j2];
74151 var hash = feature3.__featurehash__;
74155 results.push(Object.assign({}, feature3));
74160 loadTiles: function(sourceID, template, projection2) {
74161 var source = _vtCache[sourceID];
74163 source = this.addSource(sourceID, template);
74165 var tiles = tiler7.getTiles(projection2);
74166 Object.keys(source.inflight).forEach(function(k) {
74167 var wanted = tiles.find(function(tile) {
74168 return k === tile.id;
74171 abortRequest7(source.inflight[k]);
74172 delete source.inflight[k];
74175 tiles.forEach(function(tile) {
74176 loadTile2(source, tile);
74179 cache: function() {
74184 // modules/services/wikidata.js
74185 var apibase5 = "https://www.wikidata.org/w/api.php?";
74186 var _wikidataCache = {};
74187 var wikidata_default = {
74190 reset: function() {
74191 _wikidataCache = {};
74193 itemsForSearchQuery: function(query, callback) {
74196 callback("No query", {});
74199 var lang = this.languagesToQuery()[0];
74200 var url = apibase5 + utilQsString({
74201 action: "wbsearchentities",
74211 json_default(url).then(function(result) {
74212 if (result && result.error) {
74213 throw new Error(result.error);
74216 callback(null, result.search || {});
74217 }).catch(function(err) {
74219 callback(err.message, {});
74222 itemsByTitle: function(lang, title, callback) {
74225 callback("No title", {});
74228 lang = lang || "en";
74229 var url = apibase5 + utilQsString({
74230 action: "wbgetentities",
74233 sites: lang.replace(/-/g, "_") + "wiki",
74238 json_default(url).then(function(result) {
74239 if (result && result.error) {
74240 throw new Error(result.error);
74243 callback(null, result.entities || {});
74244 }).catch(function(err) {
74246 callback(err.message, {});
74249 languagesToQuery: function() {
74250 return _mainLocalizer.localeCodes().map(function(code) {
74251 return code.toLowerCase();
74252 }).filter(function(code) {
74253 return code !== "en-us";
74256 entityByQID: function(qid, callback) {
74258 callback("No qid", {});
74261 if (_wikidataCache[qid]) {
74263 callback(null, _wikidataCache[qid]);
74266 var langs = this.languagesToQuery();
74267 var url = apibase5 + utilQsString({
74268 action: "wbgetentities",
74272 props: "labels|descriptions|claims|sitelinks",
74273 sitefilter: langs.map(function(d) {
74276 languages: langs.join("|"),
74277 languagefallback: 1,
74280 json_default(url).then(function(result) {
74281 if (result && result.error) {
74282 throw new Error(result.error);
74285 callback(null, result.entities[qid] || {});
74286 }).catch(function(err) {
74288 callback(err.message, {});
74291 getDocs: function(params, callback) {
74292 var langs = this.languagesToQuery();
74293 this.entityByQID(params.qid, function(err, entity) {
74294 if (err || !entity) {
74295 callback(err || "No entity");
74300 for (i2 in langs) {
74301 let code = langs[i2];
74302 if (entity.descriptions[code] && entity.descriptions[code].language === code) {
74303 description = entity.descriptions[code];
74307 if (!description && Object.values(entity.descriptions).length)
74308 description = Object.values(entity.descriptions)[0];
74311 description: description ? description.value : "",
74312 descriptionLocaleCode: description ? description.language : "",
74313 editURL: "https://www.wikidata.org/wiki/" + entity.id
74315 if (entity.claims) {
74316 var imageroot = "https://commons.wikimedia.org/w/index.php";
74317 var props = ["P154", "P18"];
74319 for (i2 = 0; i2 < props.length; i2++) {
74320 prop = entity.claims[props[i2]];
74321 if (prop && Object.keys(prop).length > 0) {
74322 image = prop[Object.keys(prop)[0]].mainsnak.datavalue.value;
74324 result.imageURL = imageroot + "?" + utilQsString({
74325 title: "Special:Redirect/file/" + image,
74333 if (entity.sitelinks) {
74334 var englishLocale = _mainLocalizer.languageCode().toLowerCase() === "en";
74335 for (i2 = 0; i2 < langs.length; i2++) {
74336 var w = langs[i2] + "wiki";
74337 if (entity.sitelinks[w]) {
74338 var title = entity.sitelinks[w].title;
74339 var tKey = "inspector.wiki_reference";
74340 if (!englishLocale && langs[i2] === "en") {
74341 tKey = "inspector.wiki_en_reference";
74346 url: "https://" + langs[i2] + ".wikipedia.org/wiki/" + title.replace(/ /g, "_")
74352 callback(null, result);
74357 // modules/services/wikipedia.js
74358 var endpoint = "https://en.wikipedia.org/w/api.php?";
74359 var wikipedia_default = {
74362 reset: function() {
74364 search: function(lang, query, callback) {
74367 callback("No Query", []);
74370 lang = lang || "en";
74371 var url = endpoint.replace("en", lang) + utilQsString({
74375 srinfo: "suggestion",
74380 json_default(url).then(function(result) {
74381 if (result && result.error) {
74382 throw new Error(result.error);
74383 } else if (!result || !result.query || !result.query.search) {
74384 throw new Error("No Results");
74387 var titles = result.query.search.map(function(d) {
74390 callback(null, titles);
74392 }).catch(function(err) {
74397 suggestions: function(lang, query, callback) {
74403 lang = lang || "en";
74404 var url = endpoint.replace("en", lang) + utilQsString({
74405 action: "opensearch",
74412 json_default(url).then(function(result) {
74413 if (result && result.error) {
74414 throw new Error(result.error);
74415 } else if (!result || result.length < 2) {
74416 throw new Error("No Results");
74419 callback(null, result[1] || []);
74420 }).catch(function(err) {
74422 callback(err.message, []);
74425 translations: function(lang, title, callback) {
74428 callback("No Title");
74431 var url = endpoint.replace("en", lang) + utilQsString({
74439 json_default(url).then(function(result) {
74440 if (result && result.error) {
74441 throw new Error(result.error);
74442 } else if (!result || !result.query || !result.query.pages) {
74443 throw new Error("No Results");
74446 var list = result.query.pages[Object.keys(result.query.pages)[0]];
74447 var translations = {};
74448 if (list && list.langlinks) {
74449 list.langlinks.forEach(function(d) {
74450 translations[d.lang] = d["*"];
74453 callback(null, translations);
74455 }).catch(function(err) {
74457 callback(err.message);
74462 // modules/services/index.js
74464 geocoder: nominatim_default,
74465 keepRight: keepRight_default,
74466 improveOSM: improveOSM_default,
74467 osmose: osmose_default,
74468 mapillary: mapillary_default,
74470 kartaview: kartaview_default,
74472 osmWikibase: osm_wikibase_default,
74473 maprules: maprules_default,
74474 streetside: streetside_default,
74475 taginfo: taginfo_default,
74476 vectorTile: vector_tile_default,
74477 wikidata: wikidata_default,
74478 wikipedia: wikipedia_default
74481 // modules/modes/drag_note.js
74482 function modeDragNote(context) {
74487 var edit2 = behaviorEdit(context);
74488 var _nudgeInterval;
74491 function startNudge(d3_event, nudge) {
74492 if (_nudgeInterval)
74493 window.clearInterval(_nudgeInterval);
74494 _nudgeInterval = window.setInterval(function() {
74495 context.map().pan(nudge);
74496 doMove(d3_event, nudge);
74499 function stopNudge() {
74500 if (_nudgeInterval) {
74501 window.clearInterval(_nudgeInterval);
74502 _nudgeInterval = null;
74505 function origin(note) {
74506 return context.projection(note.loc);
74508 function start2(d3_event, note) {
74510 var osm = services.osm;
74512 _note = osm.getNote(_note.id);
74514 context.surface().selectAll(".note-" + _note.id).classed("active", true);
74515 context.perform(actionNoop());
74516 context.enter(mode);
74517 context.selectedNoteID(_note.id);
74519 function move(d3_event, entity, point2) {
74520 d3_event.stopPropagation();
74521 _lastLoc = context.projection.invert(point2);
74523 var nudge = geoViewportEdge(point2, context.map().dimensions());
74525 startNudge(d3_event, nudge);
74530 function doMove(d3_event, nudge) {
74531 nudge = nudge || [0, 0];
74532 var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
74533 var currMouse = geoVecSubtract(currPoint, nudge);
74534 var loc = context.projection.invert(currMouse);
74535 _note = _note.move(loc);
74536 var osm = services.osm;
74538 osm.replaceNote(_note);
74540 context.replace(actionNoop());
74543 context.replace(actionNoop());
74544 context.selectedNoteID(_note.id).enter(modeSelectNote(context, _note.id));
74546 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);
74547 mode.enter = function() {
74548 context.install(edit2);
74550 mode.exit = function() {
74551 context.ui().sidebar.hover.cancel();
74552 context.uninstall(edit2);
74553 context.surface().selectAll(".active").classed("active", false);
74556 mode.behavior = drag;
74560 // modules/modes/select_data.js
74561 function modeSelectData(context, selectedDatum) {
74566 var keybinding = utilKeybinding("select-data");
74567 var dataEditor = uiDataEditor(context);
74569 behaviorBreathe(context),
74570 behaviorHover(context),
74571 behaviorSelect(context),
74572 behaviorLasso(context),
74573 modeDragNode(context).behavior,
74574 modeDragNote(context).behavior
74576 function selectData(d3_event, drawn) {
74577 var selection2 = context.surface().selectAll(".layer-mapdata .data" + selectedDatum.__featurehash__);
74578 if (selection2.empty()) {
74579 var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
74580 if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
74581 context.enter(modeBrowse(context));
74584 selection2.classed("selected", true);
74588 if (context.container().select(".combobox").size())
74590 context.enter(modeBrowse(context));
74592 mode.zoomToSelected = function() {
74593 var extent = geoExtent(bounds_default(selectedDatum));
74594 context.map().centerZoomEase(extent.center(), context.map().trimmedExtentZoom(extent));
74596 mode.enter = function() {
74597 behaviors.forEach(context.install);
74598 keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
74599 select_default2(document).call(keybinding);
74601 var sidebar = context.ui().sidebar;
74602 sidebar.show(dataEditor.datum(selectedDatum));
74603 var extent = geoExtent(bounds_default(selectedDatum));
74604 sidebar.expand(sidebar.intersects(extent));
74605 context.map().on("drawn.select-data", selectData);
74607 mode.exit = function() {
74608 behaviors.forEach(context.uninstall);
74609 select_default2(document).call(keybinding.unbind);
74610 context.surface().selectAll(".layer-mapdata .selected").classed("selected hover", false);
74611 context.map().on("drawn.select-data", null);
74612 context.ui().sidebar.hide();
74617 // modules/behavior/select.js
74618 function behaviorSelect(context) {
74619 var _tolerancePx = 4;
74620 var _lastMouseEvent = null;
74621 var _showMenu = false;
74622 var _downPointers = {};
74623 var _longPressTimeout = null;
74624 var _lastInteractionType = null;
74625 var _multiselectionPointerId = null;
74626 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
74627 function keydown(d3_event) {
74628 if (d3_event.keyCode === 32) {
74629 var activeNode = document.activeElement;
74630 if (activeNode && (/* @__PURE__ */ new Set(["INPUT", "TEXTAREA"])).has(activeNode.nodeName))
74633 if (d3_event.keyCode === 93 || d3_event.keyCode === 32) {
74634 d3_event.preventDefault();
74636 if (d3_event.repeat)
74639 if (d3_event.shiftKey) {
74640 context.surface().classed("behavior-multiselect", true);
74642 if (d3_event.keyCode === 32) {
74643 if (!_downPointers.spacebar && _lastMouseEvent) {
74645 _longPressTimeout = window.setTimeout(didLongPress, 500, "spacebar", "spacebar");
74646 _downPointers.spacebar = {
74647 firstEvent: _lastMouseEvent,
74648 lastEvent: _lastMouseEvent
74653 function keyup(d3_event) {
74655 if (!d3_event.shiftKey) {
74656 context.surface().classed("behavior-multiselect", false);
74658 if (d3_event.keyCode === 93) {
74659 d3_event.preventDefault();
74660 _lastInteractionType = "menukey";
74661 contextmenu(d3_event);
74662 } else if (d3_event.keyCode === 32) {
74663 var pointer = _downPointers.spacebar;
74665 delete _downPointers.spacebar;
74668 d3_event.preventDefault();
74669 _lastInteractionType = "spacebar";
74670 click(pointer.firstEvent, pointer.lastEvent, "spacebar");
74674 function pointerdown(d3_event) {
74675 var id2 = (d3_event.pointerId || "mouse").toString();
74677 if (d3_event.buttons && d3_event.buttons !== 1)
74679 context.ui().closeEditMenu();
74680 if (d3_event.pointerType !== "mouse") {
74681 _longPressTimeout = window.setTimeout(didLongPress, 500, id2, "longdown-" + (d3_event.pointerType || "mouse"));
74683 _downPointers[id2] = {
74684 firstEvent: d3_event,
74685 lastEvent: d3_event
74688 function didLongPress(id2, interactionType) {
74689 var pointer = _downPointers[id2];
74692 for (var i2 in _downPointers) {
74693 _downPointers[i2].done = true;
74695 _longPressTimeout = null;
74696 _lastInteractionType = interactionType;
74698 click(pointer.firstEvent, pointer.lastEvent, id2);
74700 function pointermove(d3_event) {
74701 var id2 = (d3_event.pointerId || "mouse").toString();
74702 if (_downPointers[id2]) {
74703 _downPointers[id2].lastEvent = d3_event;
74705 if (!d3_event.pointerType || d3_event.pointerType === "mouse") {
74706 _lastMouseEvent = d3_event;
74707 if (_downPointers.spacebar) {
74708 _downPointers.spacebar.lastEvent = d3_event;
74712 function pointerup(d3_event) {
74713 var id2 = (d3_event.pointerId || "mouse").toString();
74714 var pointer = _downPointers[id2];
74717 delete _downPointers[id2];
74718 if (_multiselectionPointerId === id2) {
74719 _multiselectionPointerId = null;
74723 click(pointer.firstEvent, d3_event, id2);
74725 function pointercancel(d3_event) {
74726 var id2 = (d3_event.pointerId || "mouse").toString();
74727 if (!_downPointers[id2])
74729 delete _downPointers[id2];
74730 if (_multiselectionPointerId === id2) {
74731 _multiselectionPointerId = null;
74734 function contextmenu(d3_event) {
74735 d3_event.preventDefault();
74736 if (!+d3_event.clientX && !+d3_event.clientY) {
74737 if (_lastMouseEvent) {
74738 d3_event = _lastMouseEvent;
74743 _lastMouseEvent = d3_event;
74744 _lastInteractionType = "rightclick";
74747 click(d3_event, d3_event);
74749 function click(firstEvent, lastEvent, pointerId) {
74751 var mapNode = context.container().select(".main-map").node();
74752 var pointGetter = utilFastMouse(mapNode);
74753 var p1 = pointGetter(firstEvent);
74754 var p2 = pointGetter(lastEvent);
74755 var dist = geoVecLength(p1, p2);
74756 if (dist > _tolerancePx || !mapContains(lastEvent)) {
74760 var targetDatum = lastEvent.target.__data__;
74761 var multiselectEntityId;
74762 if (!_multiselectionPointerId) {
74763 var selectPointerInfo = pointerDownOnSelection(pointerId);
74764 if (selectPointerInfo) {
74765 _multiselectionPointerId = selectPointerInfo.pointerId;
74766 multiselectEntityId = !selectPointerInfo.selected && selectPointerInfo.entityId;
74767 _downPointers[selectPointerInfo.pointerId].done = true;
74770 var isMultiselect = context.mode().id === "select" && (lastEvent && lastEvent.shiftKey || context.surface().select(".lasso").node() || _multiselectionPointerId && !multiselectEntityId);
74771 processClick(targetDatum, isMultiselect, p2, multiselectEntityId);
74772 function mapContains(event) {
74773 var rect = mapNode.getBoundingClientRect();
74774 return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
74776 function pointerDownOnSelection(skipPointerId) {
74777 var mode = context.mode();
74778 var selectedIDs = mode.id === "select" ? mode.selectedIDs() : [];
74779 for (var pointerId2 in _downPointers) {
74780 if (pointerId2 === "spacebar" || pointerId2 === skipPointerId)
74782 var pointerInfo = _downPointers[pointerId2];
74783 var p12 = pointGetter(pointerInfo.firstEvent);
74784 var p22 = pointGetter(pointerInfo.lastEvent);
74785 if (geoVecLength(p12, p22) > _tolerancePx)
74787 var datum2 = pointerInfo.firstEvent.target.__data__;
74788 var entity = datum2 && datum2.properties && datum2.properties.entity || datum2;
74789 if (context.graph().hasEntity(entity.id)) {
74791 pointerId: pointerId2,
74792 entityId: entity.id,
74793 selected: selectedIDs.indexOf(entity.id) !== -1
74800 function processClick(datum2, isMultiselect, point2, alsoSelectId) {
74801 var mode = context.mode();
74802 var showMenu = _showMenu;
74803 var interactionType = _lastInteractionType;
74804 var entity = datum2 && datum2.properties && datum2.properties.entity;
74807 if (datum2 && datum2.type === "midpoint") {
74808 datum2 = datum2.parents[0];
74811 if (datum2 instanceof osmEntity) {
74812 var selectedIDs = context.selectedIDs();
74813 context.selectedNoteID(null);
74814 context.selectedErrorID(null);
74815 if (!isMultiselect) {
74816 if (!showMenu || selectedIDs.length <= 1 || selectedIDs.indexOf(datum2.id) === -1) {
74817 if (alsoSelectId === datum2.id)
74818 alsoSelectId = null;
74819 selectedIDs = (alsoSelectId ? [alsoSelectId] : []).concat([datum2.id]);
74820 newMode = mode.id === "select" ? mode.selectedIDs(selectedIDs) : modeSelect(context, selectedIDs).selectBehavior(behavior);
74821 context.enter(newMode);
74824 if (selectedIDs.indexOf(datum2.id) !== -1) {
74826 selectedIDs = selectedIDs.filter(function(id2) {
74827 return id2 !== datum2.id;
74829 newMode = selectedIDs.length ? mode.selectedIDs(selectedIDs) : modeBrowse(context).selectBehavior(behavior);
74830 context.enter(newMode);
74833 selectedIDs = selectedIDs.concat([datum2.id]);
74834 newMode = mode.selectedIDs(selectedIDs);
74835 context.enter(newMode);
74838 } else if (datum2 && datum2.__featurehash__ && !isMultiselect) {
74839 context.selectedNoteID(null).enter(modeSelectData(context, datum2));
74840 } else if (datum2 instanceof osmNote && !isMultiselect) {
74841 context.selectedNoteID(datum2.id).enter(modeSelectNote(context, datum2.id));
74842 } else if (datum2 instanceof QAItem && !isMultiselect) {
74843 context.selectedErrorID(datum2.id).enter(modeSelectError(context, datum2.id, datum2.service));
74845 context.selectedNoteID(null);
74846 context.selectedErrorID(null);
74847 if (!isMultiselect && mode.id !== "browse") {
74848 context.enter(modeBrowse(context));
74851 context.ui().closeEditMenu();
74853 context.ui().showEditMenu(point2, interactionType);
74856 function cancelLongPress() {
74857 if (_longPressTimeout)
74858 window.clearTimeout(_longPressTimeout);
74859 _longPressTimeout = null;
74861 function resetProperties() {
74864 _lastInteractionType = null;
74866 function behavior(selection2) {
74868 _lastMouseEvent = context.map().lastPointerEvent();
74869 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) {
74871 if (+e.clientX === 0 && +e.clientY === 0) {
74872 d3_event.preventDefault();
74875 selection2.on(_pointerPrefix + "down.select", pointerdown).on("contextmenu.select", contextmenu);
74877 behavior.off = function(selection2) {
74879 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);
74880 selection2.on(_pointerPrefix + "down.select", null).on("contextmenu.select", null);
74881 context.surface().classed("behavior-multiselect", false);
74886 // modules/operations/index.js
74887 var operations_exports = {};
74888 __export(operations_exports, {
74889 operationCircularize: () => operationCircularize,
74890 operationContinue: () => operationContinue,
74891 operationCopy: () => operationCopy,
74892 operationDelete: () => operationDelete,
74893 operationDisconnect: () => operationDisconnect,
74894 operationDowngrade: () => operationDowngrade,
74895 operationExtract: () => operationExtract,
74896 operationMerge: () => operationMerge,
74897 operationMove: () => operationMove,
74898 operationOrthogonalize: () => operationOrthogonalize,
74899 operationPaste: () => operationPaste,
74900 operationReflectLong: () => operationReflectLong,
74901 operationReflectShort: () => operationReflectShort,
74902 operationReverse: () => operationReverse,
74903 operationRotate: () => operationRotate,
74904 operationSplit: () => operationSplit,
74905 operationStraighten: () => operationStraighten
74908 // modules/operations/continue.js
74909 function operationContinue(context, selectedIDs) {
74910 var _entities = selectedIDs.map(function(id2) {
74911 return context.graph().entity(id2);
74913 var _geometries = Object.assign(
74914 { line: [], vertex: [] },
74915 utilArrayGroupBy(_entities, function(entity) {
74916 return entity.geometry(context.graph());
74919 var _vertex = _geometries.vertex.length && _geometries.vertex[0];
74920 function candidateWays() {
74921 return _vertex ? context.graph().parentWays(_vertex).filter(function(parent) {
74922 return parent.geometry(context.graph()) === "line" && !parent.isClosed() && parent.affix(_vertex.id) && (_geometries.line.length === 0 || _geometries.line[0] === parent);
74925 var _candidates = candidateWays();
74926 var operation = function() {
74927 var candidate = _candidates[0];
74929 modeDrawLine(context, candidate.id, context.graph(), "line", candidate.affix(_vertex.id), true)
74932 operation.relatedEntityIds = function() {
74933 return _candidates.length ? [_candidates[0].id] : [];
74935 operation.available = function() {
74936 return _geometries.vertex.length === 1 && _geometries.line.length <= 1 && !context.features().hasHiddenConnections(_vertex, context.graph());
74938 operation.disabled = function() {
74939 if (_candidates.length === 0) {
74940 return "not_eligible";
74941 } else if (_candidates.length > 1) {
74946 operation.tooltip = function() {
74947 var disable = operation.disabled();
74948 return disable ? _t.append("operations.continue." + disable) : _t.append("operations.continue.description");
74950 operation.annotation = function() {
74951 return _t("operations.continue.annotation.line");
74953 operation.id = "continue";
74954 operation.keys = [_t("operations.continue.key")];
74955 operation.title = _t.append("operations.continue.title");
74956 operation.behavior = behaviorOperation(context).which(operation);
74960 // modules/operations/copy.js
74961 function operationCopy(context, selectedIDs) {
74962 function getFilteredIdsToCopy() {
74963 return selectedIDs.filter(function(selectedID) {
74964 var entity = context.graph().hasEntity(selectedID);
74965 return entity.hasInterestingTags() || entity.geometry(context.graph()) !== "vertex";
74968 var operation = function() {
74969 var graph = context.graph();
74970 var selected = groupEntities(getFilteredIdsToCopy(), graph);
74975 for (i2 = 0; i2 < selected.relation.length; i2++) {
74976 entity = selected.relation[i2];
74977 if (!skip[entity.id] && entity.isComplete(graph)) {
74978 canCopy.push(entity.id);
74979 skip = getDescendants(entity.id, graph, skip);
74982 for (i2 = 0; i2 < selected.way.length; i2++) {
74983 entity = selected.way[i2];
74984 if (!skip[entity.id]) {
74985 canCopy.push(entity.id);
74986 skip = getDescendants(entity.id, graph, skip);
74989 for (i2 = 0; i2 < selected.node.length; i2++) {
74990 entity = selected.node[i2];
74991 if (!skip[entity.id]) {
74992 canCopy.push(entity.id);
74995 context.copyIDs(canCopy);
74996 if (_point && (canCopy.length !== 1 || graph.entity(canCopy[0]).type !== "node")) {
74997 context.copyLonLat(context.projection.invert(_point));
74999 context.copyLonLat(null);
75002 function groupEntities(ids, graph) {
75003 var entities = ids.map(function(id2) {
75004 return graph.entity(id2);
75006 return Object.assign(
75007 { relation: [], way: [], node: [] },
75008 utilArrayGroupBy(entities, "type")
75011 function getDescendants(id2, graph, descendants) {
75012 var entity = graph.entity(id2);
75014 descendants = descendants || {};
75015 if (entity.type === "relation") {
75016 children2 = entity.members.map(function(m) {
75019 } else if (entity.type === "way") {
75020 children2 = entity.nodes;
75024 for (var i2 = 0; i2 < children2.length; i2++) {
75025 if (!descendants[children2[i2]]) {
75026 descendants[children2[i2]] = true;
75027 descendants = getDescendants(children2[i2], graph, descendants);
75030 return descendants;
75032 operation.available = function() {
75033 return getFilteredIdsToCopy().length > 0;
75035 operation.disabled = function() {
75036 var extent = utilTotalExtent(getFilteredIdsToCopy(), context.graph());
75037 if (extent.percentContainedIn(context.map().extent()) < 0.8) {
75038 return "too_large";
75042 operation.availableForKeypress = function() {
75043 var selection2 = window.getSelection && window.getSelection();
75044 return !selection2 || !selection2.toString();
75046 operation.tooltip = function() {
75047 var disable = operation.disabled();
75048 return disable ? _t.append("operations.copy." + disable, { n: selectedIDs.length }) : _t.append("operations.copy.description", { n: selectedIDs.length });
75050 operation.annotation = function() {
75051 return _t("operations.copy.annotation", { n: selectedIDs.length });
75054 operation.point = function(val) {
75058 operation.id = "copy";
75059 operation.keys = [uiCmd("\u2318C")];
75060 operation.title = _t.append("operations.copy.title");
75061 operation.behavior = behaviorOperation(context).which(operation);
75065 // modules/operations/disconnect.js
75066 function operationDisconnect(context, selectedIDs) {
75067 var _vertexIDs = [];
75069 var _otherIDs = [];
75071 selectedIDs.forEach(function(id2) {
75072 var entity = context.entity(id2);
75073 if (entity.type === "way") {
75075 } else if (entity.geometry(context.graph()) === "vertex") {
75076 _vertexIDs.push(id2);
75078 _otherIDs.push(id2);
75081 var _coords, _descriptionID = "", _annotationID = "features";
75082 var _disconnectingVertexIds = [];
75083 var _disconnectingWayIds = [];
75084 if (_vertexIDs.length > 0) {
75085 _disconnectingVertexIds = _vertexIDs;
75086 _vertexIDs.forEach(function(vertexID) {
75087 var action = actionDisconnect(vertexID);
75088 if (_wayIDs.length > 0) {
75089 var waysIDsForVertex = _wayIDs.filter(function(wayID) {
75090 var way = context.entity(wayID);
75091 return way.nodes.indexOf(vertexID) !== -1;
75093 action.limitWays(waysIDsForVertex);
75095 _actions.push(action);
75096 _disconnectingWayIds = _disconnectingWayIds.concat(context.graph().parentWays(context.graph().entity(vertexID)).map((d) => d.id));
75098 _disconnectingWayIds = utilArrayUniq(_disconnectingWayIds).filter(function(id2) {
75099 return _wayIDs.indexOf(id2) === -1;
75101 _descriptionID += _actions.length === 1 ? "single_point." : "multiple_points.";
75102 if (_wayIDs.length === 1) {
75103 _descriptionID += "single_way." + context.graph().geometry(_wayIDs[0]);
75105 _descriptionID += _wayIDs.length === 0 ? "no_ways" : "multiple_ways";
75107 } else if (_wayIDs.length > 0) {
75108 var ways = _wayIDs.map(function(id2) {
75109 return context.entity(id2);
75111 var nodes = utilGetAllNodes(_wayIDs, context.graph());
75112 _coords = nodes.map(function(n2) {
75115 var sharedActions = [];
75116 var sharedNodes = [];
75117 var unsharedActions = [];
75118 var unsharedNodes = [];
75119 nodes.forEach(function(node) {
75120 var action = actionDisconnect(node.id).limitWays(_wayIDs);
75121 if (action.disabled(context.graph()) !== "not_connected") {
75123 for (var i2 in ways) {
75124 var way = ways[i2];
75125 if (way.nodes.indexOf(node.id) !== -1) {
75132 sharedActions.push(action);
75133 sharedNodes.push(node);
75135 unsharedActions.push(action);
75136 unsharedNodes.push(node);
75140 _descriptionID += "no_points.";
75141 _descriptionID += _wayIDs.length === 1 ? "single_way." : "multiple_ways.";
75142 if (sharedActions.length) {
75143 _actions = sharedActions;
75144 _disconnectingVertexIds = sharedNodes.map((node) => node.id);
75145 _descriptionID += "conjoined";
75146 _annotationID = "from_each_other";
75148 _actions = unsharedActions;
75149 _disconnectingVertexIds = unsharedNodes.map((node) => node.id);
75150 if (_wayIDs.length === 1) {
75151 _descriptionID += context.graph().geometry(_wayIDs[0]);
75153 _descriptionID += "separate";
75157 var _extent = utilTotalExtent(_disconnectingVertexIds, context.graph());
75158 var operation = function() {
75159 context.perform(function(graph) {
75160 return _actions.reduce(function(graph2, action) {
75161 return action(graph2);
75163 }, operation.annotation());
75164 context.validator().validate();
75166 operation.relatedEntityIds = function() {
75167 if (_vertexIDs.length) {
75168 return _disconnectingWayIds;
75170 return _disconnectingVertexIds;
75172 operation.available = function() {
75173 if (_actions.length === 0)
75175 if (_otherIDs.length !== 0)
75177 if (_vertexIDs.length !== 0 && _wayIDs.length !== 0 && !_wayIDs.every(function(wayID) {
75178 return _vertexIDs.some(function(vertexID) {
75179 var way = context.entity(wayID);
75180 return way.nodes.indexOf(vertexID) !== -1;
75186 operation.disabled = function() {
75188 for (var actionIndex in _actions) {
75189 reason = _actions[actionIndex].disabled(context.graph());
75193 if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
75194 return "too_large." + ((_vertexIDs.length ? _vertexIDs : _wayIDs).length === 1 ? "single" : "multiple");
75195 } else if (_coords && someMissing()) {
75196 return "not_downloaded";
75197 } else if (selectedIDs.some(context.hasHiddenConnections)) {
75198 return "connected_to_hidden";
75201 function someMissing() {
75202 if (context.inIntro())
75204 var osm = context.connection();
75206 var missing = _coords.filter(function(loc) {
75207 return !osm.isDataLoaded(loc);
75209 if (missing.length) {
75210 missing.forEach(function(loc) {
75211 context.loadTileAtLoc(loc);
75219 operation.tooltip = function() {
75220 var disable = operation.disabled();
75221 return disable ? _t.append("operations.disconnect." + disable) : _t.append("operations.disconnect.description." + _descriptionID);
75223 operation.annotation = function() {
75224 return _t("operations.disconnect.annotation." + _annotationID);
75226 operation.id = "disconnect";
75227 operation.keys = [_t("operations.disconnect.key")];
75228 operation.title = _t.append("operations.disconnect.title");
75229 operation.behavior = behaviorOperation(context).which(operation);
75233 // modules/operations/downgrade.js
75234 function operationDowngrade(context, selectedIDs) {
75235 var _affectedFeatureCount = 0;
75236 var _downgradeType = downgradeTypeForEntityIDs(selectedIDs);
75237 var _multi = _affectedFeatureCount === 1 ? "single" : "multiple";
75238 function downgradeTypeForEntityIDs(entityIds) {
75240 _affectedFeatureCount = 0;
75241 for (var i2 in entityIds) {
75242 var entityID = entityIds[i2];
75243 var type3 = downgradeTypeForEntityID(entityID);
75245 _affectedFeatureCount += 1;
75246 if (downgradeType && type3 !== downgradeType) {
75247 if (downgradeType !== "generic" && type3 !== "generic") {
75248 downgradeType = "building_address";
75250 downgradeType = "generic";
75253 downgradeType = type3;
75257 return downgradeType;
75259 function downgradeTypeForEntityID(entityID) {
75260 var graph = context.graph();
75261 var entity = graph.entity(entityID);
75262 var preset = _mainPresetIndex.match(entity, graph);
75263 if (!preset || preset.isFallback())
75265 if (entity.type === "node" && preset.id !== "address" && Object.keys(entity.tags).some(function(key) {
75266 return key.match(/^addr:.{1,}/);
75270 var geometry = entity.geometry(graph);
75271 if (geometry === "area" && entity.tags.building && !preset.tags.building) {
75274 if (geometry === "vertex" && Object.keys(entity.tags).length) {
75279 var buildingKeysToKeep = ["architect", "building", "height", "layer", "source", "type", "wheelchair"];
75280 var addressKeysToKeep = ["source"];
75281 var operation = function() {
75282 context.perform(function(graph) {
75283 for (var i2 in selectedIDs) {
75284 var entityID = selectedIDs[i2];
75285 var type3 = downgradeTypeForEntityID(entityID);
75288 var tags = Object.assign({}, graph.entity(entityID).tags);
75289 for (var key in tags) {
75290 if (type3 === "address" && addressKeysToKeep.indexOf(key) !== -1)
75292 if (type3 === "building") {
75293 if (buildingKeysToKeep.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/))
75296 if (type3 !== "generic") {
75297 if (key.match(/^addr:.{1,}/) || key.match(/^source:.{1,}/))
75302 graph = actionChangeTags(entityID, tags)(graph);
75305 }, operation.annotation());
75306 context.validator().validate();
75307 context.enter(modeSelect(context, selectedIDs));
75309 operation.available = function() {
75310 return _downgradeType;
75312 operation.disabled = function() {
75313 if (selectedIDs.some(hasWikidataTag)) {
75314 return "has_wikidata_tag";
75317 function hasWikidataTag(id2) {
75318 var entity = context.entity(id2);
75319 return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
75322 operation.tooltip = function() {
75323 var disable = operation.disabled();
75324 return disable ? _t.append("operations.downgrade." + disable + "." + _multi) : _t.append("operations.downgrade.description." + _downgradeType);
75326 operation.annotation = function() {
75328 if (_downgradeType === "building_address") {
75329 suffix = "generic";
75331 suffix = _downgradeType;
75333 return _t("operations.downgrade.annotation." + suffix, { n: _affectedFeatureCount });
75335 operation.id = "downgrade";
75336 operation.keys = [uiCmd("\u232B")];
75337 operation.title = _t.append("operations.downgrade.title");
75338 operation.behavior = behaviorOperation(context).which(operation);
75342 // modules/operations/extract.js
75343 function operationExtract(context, selectedIDs) {
75344 var _amount = selectedIDs.length === 1 ? "single" : "multiple";
75345 var _geometries = utilArrayUniq(selectedIDs.map(function(entityID) {
75346 return context.graph().hasEntity(entityID) && context.graph().geometry(entityID);
75347 }).filter(Boolean));
75348 var _geometryID = _geometries.length === 1 ? _geometries[0] : "feature";
75350 var _actions = selectedIDs.map(function(entityID) {
75351 var graph = context.graph();
75352 var entity = graph.hasEntity(entityID);
75353 if (!entity || !entity.hasInterestingTags())
75355 if (entity.type === "node" && graph.parentWays(entity).length === 0)
75357 if (entity.type !== "node") {
75358 var preset = _mainPresetIndex.match(entity, graph);
75359 if (preset.geometry.indexOf("point") === -1)
75362 _extent = _extent ? _extent.extend(entity.extent(graph)) : entity.extent(graph);
75363 return actionExtract(entityID, context.projection);
75364 }).filter(Boolean);
75365 var operation = function() {
75366 var combinedAction = function(graph) {
75367 _actions.forEach(function(action) {
75368 graph = action(graph);
75372 context.perform(combinedAction, operation.annotation());
75373 var extractedNodeIDs = _actions.map(function(action) {
75374 return action.getExtractedNodeID();
75376 context.enter(modeSelect(context, extractedNodeIDs));
75378 operation.available = function() {
75379 return _actions.length && selectedIDs.length === _actions.length;
75381 operation.disabled = function() {
75382 if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
75383 return "too_large";
75384 } else if (selectedIDs.some(function(entityID) {
75385 return context.graph().geometry(entityID) === "vertex" && context.hasHiddenConnections(entityID);
75387 return "connected_to_hidden";
75391 operation.tooltip = function() {
75392 var disableReason = operation.disabled();
75393 if (disableReason) {
75394 return _t.append("operations.extract." + disableReason + "." + _amount);
75396 return _t.append("operations.extract.description." + _geometryID + "." + _amount);
75399 operation.annotation = function() {
75400 return _t("operations.extract.annotation", { n: selectedIDs.length });
75402 operation.id = "extract";
75403 operation.keys = [_t("operations.extract.key")];
75404 operation.title = _t.append("operations.extract.title");
75405 operation.behavior = behaviorOperation(context).which(operation);
75409 // modules/operations/merge.js
75410 function operationMerge(context, selectedIDs) {
75411 var _action = getAction();
75412 function getAction() {
75413 var join = actionJoin(selectedIDs);
75414 if (!join.disabled(context.graph()))
75416 var merge3 = actionMerge(selectedIDs);
75417 if (!merge3.disabled(context.graph()))
75419 var mergePolygon = actionMergePolygon(selectedIDs);
75420 if (!mergePolygon.disabled(context.graph()))
75421 return mergePolygon;
75422 var mergeNodes = actionMergeNodes(selectedIDs);
75423 if (!mergeNodes.disabled(context.graph()))
75425 if (join.disabled(context.graph()) !== "not_eligible")
75427 if (merge3.disabled(context.graph()) !== "not_eligible")
75429 if (mergePolygon.disabled(context.graph()) !== "not_eligible")
75430 return mergePolygon;
75433 var operation = function() {
75434 if (operation.disabled())
75436 context.perform(_action, operation.annotation());
75437 context.validator().validate();
75438 var resultIDs = selectedIDs.filter(context.hasEntity);
75439 if (resultIDs.length > 1) {
75440 var interestingIDs = resultIDs.filter(function(id2) {
75441 return context.entity(id2).hasInterestingTags();
75443 if (interestingIDs.length)
75444 resultIDs = interestingIDs;
75446 context.enter(modeSelect(context, resultIDs));
75448 operation.available = function() {
75449 return selectedIDs.length >= 2;
75451 operation.disabled = function() {
75452 var actionDisabled = _action.disabled(context.graph());
75453 if (actionDisabled)
75454 return actionDisabled;
75455 var osm = context.connection();
75456 if (osm && _action.resultingWayNodesLength && _action.resultingWayNodesLength(context.graph()) > osm.maxWayNodes()) {
75457 return "too_many_vertices";
75461 operation.tooltip = function() {
75462 var disabled = operation.disabled();
75464 if (disabled === "conflicting_relations") {
75465 return _t.append("operations.merge.conflicting_relations");
75467 if (disabled === "restriction" || disabled === "connectivity") {
75469 "operations.merge.damage_relation",
75470 { relation: _mainPresetIndex.item("type/" + disabled).name() }
75473 return _t.append("operations.merge." + disabled);
75475 return _t.append("operations.merge.description");
75477 operation.annotation = function() {
75478 return _t("operations.merge.annotation", { n: selectedIDs.length });
75480 operation.id = "merge";
75481 operation.keys = [_t("operations.merge.key")];
75482 operation.title = _t.append("operations.merge.title");
75483 operation.behavior = behaviorOperation(context).which(operation);
75487 // modules/operations/paste.js
75488 function operationPaste(context) {
75490 var operation = function() {
75493 var oldIDs = context.copyIDs();
75494 if (!oldIDs.length)
75496 var projection2 = context.projection;
75497 var extent = geoExtent();
75498 var oldGraph = context.copyGraph();
75500 var action = actionCopyEntities(oldIDs, oldGraph);
75501 context.perform(action);
75502 var copies = action.copies();
75503 var originals = /* @__PURE__ */ new Set();
75504 Object.values(copies).forEach(function(entity) {
75505 originals.add(entity.id);
75507 for (var id2 in copies) {
75508 var oldEntity = oldGraph.entity(id2);
75509 var newEntity = copies[id2];
75510 extent._extend(oldEntity.extent(oldGraph));
75511 var parents = context.graph().parentWays(newEntity);
75512 var parentCopied = parents.some(function(parent) {
75513 return originals.has(parent.id);
75515 if (!parentCopied) {
75516 newIDs.push(newEntity.id);
75519 var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
75520 var delta = geoVecSubtract(_pastePoint, copyPoint);
75521 context.replace(actionMove(newIDs, delta, projection2), operation.annotation());
75522 context.enter(modeSelect(context, newIDs));
75524 operation.point = function(val) {
75528 operation.available = function() {
75529 return context.mode().id === "browse";
75531 operation.disabled = function() {
75532 return !context.copyIDs().length;
75534 operation.tooltip = function() {
75535 var oldGraph = context.copyGraph();
75536 var ids = context.copyIDs();
75538 return _t.append("operations.paste.nothing_copied");
75540 return _t.append("operations.paste.description", { feature: utilDisplayLabel(oldGraph.entity(ids[0]), oldGraph), n: ids.length });
75542 operation.annotation = function() {
75543 var ids = context.copyIDs();
75544 return _t("operations.paste.annotation", { n: ids.length });
75546 operation.id = "paste";
75547 operation.keys = [uiCmd("\u2318V")];
75548 operation.title = _t.append("operations.paste.title");
75552 // modules/operations/reverse.js
75553 function operationReverse(context, selectedIDs) {
75554 var operation = function() {
75555 context.perform(function combinedReverseAction(graph) {
75556 actions().forEach(function(action) {
75557 graph = action(graph);
75560 }, operation.annotation());
75561 context.validator().validate();
75563 function actions(situation) {
75564 return selectedIDs.map(function(entityID) {
75565 var entity = context.hasEntity(entityID);
75568 if (situation === "toolbar") {
75569 if (entity.type === "way" && (!entity.isOneWay() && !entity.isSided()))
75572 var geometry = entity.geometry(context.graph());
75573 if (entity.type !== "node" && geometry !== "line")
75575 var action = actionReverse(entityID);
75576 if (action.disabled(context.graph()))
75579 }).filter(Boolean);
75581 function reverseTypeID() {
75582 var acts = actions();
75583 var nodeActionCount = acts.filter(function(act) {
75584 var entity = context.hasEntity(act.entityID());
75585 return entity && entity.type === "node";
75587 if (nodeActionCount === 0)
75589 if (nodeActionCount === acts.length)
75593 operation.available = function(situation) {
75594 return actions(situation).length > 0;
75596 operation.disabled = function() {
75599 operation.tooltip = function() {
75600 return _t.append("operations.reverse.description." + reverseTypeID());
75602 operation.annotation = function() {
75603 var acts = actions();
75604 return _t("operations.reverse.annotation." + reverseTypeID(), { n: acts.length });
75606 operation.id = "reverse";
75607 operation.keys = [_t("operations.reverse.key")];
75608 operation.title = _t.append("operations.reverse.title");
75609 operation.behavior = behaviorOperation(context).which(operation);
75613 // modules/operations/split.js
75614 function operationSplit(context, selectedIDs) {
75615 var _vertexIds = selectedIDs.filter(function(id2) {
75616 return context.graph().geometry(id2) === "vertex";
75618 var _selectedWayIds = selectedIDs.filter(function(id2) {
75619 var entity = context.graph().hasEntity(id2);
75620 return entity && entity.type === "way";
75622 var _isAvailable = _vertexIds.length > 0 && _vertexIds.length + _selectedWayIds.length === selectedIDs.length;
75623 var _action = actionSplit(_vertexIds);
75625 var _geometry = "feature";
75626 var _waysAmount = "single";
75627 var _nodesAmount = _vertexIds.length === 1 ? "single" : "multiple";
75628 if (_isAvailable) {
75629 if (_selectedWayIds.length)
75630 _action.limitWays(_selectedWayIds);
75631 _ways = _action.ways(context.graph());
75632 var geometries = {};
75633 _ways.forEach(function(way) {
75634 geometries[way.geometry(context.graph())] = true;
75636 if (Object.keys(geometries).length === 1) {
75637 _geometry = Object.keys(geometries)[0];
75639 _waysAmount = _ways.length === 1 ? "single" : "multiple";
75641 var operation = function() {
75642 var difference = context.perform(_action, operation.annotation());
75643 var idsToSelect = _vertexIds.concat(difference.extantIDs().filter(function(id2) {
75644 return context.entity(id2).type === "way";
75646 context.enter(modeSelect(context, idsToSelect));
75648 operation.relatedEntityIds = function() {
75649 return _selectedWayIds.length ? [] : _ways.map((way) => way.id);
75651 operation.available = function() {
75652 return _isAvailable;
75654 operation.disabled = function() {
75655 var reason = _action.disabled(context.graph());
75658 } else if (selectedIDs.some(context.hasHiddenConnections)) {
75659 return "connected_to_hidden";
75663 operation.tooltip = function() {
75664 var disable = operation.disabled();
75665 return disable ? _t.append("operations.split." + disable) : _t.append("operations.split.description." + _geometry + "." + _waysAmount + "." + _nodesAmount + "_node");
75667 operation.annotation = function() {
75668 return _t("operations.split.annotation." + _geometry, { n: _ways.length });
75670 operation.icon = function() {
75671 if (_waysAmount === "multiple") {
75672 return "#iD-operation-split-multiple";
75674 return "#iD-operation-split";
75677 operation.id = "split";
75678 operation.keys = [_t("operations.split.key")];
75679 operation.title = _t.append("operations.split.title");
75680 operation.behavior = behaviorOperation(context).which(operation);
75684 // modules/operations/straighten.js
75685 function operationStraighten(context, selectedIDs) {
75686 var _wayIDs = selectedIDs.filter(function(id2) {
75687 return id2.charAt(0) === "w";
75689 var _nodeIDs = selectedIDs.filter(function(id2) {
75690 return id2.charAt(0) === "n";
75692 var _amount = (_wayIDs.length ? _wayIDs : _nodeIDs).length === 1 ? "single" : "multiple";
75693 var _nodes = utilGetAllNodes(selectedIDs, context.graph());
75694 var _coords = _nodes.map(function(n2) {
75697 var _extent = utilTotalExtent(selectedIDs, context.graph());
75698 var _action = chooseAction();
75700 function chooseAction() {
75701 if (_wayIDs.length === 0 && _nodeIDs.length > 2) {
75702 _geometry = "point";
75703 return actionStraightenNodes(_nodeIDs, context.projection);
75704 } else if (_wayIDs.length > 0 && (_nodeIDs.length === 0 || _nodeIDs.length === 2)) {
75705 var startNodeIDs = [];
75706 var endNodeIDs = [];
75707 for (var i2 = 0; i2 < selectedIDs.length; i2++) {
75708 var entity = context.entity(selectedIDs[i2]);
75709 if (entity.type === "node") {
75711 } else if (entity.type !== "way" || entity.isClosed()) {
75714 startNodeIDs.push(entity.first());
75715 endNodeIDs.push(entity.last());
75717 startNodeIDs = startNodeIDs.filter(function(n2) {
75718 return startNodeIDs.indexOf(n2) === startNodeIDs.lastIndexOf(n2);
75720 endNodeIDs = endNodeIDs.filter(function(n2) {
75721 return endNodeIDs.indexOf(n2) === endNodeIDs.lastIndexOf(n2);
75723 if (utilArrayDifference(startNodeIDs, endNodeIDs).length + utilArrayDifference(endNodeIDs, startNodeIDs).length !== 2)
75725 var wayNodeIDs = utilGetAllNodes(_wayIDs, context.graph()).map(function(node) {
75728 if (wayNodeIDs.length <= 2)
75730 if (_nodeIDs.length === 2 && (wayNodeIDs.indexOf(_nodeIDs[0]) === -1 || wayNodeIDs.indexOf(_nodeIDs[1]) === -1))
75732 if (_nodeIDs.length) {
75733 _extent = utilTotalExtent(_nodeIDs, context.graph());
75735 _geometry = "line";
75736 return actionStraightenWay(selectedIDs, context.projection);
75740 function operation() {
75743 context.perform(_action, operation.annotation());
75744 window.setTimeout(function() {
75745 context.validator().validate();
75748 operation.available = function() {
75749 return Boolean(_action);
75751 operation.disabled = function() {
75752 var reason = _action.disabled(context.graph());
75755 } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
75756 return "too_large";
75757 } else if (someMissing()) {
75758 return "not_downloaded";
75759 } else if (selectedIDs.some(context.hasHiddenConnections)) {
75760 return "connected_to_hidden";
75763 function someMissing() {
75764 if (context.inIntro())
75766 var osm = context.connection();
75768 var missing = _coords.filter(function(loc) {
75769 return !osm.isDataLoaded(loc);
75771 if (missing.length) {
75772 missing.forEach(function(loc) {
75773 context.loadTileAtLoc(loc);
75781 operation.tooltip = function() {
75782 var disable = operation.disabled();
75783 return disable ? _t.append("operations.straighten." + disable + "." + _amount) : _t.append("operations.straighten.description." + _geometry + (_wayIDs.length === 1 ? "" : "s"));
75785 operation.annotation = function() {
75786 return _t("operations.straighten.annotation." + _geometry, { n: _wayIDs.length ? _wayIDs.length : _nodeIDs.length });
75788 operation.id = "straighten";
75789 operation.keys = [_t("operations.straighten.key")];
75790 operation.title = _t.append("operations.straighten.title");
75791 operation.behavior = behaviorOperation(context).which(operation);
75795 // modules/modes/select.js
75796 function modeSelect(context, selectedIDs) {
75801 var keybinding = utilKeybinding("select");
75802 var _breatheBehavior = behaviorBreathe(context);
75803 var _modeDragNode = modeDragNode(context);
75804 var _selectBehavior;
75805 var _behaviors = [];
75806 var _operations = [];
75807 var _newFeature = false;
75808 var _follow = false;
75809 var _focusedParentWayId;
75810 var _focusedVertexIds;
75811 function singular() {
75812 if (selectedIDs && selectedIDs.length === 1) {
75813 return context.hasEntity(selectedIDs[0]);
75816 function selectedEntities() {
75817 return selectedIDs.map(function(id2) {
75818 return context.hasEntity(id2);
75819 }).filter(Boolean);
75821 function checkSelectedIDs() {
75823 if (Array.isArray(selectedIDs)) {
75824 ids = selectedIDs.filter(function(id2) {
75825 return context.hasEntity(id2);
75829 context.enter(modeBrowse(context));
75831 } else if (selectedIDs.length > 1 && ids.length === 1 || selectedIDs.length === 1 && ids.length > 1) {
75832 context.enter(modeSelect(context, ids));
75838 function parentWaysIdsOfSelection(onlyCommonParents) {
75839 var graph = context.graph();
75841 for (var i2 = 0; i2 < selectedIDs.length; i2++) {
75842 var entity = context.hasEntity(selectedIDs[i2]);
75843 if (!entity || entity.geometry(graph) !== "vertex") {
75846 var currParents = graph.parentWays(entity).map(function(w) {
75849 if (!parents.length) {
75850 parents = currParents;
75853 parents = (onlyCommonParents ? utilArrayIntersection : utilArrayUnion)(parents, currParents);
75854 if (!parents.length) {
75860 function childNodeIdsOfSelection(onlyCommon) {
75861 var graph = context.graph();
75863 for (var i2 = 0; i2 < selectedIDs.length; i2++) {
75864 var entity = context.hasEntity(selectedIDs[i2]);
75865 if (!entity || !["area", "line"].includes(entity.geometry(graph))) {
75868 var currChilds = graph.childNodes(entity).map(function(node) {
75871 if (!childs.length) {
75872 childs = currChilds;
75875 childs = (onlyCommon ? utilArrayIntersection : utilArrayUnion)(childs, currChilds);
75876 if (!childs.length) {
75882 function checkFocusedParent() {
75883 if (_focusedParentWayId) {
75884 var parents = parentWaysIdsOfSelection(true);
75885 if (parents.indexOf(_focusedParentWayId) === -1)
75886 _focusedParentWayId = null;
75889 function parentWayIdForVertexNavigation() {
75890 var parentIds = parentWaysIdsOfSelection(true);
75891 if (_focusedParentWayId && parentIds.indexOf(_focusedParentWayId) !== -1) {
75892 return _focusedParentWayId;
75894 return parentIds.length ? parentIds[0] : null;
75896 mode.selectedIDs = function(val) {
75897 if (!arguments.length)
75898 return selectedIDs;
75902 mode.zoomToSelected = function() {
75903 context.map().zoomToEase(selectedEntities());
75905 mode.newFeature = function(val) {
75906 if (!arguments.length)
75907 return _newFeature;
75911 mode.selectBehavior = function(val) {
75912 if (!arguments.length)
75913 return _selectBehavior;
75914 _selectBehavior = val;
75917 mode.follow = function(val) {
75918 if (!arguments.length)
75923 function loadOperations() {
75924 _operations.forEach(function(operation) {
75925 if (operation.behavior) {
75926 context.uninstall(operation.behavior);
75929 _operations = Object.values(operations_exports).map(function(o) {
75930 return o(context, selectedIDs);
75931 }).filter(function(o) {
75932 return o.id !== "delete" && o.id !== "downgrade" && o.id !== "copy";
75934 operationCopy(context, selectedIDs),
75935 operationDowngrade(context, selectedIDs),
75936 operationDelete(context, selectedIDs)
75937 ]).filter(function(operation) {
75938 return operation.available();
75940 _operations.forEach(function(operation) {
75941 if (operation.behavior) {
75942 context.install(operation.behavior);
75945 context.ui().closeEditMenu();
75947 mode.operations = function() {
75948 return _operations;
75950 mode.enter = function() {
75951 if (!checkSelectedIDs())
75953 context.features().forceVisible(selectedIDs);
75954 _modeDragNode.restoreSelectedIDs(selectedIDs);
75956 if (!_behaviors.length) {
75957 if (!_selectBehavior)
75958 _selectBehavior = behaviorSelect(context);
75960 behaviorPaste(context),
75962 behaviorHover(context).on("hover", context.ui().sidebar.hoverModeSelect),
75964 behaviorLasso(context),
75965 _modeDragNode.behavior,
75966 modeDragNote(context).behavior
75969 _behaviors.forEach(context.install);
75970 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);
75971 select_default2(document).call(keybinding);
75972 context.ui().sidebar.select(selectedIDs, _newFeature);
75973 context.history().on("change.select", function() {
75976 }).on("undone.select", checkSelectedIDs).on("redone.select", checkSelectedIDs);
75977 context.map().on("drawn.select", selectElements).on("crossEditableZoom.select", function() {
75979 _breatheBehavior.restartIfNeeded(context.surface());
75981 context.map().doubleUpHandler().on("doubleUp.modeSelect", didDoubleUp);
75984 var extent = geoExtent();
75985 var graph = context.graph();
75986 selectedIDs.forEach(function(id2) {
75987 var entity = context.entity(id2);
75988 extent._extend(entity.extent(graph));
75990 var loc = extent.center();
75991 context.map().centerEase(loc);
75994 function nudgeSelection(delta) {
75995 return function() {
75996 if (!context.map().withinEditableZoom())
75998 var moveOp = operationMove(context, selectedIDs);
75999 if (moveOp.disabled()) {
76000 context.ui().flash.duration(4e3).iconName("#iD-operation-" + moveOp.id).iconClass("operation disabled").label(moveOp.tooltip())();
76002 context.perform(actionMove(selectedIDs, delta, context.projection), moveOp.annotation());
76003 context.validator().validate();
76007 function scaleSelection(factor) {
76008 return function() {
76009 if (!context.map().withinEditableZoom())
76011 let nodes = utilGetAllNodes(selectedIDs, context.graph());
76012 let isUp = factor > 1;
76013 if (nodes.length <= 1)
76015 let extent2 = utilTotalExtent(selectedIDs, context.graph());
76016 function scalingDisabled() {
76018 return "too_small";
76019 } else if (extent2.percentContainedIn(context.map().extent()) < 0.8) {
76020 return "too_large";
76021 } else if (someMissing() || selectedIDs.some(incompleteRelation)) {
76022 return "not_downloaded";
76023 } else if (selectedIDs.some(context.hasHiddenConnections)) {
76024 return "connected_to_hidden";
76027 function tooSmall() {
76030 let dLon = Math.abs(extent2[1][0] - extent2[0][0]);
76031 let dLat = Math.abs(extent2[1][1] - extent2[0][1]);
76032 return dLon < geoMetersToLon(1, extent2[1][1]) && dLat < geoMetersToLat(1);
76034 function someMissing() {
76035 if (context.inIntro())
76037 let osm = context.connection();
76039 let missing = nodes.filter(function(n2) {
76040 return !osm.isDataLoaded(n2.loc);
76042 if (missing.length) {
76043 missing.forEach(function(loc2) {
76044 context.loadTileAtLoc(loc2);
76051 function incompleteRelation(id2) {
76052 let entity = context.entity(id2);
76053 return entity.type === "relation" && !entity.isComplete(context.graph());
76056 const disabled = scalingDisabled();
76058 let multi = selectedIDs.length === 1 ? "single" : "multiple";
76059 context.ui().flash.duration(4e3).iconName("#iD-icon-no").iconClass("operation disabled").label(_t.append("operations.scale." + disabled + "." + multi))();
76061 const pivot = context.projection(extent2.center());
76062 const annotation = _t("operations.scale.annotation." + (isUp ? "up" : "down") + ".feature", { n: selectedIDs.length });
76063 context.perform(actionScale(selectedIDs, pivot, factor, context.projection), annotation);
76064 context.validator().validate();
76068 function didDoubleUp(d3_event, loc2) {
76069 if (!context.map().withinEditableZoom())
76071 var target = select_default2(d3_event.target);
76072 var datum2 = target.datum();
76073 var entity = datum2 && datum2.properties && datum2.properties.entity;
76076 if (entity instanceof osmWay && target.classed("target")) {
76077 var choice = geoChooseEdge(context.graph().childNodes(entity), loc2, context.projection);
76078 var prev = entity.nodes[choice.index - 1];
76079 var next = entity.nodes[choice.index];
76081 actionAddMidpoint({ loc: choice.loc, edge: [prev, next] }, osmNode()),
76082 _t("operations.add.annotation.vertex")
76084 context.validator().validate();
76085 } else if (entity.type === "midpoint") {
76087 actionAddMidpoint({ loc: entity.loc, edge: entity.edge }, osmNode()),
76088 _t("operations.add.annotation.vertex")
76090 context.validator().validate();
76093 function selectElements() {
76094 if (!checkSelectedIDs())
76096 var surface = context.surface();
76097 surface.selectAll(".selected-member").classed("selected-member", false);
76098 surface.selectAll(".selected").classed("selected", false);
76099 surface.selectAll(".related").classed("related", false);
76100 checkFocusedParent();
76101 if (_focusedParentWayId) {
76102 surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
76104 if (context.map().withinEditableZoom()) {
76105 surface.selectAll(utilDeepMemberSelector(selectedIDs, context.graph(), true)).classed("selected-member", true);
76106 surface.selectAll(utilEntityOrDeepMemberSelector(selectedIDs, context.graph())).classed("selected", true);
76110 if (context.container().select(".combobox").size())
76112 context.enter(modeBrowse(context));
76114 function firstVertex(d3_event) {
76115 d3_event.preventDefault();
76116 var entity = singular();
76117 var parentId = parentWayIdForVertexNavigation();
76119 if (entity && entity.type === "way") {
76121 } else if (parentId) {
76122 way = context.entity(parentId);
76124 _focusedParentWayId = way && way.id;
76127 mode.selectedIDs([way.first()]).follow(true)
76131 function lastVertex(d3_event) {
76132 d3_event.preventDefault();
76133 var entity = singular();
76134 var parentId = parentWayIdForVertexNavigation();
76136 if (entity && entity.type === "way") {
76138 } else if (parentId) {
76139 way = context.entity(parentId);
76141 _focusedParentWayId = way && way.id;
76144 mode.selectedIDs([way.last()]).follow(true)
76148 function previousVertex(d3_event) {
76149 d3_event.preventDefault();
76150 var parentId = parentWayIdForVertexNavigation();
76151 _focusedParentWayId = parentId;
76154 var way = context.entity(parentId);
76155 var length = way.nodes.length;
76156 var curr = way.nodes.indexOf(selectedIDs[0]);
76160 } else if (way.isClosed()) {
76161 index = length - 2;
76163 if (index !== -1) {
76165 mode.selectedIDs([way.nodes[index]]).follow(true)
76169 function nextVertex(d3_event) {
76170 d3_event.preventDefault();
76171 var parentId = parentWayIdForVertexNavigation();
76172 _focusedParentWayId = parentId;
76175 var way = context.entity(parentId);
76176 var length = way.nodes.length;
76177 var curr = way.nodes.indexOf(selectedIDs[0]);
76179 if (curr < length - 1) {
76181 } else if (way.isClosed()) {
76184 if (index !== -1) {
76186 mode.selectedIDs([way.nodes[index]]).follow(true)
76190 function focusNextParent(d3_event) {
76191 d3_event.preventDefault();
76192 var parents = parentWaysIdsOfSelection(true);
76193 if (!parents || parents.length < 2)
76195 var index = parents.indexOf(_focusedParentWayId);
76196 if (index < 0 || index > parents.length - 2) {
76197 _focusedParentWayId = parents[0];
76199 _focusedParentWayId = parents[index + 1];
76201 var surface = context.surface();
76202 surface.selectAll(".related").classed("related", false);
76203 if (_focusedParentWayId) {
76204 surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
76207 function selectParent(d3_event) {
76208 d3_event.preventDefault();
76209 var currentSelectedIds = mode.selectedIDs();
76210 var parentIds = _focusedParentWayId ? [_focusedParentWayId] : parentWaysIdsOfSelection(false);
76211 if (!parentIds.length)
76214 mode.selectedIDs(parentIds)
76216 _focusedVertexIds = currentSelectedIds;
76218 function selectChild(d3_event) {
76219 d3_event.preventDefault();
76220 var currentSelectedIds = mode.selectedIDs();
76221 var childIds = _focusedVertexIds ? _focusedVertexIds.filter((id2) => context.hasEntity(id2)) : childNodeIdsOfSelection(true);
76222 if (!childIds || !childIds.length)
76224 if (currentSelectedIds.length === 1)
76225 _focusedParentWayId = currentSelectedIds[0];
76227 mode.selectedIDs(childIds)
76231 mode.exit = function() {
76232 _newFeature = false;
76233 _focusedVertexIds = null;
76234 _operations.forEach(function(operation) {
76235 if (operation.behavior) {
76236 context.uninstall(operation.behavior);
76240 _behaviors.forEach(context.uninstall);
76241 select_default2(document).call(keybinding.unbind);
76242 context.ui().closeEditMenu();
76243 context.history().on("change.select", null).on("undone.select", null).on("redone.select", null);
76244 var surface = context.surface();
76245 surface.selectAll(".selected-member").classed("selected-member", false);
76246 surface.selectAll(".selected").classed("selected", false);
76247 surface.selectAll(".highlighted").classed("highlighted", false);
76248 surface.selectAll(".related").classed("related", false);
76249 context.map().on("drawn.select", null);
76250 context.ui().sidebar.hide();
76251 context.features().forceVisible([]);
76252 var entity = singular();
76253 if (_newFeature && entity && entity.type === "relation" && Object.keys(entity.tags).length === 0 && context.graph().parentRelations(entity).length === 0 && (entity.members.length === 0 || entity.members.length === 1 && !entity.members[0].role)) {
76254 var deleteAction = actionDeleteRelation(entity.id, true);
76255 context.perform(deleteAction, _t("operations.delete.annotation.relation"));
76256 context.validator().validate();
76262 // modules/behavior/lasso.js
76263 function behaviorLasso(context) {
76264 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
76265 var behavior = function(selection2) {
76267 function pointerdown(d3_event) {
76269 if (d3_event.button === button && d3_event.shiftKey === true) {
76271 select_default2(window).on(_pointerPrefix + "move.lasso", pointermove).on(_pointerPrefix + "up.lasso", pointerup);
76272 d3_event.stopPropagation();
76275 function pointermove() {
76277 lasso = uiLasso(context);
76278 context.surface().call(lasso);
76280 lasso.p(context.map().mouse());
76282 function normalize2(a, b) {
76284 [Math.min(a[0], b[0]), Math.min(a[1], b[1])],
76285 [Math.max(a[0], b[0]), Math.max(a[1], b[1])]
76288 function lassoed() {
76291 var graph = context.graph();
76293 if (context.map().editableDataEnabled(true) && context.map().isInWideSelection()) {
76294 limitToNodes = new Set(utilGetAllNodes(context.selectedIDs(), graph));
76295 } else if (!context.map().editableDataEnabled()) {
76298 var bounds = lasso.extent().map(context.projection.invert);
76299 var extent = geoExtent(normalize2(bounds[0], bounds[1]));
76300 var intersects = context.history().intersects(extent).filter(function(entity) {
76301 return entity.type === "node" && (!limitToNodes || limitToNodes.has(entity)) && geoPointInPolygon(context.projection(entity.loc), lasso.coordinates) && !context.features().isHidden(entity, graph, entity.geometry(graph));
76303 intersects.sort(function(node1, node2) {
76304 var parents1 = graph.parentWays(node1);
76305 var parents2 = graph.parentWays(node2);
76306 if (parents1.length && parents2.length) {
76307 var sharedParents = utilArrayIntersection(parents1, parents2);
76308 if (sharedParents.length) {
76309 var sharedParentNodes = sharedParents[0].nodes;
76310 return sharedParentNodes.indexOf(node1.id) - sharedParentNodes.indexOf(node2.id);
76312 return parseFloat(parents1[0].id.slice(1)) - parseFloat(parents2[0].id.slice(1));
76314 } else if (parents1.length || parents2.length) {
76315 return parents1.length - parents2.length;
76317 return node1.loc[0] - node2.loc[0];
76319 return intersects.map(function(entity) {
76323 function pointerup() {
76324 select_default2(window).on(_pointerPrefix + "move.lasso", null).on(_pointerPrefix + "up.lasso", null);
76327 var ids = lassoed();
76330 context.enter(modeSelect(context, ids));
76333 selection2.on(_pointerPrefix + "down.lasso", pointerdown);
76335 behavior.off = function(selection2) {
76336 selection2.on(_pointerPrefix + "down.lasso", null);
76341 // modules/modes/browse.js
76342 function modeBrowse(context) {
76346 title: _t.append("modes.browse.title"),
76347 description: _t.append("modes.browse.description")
76350 var _selectBehavior;
76351 var _behaviors = [];
76352 mode.selectBehavior = function(val) {
76353 if (!arguments.length)
76354 return _selectBehavior;
76355 _selectBehavior = val;
76358 mode.enter = function() {
76359 if (!_behaviors.length) {
76360 if (!_selectBehavior)
76361 _selectBehavior = behaviorSelect(context);
76363 behaviorPaste(context),
76364 behaviorHover(context).on("hover", context.ui().sidebar.hover),
76366 behaviorLasso(context),
76367 modeDragNode(context).behavior,
76368 modeDragNote(context).behavior
76371 _behaviors.forEach(context.install);
76372 if (document.activeElement && document.activeElement.blur) {
76373 document.activeElement.blur();
76376 context.ui().sidebar.show(sidebar);
76378 context.ui().sidebar.select(null);
76381 mode.exit = function() {
76382 context.ui().sidebar.hover.cancel();
76383 _behaviors.forEach(context.uninstall);
76385 context.ui().sidebar.hide();
76388 mode.sidebar = function(_) {
76389 if (!arguments.length)
76394 mode.operations = function() {
76395 return [operationPaste(context)];
76400 // modules/behavior/add_way.js
76401 function behaviorAddWay(context) {
76402 var dispatch10 = dispatch_default("start", "startFromWay", "startFromNode");
76403 var draw = behaviorDraw(context);
76404 function behavior(surface) {
76405 draw.on("click", function() {
76406 dispatch10.apply("start", this, arguments);
76407 }).on("clickWay", function() {
76408 dispatch10.apply("startFromWay", this, arguments);
76409 }).on("clickNode", function() {
76410 dispatch10.apply("startFromNode", this, arguments);
76411 }).on("cancel", behavior.cancel).on("finish", behavior.cancel);
76412 context.map().dblclickZoomEnable(false);
76413 surface.call(draw);
76415 behavior.off = function(surface) {
76416 surface.call(draw.off);
76418 behavior.cancel = function() {
76419 window.setTimeout(function() {
76420 context.map().dblclickZoomEnable(true);
76422 context.enter(modeBrowse(context));
76424 return utilRebind(behavior, dispatch10, "on");
76427 // modules/behavior/hash.js
76428 function behaviorHash(context) {
76429 var _cachedHash = null;
76430 var _latitudeLimit = 90 - 1e-8;
76431 function computedHashParameters() {
76432 var map2 = context.map();
76433 var center = map2.center();
76434 var zoom = map2.zoom();
76435 var precision2 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
76436 var oldParams = utilObjectOmit(
76437 utilStringQs(window.location.hash),
76438 ["comment", "source", "hashtags", "walkthrough"]
76440 var newParams = {};
76441 delete oldParams.id;
76442 var selected = context.selectedIDs().filter(function(id2) {
76443 return context.hasEntity(id2);
76445 if (selected.length) {
76446 newParams.id = selected.join(",");
76448 newParams.map = zoom.toFixed(2) + "/" + center[1].toFixed(precision2) + "/" + center[0].toFixed(precision2);
76449 return Object.assign(oldParams, newParams);
76451 function computedHash() {
76452 return "#" + utilQsString(computedHashParameters(), true);
76454 function computedTitle(includeChangeCount) {
76455 var baseTitle = context.documentTitleBase() || "iD";
76459 var selected = context.selectedIDs().filter(function(id2) {
76460 return context.hasEntity(id2);
76462 if (selected.length) {
76463 var firstLabel = utilDisplayLabel(context.entity(selected[0]), context.graph());
76464 if (selected.length > 1) {
76465 contextual = _t("title.labeled_and_more", {
76466 labeled: firstLabel,
76467 count: selected.length - 1
76470 contextual = firstLabel;
76472 titleID = "context";
76474 if (includeChangeCount) {
76475 changeCount = context.history().difference().summary().length;
76476 if (changeCount > 0) {
76477 titleID = contextual ? "changes_context" : "changes";
76481 return _t("title.format." + titleID, {
76482 changes: changeCount,
76484 context: contextual
76489 function updateTitle(includeChangeCount) {
76490 if (!context.setsDocumentTitle())
76492 var newTitle = computedTitle(includeChangeCount);
76493 if (document.title !== newTitle) {
76494 document.title = newTitle;
76497 function updateHashIfNeeded() {
76498 if (context.inIntro())
76500 var latestHash = computedHash();
76501 if (_cachedHash !== latestHash) {
76502 _cachedHash = latestHash;
76503 window.history.replaceState(null, computedTitle(false), latestHash);
76505 const q = utilStringQs(latestHash);
76507 corePreferences("map-location", q.map);
76511 var _throttledUpdate = throttle_default(updateHashIfNeeded, 500);
76512 var _throttledUpdateTitle = throttle_default(function() {
76515 function hashchange() {
76516 if (window.location.hash === _cachedHash)
76518 _cachedHash = window.location.hash;
76519 var q = utilStringQs(_cachedHash);
76520 var mapArgs = (q.map || "").split("/").map(Number);
76521 if (mapArgs.length < 3 || mapArgs.some(isNaN)) {
76522 updateHashIfNeeded();
76524 if (_cachedHash === computedHash())
76526 var mode = context.mode();
76527 context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
76528 if (q.id && mode) {
76529 var ids = q.id.split(",").filter(function(id2) {
76530 return context.hasEntity(id2);
76532 if (ids.length && (mode.id === "browse" || mode.id === "select" && !utilArrayIdentical(mode.selectedIDs(), ids))) {
76533 context.enter(modeSelect(context, ids));
76537 var center = context.map().center();
76538 var dist = geoSphericalDistance(center, [mapArgs[2], mapArgs[1]]);
76540 if (mode && mode.id.match(/^draw/) !== null && dist > maxdist) {
76541 context.enter(modeBrowse(context));
76546 function behavior() {
76547 context.map().on("move.behaviorHash", _throttledUpdate);
76548 context.history().on("change.behaviorHash", _throttledUpdateTitle);
76549 context.on("enter.behaviorHash", _throttledUpdate);
76550 select_default2(window).on("hashchange.behaviorHash", hashchange);
76551 var q = utilStringQs(window.location.hash);
76553 context.zoomToEntity(q.id.split(",")[0], !q.map);
76555 if (q.walkthrough === "true") {
76556 behavior.startWalkthrough = true;
76559 behavior.hadLocation = true;
76560 } else if (!q.id && corePreferences("map-location")) {
76561 const mapArgs = corePreferences("map-location").split("/").map(Number);
76562 context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
76563 updateHashIfNeeded();
76564 behavior.hadLocation = true;
76567 updateTitle(false);
76569 behavior.off = function() {
76570 _throttledUpdate.cancel();
76571 _throttledUpdateTitle.cancel();
76572 context.map().on("move.behaviorHash", null);
76573 context.on("enter.behaviorHash", null);
76574 select_default2(window).on("hashchange.behaviorHash", null);
76575 window.location.hash = "";
76580 // node_modules/d3-brush/src/brush.js
76581 var { abs: abs2, max: max2, min: min2 } = Math;
76582 function number1(e) {
76583 return [+e[0], +e[1]];
76585 function number22(e) {
76586 return [number1(e[0]), number1(e[1])];
76590 handles: ["w", "e"].map(type2),
76591 input: function(x, e) {
76592 return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]];
76594 output: function(xy) {
76595 return xy && [xy[0][0], xy[1][0]];
76600 handles: ["n", "s"].map(type2),
76601 input: function(y, e) {
76602 return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]];
76604 output: function(xy) {
76605 return xy && [xy[0][1], xy[1][1]];
76610 handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type2),
76611 input: function(xy) {
76612 return xy == null ? null : number22(xy);
76614 output: function(xy) {
76618 function type2(t) {
76619 return { type: t };
76622 // modules/index.js
76625 dispatch: dispatch_default,
76626 geoMercator: mercator_default,
76627 geoProjection: projection,
76628 polygonArea: area_default3,
76629 polygonCentroid: centroid_default2,
76630 select: select_default2,
76631 selectAll: selectAll_default2,
76636 window.requestIdleCallback = window.requestIdleCallback || function(cb) {
76637 var start2 = Date.now();
76638 return window.requestAnimationFrame(function() {
76641 timeRemaining: function() {
76642 return Math.max(0, 50 - (Date.now() - start2));
76647 window.cancelIdleCallback = window.cancelIdleCallback || function(id2) {
76648 window.cancelAnimationFrame(id2);
76650 window.iD = modules_exports;
76652 //# sourceMappingURL=iD.js.map